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.
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...
2. Initialize the Client and Request Faucet Funds
Connect to localnet and request funds from the faucet for the sender address.
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...
3. Build the Transaction
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...
4. Dry-Run the Transaction
Verify the transaction will execute correctly before signing.
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...
5. Sign and Execute the Transaction
Sign the transaction with the private key and submit it to the network.
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...
Expected Output
Sender address: 0x<sender-hex-address>
Digest: <transaction-digest-hex>
Transaction status: Success
Effects: <transaction-effects>
Full Example
- Rust
- Go
- Python
- Kotlin
- Swift
crates/iota-sdk/examples/sign_send_iota.rs
loading...
bindings/go/examples/sign_send_iota/main.go
loading...
bindings/python/examples/sign_send_iota.py
loading...
bindings/kotlin/examples/SignSendIota.kt
loading...
bindings/swift/examples/SignSendIota.swift
loading...