Skip to main content
Version: Next (unstable)

MASM Smart Contracts

This section is the practical guide to authoring Miden smart contracts directly in Miden Assembly (MASM) — the path Miden mainnet supports for production deployments today. The Rust SDK is in active development and will become the default authoring path once it ships v1; until then, MASM is what you ship with.

You're here because you want to deploy a contract to Miden mainnet. MASM is a small, stack-based assembly language — closer to assembly than Rust or Solidity, but it gives you direct, predictable control over the VM and is what the mainnet kernel verifies. The Reference → Miden VM → Assembly section is the full language reference; this section is the Builder-side cookbook for using it.

When to use MASM vs. the Rust SDK​

ConcernMASMRust SDK
Mainnet productionSupported todayIn active development
Performance / cycle controlDirect control over emitted instructionsCompiles via Wasm → MASM; less predictable
Learning curveSmall instruction set, explicit stack semanticsFamiliar Rust ergonomics
Miden StandardsStandards modules callable directlySame standards via Rust bindings
Long-term directionLong-lived for system-level / performance-critical codeWill become the default authoring path once mature

For mainnet shipping today, the choice is straightforward: write MASM. Most production patterns — account components, note scripts, transaction scripts, P2ID and P2IDE flows, faucet policies — are already covered by Miden Standards, so most contracts compose existing standards rather than rolling everything from scratch.

Where the language reference lives​

The full Miden Assembly reference — every instruction, the stack semantics, control flow, cryptographic operations, debugging instructions — lives in Reference → Miden VM → Assembly. Treat that as the dictionary. This Builder section is the cookbook: how to structure a project, conventions for accounts, notes, and transactions, deployment, testing, and debugging in the context of building a Miden app.

Guides​

Follow the guides below to build, test, and debug MASM contracts. The examples use Rust host harnesses to assemble and execute MASM, with the execution boundaries stated in each guide.

For Rust client orchestration and network submission of a MASM account, see Deploying a Counter Contract. The Miden Bank tutorial covers the broader transaction lifecycle with Rust guest contracts.

See also​