alkanes-cli & @alkanes/ts-sdk
The alkanes-cli command-line tool and @alkanes/ts-sdk TypeScript library provide comprehensive access to the Alkanes protocol, Bitcoin blockchain, and SUBFROST APIs.
What is alkanes-cli?
alkanes-cli is a powerful command-line interface for:
Wallet Management
Create, manage, and sign transactions with HD wallets
Alkanes Protocol
Deploy contracts, execute transactions, and query balances
AMM & Liquidity
Initialize pools, execute swaps, and manage liquidity
Bitcoin Operations
Query blocks, transactions, UTXOs, and fee estimates
Ordinals & Runes
Query inscriptions, runes, and sat information
Network Endpoints
The CLI can connect to SUBFROST APIs on different networks:
| Network | JSON-RPC | Data API |
|---|---|---|
| Mainnet | https://mainnet.subfrost.io/v4/jsonrpc | https://mainnet.subfrost.io/v4/api |
| Signet | https://signet.subfrost.io/v4/jsonrpc | https://signet.subfrost.io/v4/api |
| Regtest | https://regtest.subfrost.io/v4/jsonrpc | https://regtest.subfrost.io/v4/api |
Command Namespaces
| Command | Description |
|---|---|
| wallet | HD wallet creation, addresses, signing, and transactions |
| alkanes | Alkanes protocol operations (execute, simulate, trace, swap) |
| ord | Ordinals protocol queries (inscriptions, runes, sats) |
| esplora | Block explorer queries (blocks, transactions, addresses) |
| dataapi | High-level data queries (alkanes, pools, balances) |
| metashrew | Low-level indexer queries |
| bitcoind | Bitcoin Core RPC passthrough |
| lua | Server-side Lua script execution |
Global Options
alkanes-cli [OPTIONS] <COMMAND>
Options:
--wallet-file <PATH> Path to wallet file (default: ~/.alkanes/wallet.json)
--passphrase <PASSPHRASE> Wallet passphrase for signing
--jsonrpc-url <URL> JSON-RPC endpoint URL
--data-api <URL> Data API endpoint URL
--subfrost-api-key <KEY> SUBFROST API key (or use SUBFROST_API_KEY env)
-p, --provider <PROVIDER> Network provider [default: regtest]
Options: mainnet, signet, regtest
-h, --help Print help
-V, --version Print versionTypeScript SDK (@alkanes/ts-sdk)
The same functionality is available in TypeScript:
import {
createKeystore,
unlockKeystore,
createWallet,
createProvider
} from '@alkanes/ts-sdk';
// Create a provider
const provider = createProvider({
url: 'https://mainnet.subfrost.io/v4/jsonrpc',
networkType: 'mainnet',
});
// Get block height
const height = await provider.getBlockHeight();
console.log('Block height:', height);