Write your Solidity contract
Write your contract using standard Solidity. BRC2.0 is compatible with Hardhat, Foundry, and Remix — use whichever toolchain you already know.Key differences from Ethereum to keep in mind:
block.numberrefers to the Bitcoin block height, not an Ethereum block number.block.timestampis the Bitcoin block time. It is less granular than Ethereum and can go backwards, so avoid relying on it for precision timing.msg.valuedoes not carry native ETH. Use the BRC2.0 deposit mechanism to move BRC-20 tokens into contracts instead.- Block time is approximately 10 minutes.
This DEX pattern — deposit BRC-20 tokens, execute swaps inside the EVM, withdraw back to BRC-20 — is the canonical interaction model for BRC2.0 DeFi. The deposit step moves tokens from base BRC-20 state into the contract’s internal balance. The withdraw step reverses that bridge trustlessly, with no multisig required.
Compile to bytecode
Compile your contract to produce the deployment bytecode. BRC2.0 accepts standard EVM creation bytecode — the same artifact Hardhat or Foundry would deploy to Ethereum.The bytecode value looks like
0x608060405234801561001057600080fd5b50.... Copy the full hex string — you will need it in the next step.Create the deploy inscription
Construct the BRC2.0 deploy inscription JSON. Paste the full bytecode from the previous step as the value of the
d field.pmust be"brc20-prog"— this identifies the BRC2.0 programmable module protocol.opis"deploy"(you can also use"d"as a shorthand).dis the full EVM creation bytecode, including the0xprefix.
text/plain inscription. The inscription ID will be used to derive the contract’s EVM address.Send to the module address
Inscribing the bytecode alone does not activate the contract. You must send the inscription to the BRC20PROG module address (
OP_RETURN "BRC20PROG") in a Bitcoin transaction. This is the trigger that tells indexers to execute the constructor and register the contract.Until this send transaction is confirmed, the contract does not exist from the indexer’s perspective.This two-step pattern — inscribe, then send to the module address — is consistent across all BRC2.0 operations. The inscription carries the data; the send transaction is the execution trigger.
Wait for Bitcoin confirmation
As with all BRC2.0 operations, execution is anchored to confirmed Bitcoin blocks. After the send transaction broadcasts, wait for it to be included in a Bitcoin block.Bitcoin produces a block approximately every 10 minutes. One confirmation is sufficient for indexers to process the deploy, execute the constructor, and assign the contract address.
Verify deployment
Once the block confirms, your contract is live. The contract address is deterministically derived from the inscription ID used in the deploy transaction.Use a BRC2.0 block explorer to confirm the contract exists and to retrieve its address. The explorer will show:
- The derived EVM address
- Constructor execution status (success or revert)
- Any events emitted during construction
- The deployed bytecode
Call your contract
Invoke a deployed contract by inscribing a As with deploy, inscribe the JSON and send the inscription to the BRC20PROG module address. Indexers will execute the call, update contract state, and emit any logs. State changes are committed only if execution succeeds — reverted calls leave state unchanged.
call operation and sending it to the module address.cis the EVM address of the deployed contract.bis the ABI-encoded calldata for the function you want to invoke (the same encoding you would use on Ethereum).opcan be"call"or"c"as a shorthand.
transact operation:transact accepts a signed EVM transaction blob, which combines a deposit with a contract call in a single inscription.