Chain Commands
Chain-native bb commands from bitbadgeschaind: keys, tx, query, sign-arbitrary, genesis, and node operation.
bb is the chain node binary bitbadgeschaind, a Cosmos SDK binary with the BitBadges modules. This page covers the native commands: key management, transactions, queries, offline signing, and node operation. The SDK verbs (build, deploy, api, and the rest) are forwarded to bitbadges-cli and documented on the other CLI pages.
Example
bb keys add alice
bb tx tokenization create-collection ./create-collection.json \
--from alice --chain-id bitbadges-1 --node https://rpc.bitbadges.io:443 \
--gas auto --gas-adjustment 1.5 --gas-prices 10ubadge
bb query tokenization collection 2 --node https://rpc.bitbadges.io:443 --output json
bb sign-arbitrary alice "auth challenge text"The query prints the on-chain collection document (mainnet output, permissions and default balances trimmed):
{
"collection": {
"collectionId": "2",
"collectionMetadata": {
"uri": "ipfs://QmXSWKxRjpEVqnUnQP6mwsAqrWHo6KAsKzzhYXNu9KKmGj",
"customData": ""
},
"tokenMetadata": [
{
"uri": "ipfs://QmXSWKxRjpEVqnUnQP6mwsAqrWHo6KAsKzzhYXNu9KKmGj",
"customData": "",
"tokenIds": [{ "start": "1", "end": "1" }]
}
],
"customData": "",
"manager": "",
"collectionApprovals": [],
"standards": [],
"isArchived": false,
"validTokenIds": [{ "start": "1", "end": "1" }]
}
}Endpoints and chain IDs: Network. Mainnet is bitbadges-1; testnet (bitbadges-2) is offline.
Ask your agent. Queries have MCP equivalents (query_collection, query_balance, query_dynamic_store); signing does not, by design. This prompt works, and the bb tx step stays with you and your keyring:
Fetch collection 2 from chain and summarize its approvals.keys
BitBadges supports standard Cosmos secp256k1 keys (the default --key-type) and Ethereum-style eth_secp256k1 keys. The effective keyring backend is os: client.toml sets keyring-backend = "os", so on a headless machine bb keys add asks for a keyring passphrase. For throwaway development keys, pass --keyring-backend test (unencrypted, no prompt).
bb keys add alice # new key; save the mnemonic
bb keys add alice --recover # from a mnemonic
bb keys add alice --key-type eth_secp256k1 # Ethereum-style key (sign-arbitrary needs the default secp256k1)
bb keys add dev --keyring-backend test # throwaway dev key, no passphrase
bb keys list
bb keys show alice
bb keys show alice --bech val # validator operator form
bb keys export alice # armored private key
bb keys import alice keyfile.armor
bb keys delete alicetx
bb tx tokenization transfer-tokens ./transfer.json --from alice --chain-id bitbadges-1 \
--node https://rpc.bitbadges.io:443 --gas auto --gas-adjustment 1.5 --gas-prices 10ubadge| Flag | Default | Description |
|---|---|---|
--from | required | Key name or address |
--chain-id | none (client.toml chain-id is empty after init) | Cosmos chain ID (bitbadges-1 on mainnet). Omitting it fails with chain ID required but not specified |
--node | tcp://localhost:26657 | Node RPC endpoint (https://rpc.bitbadges.io:443 on mainnet) |
--gas | 200000 | Gas limit, or auto to simulate |
--gas-adjustment | 1.0 | Multiplier with --gas auto |
--gas-prices | Use 10ubadge or higher; fees are calculated from the gas limit. | |
--keyring-backend | os (from client.toml) | os, file, test |
--broadcast-mode | sync | sync, async |
--dry-run | false | Simulate without broadcasting |
--generate-only | false | Print the unsigned transaction JSON |
Generic subcommands under bb tx: sign, sign-batch, multi-sign, multisign-batch, validate-signatures, broadcast, encode, decode, simulate. Module subcommands follow.
tokenization
Most commands take a JSON argument, inline or as a file path. Field names match the protobuf messages in Messages. Pass the bare message (the inner value), not the { "typeUrl", "value" } envelope that bb check, bb preview, and bb deploy accept; the envelope fails with unknown field "typeUrl" in types.MsgCreateCollection. creator can be omitted; it is filled from --from. Every line below also takes the flags from the tx table; FLAGS stands for --from alice --chain-id bitbadges-1 --node https://rpc.bitbadges.io:443 --gas auto --gas-adjustment 1.5 --gas-prices 10ubadge.
FLAGS="--from alice --chain-id bitbadges-1 --node https://rpc.bitbadges.io:443 --gas auto --gas-adjustment 1.5 --gas-prices 10ubadge"
# collections
bb tx tokenization create-collection ./create-collection.json $FLAGS
bb tx tokenization universal-update-collection ./update.json $FLAGS
bb tx tokenization update-collection ./update.json $FLAGS
bb tx tokenization delete-collection 1 $FLAGS
# transfers
bb tx tokenization transfer-tokens ./transfer.json $FLAGS
# approvals
bb tx tokenization set-incoming-approval 1 ./approval.json $FLAGS
bb tx tokenization set-outgoing-approval 1 ./approval.json $FLAGS
bb tx tokenization delete-incoming-approval 1 agent-daily-budget $FLAGS
bb tx tokenization delete-outgoing-approval 1 agent-daily-budget $FLAGS
bb tx tokenization update-user-approved-transfers ./approvals.json $FLAGS
bb tx tokenization purge-approvals 1 true "" false '[]' $FLAGS
# metadata and configuration
bb tx tokenization set-setcollectionmetadata ./metadata.json $FLAGS
bb tx tokenization set-settokenmetadata ./metadata.json $FLAGS
bb tx tokenization set-setcustomdata ./data.json $FLAGS
bb tx tokenization set-setstandards ./standards.json $FLAGS
bb tx tokenization set-setcollectionapprovals ./approvals.json $FLAGS
bb tx tokenization set-valid-token-ids ./tokenids.json $FLAGS
bb tx tokenization set-manager ./manager.json $FLAGS
bb tx tokenization set-setisarchived ./archived.json $FLAGS
# dynamic stores
bb tx tokenization create-dynamic-store true $FLAGS
bb tx tokenization update-dynamic-store 1 false true $FLAGS
bb tx tokenization set-dynamic-store-value 1 bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue true $FLAGS
bb tx tokenization delete-dynamic-store 1 $FLAGS
# address lists and votes
bb tx tokenization create-address-lists ./lists.json $FLAGS
bb tx tokenization cast-vote 1 collection bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d multisig-approval proposal-1 100 $FLAGSExample transfer.json (alice sends bob one unit of token ID 1 in collection 1):
{
"collectionId": "1",
"transfers": [
{
"from": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d",
"toAddresses": ["bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue"],
"balances": [
{
"amount": "1",
"tokenIds": [{ "start": "1", "end": "1" }],
"ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }]
}
]
}
]
}| Command | Arguments |
|---|---|
create-collection, update-collection, universal-update-collection, set-manager, set-valid-token-ids, set-setcollectionmetadata, set-settokenmetadata, set-setcustomdata, set-setstandards, set-setcollectionapprovals, set-setisarchived, create-address-lists, transfer-tokens, update-user-approved-transfers | [tx-json-or-file] |
delete-collection | [collection-id] |
set-incoming-approval, set-outgoing-approval | [collection-id] [approval-json-or-file] |
delete-incoming-approval, delete-outgoing-approval | [collection-id] [approval-id] |
purge-approvals | [collection-id] [purge-expired] [approver-address] [purge-counterparty-approvals] [approvals-to-purge-json-or-file] |
create-dynamic-store | [default-value] |
update-dynamic-store | [store-id] [default-value] [global-enabled] |
set-dynamic-store-value | [store-id] [address] [value] |
delete-dynamic-store | [store-id] |
cast-vote | [collection-id] [approval-level] [approver-address] [approval-id] [proposal-id] [yes-weight] |
Files are easier than inline JSON for anything beyond a one-liner. Prefer bb build plus bb deploy --with-keyring for the common shapes; it validates before it signs.
gamm
bb tx gamm create-pool --pool-file ./pool.json $FLAGS
bb tx gamm join-pool --pool-id 7 --share-amount-out 1000000 \
--max-amounts-in 1000000000ubadge --max-amounts-in 1000000ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $FLAGS
bb tx gamm exit-pool --pool-id 7 --share-amount-in 1000000 \
--min-amounts-out 1ubadge --min-amounts-out 1ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $FLAGS
bb tx gamm swap-exact-amount-out 1000000ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 2000000000 \
--swap-route-pool-ids 7 --swap-route-denoms ubadge $FLAGSExample pool.json (a 50/50 balancer pool; the creator deposits both sides):
{
"weights": "1ubadge,1ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8",
"initial-deposit": "1000000000000ubadge,1000000000ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8",
"swap-fee": "0.003",
"future-governor": "168h"
}join-pool and exit-pool take flags only and no positional arguments. Repeat --max-amounts-in and --min-amounts-out once per denom. swap-exact-amount-out takes [token-out] [token-in-max-amount] and gets its route from --swap-route-pool-ids and --swap-route-denoms, where the denom is the input denom for each hop. Before v36, the Usage: line that --help printed for these commands listed the message fields, not the arguments the command accepts; v36 prints the real forms. Pool 7 is the ubadge / canonical USDC (ibc/E1116484...) pool; bb query gamm pools lists every pool and its denoms.
bb tx gamm swap-exact-amount-in takes [token-in] [token-out-min-amount] plus the route flags, and an optional --affiliates '[{"address":"bb1...","basis_points_fee":"10"}]' (default empty). This needs v36 or later. In v35 every form fails with field type not recognized on the affiliates field, so use bb tx poolmanager swap-exact-amount-in (below) there.
bb tx gamm swap-exact-amount-in 1000000000ubadge 1 \
--swap-route-pool-ids 7 --swap-route-denoms ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $FLAGSThe pool-entry and exit variants (join-swap-extern-amount-in, join-swap-share-amount-out, exit-swap-extern-amount-out, exit-swap-share-amount-in) and swap-exact-amount-in-with-ibc-transfer are listed in bb tx gamm --help. Message semantics: gamm messages.
poolmanager
Cross-pool routing, estimates, and taker fees. Message semantics: x/poolmanager. Swaps take the amounts as positional arguments and the route as flags. Each --swap-route-denoms entry is the output denom of that hop for exact-in swaps and the input denom for exact-out swaps.
# exact in: [token-in] [token-out-min-amount]
bb tx poolmanager swap-exact-amount-in 1000000000ubadge 1 \
--swap-route-pool-ids 7 --swap-route-denoms ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $FLAGS
# exact out: [token-out] [token-in-max-amount]
bb tx poolmanager swap-exact-amount-out 1000000ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 2000000000 \
--swap-route-pool-ids 7 --swap-route-denoms ubadge $FLAGSA swap that misses the minimum fails at simulation with token calculated amount is lesser than min amount: got <n>, required <min>. split-route-swap-exact-amount-in, split-route-swap-exact-amount-out, create-pool, and set-denom-pair-taker-fee are listed in bb tx poolmanager --help.
managersplitter
Proxy manager addresses. Unlike tokenization, these commands take inline JSON (not a file path). The CLI overwrites admin / executor from --from. Field shapes: x/managersplitter messages.
bb tx managersplitter create-manager-splitter '<json>' $FLAGS
bb tx managersplitter update-manager-splitter '<json>' $FLAGS
bb tx managersplitter delete-manager-splitter '<json>' $FLAGS
bb tx managersplitter execute-universal-update-collection '<json>' $FLAGSquery
NODE="--node https://rpc.bitbadges.io:443 --output json"
bb query tokenization collection 1 $NODE
bb query tokenization balance 1 bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d $NODE
bb query tokenization balance-for-token 1 bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d 7 1788739200000 $NODE
bb query tokenization collection-stats 1 $NODE
bb query tokenization params $NODE
bb query tokenization address-list "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d:bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue" $NODE
bb query tokenization dynamic-store 1 $NODE
bb query tokenization dynamic-store-value 1 bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue $NODE
bb query tokenization wrappable-balances badgeslp:64:utoken bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d $NODE
bb query tokenization is-address-reserved-protocol bb1gycvn0nc50lh753dgk4qys5p2sdws8aw7ec9v9gg65pkhm6hqq3qjd3t3n $NODE
bb query tokenization all-reserved-protocol-addresses $NODE
bb query tokenization approvals-trackers 2 outgoing bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d agent-daily-budget agent-daily-budget overall "" $NODE
bb query tokenization num-used-for-merkle-challenge 1 collection bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d code-claim code-claim 0 $NODE
bb query tokenization num-used-for-eth-signature-challenge 1 collection bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d eth-gated eth-gated 0x9f1c2b3a4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8 $NODE
bb query tokenization vote 1 collection bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d multisig-approval proposal-1 bb1zc268nctj8xwslgw7q22cahs6k4y048agr6fvf $NODE
bb query tokenization votes 1 collection bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d multisig-approval proposal-1 $NODE
bb query gamm pools $NODE
bb query gamm pool 2 $NODE
bb query gamm pool-params 2 $NODE
bb query gamm spot-price 7 ubadge ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 false $NODE
bb query gamm estimate-swap-exact-amount-in 7 bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d 1000000000ubadge --swap-route-pool-ids=7 --swap-route-denoms=ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $NODE
bb query gamm pools-with-filter 1ubadge Balancer $NODE
bb query poolmanager num-pools $NODE
bb query poolmanager pool 2 $NODE
bb query poolmanager all-pools $NODE
bb query poolmanager spot-price 7 ubadge ibc/E1116484B327AEE59CDC3DA73D319834781A13DB2A7DFC1F38A30CD45ABF58B8 $NODE
bb query managersplitter params $NODE
bb query managersplitter all-manager-splitters $NODE
bb query managersplitter manager-splitter bb1gycvn0nc50lh753dgk4qys5p2sdws8aw7ec9v9gg65pkhm6hqq3qjd3t3n $NODE
bb query bank balances bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d $NODE
bb query tx 903D4A6E205AD77D334933E3C9BB455012D8A334AA2D98DFD301C3F7E8AB92C6 $NODE
bb query block --type=height 12000000 $NODE # the public RPC prunes old blocks; use a recent heightbb query bank balances for an address that holds nothing prints { "balances": [], "pagination": {} }.
Every query accepts --node <rpc> and --output json. q is an alias for query. One page per query with the response shape: Queries.
sign-arbitrary
bb sign-arbitrary alice "auth challenge text"
echo -n "auth challenge text" | bb sign-arbitrary alice
bb sign-arbitrary alice --message-file challenge.txt
bb sign-arbitrary alice "auth challenge text" --output raw # only the base64 signatureOutput for a throwaway secp256k1 key (real signature, produced offline):
{
"address": "bb1hz59w73vsqygl7z9zl49yvwjnl534n0yyexmkf",
"algo": "secp256k1",
"format": "adr36",
"message": "auth challenge text",
"pubKey": "A7TliNEJ+WoiaZvtnrOrdIuLIaVayagqvp47kF2L3Np3",
"signature": "Bk/AuuDrt/kChEgF4myQJMCX//1wqoEffd+4RghpKaU0q2QRpVjw0zaf+WHs3FnM8AsEnKm3CeMLc/2/AfKQ9A=="
}Signs any message with a keyring key in ADR-36 format, offline, with no chain access. The output feeds bb auth login --signature "$SIG" --public-key "$PUBKEY" --message "$MSG"; see Auth. The signed bytes equal Keplr's serializeSignDoc(makeADR36AminoSignDoc(...)) and verify with verifyADR36Amino.
| Flag | Description |
|---|---|
--message-file <path> | Read the message from a file; cannot combine with a positional message. Stdin is read only when neither is supplied. |
--output <json|raw> | Default json |
keyring flags, --home | Standard Cosmos keyring selection |
Only secp256k1 keys are supported; an eth_secp256k1 key errors with a pointer to bb keys add <name> --key-type secp256k1. EIP-191 support is a planned --format eip191 flag.
Node Operation
| Command | Purpose |
|---|---|
start | Run the node (Cosmos EVM server flags for JSON-RPC and EVM config) |
init, genesis | Initialize a home directory; genesis subcommands (gentx, collect-gentxs, validate, and the rest) |
status, version | Node status; binary version |
config | Manage client.toml (chain-owned; the SDK's settings live under bb settings) |
export, rollback, index-eth-tx | Cosmos EVM additions |
pre-upgrade | Pre-upgrade hook for cosmovisor |
prune, snapshots, comet (tendermint), debug | Standard Cosmos SDK maintenance |
Running a validator or full node: Run a Node. Build from source: CLI.
SDK Alternative
import { BitBadgesSigningClient, GenericCosmosAdapter, MsgTransferTokens } from 'bitbadges';
const adapter = await GenericCosmosAdapter.fromMnemonic(process.env.MNEMONIC!, 'bitbadges-1');
const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' });
const msg = new MsgTransferTokens({
creator: client.address,
collectionId: '1',
transfers: [
{
from: client.address,
toAddresses: ['bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue'],
balances: [
{
amount: '1',
tokenIds: [{ start: '1', end: '1' }],
ownershipTimes: [{ start: '1', end: '18446744073709551615' }]
}
]
}
]
});
const result = await client.signAndBroadcast([msg]);
console.log(result.txHash, result.success);The Signing Client handles gas estimation, sequence management, and broadcasting for every message type.