opnet
OPNet Development Skill
Critical Architecture Facts
OPNet is a Bitcoin L1 consensus layer (not a metaprotocol) that enables smart contracts directly on Bitcoin using WebAssembly. It does not have a gas token; it uses bitcoin directly. Contracts are non-custodial: they never hold BTC, cannot receive blockchain.tx.value, and cannot send blockchain.transfer(). All financial logic follows a "verify, don't custody" pattern where the contract verifies the user's L1 transaction outputs against internal state.
OPNet does NOT use OP_RETURN. OPNet embeds transaction data in SegWit witness fields using P2WDA (Pay-to-Witness-Data-Authentication), which exploits the witness discount where witness bytes weigh 1 unit instead of 4. This makes OPNet data embedding ~75% cheaper than OP_RETURN. Some reference files discuss OP_RETURN in the context of raw Bitcoin script opcodes that contracts can construct, but that is a general Bitcoin scripting capability, not OPNet's data embedding mechanism. Never describe OPNet as using OP_RETURN for its consensus layer or transaction data.
Transactions containing BTC on OPNet can partially revert: only the consensus-layer execution reverts, while Bitcoin transfers remain valid since they are always valid when included in blocks. OPNet is fully trustless, permissionless, and decentralized, relying on Bitcoin PoW and OPNet epoch SHA-1 mining. After 20 blocks an epoch is buried deep enough that changing it requires rewriting Bitcoin's history at millions of dollars per hour. The checksum root for each epoch is a cryptographic fingerprint of the entire state; if even one bit differs, the checksum completely changes, making silent state corruption impossible.
Packages
Install specific versions for compatibility:
npm i @btc-vision/transaction@1.8.0-beta.9 opnet@1.8.1-beta.6 @btc-vision/ecpair@4.0.2 @btc-vision/bip32@7.0.2 @btc-vision/bitcoin@7.0.0-alpha.10