SuperAPI AI Directory

subxt

subxt is a Rust library developed by Parity for interacting with Substrate chains in the Polkadot network. It supports submitting extrinsics, reading storage values, constants, and Runtime APIs at arbitrary blocks, subscribing to new blocks, and provides both statically typed and dynamic interfaces; it can perform trustless interaction via a built-in light client, can also be compiled to WebAssembly to run in the browser, or be called from other languages via FFI, and supports partial functionality offline.

Open website

About this tool

subxt is a Rust library for interacting with Substrate-based chains in the Polkadot network. Its name comes from the core use case of "submitting extrinsics".

Main capabilities:

  • Submit extrinsics (transactions).
  • Access information at arbitrary blocks, such as storage values, constants, Runtime APIs, and View Functions.
  • Subscribe to new blocks and perform the above operations on new blocks.
  • Perform the above operations through a safe statically typed interface or a flexible dynamic interface.
  • Interact with the chain in a trustless manner via a built-in light client, covering most of the above functionality.
  • Compile to WebAssembly to run entirely in the browser, or be called from many other languages via FFI.
  • Be used fully offline, providing partially available functionality.

Usage: the repository provides a single-file examples folder and a project-style examples folder, containing subxt usage examples of different sizes; you can also read the documentation to learn more. The official documentation calls submitting a transaction the subxt "hello world" example.

Use cases and ecosystem: subxt is used by several real projects, including cargo-contract CLI (interacting with Wasm smart contracts), xcm-cli (submitting XCM messages), phala-pherry (a relayer between the Phala blockchain and off-chain Secure workers), crunch (a CLI for batch claiming staking rewards), interbtc-clients (Vault/Relayer and Oracle clients for the interBTC parachain), tidext (a Tidechain client with a Stronghold signer), staking-miner-v2 (submitting NPos election solutions and earning rewards), polkadot-introspector (a Polkadot node monitoring tool), ink! (a smart contract language that uses subxt for contract end-to-end testing), Chainflip (a decentralized exchange for native cross-chain swaps), Hyperbridge (a verifiable cross-chain interoperability coprocessor), and pop CLI (an all-in-one Polkadot development tool).

Limitations and alternatives: if using TypeScript/JavaScript, the official recommendation is polkadot-api as an actively developed alternativesolution. The repository code is dual-licensed under GPL-3.0 or Apache-2.0; see the LICENSE file for details.