CLI
Install the bb CLI, learn its command groups, configure settings and API keys, and run doctor and completion.
The bb CLI builds, inspects, signs, and broadcasts BitBadges transactions and calls the BitBadges API from the terminal. This page covers install, the command groups, settings, and health checks.
Agents should start with CLI Automation, choose a standard, and use the main-wallet payment flow when a human signs each request. The installed --help-json tree is the syntax authority; the standard pages explain the state and accounting rules behind those commands.
Install
curl -fsSL https://install.bitbadges.io | sh
bb version
bb doctorThe one-liner installs two binaries:
| Binary | What it is | Where it comes from |
|---|---|---|
bitbadgeschaind | The chain node binary (Cosmos SDK). The installer symlinks it as bb. | GitHub release for your OS and architecture, into /usr/local/bin |
bitbadges-cli | The SDK CLI (Node.js). bb forwards SDK verbs to it. | bun install -g bitbadges@<pinned> if bun is present, else npm install -g bitbadges@<pinned>. The installer pins an SDK version (--sdk-version overrides it). |
bb is the only name used in these docs. bitbadgeschaind is the canonical binary name and is accepted everywhere bb is.
The installer verifies the downloaded chain binary against the release's checksums.txt (sha256) and refuses to install if the file is missing, the asset is not listed, or the hash does not match. It installs a pinned bitbadges npm version rather than the latest, so the SDK CLI can trail npm; run bb version and bitbadges-cli --version after install, and pass --sdk-version <v> (or run npm install -g bitbadges@latest) to choose another.
Installer options:
curl -fsSL https://install.bitbadges.io | sh -s -- --version v35 # pin a release
curl -fsSL https://install.bitbadges.io | sh -s -- --install-dir ~/.local/bin
curl -fsSL https://install.bitbadges.io | sh -s -- --no-sudo
curl -fsSL https://install.bitbadges.io | sh -s -- --testnet # testnet binary (testnet is offline)
curl -fsSL https://install.bitbadges.io | sh -s -- --sdk-version 0.45.15 # choose the bitbadges npm version
curl -fsSL https://install.bitbadges.io | sh -s -- --skip-checksum # skip sha256 verification (only for old releases without checksums.txt)| Platform | Architecture |
|---|---|
| Linux | x86_64, ARM64 |
| macOS | Intel, Apple Silicon |
| Windows | x86_64 via Git Bash, MSYS2, or WSL (no bb symlink; call bitbadgeschaind.exe) |
Not every release ships every platform. The v36 release has Linux and Windows assets only, with no macOS binaries (v34 was the same), so the default (latest) install fails on macOS with download failed. Check the assets on the releases page before you install. v35 is the most recent release with macOS binaries (--version v35).
SDK CLI Only
If you do not need the chain node binary:
bun install -g bitbadges # or: npm install -g bitbadges
bitbadges-cli --helpAn npm-only install's
bbis the SDK CLI. Sincebitbadges0.45.9, the npm package shipsbbas an alias ofbitbadges-cli, so SDK verbs in help text and examples (bb build,bb api,bb settings set apiKey <key>) run as written. Thatbbdoes not include the chain binary: native chain commands still need the installer above, which symlinksbbtobitbadgeschaind. With both installed, thebbthat comes first onPATHwins;bitbadges-cli ...always reaches the SDK CLI. On 0.45.8 or older there is no npmbb; usebitbadges-cli ....
The npm package bitbadges ships four bins: bitbadges, bitbadges-cli, and bb (the CLI, same file; bb since 0.45.9) and bitbadges-builder (the MCP builder tools server, see Set Up Your AI). SDK-owned commands such as bb build and bb api run as bitbadges-cli build and bitbadges-cli api. Native chain commands such as query, keys, and sign-arbitrary still require bitbadgeschaind; the SDK-only install does not provide them.
Chain Binary from Source
git clone https://github.com/BitBadges/bitbadgeschain.git
cd bitbadgeschain
make build-mainnet-darwin/arm64 # or build-mainnet-linux/amd64, build-mainnet-linux/arm64, build-mainnet-darwin/amd64, build-mainnet-windows/amd64Requires the Go version in go.mod (1.26 at time of writing). Pre-built binaries are on the releases page. Use the binary version that matches the current chain height; the chain upgrades periodically.
Claude Code Plugin
Claude Code users can add the Claude Code Plugin on top of this install. It wires the MCP server and adds workflow skills. It does not replace the CLI.
Command Groups
bb --help prints the commands in groups so you can tell which binary owns a verb.
bb --help
bb cli --help-json | jq '.commands[] | .name' # full SDK command tree as JSON| Group | Commands | Reference |
|---|---|---|
| Chain node (Cosmos SDK) | start, init, status, version, tx, query (q), keys, sign-arbitrary, genesis, config, debug, prune, snapshots, comet, export, rollback, index-eth-tx, pre-upgrade | Chain Commands |
| Build and ship a transaction | build, check, explain, simulate, preview, deploy, tx status, tx wait | Build, Analyze, Deploy |
| Standards (end-user actions) | pay-requests, bounties, subscriptions, intents, credit-tokens, spendable-credits, products, crowdfunds, auctions, prediction-markets, smart-tokens, vault, ibc-token, issuer-controlled, nfts, custom-2fa, dynamic-stores, standards (inspect) | Standards |
| Indexer access | api, auth | API, Auth |
| Account and lookup | account, amount, url | Account, Swap |
| Swap and DEX | swap, pools, pairs, balances, price, assets | Swap |
| Dev / agent surface | dev (tools, resources, docs, skills, capabilities, standards, requests, gen-pub-key, feedback) | Dev |
| Local state | settings, burner, session | this page, Deploy, Dev |
| Discovery | doctor | this page |
| Misc | completion | this page |
The chain binary forwards SDK verbs by name. Chain releases before v35 do not forward tx status, tx wait, amount, balances, assets, url, or custom-2fa. On those releases run them as bitbadges-cli <verb>; bb --help shows which verbs your binary forwards. If bitbadges-cli cannot be found, an SDK verb such as bb check tx.json prints an install hint on stderr and exits 127 from v36 on, so scripts can tell a missing dependency from a failed check. v35 and earlier exit 0 with empty output in that case.
Deprecated Forms
Old forms still resolve for one release and print a one-line [bb] DEPRECATED: banner on stderr that names the new form. The release after the window removes them.
| Old form | New form |
|---|---|
bb cli <verb> | bb <verb> |
bb portfolio, bb address, bb lookup, bb alias, bb gen-list-id | bb account <verb> |
bb tools, bb tool, bb resources, bb docs, bb skills, bb gen-pub-key | bb dev <verb> |
bb config | bb settings (the chain binary owns bb config, which manages client.toml) |
bb sign-with-browser | bb deploy --browser --message |
bb gen-tx-payload | bb deploy --gen-payload |
bb swap pools, bb swap asset-pairs | bb pools, bb pairs |
bb build smart-account | bb build smart-token |
--expiry, --valid-until | --expiration |
--json-only | --quiet |
BB_QUIET=1 or --quiet suppresses the banner. Do not write new scripts or agent prompts against the old forms.
Output Envelope
Every data-emitting SDK verb prints one JSON envelope on stdout and human commentary on stderr. JSON is the default output, so there is no --json flag; passing --json to a verb such as doctor or price fails with unknown option '--json'. Use --condensed for single-line JSON or -q to silence stderr.
bb api tokens get-collection 1 | jq .data
bb explain tx.json --quiet | jq -r .data.fullText{ "ok": true, "data": {}, "warnings": [], "hint": "optional", "meta": {}, "error": null }| Flag | Applies to | Description |
|---|---|---|
--condensed | every envelope verb | Single-line JSON |
--output-file <path> | every envelope verb | Write the envelope to a file instead of stdout |
-q, --quiet | global | Silence stderr commentary (review banners, "Written to" notices, deprecation banners). Errors still print. Same as BB_QUIET=1. |
--help-json | global | Print the SDK command tree as JSON. After a subcommand path (bb api tokens --help-json), prints only that subtree as { path, commands }; bare --help-json prints the whole tree (since 0.45.9) |
bb build adds a meta sidecar with validation, review, simulate, and resolved-metadata reports next to the message in data. hint is set on common failures (auth rejected, 401/403, insufficient funds on deploy, tx wait timeout).
Inputs are uniform: a file path, @file.json, inline JSON, or - for stdin.
Settings
bb settings set apiKey "$BITBADGES_API_KEY"
bb settings show
bb settings unset apiKeyTestnetConfig lives at ~/.bitbadges/config.json (or $BITBADGES_CONFIG_DIR/config.json). Since bitbadges 0.45.15, saving settings creates the directory with mode 0700 and the file with mode 0600, and tightens existing entries to those modes (skipped on Windows). Get an API key at bitbadges.io/developer.
| Subcommand | Description |
|---|---|
settings show | Print the current config as an envelope |
settings set <key> <value> | Set one key |
settings unset <key> | Remove one key |
| Key | Values |
|---|---|
apiKey | Default API key |
apiKeyTestnet | Testnet API key |
apiKeyLocal | Local API key |
network | mainnet, testnet, local |
url | Custom API base URL |
Environment Variables
| Variable | Description |
|---|---|
BITBADGES_API_KEY | Default API key (all networks) |
BITBADGES_API_KEY_TESTNET | Testnet API key |
BITBADGES_API_KEY_LOCAL | Local API key |
BITBADGES_API_URL | Custom API base URL (overrides config) |
BITBADGES_CONFIG_DIR | Override ~/.bitbadges |
BB_QUIET | 1 silences stderr commentary |
BITBADGES_TESTNET_OFFLINE | false bypasses the testnet-offline guard for a private chain that uses the testnet chain ID |
Network Flags
Every SDK verb that reaches the network accepts the same flags.
| Flag | Description |
|---|---|
--network <name> | mainnet, testnet, or local |
--mainnet | Shortcut for --network mainnet (the default) |
--testnet | Shortcut for --network testnet. Testnet is offline; see Testnet. |
--local | Shortcut for --network local (http://localhost:3001, LCD http://localhost:1317) |
--url <url> | Custom API base URL (overrides everything else) |
--api-key <key> | Override the API key for this call |
Resolution order for the API key: --api-key > network-specific env var > BITBADGES_API_KEY > network-specific config key > apiKey in config. For the base URL: --url > --local > --testnet > BITBADGES_API_URL > config url > https://api.bitbadges.io.
| Network | API | LCD | Cosmos chain ID | EVM chain ID | EVM RPC |
|---|---|---|---|---|---|
| mainnet | https://api.bitbadges.io | https://lcd.bitbadges.io | bitbadges-1 | 50024 | https://evm-rpc.bitbadges.io |
| testnet (offline) | https://api.bitbadges.io/testnet | https://lcd-testnet.bitbadges.io | bitbadges-2 | 50025 | https://evm-rpc-testnet.bitbadges.io |
| local | http://localhost:3001 | http://localhost:1317 | bitbadges-local-1 | 90123 | http://localhost:8545 |
--local / --network local still uses the published SDK preset Cosmos chain ID bitbadges-1. For a chain initialized as bitbadges-local-1, pass --chain-id bitbadges-local-1 (for example bb deploy --gen-payload --local --chain-id bitbadges-local-1). See Signing Client.
Doctor
bb doctor
bb doctor --with-preview
bb doctor --condensed | jq '.data.checks[] | select(.status != "pass")'Probes, in order: Node version (18 or newer), SDK package and version, config file, API key for the resolved network (pings the simulate endpoint), MCP stdio bin, persisted sessions parse, and with --with-preview a preview upload and fetch round trip that asserts byte equality. Each probe reports pass, fail, warn, or skip. The exit code is non-zero only on hard failures.
| Flag | Description |
|---|---|
--with-preview | Add the preview round-trip probe |
--condensed, --output-file | Output flags |
| network flags | Which API the key probe hits |
Session
Builder sessions from bb dev tools call --session <id> persist under ~/.bitbadges/sessions/<id>.json.
bb session list
bb session show demo
bb session reset demoCompletion
eval "$(bb completion)" # bash or zsh
bb completion zsh >> ~/.zshrcThe emitted script supports both shells through bashcompinit. Pass bash or zsh as a hint; any other value exits 2.
Quick Examples
bb query bank balances bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d --output json # chain native
bb api tokens get-collection 1 # BitBadges API
bb build vault --backing-coin USDC --name "Demo Vault" \
--image ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/vault.png \
--description "USDC vault" \
| bb preview - --open # build, then review and sign in the browser
bb auth login --browser --address bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d # session for Full Access routes
bb check tx.json && bb simulate tx.json # audit and dry-runThe first command, run against mainnet for an address that holds nothing, prints:
{
"balances": [],
"pagination": {}
}Ask your agent. With the MCP builder tools wired, the build-and-preview line above is one prompt:
Build a USDC vault called Demo Vault and give me a link to review and sign.bb --help ends with the Chaosnet warning and a link to the policies at bitbadges.io/policies. Transactions use real tokens.