Python SDK for interacting with Mina Protocol nodes.
- Daemon GraphQL client — query node status, accounts, blocks; send payments and delegations
- Typed response objects with
Currencyarithmetic - Automatic retry with configurable backoff
- Context manager support
pip install mina-sdkFor archive database support (coming soon):
pip install mina-sdk[archive]from mina_sdk import MinaDaemonClient, Currency
with MinaDaemonClient() as client:
# Check sync status
print(client.get_sync_status()) # "SYNCED"
# Query an account
account = client.get_account("B62q...")
print(f"Balance: {account.balance.total} MINA")
# Send a payment
result = client.send_payment(
sender="B62qsender...",
receiver="B62qreceiver...",
amount=Currency("1.5"),
fee=Currency("0.01"),
)
print(f"Tx hash: {result.hash}")client = MinaDaemonClient(
graphql_uri="http://127.0.0.1:3085/graphql", # default
retries=3, # retry failed requests
retry_delay=5.0, # seconds between retries
timeout=30.0, # HTTP timeout in seconds
)| Method | Description |
|---|---|
get_sync_status() |
Node sync status (SYNCED, BOOTSTRAP, etc.) |
get_daemon_status() |
Comprehensive daemon status |
get_network_id() |
Network identifier |
get_account(public_key) |
Account balance, nonce, delegate |
get_best_chain(max_length) |
Recent blocks from best chain |
get_peers() |
Connected peers |
get_pooled_user_commands(public_key) |
Pending transactions |
| Method | Description |
|---|---|
send_payment(sender, receiver, amount, fee) |
Send a payment |
send_delegation(sender, delegate_to, fee) |
Delegate stake |
set_snark_worker(public_key) |
Set/unset SNARK worker |
set_snark_work_fee(fee) |
Set SNARK work fee |
from mina_sdk import Currency
a = Currency(10) # 10 MINA
b = Currency("1.5") # 1.5 MINA
c = Currency.from_nanomina(1_000_000_000) # 1 MINA
print(a + b) # 11.500000000
print(a.nanomina) # 10000000000
print(a > b) # Truegit clone https://github.com/MinaProtocol/mina-sdk-python.git
cd mina-sdk-python
python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytestApache License 2.0