Updated: 7/28/2026

Connect with the Python SDK

Connecting to the Kaspa network from Python using the kaspa package's RpcClient and Resolver.

The Python SDK (kaspanet/kaspa-python-sdk) is a native extension module built from rusty-kaspa via PyO3 - the same underlying code as the node and the WASM SDK. It covers the RPC client (WebSocket/wRPC), the Wallet SDK (keys, derivation, transactions), and a managed wallet interface.

Get the SDK

pip install kaspa

Unlike the WASM SDK’s npm packages, PyPI is current - the kaspa package tracks rusty-kaspa releases (2.0.1 as of July 2026, Python 3.10-3.14). API docs: kaspanet.github.io/kaspa-python-sdk.

Connect

The API is async and mirrors the WASM SDK in snake_case. No node required - Resolver finds a public node:

import asyncio
from kaspa import Resolver, RpcClient

async def main():
    client = RpcClient(resolver=Resolver(), network_id="mainnet")  # or "testnet-10"
    await client.connect()

    info = await client.get_server_info()
    print("Synced:", info["isSynced"], "DAA score:", info["virtualDaaScore"])

    await client.disconnect()

asyncio.run(main())

To connect to a specific node instead (see Run a Node), pass a url - the node must have wRPC enabled (--rpclisten-borsh):

client = RpcClient(url="ws://127.0.0.1:17110", network_id="mainnet", encoding="borsh")

Note RPC responses are dicts with camelCase keys (isSynced, tipHashes) even though methods are snake_case.

Next

  • Build a Transaction - the Python flow is the same (create_transactions, sign, submit).
  • Subscriptions work like the WASM SDK events - see examples/rpc/subscriptions.py in the repo.
  • Use Testnet while developing; client.set_network_id("testnet-10") switches networks between connections.