Skip to main content

Miden Python SDK

A Python SDK for interacting with the Miden blockchain, providing a Pythonic interface to Miden's core features without requiring Rust expertise.

Miden License Status

Overview

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

Installation

  1. Install the Miden client:
cargo install miden-client
  1. Install the Python SDK:
pip install miden-sdk
  1. 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/

Quick Start

Create a Wallet

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}")

Send a Payment

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}")

Import a Note

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}")

Project Structure

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

Requirements

  • Python 3.7+
  • miden-client (Rust)
  • @demox-labs/miden-sdk WASM module

Development

  1. Clone the repository:
git clone https://github.com/chumbacash/miden-sdk.git
cd miden-sdk
  1. Install development dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest

Features

  • 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

Status

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.

Resources

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for miden-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miden-sdk 0.1.1
File Size Uploaded
miden_sdk-0.1.1.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for miden-sdk 0.1.1
File Interpreter ABI Platform
miden_sdk-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / miden_sdk-0.1.1.tar.gz

Download URL miden_sdk-0.1.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
65989fac03ed3860361b762ba3a7ba0f0a7ccf6f7c7b752f315dbadcd259440e
BLAKE2b-256 checksum
How to use checksums
dad7acb3481ff255a35b19454ac2495921ab32c63177c56ad290ecb3ef73891e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / miden_sdk-0.1.1-py3-none-any.whl

Download URL miden_sdk-0.1.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69e0aaadf167ee14cb8bedb3c9230fa1ccffc825fd53ff90d3f561a948c2bfdf
BLAKE2b-256 checksum
How to use checksums
d6e44ba55f6084cddf3b090db562160c08b11e17f0add650ac5fe2986b23513b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page