Kaspa Python SDK¶
This Python package, kaspa, provides an SDK for interacting with the
Kaspa network from Python. This SDK provides features in the following main categories:
- RPC Client — RPC API for the Kaspa node using WebSockets.
- Wallet SDK — Bindings for wallet-related primitives such as key management, derivation, and transactions.
- Managed Wallet — A high-level, single Python class interface to the Rusty Kaspa Wallet API. This provides full wallet functionality in the single Python class:
Wallet.
This project closely mirrors Kaspa's WASM SDK, while trying to respect Python conventions.
Bindings to Rusty Kaspa¶
kaspa is a Python-native extension module built from bindings to Rust and
rusty-kaspa source. PyO3 and Maturin are used
to create bindings and build the extension module.
As-thin-as-possible
This project strives to provide as-thin-as-possible Python-compatible wrappers over rusty-kaspa source. Allowing Python developers leverage the features, stability, and security of rusty-kaspa directly, with minimal reimplementation in Python.
More information on bindings approach and development notes can be found in the Contributing section.
A (Very) Basic Example¶
import asyncio
from kaspa import Resolver, RpcClient
async def main():
client = RpcClient(resolver=Resolver())
await client.connect()
print(await client.get_server_info())
if __name__ == "__main__":
asyncio.run(main())
How the docs are organised¶
-
Getting Started
Install the SDK, run the first script, read the security note before generating real keys. -
Learn
How the SDK is shaped, taught topic by topic. Connections, wallets, derivation, transactions, the Kaspa concepts behind them. -
Examples
Runnable scripts on GitHub covering RPC, wallet, transactions, derivation, mnemonics, message signing, and addresses. -
API Reference
Every public class, method, and signature. Auto-generated.
License¶
This project is licensed under the ISC License.