Skip to main content

Alkanes Integration

The Alkanes CLI (alkanes) is the primary command-line tool for interacting with the Alkanes metaprotocol on Bitcoin. It provides commands for wallet management, token operations, contract deployment, and querying the network.

Installation

Install from the alkanes-rs repository:

git clone https://github.com/kungfuflex/alkanes-rs
cd alkanes-rs
cargo build --release

The binary will be available at target/release/alkanes.

Global Options

All commands support these global options:

OptionDescription
--wallet-file <PATH>Path to wallet file
--passphrase <PHRASE>Wallet passphrase for signing
--wallet-address <ADDR>Watch-only mode (read-only)
--jsonrpc-url <URL>Custom JSON-RPC endpoint
--provider <PROVIDER>Network: regtest, signet, mainnet
--frbtc-address <ADDR>Override frBTC contract address

Wallet Commands

Create a Wallet

alkanes wallet create

Creates a new wallet with a 12-word mnemonic phrase. Store this phrase securely.

List Addresses

alkanes wallet addresses --range 0:5

Shows wallet addresses. Use range notation start:end to specify which addresses to display.

Check Balance

alkanes wallet balance

Displays BTC and token balances for your wallet.

List UTXOs

alkanes wallet utxos

Lists all unspent transaction outputs in your wallet.

Alkanes Operations

Wrap BTC to frBTC

alkanes alkanes wrap-btc <AMOUNT> \
--to <RECIPIENT_ADDRESS> \
--from <YOUR_ADDRESS> \
--change <CHANGE_ADDRESS> \
--fee-rate <SAT_PER_VB> \
-y

Wraps native BTC to frBTC tokens. The -y flag auto-confirms the transaction.

Example:

alkanes alkanes wrap-btc 0.01 \
--to bc1p... \
--from bc1q... \
--change bc1q... \
--fee-rate 10 \
-y

Check Token Balance

alkanes alkanes getbalance --address <ADDRESS>

View Pending Unwraps

alkanes alkanes unwrap --block-tag latest

Shows pending frBTC unwrap requests waiting to be processed.

Execute Custom Transactions

alkanes alkanes execute \
--inputs <REQUIREMENTS> \
--to <ADDRESSES> \
--protostones <SPECS> \
-y

For advanced users building custom Alkanes transactions.

Input format:

  • B:amount — Bitcoin amount in sats
  • BLOCK:TX:amount — Specific token amount

Inspect Contracts

alkanes alkanes inspect <OUTPOINT> --disasm --meta

Disassemble and inspect contract bytecode.

Simulate Transactions

alkanes alkanes simulate <TX_HEX>

Simulate an Alkanes transaction without broadcasting.

Bitcoin RPC Commands

Direct Bitcoin Core RPC access:

# Get block count
alkanes bitcoind getblockcount

# Get raw transaction
alkanes bitcoind getrawtransaction <TXID>

# Decode transaction
alkanes bitcoind decoderawtransaction <TX_HEX>

# Send transaction
alkanes bitcoind sendrawtransaction <TX_HEX>

Esplora Commands

Query Esplora API:

# Get address info
alkanes esplora address <ADDRESS>

# Get address UTXOs
alkanes esplora address-utxo <ADDRESS>

# Get transaction
alkanes esplora tx <TXID>

# Fee estimates
alkanes esplora fee-estimates

Transaction Options

Fee Rate

Set custom fee rate in sat/vB:

--fee-rate 15

Broadcasting Methods

OptionDescription
DefaultStandard mempool broadcast
--use-slipstreamMARA Slipstream (bypasses mempool)
--use-rebarRebar Shield (private relay with MEV protection)
--mineMine immediately (regtest only)

Auto-confirm

Skip confirmation prompts:

-y, --auto-confirm

Key Constants

ConstantValueDescription
frBTC Contract{32, 0}Block 32, Transaction 0
Wrap Opcode77frBTC exchange function
Unwrap Opcode78frBTC unwrap function
Get Signer Opcode103Query signer address
Genesis Block880000Mainnet genesis

Getting Help

alkanes --help
alkanes <COMMAND> --help

For issues and contributions: kungfuflex/alkanes-rs

See Also