Skip to content

Rust SDK - Orderless Transactions

Orderless transactions allow you to create transactions that do not specify an order of execution between them. This is useful when multiple machines need to sign or submit for the same sending account, but the order does not affect the outcome.

See Orderless Transactions for the protocol overview (AIP-123 and AIP-129).

Aptos::sign_submit_and_wait_orderless wraps an ordinary payload, attaches a replay-protection nonce, and submits. Pass None for the nonce to let the SDK generate a fresh random value.

use aptos_sdk::{Aptos, AptosConfig, account::Ed25519Account, transaction::EntryFunction};
let aptos = Aptos::new(AptosConfig::devnet())?;
let sender = aptos.create_funded_account(1_000_000_000).await?;
let recipient = Ed25519Account::generate();
let payload = EntryFunction::apt_transfer(recipient.address(), 1_000_000)?;
let result = aptos
.sign_submit_and_wait_orderless(&sender, payload.into(), None, None)
.await?;

The third argument is an optional explicit nonce (Some(nonce) to reuse a specific value). The fourth argument is an optional wait timeout.

After that, treat the result like any other submitted transaction: inspect success, hash, and vm_status on result.data.

The SDK repository includes a runnable example that follows this API:

Run it with:

Terminal window
cargo run -p aptos-sdk --example orderless_transaction --features "ed25519,faucet"