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-progContract Operations
| Command | Description |
|---|---|
| deploy | Deploy a contract from Foundry build JSON |
| transact | Call a contract function (state-changing) |
| call | Call a contract function (read-only, eth_call) |
| wrap-btc | Wrap 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 sendrawtransactionsContract Queries
| Command | Description |
|---|---|
| get-code | Get contract bytecode (eth_getCode) |
| get-contract-deploys | Get contract deployments by address |
| get-storage-at | Get storage at location (eth_getStorageAt) |
Balance & Account
| Command | Description |
|---|---|
| get-balance | Get frBTC balance (eth_getBalance) |
| brc20-balance | Get BRC20 balance (brc20_balance) |
| get-transaction-count | Get nonce (eth_getTransactionCount) |
Transaction Queries
| Command | Description |
|---|---|
| get-transaction | Get transaction by hash |
| get-transaction-receipt | Get transaction receipt |
| get-receipt-by-inscription | Get receipt by inscription ID |
| trace-transaction | Get transaction trace |
Block Queries
| Command | Description |
|---|---|
| block-number | Get current block number |
| get-block-by-number | Get block by number |
| get-block-by-hash | Get block by hash |
Other Commands
| Command | Description |
|---|---|
| estimate-gas | Estimate gas (eth_estimateGas) |
| chain-id | Get chain ID (eth_chainId) |
| gas-price | Get gas price (eth_gasPrice) |
| get-logs | Get logs (eth_getLogs) |
| unwrap | Get 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 splitbrc20-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 splitbrc20-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 argumentsbrc20-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...abcdbrc20-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-numberbrc20-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 latestJSON-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_gasPriceBRC20-Prog Specific Methods
# BRC20-Prog specific methods:
brc20_version
brc20_balance
brc20_getTxReceiptByInscriptionId
brc20_getInscriptionIdByTxHash
brc20_getInscriptionIdByContractAddress