A Python SDK for interacting with the Miden blockchain, providing a Pythonic interface to Miden's core features without requiring Rust expertise.
Miden is a zkRollup secured by Ethereum and the AggLayer, offering privacy, client-side proving, parallel execution, and Turing-complete smart contracts. This SDK provides a Pythonic interface to Miden's core features:
- Node Communication: Interact with Miden nodes via gRPC
- Wallet & Account Management: Create and manage private/public and mutable/immutable accounts
- Transaction Building: Construct and submit transactions
- STARK Proof Generation: Generate proofs using the Miden CLI
- Note Management: Create, import, and export private or public notes
- Install the Miden client:
cargo install miden-client- Install the Python SDK:
pip install miden-sdk- Download and place the WASM module:
# Install @demox-labs/miden-sdk
npm install @demox-labs/miden-sdk
# Copy WASM module to SDK directory
cp node_modules/@demox-labs/miden-sdk/dist/miden_sdk.wasm miden_sdk/wasm/from miden_sdk import MidenClient, Wallet
# Initialize client with testnet endpoint
client = MidenClient(rpc_endpoint="http://18.203.155.106:57291")
# Create a private, mutable wallet
wallet = client.new_wallet(storage_mode="private", mutable=True)
# Save wallet to JSON
wallet.save("wallet.json")
print(f"Wallet created: {wallet.account_id}")from miden_sdk import MidenClient, Wallet, Transaction, NoteType
# Initialize client
client = MidenClient(rpc_endpoint="http://18.203.155.106:57291")
# Load wallet
wallet = Wallet.load("wallet.json", client=client)
# Create a payment transaction
tx = Transaction.pay_to_id(
sender=wallet,
recipient_address="0xABC1234567890...",
amount=100,
faucet_id="0xDEF4567890...",
note_type=NoteType.PRIVATE
)
# Generate STARK proof
tx.generate_proof()
# Submit transaction
tx_id = client.send_transaction(tx)
print(f"Transaction submitted: {tx_id}")from miden_sdk import MidenClient, Note
# Initialize client
client = MidenClient(rpc_endpoint="http://18.203.155.106:57291")
# Import note from JSON
note = Note.import_note("note.json")
# Add to client's note store
client.add_note(note)
print(f"Note imported: {note.id}")miden-sdk/
├── miden_sdk/
│ ├── __init__.py
│ ├── client.py # gRPC and WASM integration
│ ├── wallet.py # Keypair and account management
│ ├── transaction.py # Transaction construction
│ ├── note.py # Note creation and querying
│ ├── config.py # Constants and configurations
│ ├── utils.py # Utility functions
├── tests/ # Unit and integration tests
├── examples/ # Example scripts
- Python 3.7+
- miden-client (Rust)
- @demox-labs/miden-sdk WASM module
- Clone the repository:
git clone https://github.com/chumbacash/miden-sdk.git
cd miden-sdk- Install development dependencies:
pip install -e ".[dev]"- Run tests:
pytest- Intuitive API Design: User-friendly interface following Python idioms
- Clear Error Handling: Custom exceptions with informative messages
- Type Hinting: Comprehensive type hints for IDE support
- Modular Architecture: Clean separation of concerns
This SDK is in alpha stage and compatible with Miden Testnet v6 (released February 2025). It will be updated as Miden evolves toward mainnet launch in late 2025.
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.