Welcome to the comprehensive documentation for @btc-vision/btc-runtime, the OP_NET Smart Contract Runtime for Bitcoin L1.
git clone https://github.com/btc-vision/example-tokens.git
cd example-tokens
npm install
npm run build:token- Quick Start - Clone Example Project
- Prerequisites
- Manual Setup
- Adding More Contracts
- Package Dependencies
- Troubleshooting
- What We're Building
- Step 1: Create the Contract File
- Contract Lifecycle Overview
- Step 2: Understanding the Code
- Step 3: Understanding Types
- Step 4: Inherited OP20 Methods
- Step 5: Building the Contract
- Solidity Comparison
- Common Patterns
- Your Project Structure
- Key Files
- btc-runtime Library Structure
- Import Patterns
- Contract Organization
- Comparison with Solidity Projects
- Best Practices
- Testing Structure
- Overview
- Blockchain Singleton
- Transaction Context
- Contract Context
- Network Information
- Storage Operations
- Event Emission
- Cross-Contract Calls
- Signature Verification
- Solidity Comparison
- Overview
- Storage Architecture
- Pointer System
- Storage Types
- Reading and Writing
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- Contract Lifecycle
- Method Selectors
- Access Control
- Event Emission
- Storage Patterns
- Complete Example
- Inheritance
- Best Practices
- Overview
- ERC20 vs OP20 Comparison
- Initialization
- Transfer Flow
- Token Lifecycle
- Built-in Methods
- Approval Flow
- Solidity Comparison
- Storage Layout
- Extending OP20
- Events
- Approval Patterns
- Edge Cases
- Complete Token Example
- Best Practices
- Overview
- ERC20Permit vs OP20S Comparison
- Why Signature-Based Approvals?
- Permit Flow
- Detailed Permit Sequence
- Message Construction
- Nonce Management
- Permit Method
- Nonces
- Solidity Comparison (EIP-2612)
- Domain Separator
- Quantum Resistance
- Implementation Details
- Additional Methods
- Use Cases
- Security Considerations
- Best Practices
- Overview
- ERC721 vs OP721 Comparison
- Initialization
- Minting Flow
- Transfer Sequence
- Safe Transfer Pattern
- NFT Lifecycle
- Token Existence States
- Built-in Methods
- Solidity Comparison
- Storage Layout
- Extending OP721
- Internal Methods
- Enumeration
- Events
- Edge Cases
- Complete NFT Example
- Best Practices
- Overview
- OpenZeppelin vs OP_NET ReentrancyGuard
- What is Reentrancy?
- Guard Mechanism
- Vulnerable Contract Attack
- Protected Contract Defense
- Choosing a Guard Mode
- Guard Modes
- How It Works
- Usage Patterns
- Solidity Comparison
- Best Practices
- Common Mistakes
- Testing Reentrancy
- Overview
- Class Reference
- Events
- Usage Patterns
- Security Considerations
- Update Workflow
- Combining with Other Base Classes
- Solidity Comparison
- Overview
- Creating Addresses
- Address Comparison
- Special Addresses
- Address Methods
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- Reading Values
- Reading Arrays
- Reading Complex Types
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- Class Hierarchy
- Available Types
- Storage Key Generation
- Usage
- Storage Behavior
- Initialization
- Solidity vs OP_NET Comparison
- Side-by-Side Code Examples
- Patterns
- Best Practices
- Overview
- Available Types
- Storage Structure
- Operations
- Solidity vs OP_NET Comparison
- Side-by-Side Code Examples
- Common Patterns
- Use Cases
- Best Practices
- Overview
- CRITICAL: Map Implementation Warning
- StoredMapU256
- Using Address Keys
- Nested Maps
- MapOfMap
- Solidity vs OP_NET Comparison
- Side-by-Side Code Examples
- Common Patterns
- Best Practices
- Overview
- AddressMemoryMap
- Storage Flow
- Solidity vs OP_NET Comparison
- Side-by-Side Code Examples
- Usage Examples
- Storage vs Memory
- Warning: AssemblyScript Map vs btc-runtime Map
- Patterns
- Best Practices
- Architecture Overview
- Overview
- Making Calls
- Handling Results
- Common Patterns
- Solidity Comparison
- Security Considerations
- Advanced Patterns
- Overview
- Supported Signature Schemes
- Schnorr Signatures
- ML-DSA Signatures
- Verification API
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- ML-DSA (FIPS 204)
- Security Levels
- The Address Class
- Migration Path
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- BitcoinOpcodes
- Address Generation
- Script Building
- Timelocks
- Script Analysis
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- How It Works
- Basic Usage
- The Timelock Pattern
- Storage Compatibility
- Security Considerations
- Comparison with Other Platforms
- Complete Example
- Update Workflow
- Overview
- Plugin Architecture
- Creating Plugins
- Lifecycle Hooks
- Built-in Plugins
- Solidity vs OP_NET Comparison
- Best Practices
- Overview
- Features
- Role System
- Pausability
- Blacklist
- Minter Allowances
- Complete Code
- Solidity Comparison
- Overview
- Multi-Oracle Architecture
- Price Aggregation
- Staleness Protection
- Deviation Checks
- Complete Code
- Solidity Comparison
- Overview
- Sale Phases
- Reservation System
- Whitelist
- Reveal Mechanism
- Complete Code
- Solidity Comparison
- Overview
- Properties
- Transaction Context
- Contract Context
- Network Context
- Storage Architecture
- Storage Methods
- Event Methods
- Cross-Contract Methods
- Signature Methods
- Overview
- StoredU256
- StoredU64
- StoredBoolean
- StoredString
- StoredAddress
- StoredU256Array
- StoredAddressArray
- StoredMapU256
- AddressMemoryMap
Every documentation page includes Solidity Comparison sections with side-by-side code examples. Start with: