Skip to main content

Sign and Send IOTA

Alpha Software

The IOTA SDK is currently in alpha. APIs, interfaces, and behavior may change without notice between releases. It is not yet recommended for production use.

This how-to demonstrates how to sign and execute an IOTA transfer transaction on localnet.

info

This example runs on localnet. Make sure you have a local IOTA node running before executing the code.

Prerequisites

  • The IOTA SDK installed for your target language
  • A running local IOTA node

Steps

1. Define the Recipient Address and Private Key

Create a throwaway Ed25519 private key from a zeroed byte array and derive the sender address from it.

crates/iota-sdk/examples/sign_send_iota.rs
loading...

2. Initialize the Client and Request Faucet Funds

Connect to localnet and request funds from the faucet for the sender address.

crates/iota-sdk/examples/sign_send_iota.rs
loading...

3. Build the Transaction

crates/iota-sdk/examples/sign_send_iota.rs
loading...

4. Dry-Run the Transaction

Verify the transaction will execute correctly before signing.

crates/iota-sdk/examples/sign_send_iota.rs
loading...

5. Sign and Execute the Transaction

Sign the transaction with the private key and submit it to the network.

crates/iota-sdk/examples/sign_send_iota.rs
loading...

Expected Output

Sender address: 0x<sender-hex-address>
Digest: <transaction-digest-hex>
Transaction status: Success
Effects: <transaction-effects>

Full Example

crates/iota-sdk/examples/sign_send_iota.rs
loading...