BRC20-Prog Commands

The brc20-prog namespace provides operations for BRC20-Prog, the EVM-compatible smart contract layer on Bitcoin. This enables Ethereum-style contract deployment and interaction.

Endpoint Configuration

BRC20-Prog uses a separate JSON-RPC endpoint:

# Using the brc20-prog endpoint
alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  brc20-prog block-number

# Or with your API key:
--brc20-prog-rpc-url https://mainnet.subfrost.io/v4/YOUR_API_KEY/brc20-prog

Contract Operations

CommandDescription
deployDeploy a contract from Foundry build JSON
transactCall a contract function (state-changing)
callCall a contract function (read-only, eth_call)
wrap-btcWrap BTC to frBTC and execute in brc20-prog

Inscription Safety

The SDK automatically protects inscribed UTXOs by splitting them before use. If a UTXO contains inscriptions, a split transaction sends inscribed sats to a safe output before the commit transaction.

# Transaction bundle for contract deployment with inscribed UTXO:
# 1. Split TX: Protects inscribed sats → safe output
# 2. Commit TX: Uses clean sats from split
# 3. Reveal TX: Reveals the inscription
# 4. Activation TX: Activates the contract (optional)

# All transactions are broadcast atomically via sendrawtransactions

Contract Queries

CommandDescription
get-codeGet contract bytecode (eth_getCode)
get-contract-deploysGet contract deployments by address
get-storage-atGet storage at location (eth_getStorageAt)

Balance & Account

CommandDescription
get-balanceGet frBTC balance (eth_getBalance)
brc20-balanceGet BRC20 balance (brc20_balance)
get-transaction-countGet nonce (eth_getTransactionCount)

Transaction Queries

CommandDescription
get-transactionGet transaction by hash
get-transaction-receiptGet transaction receipt
get-receipt-by-inscriptionGet receipt by inscription ID
trace-transactionGet transaction trace

Block Queries

CommandDescription
block-numberGet current block number
get-block-by-numberGet block by number
get-block-by-hashGet block by hash

Other Commands

CommandDescription
estimate-gasEstimate gas (eth_estimateGas)
chain-idGet chain ID (eth_chainId)
gas-priceGet gas price (eth_gasPrice)
get-logsGet logs (eth_getLogs)
unwrapGet pending unwraps from FrBTC contract

brc20-prog deploy-contract

Deploy a Solidity contract from Foundry build output.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  --wallet-file ~/.alkanes/wallet.json \
  --passphrase "your-passphrase" \
  brc20-prog deploy ./out/MyContract.sol/MyContract.json \
  --fee-rate 10

# Arguments:
# <FOUNDRY_JSON_PATH>  Path to Foundry build JSON file

# Options:
# --from <addresses>    Addresses to source UTXOs from
# --change <address>    Change address
# --fee-rate <rate>     Fee rate in sat/vB
# --use-activation      Use 3-transaction activation pattern
# --mempool-indexer     Enable mempool indexer for pending UTXO tracing
# --trace               Enable transaction tracing
# --mine                Mine a block after broadcasting (regtest only)
# --raw                 Output raw JSON

# Output includes split_txid and split_fee if inscribed UTXOs were split

brc20-prog transact

Call a state-changing function on a BRC20-prog contract.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  --wallet-file ~/.alkanes/wallet.json \
  --passphrase "your-passphrase" \
  brc20-prog transact 0x1234...abcd "transfer(address,uint256)" 0xRecipient...,1000 \
  --fee-rate 10

# Arguments:
# <address>     Contract address (0x prefixed hex)
# <signature>   Function signature (e.g., "transfer(address,uint256)")
# [calldata...] Arguments as comma-separated values

# Options:
# --from <addresses>    Addresses to source UTXOs from
# --change <address>    Change address
# --fee-rate <rate>     Fee rate in sat/vB
# --mempool-indexer     Enable mempool indexer for pending UTXO tracing
# --trace               Enable transaction tracing
# --mine                Mine a block after broadcasting (regtest only)
# --raw                 Output raw JSON

# Output includes split_txid and split_fee if inscribed UTXOs were split

brc20-prog wrap-btc

Wrap BTC to frBTC and execute a function on a target contract.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  --wallet-file ~/.alkanes/wallet.json \
  --passphrase "your-passphrase" \
  brc20-prog wrap-btc 100000 \
  --target 0x1234...abcd \
  --signature "deposit()" \
  --calldata "" \
  --fee-rate 10 \
  -y

# Arguments:
# <AMOUNT>  Amount of BTC to wrap (in satoshis)

# Options:
# --target <TARGET>         Target contract address
# --signature <SIGNATURE>   Function signature to call
# --calldata <CALLDATA>     Calldata arguments

brc20-prog call

Make a read-only call to a contract (eth_call equivalent).

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  brc20-prog call \
  --to 0x1234...abcd \
  --data 0x70a08231000000000000000000000000...

brc20-prog get-balance

Get the frBTC balance of an address.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  brc20-prog get-balance 0x1234...abcd

brc20-prog block-number

Get the current block number.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  brc20-prog block-number

brc20-prog get-logs

Get event logs matching filter criteria.

alkanes-cli -p mainnet \
  --brc20-prog-rpc-url https://mainnet.subfrost.io/v4/jsonrpc/brc20-prog \
  brc20-prog get-logs \
  --address 0x1234...abcd \
  --from-block 840000 \
  --to-block latest

JSON-RPC Methods

BRC20-Prog supports standard Ethereum JSON-RPC methods:

# Standard Ethereum JSON-RPC methods:
eth_blockNumber
eth_getBalance
eth_getCode
eth_call
eth_estimateGas
eth_getTransactionByHash
eth_getTransactionReceipt
eth_getBlockByNumber
eth_getBlockByHash
eth_getTransactionCount
eth_getStorageAt
eth_getLogs
eth_chainId
eth_gasPrice

BRC20-Prog Specific Methods

# BRC20-Prog specific methods:
brc20_version
brc20_balance
brc20_getTxReceiptByInscriptionId
brc20_getInscriptionIdByTxHash
brc20_getInscriptionIdByContractAddress