RADIX WikiRADIX Wiki

Introduction

A Python program works with Radix through two pieces, and needs no node of its own. The Gateway API is a public JSON service over HTTPS that reads ledger state and accepts finished transactions, so any Python HTTP client can call it (Network APIs). The radix-engine-toolkit package on PyPI builds, signs and compiles transactions on the machine running the script; it is generated from the Rust Radix Engine Toolkit with UniFFI, the same core behind the TypeScript, Swift, C# and Kotlin wrappers.

Reading the ledger needs only the Gateway. Writing to it needs both: the toolkit makes the signed transaction, and the Gateway carries it to the network.

How do I read Radix ledger data in Python?

Send a POST request with a JSON body to a Gateway endpoint. /status/gateway-status returns the current ledger state, including the epoch, and /state/entity/details returns the details and metadata of up to 20 addresses per call (Gateway API schema). This reads the current epoch and the total supply of $XRD from the public mainnet Gateway:

import requests
 
GATEWAY = "https://mainnet.radixdlt.com"
XRD = "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd"
 
status = requests.post(f"{GATEWAY}/status/gateway-status", json={}).json()
print("epoch", status["ledger_state"]["epoch"])
 
details = requests.post(f"{GATEWAY}/state/entity/details", json={"addresses": [XRD]}).json()
print("supply", details["items"][0]["details"]["total_supply"])

Every endpoint and field is listed in the Gateway API reference. A script that polls heavily or runs in production can point the same code at a commercial Gateway instead; Radix keeps a list of Gateway providers. For transaction history, /stream/transactions pages through committed transactions with filters by account, resource and event.

How do I build and submit a Radix transaction in Python?

Install the toolkit with pip install radix-engine-toolkit and follow four steps, which the package page shows in full against Stokenet:

  1. Write the manifest. ManifestBuilder chains instructions, such as locking a fee, taking $XRD from the Stokenet faucet and depositing it to an account, and .build(network_id) returns a TransactionManifest. A transaction manifest is the list of instructions the network runs in order.
  2. Set the header. TransactionHeader takes the network id, a start and end epoch, a random nonce, the notary's public key and a tip. The toolkit has no view of the ledger, so the epoch comes from the Gateway's /status/gateway-status.
  3. Sign and notarize. TransactionBuilder joins header and manifest, signs with each signer's private key and notarizes. statically_validate raises an exception if the transaction is malformed, and intent_hash() gives the transaction's id.
  4. Submit through the Gateway. The toolkit does not submit anything. bytearray(transaction.compile()).hex() is the payload for /transaction/submit, sent as notarized_transaction_hex; /transaction/status then takes the intent hash and reports whether it committed (Gateway API schema).

Private keys stay in the script's process: nothing in this flow sends a key to the Gateway. The toolkit's developer guide covers what it can and cannot check before submission, and the transaction lifecycle covers what happens after.

Which Python scripts does this wiki keep?

Two analysis scripts sit beside this page: the DLT Efficiency Metric, which sets GitHub repository counts against Google Trends interest for five networks, and Proof of Work, a worked mining example. Neither talks to the Radix ledger.

HydrateLast updated 2h agov1.0.01 revision
CiteRADIX Wiki. "Using Python with Radix." November 3, 2026. https://radix.wiki/contents/resources/python-scripts/using-python-with-radix