---
title: Send Transactions with SDKs
description: Learn how to construct, sign, and submit transactions to any Polkadot SDK-based chain using the Subxt Rust library and a local development node.
categories: Chain Interactions, Tooling
url: https://docs.parity.io/tools/chain-interactions/send-transactions/with-sdks/
word_count: 838
token_estimate: 1680
version_hash: sha256:b7663f2945b7f8345f3f96c06420bc8cbd7e547f369082390736aa02d0247dcf
last_updated: 2026-11-17T22:40:44+00:00
---

# Send Transactions with SDKs

## Introduction

Sending transactions on Polkadot SDK-based blockchains involves constructing an extrinsic (transaction), signing it with your account's private key, and submitting it to the network.

This guide uses [Subxt](/tools/subxt.md), Parity's Rust library for Polkadot SDK-based chains, to send a balance transfer on a local development node. The example signs with the `//Alice` development account and sends funds to `//Bob`, so you do not need to fund an account first.

The same transaction flow works with third-party client libraries, for example [Polkadot API (PAPI)](https://developers.polkadot.com/reference/tools/papi/), [Dedot](https://developers.polkadot.com/reference/tools/dedot/), [Polkadot.js API](https://developers.polkadot.com/reference/tools/polkadot-js-api/), and [Python Substrate Interface](https://developers.polkadot.com/reference/tools/py-substrate-interface/).

## Prerequisites

- [Rust](https://rustup.rs/) toolchain (latest stable) and Cargo.
- A local development node listening on `ws://127.0.0.1:9944`, for example the parachain template node described in [Run the Node Locally](/polkadot-sdk/launch-a-parachain/set-up-the-parachain-template.md#run-the-node-locally). The template's `development` preset funds the well-known development accounts, such as Alice and Bob, as defined in its [genesis config presets](https://github.com/paritytech/polkadot-sdk-parachain-template/blob/v0.0.5/runtime/src/genesis_config_presets.rs).

## Set Up the Project

1. Create a new Rust project:

    ```bash
    cargo new subxt-send-tx-example && cd subxt-send-tx-example
    ```

2. Install the Subxt CLI:

    ```bash
    cargo install subxt-cli@0.50.1
    ```

3. Download the metadata from your local node:

    ```bash
    subxt metadata --url ws://127.0.0.1:9944 -o metadata.scale
    ```

4. Update `Cargo.toml` with the required dependencies:

    ```toml title="Cargo.toml"
    [package]
    name = "subxt-send-tx-example"
    version = "0.1.0"
    edition = "2021"
    
    [[bin]]
    name = "send_transfer"
    path = "src/bin/send_transfer.rs"
    
    [dependencies]
    subxt = { version = "0.50.1", features = ["native"] }
    subxt-signer = "0.50.1"
    tokio = { version = "1", features = ["rt", "macros"] }
    
    ```

## Send a Balance Transfer

The following example constructs, signs, and submits a `Balances.transfer_keep_alive` transaction, then waits for it to be finalized.

Create a file at `src/bin/send_transfer.rs` and add the following code to it:

```rust title="src/bin/send_transfer.rs"
use subxt::utils::AccountId32;
use subxt::{OnlineClient, PolkadotConfig};
use subxt_signer::sr25519::dev;

// Generate an interface from the node's metadata
#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
pub mod runtime {}

// WebSocket endpoint of your local development node
const NODE_URL: &str = "ws://127.0.0.1:9944";

// Amount to transfer, in the chain's smallest unit
const AMOUNT: u128 = 1_000_000_000_000;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize the Subxt client
    let api = OnlineClient::<PolkadotConfig>::from_url(NODE_URL).await?;

    // Anchor to the current block
    let at_block = api.at_current_block().await?;

    println!("Connected to {}", NODE_URL);

    // Use the Alice and Bob development accounts
    let sender_keypair = dev::alice();
    let sender_address = AccountId32::from(sender_keypair.public_key());
    let dest = AccountId32::from(dev::bob().public_key());

    println!("Sender address: {}", sender_address);
    println!("Recipient address: {}", dest);
    println!("Amount: {}\n", AMOUNT);

    // Get sender's account info to check balance
    let account_storage = at_block
        .storage()
        .entry(runtime::storage().system().account())?;
    let account_info = account_storage
        .fetch((sender_address,))
        .await?
        .decode()?;

    println!("Sender balance: {}", account_info.data.free);

    // Build the balance transfer extrinsic
    let balance_transfer_tx = runtime::transactions()
        .balances()
        .transfer_keep_alive(dest.into(), AMOUNT);

    // Sign and submit the extrinsic, then wait for it to be finalized
    println!("\nSigning and submitting transaction...");
    let events = at_block
        .transactions()
        .sign_and_submit_then_watch_default(&balance_transfer_tx, &sender_keypair)
        .await?
        .wait_for_finalized_success()
        .await?;

    // Check for a successful transfer event
    if let Some(event) = events.find_first::<runtime::balances::events::Transfer>() {
        println!("\nTransaction successful!");
        println!("Transfer event: {:?}", event);
    }

    Ok(())
}

```

Key aspects of the code:

- **Development signer**: [`subxt_signer::sr25519::dev::alice()`](https://docs.rs/subxt-signer/0.50.1/subxt_signer/sr25519/dev/index.html) returns the `//Alice` development keypair. To sign with your own account on another chain, load it with `Keypair::from_phrase` instead. For all the ways to create a signer, see [Sign Transactions with subxt-signer](/tools/subxt.md#sign-transactions-with-subxt-signer).
- **Transaction payload**: `runtime::transactions().balances().transfer_keep_alive()` builds a type-checked call from the generated interface.
- **Submission**: `sign_and_submit_then_watch_default` signs the transaction with default parameters, submits it, and returns a progress handle. `wait_for_finalized_success` waits for finalization and returns the transaction's events.

!!! warning
    Development accounts use publicly known keys. Use them only on local development chains. Never share your mnemonic phrase or private keys, and use secure key management in production.

Run the script:

```bash
cargo run --bin send_transfer
```

The script prints the sender and recipient addresses, the sender's free balance, and the `Balances.Transfer` event once the transaction is finalized.

## Where to Go Next

<div class="grid cards" markdown>

- <span class="badge guide">Guide</span> **Query On-Chain State**

    ---

    Learn how to query storage and runtime data with Subxt.

    [:octicons-arrow-right-24: Get Started](/tools/chain-interactions/query-data/query-sdks.md)

- <span class="badge guide">Guide</span> **Calculate Transaction Fees**

    ---

    Estimate fees before sending transactions.

    [:octicons-arrow-right-24: Get Started](/tools/chain-interactions/send-transactions/calculate-transaction-fees.md)

</div>
