Python SDK Quickstart
Install the SDK
Section titled “Install the SDK”pip install soma-sdkuv add soma-sdkConnect to a Node
Section titled “Connect to a Node”import asynciofrom soma_sdk import SomaClient, Keypair
async def main(): client = await SomaClient( "http://localhost:9000", faucet_url="http://localhost:9123", )
chain_id = await client.get_chain_identifier() version = await client.get_server_version() print(f"Connected to chain {chain_id} (v{version})")
asyncio.run(main())Generate a Keypair and Fund It
Section titled “Generate a Keypair and Fund It”keypair = Keypair.generate()print(f"Address: {keypair.address()}")
await client.request_faucet(keypair.address())balance = await client.get_balance(keypair.address())print(f"Balance: {SomaClient.to_soma(balance)} SOMA")Keypair generates an Ed25519 key pair by default. You can also restore from a mnemonic or secret key.
SomaClient.to_soma() converts shannons to SOMA (1 SOMA = 1,000,000,000 shannons).
Query Network State
Section titled “Query Network State”state = await client.get_latest_system_state()print(f"Epoch: {state.epoch}")
targets = await client.get_targets(status="open", limit=5)print(f"Open targets: {len(targets)}")Send Tokens
Section titled “Send Tokens”recipient = Keypair.generate()tx = await client.build_transfer_coin( keypair.address(), recipient.address(), coin=None, # auto-select amount=1_000_000_000, # 1 SOMA)signed = keypair.sign(tx)effects = await client.execute_transaction(signed)print(f"Transaction: {effects.digest}")Next Steps
Section titled “Next Steps”- Model Development — commit and reveal model weights
- Data Submission — score data against targets and submit
- Python SDK Reference — full API docs