What is OP_NET?
The First Consensus Layer on Bitcoin
OP_NET is the first consensus layer on Bitcoin, enabling fully expressive smart contracts directly on Bitcoin's Layer 1 without modifying or forking the base protocol. Unlike metaprotocols that rely on indexers (where different indexers can show different balances), OP_NET provides cryptographic proof of correct execution where every participant must arrive at exactly the same result.
When a smart contract executes on OP_NET, it proves what happened with mathematical certainty that makes any other outcome impossible.
OP_NET introduces the concept of a "consensus layer" as a novel architectural pattern. In existing blockchain terminology, "consensus layer" refers to the internal component of a blockchain responsible for block agreement (e.g., Ethereum's Beacon Chain). OP_NET redefines this term to describe an external system that observes a base layer blockchain's blocks and derives deterministic state according to its own ruleset, without requiring modifications to the base layer protocol.
Why OP_NET is Not a Metaprotocol
Metaprotocols like BRC-20, Runes, and Alkanes all operate by having indexers interpret data. When you "own" BRC-20 tokens, those tokens don't exist on Bitcoin. They exist in database entries maintained by indexers. Different indexers can show different balances because there's no mechanism forcing them to agree. They're hoping everyone calculates the same results, but hope isn't consensus.
OP_NET is fundamentally different:
- Cryptographic Consensus: Given the same Bitcoin blocks, every OP_NET node derives the exact same state. If two nodes disagree about a balance, one is probably wrong.
- No New Trust: There's no bridge, no custodian, no new trust assumptions beyond Bitcoin itself.
- Single Honest Node: OP_NET needs only ONE honest node to maintain validity since all state is deterministically derived from Bitcoin blocks.
- Inherited Security: OP_NET inherits Bitcoin's security and can only be more secure, never less. The only way to change OP_NET state is to reorg Bitcoin itself.
Security Properties
A consensus layer inherits the parent chain's security and can only be more secure, never less. OP_NET adds its own security on top of Bitcoin:
- ML-DSA Signatures: OP_NET requires ML-DSA (post-quantum signatures) for smart contract interactions, adding quantum-resistant security on top of Bitcoin's ECDSA.
- Epoch SHA-1 Mining: Uses a purely deterministic challenge for reward distribution. SHA-1 miners cannot decide the consensus. They only compete for rewards.
- Guaranteed Finality: Even if nobody mines the SHA-1 pattern, the genesis block hash of the parent chain becomes the miner of that epoch, ensuring consensus finality never stops.
- Zero New Trust: OP_NET has no new trust assumptions beyond Bitcoin itself.
Architecture Overview
As a consensus layer built on Bitcoin, OP_NET observes blocks and derives deterministic state from transaction data. OP_NET architecture is organized into several interconnected components/layers:
- Bitcoin Layer: Provides data availability, timestamping, and immutability.
- OP_NET Nodes: Monitor Bitcoin blocks and process OP_NET transactions.
- OP_VM: WebAssembly virtual machine for smart contract execution.
- State Management Layer: Manages smart contract storage, balances, and Merkle trees.
- Epoch System: Checkpoints state every 5 Bitcoin blocks.
OP_NET Nodes
OP_NET nodes run in parallel with Bitcoin nodes. They continuously monitor new Bitcoin blocks and detect transactions that encode OP_NET operations. When such a transaction is found, the embedded payload is extracted and forwarded to the OP_VM for execution.
The node execution process follows these steps:
- Monitor new Bitcoin blocks for OP_NET transactions.
- Extract and validate embedded payloads.
- Order transactions deterministically (by gas price, priority, txid).
- Forward valid transactions to OP_VM for execution.
- Maintain synchronized state with all other nodes.
OP_NET needs only ONE honest node to maintain validity. Any node can independently verify the entire state by processing Bitcoin blocks through OP_NET's rules.
OP_VM
The OP_VM is responsible for executing smart contract code. It is built on WebAssembly technology and provides the following properties:
- Deterministic: Same inputs always produce same outputs across all nodes.
- Gas-Metered: Every operation has a cost, preventing infinite loops.
- Multi-Language: Supports AssemblyScript, Rust, C++, or any WASM-compatible language.
Smart contract execution is completely deterministic. If a smart contract calculates a swap price, every node calculates the exact same price.
State Management Layer
The State management layer manages persistent storage for smart contracts. It maintains all smart contract data and ensures state consistency across the network:
- Storage Slots: Each smart contract can allocate storage slots consisting of 32 bytes keys mapped to 32 bytes values.
- Merkle Trees: All state changes are organized within Merkle tree structures, enabling efficient cryptographic verification.
- State(checksum) Root: A cryptographic fingerprint representing the entire system state is computed at each epoch.
State is fully derivable from genesis. Any node can reconstruct the complete state by replaying OP_NET operations from Bitcoin blocks, ensuring verifiability and trustless synchronization.
Epoch System
OP_NET divides time into periods called epochs. Each epoch spans 5 consecutive Bitcoin blocks, approximately 50 minutes in duration:
- Transactions confirmed during the epoch become part of its state.
- Transactions are ordered deterministically within each block.
- All nodes execute smart contracts and arrive at identical state.
- At epoch end, a checksum root is computed.
- Miners compete to find SHA-1 near-collisions with previous epoch's checksum.
- Winner's solution becomes the official checkpoint in Bitcoin.
Epoch Mining
SHA-1 epoch mining is purely for reward distribution. Miners cannot influence consensus:
- Given the same Bitcoin blocks, every node derives the exact same state.
- The PoW only determines who receives fees from a future epoch.
- If nobody mines, the genesis block hash becomes the epoch miner.
Time-Delayed Attestations
Epoch solutions must include attestations about state from 4 epochs ago (~21 blocks deep). This ensures:
- Attested state is so deep it's effectively immutable.
- All honest nodes agree on the attested state.
- Forks are mathematically impossible, not just unlikely.
Transaction Flow
All OP_NET transactions are standard Bitcoin transactions. OP_NET nodes detect embedded payloads in tapscript witness data, parse them as smart contract calls, and execute them deterministically.
- Create: User creates transaction with ML-DSA signature.
- Broadcast: Transaction broadcast to Bitcoin network.
- Confirm: Bitcoin miners include it in a block.
- Detect: OP_NET nodes detect the transaction.
- Order: Transaction sorted by gas price, priority, txid.
- Execute: OP_VM executes the smart contract call.
- Update: State changes recorded in local database.
- Checkpoint: State included in next epoch's checksum.
Smart Contracts
Smart contracts are deterministic programs executed by the OP_VM. They power token issuance and management, DeFi primitives like DEXs and lending, marketplaces, role-based access control, and on-chain governance.