# BitBadges documentation, every page in one file # Generated from the corpus at build time. Page count: 255. # The SDK reference (/sdk/reference) and proto schema (/chain/proto) are # generated separately and excluded here; browse them on the site. ## File: README.md --- description: "What BitBadges is, how the chain, the hosted services, and the tools fit together, what one collection looks like, and where to start." --- # BitBadges Documentation Set `SIGNER` to the wallet address authorized to sign the transaction, matching its explicit creator or sender. Browser deployment requires this binding even when reading a saved transaction. BitBadges is a Cosmos SDK Layer 1 whose core module, `x/tokenization`, is a complete token standard: every collection, balance, approval, and permission is chain state that the module enforces on every transfer. This page explains the system end to end, shows what a token collection looks like, and sends you to the right tab. ## Create with Your AI Tell Claude what you want to build: ```text Hey Claude, create me a 5 ATOM / month subscription. ``` With the BitBadges MCP builder connected, your AI can turn that request into a collection with payment rules and expiring membership tokens. It asks for the details, builds and checks the transaction, and returns a link where you review and sign with your wallet. 1. [Set Up Your AI](agents/setup.md): connect the builder to Claude Code, Claude Desktop, Cursor, Codex, or another MCP client. 2. [Create Your First Collection](start/first-collection.md): go from the subscription prompt to a reviewed transaction. The monthly preset uses 30-day periods; automatic renewal requires subscriber authorization. 3. Refine the result in conversation: choose the payment coin, transfer rules, supply limits, or what the manager can change. The same creation flow works across the token standard: ```text Create me a payment request for 10 USDC and give me the review link. ``` ```text Make a 500-piece NFT collection where only I can mint. ``` For a build flow inside your application, use the [Programmatic Agent](agents/programmatic-agent.md). For repeatable commands and direct TypeScript integration, use the [CLI](cli/README.md) and [SDK](sdk/README.md). ## Create in the Browser On [bitbadges.io](https://bitbadges.io), you can also create collections, set transferability, run claims, and trade with a wallet. These docs explain the token model and cover integrations, automation, custom plugins, and node operations. ## What You Get | Layer | Pieces | What it does | | --- | --- | --- | | Chain (`bitbadges-1`) | `x/tokenization`, `x/gamm`, `x/managersplitter`, IBC, EVM precompiles | Tokens with time-based balances and three-level transfer approvals. A Balancer-style DEX. Wrapping to `x/bank` denoms for IBC. Solidity access through precompiles at `0x...1001` to `0x...1003`. | | Hosted services | BitBadges API, claims and plugins, Sign In with BitBadges, bitbadges.io | Indexed reads (balances, metadata, activity), off-chain claim gating with 16 built-in plugins plus your own HTTP plugins, OAuth-style sign in, and a no-code site. | | Tools | `bb` CLI, `bitbadges` npm package, MCP builder tools, Claude Code plugin | Build, check, simulate, preview, sign, and broadcast transactions from a terminal, TypeScript, or an AI agent. | The chain enforces the rules. The hosted services make them easy to read and to gate. The tools generate valid transactions so you rarely hand-write the structures below. ## One Collection, Annotated A collection is created with one message. This example fixes the valid IDs at 1 through 100 and caps supply at one unit per ID. Its locked mint rule lets only the creator initiate up to 100 mints, issuing IDs in order. The manager can still edit metadata and add post-mint transfer rules, but cannot change minting or force holders to transfer their tokens. The addresses and metadata URIs are illustrative. Replace both `creator` and `manager`, plus the mint rule's `initiatedByListId`, with your wallet address. Supply your own metadata URIs. Recipients accept incoming transfers by default and can change their own incoming approvals. The example has no post-mint transfer rule, so holders cannot transfer tokens until the manager adds one. ```json fold=3-17,19-25,31-37,62-66,75-97,107-112,114-158,166-177 { "creator": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d", "defaultBalances": { "balances": [], "outgoingApprovals": [], "incomingApprovals": [], "autoApproveSelfInitiatedOutgoingTransfers": false, "autoApproveSelfInitiatedIncomingTransfers": false, "autoApproveAllIncomingTransfers": true, "userPermissions": { "canUpdateOutgoingApprovals": [], "canUpdateIncomingApprovals": [], "canUpdateAutoApproveSelfInitiatedOutgoingTransfers": [], "canUpdateAutoApproveSelfInitiatedIncomingTransfers": [], "canUpdateAutoApproveAllIncomingTransfers": [] } }, "validTokenIds": [{ "start": "1", "end": "100" }], "collectionPermissions": { "canDeleteCollection": [], "canArchiveCollection": [], "canUpdateStandards": [], "canUpdateCustomData": [], "canUpdateManager": [], "canUpdateCollectionMetadata": [], "canUpdateValidTokenIds": [ { "tokenIds": [{ "start": "1", "end": "18446744073709551615" }], "permanentlyPermittedTimes": [], "permanentlyForbiddenTimes": [{ "start": "1", "end": "18446744073709551615" }] } ], "canUpdateTokenMetadata": [], "canUpdateCollectionApprovals": [ { "fromListId": "Mint", "toListId": "All", "initiatedByListId": "All", "transferTimes": [{ "start": "1", "end": "18446744073709551615" }], "tokenIds": [{ "start": "1", "end": "18446744073709551615" }], "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }], "approvalId": "All", "permanentlyPermittedTimes": [], "permanentlyForbiddenTimes": [{ "start": "1", "end": "18446744073709551615" }] } ], "canAddMoreAliasPaths": [], "canAddMoreCosmosCoinWrapperPaths": [] }, "manager": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d", "collectionMetadata": { "uri": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/collection.json", "customData": "" }, "tokenMetadata": [ { "uri": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/{id}.json", "customData": "", "tokenIds": [{ "start": "1", "end": "100" }] } ], "customData": "", "collectionApprovals": [ { "fromListId": "Mint", "toListId": "All", "initiatedByListId": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d", "transferTimes": [{ "start": "1", "end": "18446744073709551615" }], "tokenIds": [{ "start": "1", "end": "100" }], "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }], "uri": "", "customData": "", "approvalId": "manager-mint", "approvalCriteria": { "merkleChallenges": [], "predeterminedBalances": { "manualBalances": [], "incrementedBalances": { "startBalances": [ { "amount": "1", "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }], "tokenIds": [{ "start": "1", "end": "1" }] } ], "incrementTokenIdsBy": "1", "incrementOwnershipTimesBy": "0", "durationFromTimestamp": "0", "allowOverrideTimestamp": false, "recurringOwnershipTimes": { "startTime": "0", "intervalLength": "0", "chargePeriodLength": "0" }, "allowOverrideWithAnyValidToken": false, "allowAmountScaling": false, "maxScalingMultiplier": "0" }, "orderCalculationMethod": { "useOverallNumTransfers": true, "usePerToAddressNumTransfers": false, "usePerFromAddressNumTransfers": false, "usePerInitiatedByAddressNumTransfers": false, "useMerkleChallengeLeafIndex": false, "challengeTrackerId": "" } }, "approvalAmounts": { "overallApprovalAmount": "0", "perToAddressApprovalAmount": "0", "perFromAddressApprovalAmount": "0", "perInitiatedByAddressApprovalAmount": "0", "amountTrackerId": "", "resetTimeIntervals": { "startTime": "0", "intervalLength": "0" } }, "maxNumTransfers": { "overallMaxNumTransfers": "100", "perToAddressMaxNumTransfers": "0", "perFromAddressMaxNumTransfers": "0", "perInitiatedByAddressMaxNumTransfers": "0", "amountTrackerId": "mint", "resetTimeIntervals": { "startTime": "0", "intervalLength": "0" } }, "coinTransfers": [], "requireToEqualsInitiatedBy": false, "requireFromEqualsInitiatedBy": false, "requireToDoesNotEqualInitiatedBy": false, "requireFromDoesNotEqualInitiatedBy": false, "overridesFromOutgoingApprovals": true, "overridesToIncomingApprovals": false, "autoDeletionOptions": { "afterOneUse": false, "afterOverallMaxNumTransfers": false, "allowCounterpartyPurge": false, "allowPurgeIfExpired": false }, "mustOwnTokens": [], "dynamicStoreChallenges": [], "ethSignatureChallenges": [], "senderChecks": { "mustBeEvmContract": false, "mustNotBeEvmContract": false, "mustBeLiquidityPool": false, "mustNotBeLiquidityPool": false }, "recipientChecks": { "mustBeEvmContract": false, "mustNotBeEvmContract": false, "mustBeLiquidityPool": false, "mustNotBeLiquidityPool": false }, "initiatorChecks": { "mustBeEvmContract": false, "mustNotBeEvmContract": false, "mustBeLiquidityPool": false, "mustNotBeLiquidityPool": false }, "altTimeChecks": { "offlineHours": [], "offlineDays": [], "offlineMonths": [], "offlineDaysOfMonth": [], "offlineWeeksOfYear": [], "timezoneOffsetMinutes": "0", "timezoneOffsetNegative": false }, "mustPrioritize": false, "votingChallenges": [], "allowBackedMinting": false, "allowSpecialWrapping": false, "evmQueryChallenges": [], "userApprovalSettings": { "allowedDenoms": [], "disableUserCoinTransfers": false, "userRoyalties": { "percentage": "0", "payoutAddress": "" } } }, "version": "0" } ], "standards": ["NFTs"], "isArchived": false, "mintEscrowCoinsToTransfer": [], "cosmosCoinWrapperPathsToAdd": [], "invariants": { "noCustomOwnershipTimes": false, "maxSupplyPerId": "1", "noForcefulPostMintTransfers": true, "disablePoolCreation": false, "evmQueryChallenges": [] }, "aliasPathsToAdd": [] } ``` The Collapsed view hides default fields. Select Full to inspect the complete JSON. The field reference is in [MsgCreateCollection](token-standard/messages/msg-create-collection.md). This object is the message value, not a transaction envelope. Save the Full JSON as `collection-value.json`, make the replacements above, then wrap it for the CLI using `jq`: ```bash jq '{messages: [{typeUrl: "/tokenization.MsgCreateCollection", value: .}]}' collection-value.json > collection.json bb check collection.json --depth structural ``` | Field | What it decides | Read | | --- | --- | --- | | `validTokenIds` | Which token IDs exist. IDs are numbers; fungible or non-fungible depends only on how many units you mint per ID. | [Collections](token-standard/concepts/collections.md) | | `collectionMetadata`, `tokenMetadata` | Where the name, image, and description live. `{id}` expands per token. Inline JSON in `customData` needs no hosting. | [Collections](token-standard/concepts/collections.md) | | `collectionApprovals` | Who can move which tokens from whom to whom, when, and under which conditions. `fromListId: "Mint"` makes this a mint rule. | [Transferability](token-standard/concepts/transferability.md) | | `approvalCriteria` | The conditions: caps via trackers, a fixed mint order via predetermined balances, payments, Merkle proofs, votes, ownership checks, EVM queries, time windows. | [Approval Criteria](token-standard/approval-criteria/README.md) | | `ownershipTimes` | Balances carry a time range. A subscription is a balance that expires; a vesting schedule is a balance that starts later. No follow-up transaction. | [Balances](token-standard/concepts/balances.md) | | `collectionPermissions` | What the manager may still change, per time range, and whether that answer is frozen. This example locks the valid ID range and mint rules; `invariants.maxSupplyPerId` caps supply per ID. | [Permissions](token-standard/concepts/permissions.md) | | `standards` | Labels that tell apps how to interpret the collection. | [Collections](token-standard/concepts/collections.md) | Token transfers are checked against collection-level, sender outgoing, and recipient incoming approvals. Collection criteria can explicitly override the user approval layers. Wrapped-token movements on BitBadges also use this approval model; remote chains do not execute BitBadges approval rules. [Concepts](token-standard/concepts/README.md) walks the model in dependency order. ## What Changes Versus ERC-20 and ERC-721 | Need | Contract standards | BitBadges | | --- | --- | --- | | Fungible and non-fungible | Two standards, two contracts | One collection. `amount` per token ID. | | Expiring or scheduled ownership | Custom contract, a cron job, or a burn later | `ownershipTimes` on the balance. The chain reports the balance as absent outside the range. | | Transfer rules | `require` statements in Solidity, per contract, audited each time | Approvals with criteria, checked on token transfers and wrapped-token movements on BitBadges. | | Allowlists and blocklists | Mappings in the contract | Reusable [Address Lists](token-standard/concepts/address-lists.md): `"All"`, `"Mint"`, `"!bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue"`, or stored lists. | | Mint gating | A merkle-drop contract | [Merkle Challenges](token-standard/approval-criteria/merkle-challenges.md) on-chain, or [Claims](api/claims/README.md) with plugins off-chain that produce the proof. | | Royalties and payments | EIP-2981 hints that marketplaces may ignore | [Coin Transfers](token-standard/approval-criteria/coin-transfers.md) and [user royalties](token-standard/approval-criteria/user-approval-settings.md) enforced inside the transfer. | | Upgradability | Proxy patterns | [Permissions](token-standard/concepts/permissions.md) with permitted and forbidden time ranges, freezable per field. | | Compliance checks | Off-chain, or a per-token contract | KYC via [dynamic stores](token-standard/approval-criteria/dynamic-store-challenges.md), business hours via [Alt Time Checks](token-standard/approval-criteria/alt-time-checks.md), on-chain EVM reads via [EVM Query Challenges](token-standard/approval-criteria/evm-query-challenges.md). See [Compliance Zones](token-standard/concepts/compliance-zones.md). | | Cross-chain | Bridges | [Wrapper paths](token-standard/ibc/cosmos-coin-wrapper-paths.md) turn tokens into `x/bank` denoms for IBC and DEX trading. Approvals apply on the BitBadges side; remote voucher transfers follow the remote chain's rules. | | Contracts | Everything | Optional. Solidity reads and writes the module through [precompiles](chain/evm/README.md). | The longer argument is in [Why BitBadges](about/README.md) and [Comparisons](about/comparisons.md). ## What People Build Each row below has a longer pitch, with the fields that matter and a prompt for an agent, under [Use Cases](use-cases/README.md). | Build | Mechanism | Start | | --- | --- | --- | | NFT or fungible collection | `validTokenIds` plus a mint approval | [Create a Collection](guides/create-a-collection.md) | | Subscription, membership, expiring credential | `ownershipTimes` and recurring predetermined balances | [Subscriptions and Time-Based Tokens](guides/subscriptions-and-time-based-tokens.md) | | Tradable, burnable, soulbound, or admin-revocable tokens | Post-mint approvals and overrides | [Set Transferability](guides/set-transferability.md) | | Airdrop, allowlist, quest, social-gated mint | Claims with plugins that emit a Merkle proof | [Distribute with Claims](guides/distribute-with-claims.md) | | Token-gated API or content | BB-402: a 402 response, a signed proof, a balance check | [Gate access](guides/gate-access.md) | | Login with a wallet | Sign In with BitBadges (OAuth flow) | [Sign In Users](guides/sign-in-users.md) | | Compliant asset with KYC and transfer limits | Dynamic stores, trackers, alt time checks, compliance zones | [Compliance Zones](token-standard/concepts/compliance-zones.md) | | Stablecoin-backed or IBC-backed token | Backed minting against an existing denom | [Smart Tokens and Vaults](guides/smart-tokens-and-vaults.md) | | Liquidity pool or swap | Wrap, then `x/gamm` | [Trade on the DEX](guides/trade-on-the-dex.md) | | Auction, bounty, crowdfund, prediction market, payment request, product catalog | Standards with `bb` verbs and agent skills | [Standards](cli/standards.md), [Skills](agents/skills/README.md) | | Agent-controlled vault with spend limits | Outgoing approvals with daily-reset trackers | [Spending Authorization](agents/spending-authorization.md) | ## Pick a Path Choose a path for reading data or building transactions. Reads need no wallet signature. Writes require review and a signed broadcast. Mainnet is the live network; testnet is offline. ### CLI ```bash curl -fsSL https://install.bitbadges.io | sh bb settings set apiKey "$BITBADGES_API_KEY" # key from https://bitbadges.io/developer bb api tokens get-collection 1 # read through the BitBadges API bb build --help # 19 builders: subscription, smart-token, auction, transfer, ... bb check collection.json # validate a saved collection or transaction bb simulate collection.json bb deploy collection.json --browser --expected-address "$SIGNER" # review and sign in the browser ``` [Quickstart](start/quickstart.md), [CLI reference](cli/README.md) ### TypeScript ```ts import { BigIntify, BitBadgesAPI } from 'bitbadges'; const api = new BitBadgesAPI({ convertFunction: BigIntify, apiKey: process.env.BITBADGES_API_KEY }); const { collection } = await api.getCollection('1'); console.log(collection.collectionId, collection.validTokenIds); ``` Install `bitbadges` and set `BITBADGES_API_KEY` from the [developer portal](https://bitbadges.io/developer) before running this server-side example. It reads collection 1. For a write, follow [Transactions](sdk/transactions/README.md) to select a signer and prepare a transfer using tokens you own and a recipient you choose. [SDK reference](sdk/README.md), [Transactions](sdk/transactions/README.md) ### AI Agent Start with the CLI: discover the installed commands and standard instructions, build a proposal, then review it before requesting a signature. The SDK package also ships the optional `bitbadges-builder` MCP server. The separately installed Claude Code plugin routes agents through these same commands and instructions. ```bash bb --help-json bb dev skills bb build --help ``` [Set Up Your AI](agents/setup.md), [Claude Code Plugin](agents/claude-code-plugin.md), [MCP Builder Tools](agents/mcp-tools.md) ### No Code The [Create tab](https://bitbadges.io/create) and the [developer portal](https://bitbadges.io/developer) create collections, claims, address lists, and API keys without an integration. Paste any transaction JSON at `bitbadges.io/mint/local-builder` to review and sign it. ## Networks | Network | Chain ID | EVM chain ID | Endpoints | | --- | --- | --- | --- | | mainnet | `bitbadges-1` | `50024` | `https://rpc.bitbadges.io`, `https://lcd.bitbadges.io`, `https://evm-rpc.bitbadges.io`, `https://api.bitbadges.io` | | testnet | offline | | [Testnet status](chain/testnet.md) | Full table, denoms, and node setup: [Network](chain/README.md). ## The Tabs | Tab | Read it when you want to | Start at | | --- | --- | --- | | Docs | Install, run a first transaction, do a task, use the site, or read why BitBadges exists | [Quickstart](start/quickstart.md), [Using the Frontend](using-the-frontend/README.md), [Guides](guides/README.md), [About](about/README.md) | | Token Standard | Understand the data model, approval criteria, every message and query, and wrapping | [Overview](token-standard/README.md) | | Chain | The other modules, the DEX, EVM precompiles, endpoints, denoms, running a node | [Chain](chain/README.md) | | API | Call the hosted API, run claims and plugins, add Sign In with BitBadges | [BitBadges API](api/README.md), [OpenAPI reference](/api-reference) | | SDK & CLI | Use `bitbadges` from TypeScript or drive everything from `bb` | [SDK](sdk/README.md), [CLI](cli/README.md) | | Agents | Wire Claude, Cursor, Codex, or any MCP client to build tokens | [Agents](agents/README.md) | For agents reading this site: [Reading the Docs](agents/reading-the-docs.md) lists `llms.txt`, the single-file corpus, and the URL patterns. ## File: about/README.md --- description: "Why BitBadges exists, the three theses behind it, the design decisions, and what the x/tokenization standard provides." --- # Why BitBadges BitBadges is a Cosmos SDK Layer 1 built around one module, `x/tokenization`, that serves as a complete token standard for RWAs, compliance, payments, and custom transferability. This page states the reasoning behind that choice. The mechanics live in the [Token Standard](../token-standard/README.md) tab. | Page | Read it when | | --- | --- | | [Use Cases](use-cases.md) | You want to know what people build with the standard | | [Comparisons](comparisons.md) | You are coming from ERC-20, ERC-3643, or another L1 | | [BADGE Token](badge-token.md) | You need the native coin, its purposes, and the validator model | | [Links and Resources](links.md) | You want the app, explorer, socials, brand assets, or how to contribute | | [FAQ](faq.md) | You have a short question, including the fee schedule | ## Theses 1. The next wave of tokenization needs a new standard. Existing ones are built on older technology and are not enough. 2. Compliance and transferability are not an allowlist, a blocklist, or a transferable-versus-soulbound switch. They are a set of moving parts: time gating, ownership checks, approvals, who can send to whom, who can initiate, revocation, freezing, and more. On-chain compliance has to handle all of these automatically, and that logic belongs in the token standard, not in a manually updated list. 3. A standardized, reusable, no-code approach wins over per-use-case smart contracts over time. The motive is the same as the theses. Blockchains and interoperability have potential that the current infrastructure and token standards cannot deliver. ## Problems with Existing Standards ERC-20, ERC-721, CW-20, ICS-20, `x/bank`, `x/tokenfactory`, and `x/nft` cover many use cases, but the approach has structural problems: - Too simple. Mint, transfer, and burn are not enough for most real-world applications. The industry has stayed on these primitives for more than ten years because of technical debt. - Vulnerable by default. Each token contract is a new deployment and a new attack surface, and each needs its own audit. - Complex and expensive. Even a basic contract needs technical knowledge to implement, deploy, and maintain. - Low interoperability. Tokens stay siloed in one ecosystem, which splits a user base across chains. IBC is the best current answer and still leaves room to improve. - Fragmented. Competing standards add incompatible twists, which creates confusion. ## Design Decisions ### Universality One standard for NFTs, fungible tokens, subscriptions, quests, credentials, real-world assets, and regulatory compliance. Adapters and wrappers can expose simpler interfaces, but compatibility requires an explicit mapping of balances, ownership times, and transfer rules. ### A Module, Not Contracts The standard is a Cosmos SDK module. Every feature is implemented once and reused by every collection. Creating a collection is a message with parameters, which is how the BitBadges site is no-code by default. The expectation is that nearly all users never write code, whatever the complexity of the use case. One reusable, tested code path replaces a new contract per token. ### Ever-Evolving Features are added to the module as the need appears, without accruing technical debt in deployed contracts. If a use case is missing, the answer is to add it to the standard. ### IBC-First BitBadges is Cosmos native with IBC at the core: 1. A configured [Cosmos coin wrapper path](../token-standard/ibc/cosmos-coin-wrapper-paths.md) exposes tokens as an ICS-20-compatible bank denom for supported IBC routes. 2. Payments, subscriptions, swaps, and liquidity can use any IBC denom. 3. The module is IBC-enabled, so core messages can run over IBC, including one-signature multi-hop transfers. For example, a team can create a token on BitBadges, wrap 20% of the supply to ICS-20, send 10% to Osmosis, send 10% to an EVM chain over IBC Eureka, and keep the rest under time-dependent release in the native module. Think of BitBadges as a layer above IBC: launch on BitBadges for the features, wrap to IBC for reach. ### Value-Add over Duplication BitBadges prioritizes utility that Cosmos does not already have. Where a service already exists in the ecosystem, the preferred path is to wrap tokens and send them there over IBC rather than rebuild it. ## What the Standard Provides ### Time-Dependent Accounting Every balance carries ownership times, down to the millisecond. A balance is an ownership right for a token id over a time range. Bob can own token 5 until next July, at which point ownership ends with no further transaction. This supports auto-expiring and renewing subscriptions, vesting, and time-based release schedules. Recurring subscriptions combine this with a bot-tipping system for the recurring payment. ### Three Transferability Levels 1. Collection-level approvals. The manager defines the collection-wide rules and can override user-level approvals when configured to. 2. Outgoing approvals. Each sender sets rules for transfers out (for example listings). 3. Incoming approvals. Each recipient sets rules for transfers in (for example bids). A transfer succeeds only if the sender has the balance, a collection-level approval matches, and the outgoing and incoming approvals match (unless the collection approval overrides them). Swaps and pools that execute native token transfers use the same checks. Wrapping and IBC routes must be configured explicitly; a bank-denom representation on another chain does not automatically run BitBadges approval logic. ### Approval Criteria Every approval, on every level, can specify who can send, who can receive, who can initiate, transfer times, ownership times, predetermined or tallied amounts, the number of transfers, revocability, freezing, BADGE or other IBC coin transfers, royalties, recurrence, non-transferability, incrementing token ids, and ownership of other tokens. See [Approval Criteria](../token-standard/approval-criteria/README.md). ### Off-Chain Criteria An oracle-like path lets a service check off-chain criteria and hand the user a signed code to redeem on-chain. BitBadges runs one such service with plugins and external integrations for criteria such as Discord membership, X followers, email, passwords and claim codes, private off-chain data, AI agents, and custom endpoints. A custom criteria service moves the off-chain evaluation trust to that service; the chain verifies the configured proof, not the underlying off-chain fact. See [Distribute with Claims](../guides/distribute-with-claims.md). ### Manager Permissions Each collection can have a manager with fine-grained, lockable permissions: update metadata, update transferability, archive, delete, add tokens, pause transfers, throttle volume, and more. Checks and balances are enforced on-chain. See [Permissions](../token-standard/concepts/permissions.md). ### EVM and IBC Extension The goal is that every use case works natively. Where custom logic is needed, EVM contracts call into the module through precompiles, and the module reaches other environments over IBC. See [EVM](../chain/evm/README.md). ## Related - [Token Standard](../token-standard/README.md) - [Quickstart](../start/quickstart.md) - [Comparisons](comparisons.md) ## File: about/badge-token.md --- description: "BADGE, the native coin of the BitBadges chain. Its purposes, supply and distribution, and the validator rewards and proof-of-authority model." --- # BADGE Token BADGE is the native gas coin of the BitBadges chain (denom `ubadge`). Read the [BADGE disclosure](https://bitbadges.io/credits-disclosure) and the other policies on the site for full disclaimers. ## Purposes 1. Gas and transaction fees. 2. Proof of stake and proof of authority. Validators bond BADGE to secure the network. 3. In-site currency. The site prioritizes more established coins such as USDC for in-site use. 4. Fee sink. The 0.1% taker fee on swaps goes to the community pool. See [FAQ](faq.md) for the fee schedule. ## Distribution The [explorer](https://explorer.bitbadges.io) shows current supply, distribution, and validators. Read current chain state rather than treating a historical allocation as today's circulating supply. BADGE trades on Osmosis at [app.osmosis.zone/assets/BADGE](https://app.osmosis.zone/assets/BADGE) and works with other IBC-enabled services. ## Security Model BitBadges combines proof-of-stake validator rewards with a proof-of-authority delegation model. ### Validator Rewards and Delegations Validator rewards, program eligibility, and delegated allocations can change independently. A delegation shown in the explorer is voting power assigned to a validator; it is not evidence that the validator owns those tokens or that a historical reward has been paid. Use the [BADGE disclosure](https://bitbadges.io/credits-disclosure) for published program terms, and check the [explorer](https://explorer.bitbadges.io) and relevant governance proposals for current delegations and executed distributions. Do not infer circulating supply or a restriction on selling from delegated balances alone. ## Related - [FAQ](faq.md) - [Network](../chain/README.md) - [Run a Node](../chain/run-a-node.md) ## File: about/comparisons.md --- description: "How the BitBadges L1 and token standard compare to other chains and to ERC-3643, and how ERC-3643 works as an interface on BitBadges." --- # Comparisons BitBadges is its own Cosmos SDK Layer 1 with a token standard that works like an API: the logic is implemented once in the module, and each collection customizes it through messages. This page compares that design to other protocols and to ERC-3643 (T-REX), a standard for permissioned security tokens. ## BitBadges L1 Versus Other Protocols ### Chain Architecture BitBadges is a Layer 1, not a Layer 2 or a sidechain. It is built with the Cosmos SDK, which provides the foundation for its configured Cosmos modules and IBC support. The native token standard has its own balances and approval model. EVM contracts can access it through precompiles; ERC-compatible wrappers require explicit integration. A native collection is not automatically an ERC-20 contract or a Bitcoin Ordinal. ### Security Model BitBadges is less decentralized today than the largest protocols, and decentralization grows over time. The intended role is one part of an application stack rather than the whole of it. An application can use BitBadges for authentication and gating while accepting payments in its native currency. ### Cross-Chain Interoperability IBC connects BitBadges through configured channels and supported routes. Wrapper paths expose compatible bank denoms; integration depends on the destination chain and application. See [IBC](../token-standard/ibc/README.md). ### Token Standard Protocols such as Ethereum rely on ERC-20 and ERC-721, which need a smart contract deployment per token. That approach grows complex, adds a new attack surface per contract, and does not model the structure most use cases need. On BitBadges, everything is implemented natively and a collection customizes the requests, which is why the BitBadges site is no-code by default. ### Smart Contract Support Ethereum and Solana have broad smart contract support. BitBadges supports EVM contracts, including contract-based token implementations. Its native collections use `x/tokenization`; contracts can access that module through precompiles. The goal remains a standard where custom contracts are never needed. See [EVM](../chain/evm/README.md). ## BitBadges and ERC-3643 ERC-3643 and BitBadges are not competing standards. They operate at different layers. The BitBadges standard enforces compliance at the protocol level, and ERC-3643 can serve as a Solidity interface that calls into it through EVM precompiles. A Solidity developer keeps the ERC-3643 API and gets protocol-level enforcement behind it. ### Overview ERC-3643 (T-REX, Token for Regulated EXchanges) is an Ethereum standard for compliant security tokens. The [ERC-3643 Association](https://www.erc3643.org/) reports more than $32 billion in tokenized assets on its website (checked 7 September 2026); this is an association-reported adoption figure, not a measure of technical compatibility. BitBadges enforces compliance rules, transfer restrictions, and approval logic in the chain itself. No contract deployment is needed. For EVM developers, precompiles expose the native standard through Solidity interfaces such as ERC-3643. ### Feature Comparison | Feature | BitBadges protocol standard | ERC-3643 interface (through precompiles on BitBadges, or natively on Ethereum) | | --- | --- | --- | | Enforcement layer | Protocol level; the chain enforces the rules | Contract level; Solidity contracts enforce the rules | | Smart contracts required | No; collections are configured through transaction messages | Yes; each token deploys several contracts (token, identity registry, compliance module, claim topics) | | Deployment experience | No-code site, CLI template builders, or MCP builder tools | Developer only; needs Solidity expertise and contract deployment | | Multi-chain support | IBC over configured, supported routes | Requires a supported cross-chain transport or wrapper | | Identity and compliance | Built-in approval criteria: ownership requirements, merkle proofs, signature challenges, on-chain queries | ONCHAINID identity framework with claim topics and trusted issuers | | Transfer restrictions | Per-approval rules: address lists, time windows, amount limits, tracker-based caps, 2FA gating, coin payment requirements | Compliance modules with rule contracts (country restrictions, investor limits, time locks) | | Permissioning | Granular, lockable permissions; each field can be frozen or left manager-controlled independently | Owner and agent roles with recovery mechanisms | | Token types | Fungible tokens, NFTs, subscriptions, vaults, prediction markets, bounties, and more from one standard | Primarily fungible equity and security tokens | | Forced transfers | Admin override approvals | Recovery and forced transfer functions | | Supply control | Configurable mint and burn rules with lockable permissions | Mint and burn controlled by token agents | ### ERC-3643 Strengths - Institutional tooling: an established implementation and identity framework designed for permissioned tokens. - Regulatory track record: purpose-built for securities compliance with established legal frameworks. - Ecosystem maturity: identity providers, compliance modules, and institutional tooling. - ONCHAINID: a mature decentralized identity framework for KYC and AML. ### BitBadges Strengths - No smart contract development: a compliant token is configured through transaction parameters or the no-code site. - Shared enforcement: native transfers are checked by the module even when initiated through a precompile. Security still depends on the module, configured approvals, manager permissions, and any application contracts. - Broader token types: subscriptions, prediction markets, vaults, auctions, bounties, and NFTs from the same standard. - Agent friendly: MCP builder tools and CLI template builders let AI agents create and manage compliant tokens. - Cosmos ecosystem: IBC connectivity through supported channels and routes. Destination support and enabled channels determine where an asset can move. - Lower barrier: no Solidity, gas optimization, or contract auditing. ### How They Work Together Through EVM precompiles, a Solidity contract calls the native token standard with the ERC-3643 function signatures developers already know. The precompile bridges the call; the chain enforces the transfer rules, identity checks, and compliance logic, not the contract. The ERC-3643 interface is optional: the no-code site, the CLI builders, and the MCP builder tools talk to the protocol standard directly. See [Tokenization Precompile](../chain/evm/tokenization-precompile/README.md) and the [ERC-3643 specification](https://www.erc3643.org/). ## Related - [Why BitBadges](README.md) - [Transferability](../token-standard/concepts/transferability.md) - [Permissions](../token-standard/concepts/permissions.md) - [EVM](../chain/evm/README.md) ## File: about/faq.md --- description: "Short answers on smart contracts, compliance enforcement, L1 versus L2, ERC compatibility, EVM extension, and the protocol fee schedule." --- # FAQ Short answers to the questions that come up most. Each answer links to the page with the detail. ## Are Smart Contracts Needed? A collection can be created and managed through native transaction messages without deploying a custom smart contract. Use the site, CLI, or SDK for the patterns supported by the module. Applications may still need backend logic or EVM contracts for behavior outside those primitives. ## How Is Compliance Checked on Every Transfer? The `collectionApprovals` of a collection are checked on every transfer. They define the collection-wide transferability rules. A transfer that satisfies no collection approval fails. Applications and pools that execute native token transfers use those checks. Wrapping and cross-chain movement require their own supported paths; a destination chain does not automatically execute BitBadges approval logic. See [Transferability](../token-standard/concepts/transferability.md). ## Is BitBadges an L1 or an L2? BitBadges is its own Layer 1 built with the Cosmos SDK. ## Why a Registry Instead of a Contract per Collection? A reusable standard exercised thousands of times beats unique, vulnerable contracts over the long run. The registry approach also improves scalability, consistency, and standardization. ## Are Tokens ERC-721, ERC-20, or ERC-3643 Compatible? Native collections use their own token model and are not automatically ERC contracts. EVM contracts can integrate through precompiles and expose compatible interfaces; the wrapper must map the native balances and permissions to that interface. See [Comparisons](comparisons.md). ## Can the Standard Be Extended with Smart Contracts? Yes. The token standard is a Cosmos module. The aim is that no smart contract is ever needed, but EVM environments can call into the module, and the module can call into other environments. See [EVM](../chain/evm/README.md). ## What Does the Protocol Charge? Can I Add Affiliate Fees? BitBadges charges a 0.1% fee at the protocol level on swaps and on paid transfers: - `x/tokenization` transfers with coin payments (`coinTransfers`): 0.1% in the payment denom. - `x/gamm` swaps: a 0.1% taker fee. Plain `x/tokenization` transfers without a payment, and IBC or `x/bank` sends, carry no protocol fee. Affiliate fees are yours to design on top of that: - `x/tokenization`: add another coin transfer to the approval (for example a 0.1% payout to the initiator). - `x/gamm`: an affiliates field is built into the protocol. The protocol itself takes nothing from it. The BitBadges API takes a 20% cut of affiliate fees routed through it. ## Related - [Why BitBadges](README.md) - [BADGE Token](badge-token.md) - [Links and Resources](links.md) ## File: about/links.md --- description: "Official BitBadges links: app, explorer, install, packages, API reference, socials, integrations, brand assets, and how to contribute." --- # Links and Resources Official links for the app, the code, the community, and the brand. Discord is the preferred contact. See the rest of the docs for specific subjects. ## Product - [BitBadges app](https://bitbadges.io) - [Explorer](https://explorer.bitbadges.io) - [Get featured on the Explore page](https://tally.so/r/mBy2aR) ## Install ```bash curl -fsSL https://install.bitbadges.io | sh ``` One command installs the chain binary (with the `bb` alias) and the SDK CLI on Linux, macOS (Intel and Apple Silicon), and Windows (Git Bash or WSL). See [Quickstart](../start/quickstart.md) and [CLI](../cli/README.md). - [Chain binary releases](https://github.com/BitBadges/bitbadgeschain/releases) - [`bitbadges` on npm](https://www.npmjs.com/package/bitbadges): the SDK, the SDK CLI, and the MCP builder tools in one package. ```bash npm install bitbadges # SDK in a project bun add bitbadges # or with bun npm install -g bitbadges # SDK CLI and MCP builder tools globally ``` ## Documentation and Reference - [API reference](/api-reference): the interactive reference for every BitBadges API route. - [SDK](../sdk/README.md) and [BitBadges API](../api/README.md). - [Reading the Docs](../agents/reading-the-docs.md): `llms.txt`, `for-llms.txt` (the full docs as one text file), and `bb dev docs`. - [Proto definitions](https://github.com/BitBadges/bitbadgeschain/tree/master/proto) ## Socials - [Discord](https://discord.com/invite/TJMaEd9bar) - [X (Twitter)](https://twitter.com/bitbadges_io) - [Telegram](https://t.me/bitbadges_chat) - [LinkedIn](https://linkedin.com/company/bitbadges) - [GitHub](https://github.com/bitbadges) ## Integrations - [Zapier](https://zapier.com/apps/bitbadges/integrations) ## Brand Guidelines Use the BitBadges name and logo on your site as you see fit. Ask on Discord for other logos, images, or information, or with any question about usage.
BitBadges wordmark in blue to pink gradient
Wordmark
BitBadges logo mark
Logo mark
## Contributing Everything is open source at [github.com/bitbadges](https://github.com/bitbadges). Contributions to the core source code are welcome. - Build on BitBadges: a dApp, a developer tool, or your own frontend for tokens. Reach out on Discord to get it listed in the Ecosystem. - Improvement proposals: [github.com/BitBadges/BBIPs](https://github.com/BitBadges/BBIPs). - Bug bounties: to be announced. - Developer rewards: hackathons, bug bounties, and a developer funding pool are planned. ## Related - [Quickstart](../start/quickstart.md) - [FAQ](faq.md) ## File: about/use-cases.md --- description: "What people build with the BitBadges token standard, grouped by domain, with the feature each use case relies on." --- # Use Cases The token standard tokenizes assets, services, and rights with protocol-level transferability rules, payments in any IBC denom, and time-dependent balances. Any use case in crypto is a tokenization use case in some form, so the module also serves as a general primitive for application development. ## Asset Tokenization - Compliant tokenized assets. Compliance checks run on every transfer at the protocol level, including in liquidity pools and orderbooks, so no application has to enforce the rules itself. - Real-world assets. Jewelry, art, collectibles, or any product, purchasable with any IBC currency and moved with permissioned IBC transfers. - Real estate with license verification. A property license is verified on every transfer, so only licensed properties move. - Compliant ICS-20 derivatives. Wrap an existing ICS-20 token such as USDC into a derivative (for example clUSDC) backed 1:1 by the original, with rate limits, compliance checks, and withdrawal restrictions. This gives a chain a permissioned version of a standard token without modifying the token itself. See [Smart Tokens and Vaults](../guides/smart-tokens-and-vaults.md). ## NFTs and Collectibles - Collectibles and profile pictures. Standard NFT mechanics with rarity and full transferability controls. - Gated NFTs and quests. Mints gated by claim plugins or external integrations: email verification, Discord membership, or a custom requirement. - Quest rewards. NFTs with payouts attached, gated by criteria-based approvals, for games, loyalty programs, and engagement campaigns. ## Soulbound Tokens and Compliance - Soulbound tokens. A non-transferable collection locks tokens to addresses for achievements, credentials, attestations, and proof of anything. - Compliance as a service. Keep your token on ERC-3643 or `x/bank` and use BitBadges as the compliance check by verifying ownership of compliance tokens: licenses, subscriptions, NFTs, KYC credentials, and address lists. Configure the approval criteria needed for the application rather than assuming token ownership proves every compliance requirement. See [Comparisons](comparisons.md). ## Subscriptions and Recurring Payments - Auto-renewing subscriptions. Subscription tokens purchasable with any IBC currency that renew through bots, with optional provider revocation for cancellation policies. See [Subscriptions and Time-Based Tokens](../guides/subscriptions-and-time-based-tokens.md). - Payroll automation. Recurring payments with no-code setup. Verify that recipients still hold an employment NFT or meet custom criteria before each payment. ## Securities and Financial Instruments - Stocks with accredited investor KYC. Transferability approvals allow only verified investors to receive the security. - Freezable and revocable currencies. The manager can freeze or revoke transfers, as regulated currencies, stablecoins, and other instruments require. - Bonds and CDs with clawbacks. Administrative clawback controls built into the instrument. ## Time-Based Systems - Vesting. Time-dependent balances and approvals release tokens on a schedule for employee options, token vesting, and gradual rewards. - Time-vested escrow. Assets stay in custody until a time condition is met, for milestone payments and conditional releases. - Expiring access tokens. Tickets and session credentials that expire through time-dependent balances. - Auto-expiring occupation tokens. Rentals, bookings, and temporary ownership that end at a set time with no manual step. - Rental agreements. Time-dependent leases with custom terms enforced through approvals. Contracts, payments, and access rights are on-chain and expire automatically. ## Legal and Compliance - Dispute resolution and clearing. Define the rules to hold, freeze, or reverse transactions. - Advanced admin controls. Revocability and freezability for regulatory compliance or emergency asset protection. - Intellectual property rights. Patents and IP rights with licensing terms enforced on every transfer. ## Business Operations - Refund and return policies. Receipt tokens with return policies expressed as transferability approvals and refunds paid out on-chain. - Address lists and reputation. Public lists of scammers, compromised keys, and trusted entities that any application can reference. ## Features Every Use Case Shares - Protocol-level enforcement: rules run in the chain, not in each application. - Multi-currency: payments in any IBC-compatible denom. - Custom transferability: who can transfer, to whom, and under what conditions. - Time dependence: schedules, expirations, and vesting in the balance itself. - Claim plugins and external integrations for off-chain eligibility checks. - On-chain verification of configured approval criteria and submitted proofs; off-chain facts still depend on the services attesting to them. ## Related - [Use Cases by Build](../use-cases/README.md) - [Why BitBadges](README.md) - [Guides](../guides/README.md) - [Transferability](../token-standard/concepts/transferability.md) ## File: agents/README.md --- description: "Install paths, quickstart, and the review-and-sign handoff for AI agents and bots that build on BitBadges." --- # Agents This tab is for AI agents, bots, and the people wiring them: how to install, which surface to use, and how a built transaction reaches a human wallet for signature. ## Discover Installed Capabilities Use the CLI first. Discover a small operation list, then load only the schema or standard instructions needed for the task: ```bash bb dev capabilities bb dev capabilities build_payment_request_v2 bb dev skills payment-request bb build payment-request-v2 --list-examples ``` The capability response includes `schemaVersion` and `catalogHash`. Schemas come from the same installed registry as MCP's `get_capabilities`; do not assume a downloaded documentation page matches an older installed binary. This catalog covers shared builder tools. Standard-specific CLI commands remain discoverable through `bb --help-json`, and native Cosmos operations through `bb tx --help`. Offline skill/schema discovery does not require an API key. ## Ask the Human to Pay The primary payment flow uses the human's main wallet. The agent resolves the exact recipient, network, asset, amount, and invoice obligation, builds the proposed payment, and opens a browser request for the human to review and sign. An agent-owned wallet is optional. ```bash bb pay-requests show 46 bb pay-requests pay 46 --creator "$PAYER" --obligation payment-1 --units 1 --browser ``` Use the real collection and obligation IDs from the merchant's request. Follow [Main-Wallet Payment Requests](main-wallet-payments.md) for the complete flow, [CLI Automation](../cli/agent-workflow.md) for machine-readable discovery and retries, and [Standards](../standards/README.md) to choose the correct payment model. A one-off invoice payment does not grant ongoing spending permission. For unattended operation or a withdrawal budget, compare [spending authority models](spending-models.md) before funding an agent. Prompts and hooks do not constrain a signing key that the agent controls. ## Create Your First Collection Connect your client using [Set Up Your AI](setup.md), then ask: ```text Hey Claude, create me a 5 ATOM / month subscription. ``` The builder gathers the details, generates the collection and payment rules, checks the transaction, and returns a link to review and sign with your wallet. [Your First Collection](../start/first-collection.md) walks through the full flow, including 30-day periods and renewal authorization. You can use the same workflow for NFTs, fungible tokens, smart tokens, and payment requests. ## Install ```bash curl -fsSL https://install.bitbadges.io | sh export BITBADGES_API_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef # your key from bitbadges.io/developer bb settings set apiKey "$BITBADGES_API_KEY" bb doctor ``` This installs the chain binary and the SDK CLI as `bb`. Every path below starts from this install. Get an API key at [bitbadges.io/developer](https://bitbadges.io/developer); the example key above is fake. Per-harness MCP configs (Claude Desktop, Cursor, Windsurf, Codex, VS Code, Zed, no-tools LLMs): [Set Up Your AI](setup.md). ## What to Say Once a harness is wired, these prompts map onto the MCP builder tools and the skills. Copy one and change the names. Create a token: ```text Create an NFT collection called Demo NFTs with 100 tokens, manager bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d, fully immutable after creation. ``` ```text Build a fungible token called Demo Coin with 1,000,000 units of token ID 1 and a public mint of up to 10 per address. ``` ```text Make a USDC-backed smart token with symbol vUSDC and a daily withdraw limit of 1000. ``` Distribute: ```text Mint 100 Demo Coin to bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue and bb1zc268nctj8xwslgw7q22cahs6k4y048agr6fvf in the same transaction that creates the collection. ``` ```text Create a code-gated claim for collection 1 with 50 codes, one use per address. ``` Gate: ```text Check whether bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue owns at least 1 of token ID 1 in collection 1. ``` ```text Build a 30-day subscription called Demo Membership at 10 USDC per interval paid to bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d. ``` Trade: ```text Add a tradable listing approval to collection 1 so anyone can buy token ID 5 for 25 USDC. ``` ```text Give my agent wallet bb18cad7xxsk3drvwdxeasc3wqn2plftpzq2tsrsr a daily budget of 100 units of collection 2 that it can send to bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue. ``` Inspect: ```text Explain collection 1 for an auditor: who can change what, and how do tokens move. ``` ```text Review this transaction file for problems before I sign it. ``` Every build ends the same way: the agent calls `get_review_url` (or runs `bb preview`) and hands you a bitbadges.io link where you review and sign with your own wallet; the agent never holds the key. ## Paths | Path | Best for | Install | Reference | | --- | --- | --- | --- | | CLI and chain binary (start here) | Terminal agents, shell scripts, any language | `curl -fsSL https://install.bitbadges.io \| sh` | [CLI](../cli/README.md) | | MCP builder tools | Cursor, Claude Desktop, Codex, any MCP client | `npm i -g bitbadges` | [MCP Builder Tools](mcp-tools.md) | | Claude Code plugin | Claude Code users: auto-wired MCP plus 8 workflow skills | `/plugin marketplace add BitBadges/bitbadges-plugin` then `/plugin install bitbadges` | [Claude Code Plugin](claude-code-plugin.md) | | Programmatic agent | Node processes that build from a prompt with your own Anthropic or OpenAI key | `npm i bitbadges @anthropic-ai/sdk` | [Programmatic Agent](programmatic-agent.md) | | SDK signing client | Full TypeScript bots that sign and broadcast | `npm i bitbadges` | [Signing Client](../sdk/transactions/signing-client.md) | | Direct HTTP | Lightweight scripts in any language | REST calls to `api.bitbadges.io` | [API](../api/README.md) | | Spending authorization | Daily caps, time windows, and revocation for a delegate wallet | on-chain approval | [Spending Authorization](spending-authorization.md) | Bring your own AI. The MCP server, the CLI, and the plugin are model-agnostic; the harness you already run provides the model. The site runs no LLM of its own and never holds your model key: it receives what you built, reviews it, and signs it. ```bash # Step 1: install the chain binary and CLI (always) curl -fsSL https://install.bitbadges.io | sh bb settings set apiKey "$BITBADGES_API_KEY" # Step 2: optionally add a harness convenience # Claude Code: # /plugin marketplace add BitBadges/bitbadges-plugin # /plugin install bitbadges # Cursor, Claude Desktop, other MCP clients: # claude mcp add bitbadges-builder -- npx -y -p bitbadges bitbadges-builder ``` ## Optional Agent-Owned Wallet (TypeScript) This path is for funds intentionally assigned to an agent-controlled wallet. Use the browser handoff above when a human should approve each payment with their main wallet. ```bash npm install bitbadges ``` ```ts import { BitBadgesSigningClient, GenericEvmAdapter, MsgTransferTokens, NETWORK_CONFIGS } from 'bitbadges'; // 1. Create an adapter from a mnemonic (server-side only; never commit the phrase) const adapter = await GenericEvmAdapter.fromMnemonic(process.env.MNEMONIC!, NETWORK_CONFIGS['mainnet'].evmRpcUrl); // 2. Create a signing client (mainnet) const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' }); // 3. Fund client.address with BADGE for fees before the first broadcast // 4. Broadcast your first transaction: send 5 units of Demo Coin (collection 2, token ID 1) to bob const result = await client.signAndBroadcast([ new MsgTransferTokens({ creator: client.address, collectionId: '2', transfers: [ { from: client.address, toAddresses: ['bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue'], balances: [ { amount: '5', tokenIds: [{ start: '1', end: '1' }], ownershipTimes: [{ start: '1', end: '18446744073709551615' }] } ] } ] }) ]); console.log('TX Hash:', result.txHash, 'success:', result.success); ``` Examples target mainnet because testnet is offline. The faucet API shape and the testnet status live on [Testnet](../chain/testnet.md). ## Agent Workflow with the CLI The CLI returns JSON on every command, accepts stdin (`-`), file paths (`@file.json`), and inline JSON, and needs no build step. ```bash # Discover the command tree as JSON (for LLM tool discovery) bb --help-json bb api --help bb api tokens --help # Query bb api tokens get-collection 1 bb api tokens get-balance-by-address 1 bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue bb api accounts get-account --body '{"address":"bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue"}' bb api --search owners # Review and audit bb check tx.json bb explain tx.json bb check 42 bb explain 42 # Browse docs and skills bb dev docs all bb dev docs learn/approvals bb dev skills bb dev skills smart-token # Sign and broadcast with the chain binary bb keys add agent-wallet bb tx tokenization create-collection ./collection.json \ --from agent-wallet --chain-id bitbadges-1 \ --node https://rpc.bitbadges.io:443 \ --gas auto --gas-adjustment 1.5 --gas-prices 10ubadge # Or broadcast a signed tx through the API bb api tx broadcast-tx --body @signed-tx.json ``` `bb api tokens get-collection 1` returns the standard envelope (mainnet output, trimmed to the first fields): ```json { "ok": true, "data": { "collection": { "collectionId": "1", "collectionMetadata": { "metadata": { "name": "BitBadges Examples", "description": "Badges are generic and can be created for many different purposes and use cases. This collection highlights some of our favorites.", "image": "ipfs://QmNytJNN44stkMndshtdfcCW2mzaCm6A23maiKaQvUqoj8" }, "uri": "ipfs://QmSTZZPgYF58gS9bM7q3nWVegUJH51WBdT91fz7q94qDwS", "customData": "" } } }, "warnings": [], "error": null } ``` `--dry-run` simulates any API call without side effects. ### Which Surface Does What | Task | Surface | | --- | --- | | Query data, browse docs, review transactions | CLI (`bb`) | | Build collections with guided workflows | MCP builder tools | | Sign and broadcast | Chain binary (`bb tx`) or SDK signing client | | Key management | Chain binary (`bb keys`) | ### API Key Versus Session The API key is required on every BitBadges API call and carries the app scope. Anything that mutates an account, manages keys, or publishes signed data also needs a user scope: a session cookie from `bb auth login`. The CLI is wallet-agnostic. Pair it with `bb sign-arbitrary` for headless Cosmos signing, or paste in a signature from any external wallet. ```bash # 1. Fetch a challenge (saves the nonce cookie locally for step 3) MSG=$(bb auth challenge --address $(bb keys show agent-wallet -a) | jq -r .data.message) # 2. Sign offline with the chain binary SIG_JSON=$(bb sign-arbitrary agent-wallet "$MSG") # 3. Post the signature (stores the session under ~/.bitbadges/auth.json) bb auth login \ --address "$(echo "$SIG_JSON" | jq -r .address)" \ --signature "$(echo "$SIG_JSON" | jq -r .signature)" \ --public-key "$(echo "$SIG_JSON" | jq -r .pubKey)" \ --message "$MSG" # 4. Add --with-session to Full Access requests bb api accounts get-account --body '{"address":"bb18cad7xxsk3drvwdxeasc3wqn2plftpzq2tsrsr"}' --with-session ``` Sessions are multi-account and multi-network. Full reference: [Auth](../cli/auth.md). ### Deprecation Banner Legacy forms (`bb cli `, `bitbadges-cli sign-with-browser`, `bitbadges-cli gen-tx-payload`, and the per-utility top-level names that moved under `bb account`, `bb dev`, and `bb settings`) print a one-line deprecation banner to stderr during the migration window. Stdout (the JSON envelope) is unchanged. Set `BB_QUIET=1` in the agent's environment if banner noise breaks line-based stderr parsers; the same flag suppresses every command's auto-review commentary. The release after the migration window hard-fails the old forms, so update prompts and scripts ahead of the cutover. ### Example: Automated Balance Check and Mint ```bash #!/bin/bash # Check bob's Demo Coin balance and mint when it drops below a threshold COLLECTION_ID=2 ADDRESS="bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue" THRESHOLD=10 BALANCE=$(bb api tokens get-balance-by-address "$COLLECTION_ID" "$ADDRESS" --condensed) # bb api emits the envelope; the body lives at .data AMOUNT=$(echo "$BALANCE" | jq -r '.data.balances[0].amount // "0"') if [ "$AMOUNT" -lt "$THRESHOLD" ]; then echo "Balance $AMOUNT below threshold $THRESHOLD, minting" bb check ./mint-tx.json bb tx tokenization transfer-tokens ./mint-tx.json \ --from agent-wallet --chain-id bitbadges-1 \ --node https://rpc.bitbadges.io:443 \ --gas auto --gas-prices 10ubadge fi ``` ## Hand Off to the Browser to Sign In the browser-handoff workflow, agents build and people sign. The link opens the review flow (Preview, Review Items, Transferability, Permissions, then wallet signature). Separately, a bot configured with a signing key can use the SDK or CLI to broadcast; see [Spending Authorization](spending-authorization.md) for bounded delegation. | From | Get the link | | --- | --- | | MCP or Claude Code | call `get_review_url` and open `reviewUrl` (see [MCP Builder Tools](mcp-tools.md#hand-off-to-the-browser)) | | CLI | `bb preview tx.json --open` (or `bb build vault --backing-coin USDC --name "Demo Vault" \| bb preview - --open`) | | Programmatic agent | `result.reviewUrl` | | Any LLM, no tools | paste the JSON into `bitbadges.io/mint/local-builder` | Two carriers exist. `bb preview` and `get_review_url` upload the transaction to the open preview endpoint and return a short `?code=prv_...` link that expires in 1 hour. The programmatic agent returns a `#tx=` link that carries the whole transaction in the URL hash, so nothing is uploaded. Update transactions (a non-zero `collectionId`) route to `/update/local-builder/:id` so the site diffs against on-chain state. Details: [Analyze](../cli/analyze.md) and [Deploy](../cli/deploy.md). ## Metadata Without Hosting The CLI builders and templates accept `--name`, `--image`, and `--description` (or `--name` plus `--description` for approvals, which have no image) and serialize them into the on-chain `customData` field. The BitBadges API, the SDK, and the site parse `customData` on read and surface it as the resolved metadata, so an agent can ship a working collection without an IPFS pin or a Pinata account. Pass `--uri ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/collection.json` (a file you host) instead to host the JSON yourself. The URI takes priority when both are set. On-chain shape: [Collections](../token-standard/concepts/collections.md). {% hint style="warning" %} `--image` should be a URL, not bytes. Inline `customData` lives on-chain: you pay gas per byte and blocks have a hard size cap. Pre-host images on IPFS or any URL host and pass the URL to `--image`. Inline `customData` is for the metadata wrapper (name, description, link to image), not the image itself. {% endhint %} For zero hosting and an image, the SDK ships a deterministic SVG placeholder-art generator (`import { generatePlaceholderArt } from 'bitbadges'`). It produces 1-8 KB `data:image/svg+xml;base64,...` URIs you can pass to `--image`. The same seed always produces the same art. The SVG bytes still live on-chain, so a 1-8 KB SVG costs about 10-80k extra gas per write versus a hosted URL. Use it for placeholder looks, not for image-heavy or high-frequency-update collections. ## Network Configuration | Network | API URL | Node 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-1` | 90123 | `http://localhost:8545` | Testnet endpoints when it returns: RPC `https://rpc-testnet.bitbadges.io`, WebSocket `wss://rpc-testnet.bitbadges.io/websocket`. Status: [Testnet](../chain/testnet.md). Full endpoint table: [Network](../chain/README.md). ## Token-Gated API Access (BB-402) BB-402 lets any server gate API access behind on-chain token ownership with the standard HTTP 402 status code. BB-402 uses token ownership as the primitive: a soulbound token that costs X USDC is a verifiable on-chain receipt, and the same protocol handles subscriptions, tiered access, reputation, blocklists, and compound conditions with `$and` / `$or` logic. ```text Agent --> Server: GET /api/data Server --> Agent: 402 { ownershipRequirements, message } Agent --> Server: GET /api/data + X-BB-Proof: { address, chain, message, signature } Server --> Agent: 200 OK (or 403) ``` Guide: [Gate access](../guides/gate-access.md). Spec: [BB-402](../token-standard/bb-402/README.md). ## In This Tab | Page | Read it when | | --- | --- | | [Set Up Your AI](setup.md) | You want the exact MCP config for your harness | | [MCP Builder Tools](mcp-tools.md) | You run an MCP client and want the full tool list, client configs, and workflows | | [Claude Code Plugin](claude-code-plugin.md) | You use Claude Code and want the auto-wired MCP plus workflow skills | | [Programmatic Agent](programmatic-agent.md) | You build from prompts in Node with your own Anthropic or OpenAI key | | [Spending Authorization](spending-authorization.md) | You give an agent a delegate wallet with on-chain caps and revocation | | [Bot Examples](bot-examples.md) | You want copy-paste patterns: mint, gate, react to events | | [Reading the Docs](reading-the-docs.md) | Your agent needs to fetch documentation by URL, tool, or CLI | | [Skills](skills/README.md) | You want the per-token-type build instructions the builder ships with | ## Related - [Claims API](../api/claims/endpoints.md) for automated minting through claims - [WebSocket Events](../chain/websocket-events.md) - [BitBadges AI Quickstarter](https://github.com/BitBadges/bitbadges-quickstarter-ai) (GitHub template repo) - [SDK AI agent guide](https://github.com/BitBadges/bitbadgesjs/blob/main/packages/bitbadgesjs-sdk/AI_AGENT_GUIDE.md) ## File: agents/bot-examples.md --- description: "Copy-paste bot patterns on mainnet. Mint a fungible token, conditional transfer, ownership gating, event subscription, and the builder tool workflow." --- # Bot Examples Copy-paste patterns for bots and agents that act on mainnet. Each example is a complete script; the addresses are the docs fixtures (alice `bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d` runs the bot, bob `bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue` is the user), so swap in your own. Testnet is offline, so every example targets mainnet. Test on a low-value collection first. Testnet status and the faucet API shape: [Testnet](../chain/testnet.md). Every example that reads from the BitBadges API needs an API key in `BITBADGES_API_KEY`. Create one at [bitbadges.io/developer](https://bitbadges.io/developer). See [BitBadges API](../api/README.md). ## 1. Mint a Fungible Token Create a fungible token collection with server-side signing. The collection message comes from `bb build`, the MCP builder tools (`get_transaction`), or the [Create a Collection](../guides/create-a-collection.md) guide, saved as `collection.json`. ```ts import { readFileSync } from 'node:fs'; import { BitBadgesSigningClient, GenericEvmAdapter, NETWORK_CONFIGS, MsgCreateCollection } from 'bitbadges'; const adapter = await GenericEvmAdapter.fromMnemonic(process.env.MNEMONIC!, NETWORK_CONFIGS['mainnet'].evmRpcUrl); const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' }); // collection.json holds { "messages": [{ "typeUrl": "/tokenization.MsgCreateCollection", "value": {} }] } with the value filled in const built = JSON.parse(readFileSync('./collection.json', 'utf8')); const msg = new MsgCreateCollection({ ...built.messages[0].value, creator: client.address }); const result = await client.signAndBroadcast([msg]); if (result.success) { console.log('Collection created. TX:', result.txHash); } else { console.error('Failed:', result.error); } ``` Load the `fungible-token` skill for the message shape: `bb dev skills fungible-token` or `get_skill_instructions({ skillId: "fungible-token" })`. ## 2. Check a Balance and Transfer on a Condition Top up bob's Demo Coin (collection 2, token ID 1) when he holds fewer than 10 units. ```ts import { BigIntify, BitBadgesAPI, BitBadgesSigningClient, GenericEvmAdapter, NETWORK_CONFIGS, MsgTransferTokens } from 'bitbadges'; const api = new BitBadgesAPI({ apiUrl: 'https://api.bitbadges.io', apiKey: process.env.BITBADGES_API_KEY, convertFunction: BigIntify }); const COLLECTION_ID = '2'; const BOB = 'bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue'; // Check balance const balanceDoc = await api.getBalanceByAddress(COLLECTION_ID, BOB); const held = balanceDoc.balances .filter((b) => b.tokenIds.some((range) => range.start <= 1n && range.end >= 1n)) .reduce((sum, b) => sum + b.amount, 0n); // Conditional transfer if (held < 10n) { const adapter = await GenericEvmAdapter.fromMnemonic(process.env.MNEMONIC!, NETWORK_CONFIGS['mainnet'].evmRpcUrl); const client = new BitBadgesSigningClient({ adapter, network: 'mainnet' }); const result = await client.signAndBroadcast([ new MsgTransferTokens({ creator: client.address, collectionId: COLLECTION_ID, transfers: [ { from: client.address, toAddresses: [BOB], balances: [ { tokenIds: [{ start: 1n, end: 1n }], ownershipTimes: [{ start: 1n, end: 18446744073709551615n }], amount: 10n - held } ] } ] }) ]); console.log('Transfer result:', result.txHash, result.success); } ``` ## 3. Gate Access (Verify Ownership) Check that a user owns a token before granting access. ```ts import { BigIntify, BitBadgesAPI } from 'bitbadges'; const api = new BitBadgesAPI({ apiUrl: 'https://api.bitbadges.io', apiKey: process.env.BITBADGES_API_KEY, convertFunction: BigIntify }); const GATING_COLLECTION_ID = '1'; async function checkAccess(userAddress: string): Promise { try { const balanceDoc = await api.getBalanceByAddress(GATING_COLLECTION_ID, userAddress); // Does the user own token ID 1? return balanceDoc.balances.some( (b) => b.tokenIds.some((range) => range.start <= 1n && range.end >= 1n) && b.amount > 0n ); } catch (error) { console.error('Ownership check failed:', error); return false; } } const allowed = await checkAccess('bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue'); console.log(allowed ? 'grant access' : 'deny access'); ``` For an HTTP-native version of this check (the server answers 402 and the agent proves ownership with a signature), use [Gate access](../guides/gate-access.md). ## 4. Subscribe to Events and React Listen for transfers on a collection and act on each one. ```ts import WebSocket from 'ws'; const RPC_WS = 'wss://rpc.bitbadges.io/websocket'; function connect() { const ws = new WebSocket(RPC_WS); ws.on('open', () => { ws.send( JSON.stringify({ jsonrpc: '2.0', method: 'subscribe', id: 1, params: { query: "tm.event='Tx' AND message.action='/tokenization.MsgTransferTokens'" } }) ); console.log('Listening for transfers'); }); ws.on('message', async (data: WebSocket.Data) => { const msg = JSON.parse(data.toString()); if (msg.result?.data?.value?.TxResult) { const txHash = msg.result.events?.['tx.hash']?.[0]; console.log('Transfer detected:', txHash); await handleTransfer(txHash); } }); ws.on('close', () => { console.log('Disconnected, reconnecting in 5s'); setTimeout(connect, 5000); }); } async function handleTransfer(txHash: string) { // your logic: notify, update a database, trigger another transaction console.log(`Processing transfer ${txHash}`); } connect(); ``` Query syntax and event types: [WebSocket Events](../chain/websocket-events.md). ## 5. Builder Tool Workflow With the [MCP Builder Tools](mcp-tools.md) (Claude Desktop, Claude Code, Cursor), build a collection with the session tools and verify before handing off. Every call below is the JSON the client sends; the same files work with `bb dev tools call --args-file`. ```text # 1. Load the skill get_skill_instructions({ "skillId": "fungible-token" }) # 2. Build with per-field tools (all in parallel) set_standards({ "standards": ["Fungible Tokens"] }) set_valid_token_ids({ "tokenIds": [{ "start": "1", "end": "1" }] }) set_default_balances({ "defaultBalances": { "balances": [], "outgoingApprovals": [], "incomingApprovals": [], "autoApproveSelfInitiatedOutgoingTransfers": true, "autoApproveSelfInitiatedIncomingTransfers": true, "autoApproveAllIncomingTransfers": true } }) set_permissions({ "preset": "locked-approvals" }) set_collection_metadata({ "name": "Demo Coin", "description": "Token managed by my AI agent", "image": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/coin.png" }) add_approval({ "approvalId": "public-mint", "fromListId": "Mint", "toListId": "All", "initiatedByListId": "All", "tokenIds": [{ "start": "1", "end": "1" }], "approvalCriteria": { "overridesFromOutgoingApprovals": true, "overridesToIncomingApprovals": true, "approvalAmounts": { "overallApprovalAmount": "1000000", "perToAddressApprovalAmount": "10", "perFromAddressApprovalAmount": "0", "perInitiatedByAddressApprovalAmount": "0", "amountTrackerId": "public-mint", "resetTimeIntervals": { "startTime": "0", "intervalLength": "0" } } } }) # 3. (Optional) auto-mint to yourself at creation add_transfer({ "transfers": [ { "from": "Mint", "toAddresses": ["bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d"], "balances": [ { "amount": "10", "tokenIds": [{ "start": "1", "end": "1" }], "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }] } ], "prioritizedApprovals": [ { "approvalId": "public-mint", "approvalLevel": "collection", "approverAddress": "", "version": "0" } ], "onlyCheckPrioritizedCollectionApprovals": true } ] }) # 4. Verify (in parallel) validate_transaction({}) review_collection({}) simulate_transaction({}) ``` `review_collection` returns findings and a summary. Fix anything critical before signing. ```json { "findings": ["…"], "summary": { "critical": 0, "warning": 1, "info": 3, "verdict": "warn" } } ``` ```text # 5. Export and hand off get_transaction({}) get_review_url({}) # give the user reviewUrl to review and sign ``` ```json { "success": true, "code": "prv_7tffq58d", "reviewUrl": "https://bitbadges.io/mint/local-builder?code=prv_7tffq58d", "expiresAt": 1788803578315, "expiresIn": "1 hour" } ``` ### CLI Template Build ```bash # Vault token (prints transaction JSON) bb build vault --backing-coin USDC --name "Demo Vault" --description "USDC vault" \ --image ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/vault.png --explain # Subscription collection bb build subscription --interval monthly --price 10 --denom USDC --recipient bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d \ --uri ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/collection.json # Review and sign in the browser bb build vault --backing-coin USDC --name "Demo Vault" --description "USDC vault" \ --image ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/vault.png | bb preview - --open ``` Every template builder: [Build](../cli/build.md). ### Query Sequence (No Signing) ```text search({ "query": "Demo Coin" }) -> query_collection({ "collectionId": "2" }) -> query_balance({ "collectionId": "2", "address": "bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue" }) -> verify_ownership({ "address": "bb1py4mfpg6uf59qkyzg0nmau322c5873eeysp5ue", "collectionId": "2", "tokenId": "1" }) ``` The builder builds and validates but never signs or broadcasts. Sign with the SDK signing client, the chain binary, or the review-and-sign link. ## Tips for Agents - Simulate before broadcasting. Use `simulate_transaction`, `bb simulate`, or the signing client's `simulate: true` option to catch errors before spending gas. - Test on a low-value collection first. Testnet is offline; see [Testnet](../chain/testnet.md) for status and the faucet shape. - Check `result.success` and `result.error` after every broadcast. - The signing client handles nonce and sequence with retries. - Keep credentials in environment variables (`MNEMONIC`, `BITBADGES_API_KEY`). Never hardcode them. - Bound what an agent can spend with an on-chain [Spending Authorization](spending-authorization.md). ## Related - [Signing Client](../sdk/transactions/signing-client.md) - [Claims API](../api/claims/endpoints.md) for automated minting through claims - [Agents](README.md) ## File: agents/claude-code-plugin.md --- description: "Install and use the BitBadges Claude Code plugin. It wires the MCP builder tools and adds 8 workflow skills, two slash commands, and a builder subagent." --- # Claude Code Plugin The Claude Code plugin is a convenience layer on top of the chain binary and CLI for Claude Code users. It registers the `bitbadges-builder` MCP server and ships 8 skills that teach Claude how to use the CLI, the MCP tools, and the docs for common workflows. ```sh curl -fsSL https://install.bitbadges.io | sh bb settings set apiKey "$BITBADGES_API_KEY" ``` ```text /plugin marketplace add BitBadges/bitbadges-plugin /plugin install bitbadges /bitbadges:setup ``` The plugin is a thin harness, not a knowledge base. Token-type instructions live in the SDK and surface through `bb dev skills smart-token` (one command per skill id), the `get_skill_instructions` MCP tool, and the [Skills](skills/README.md) pages. The plugin's job is to teach Claude where to find them and how to compose them, not to ship one wrapper per token type. ## Prerequisites The combined installer provides `bb`, the chain binary, and the SDK commands. The SDK package provides `bitbadges-cli` and `bitbadges-builder`. Offline building needs the SDK CLI; native Cosmos commands need the chain binary. MCP is optional for CLI work. Configure API access for remote operations when needed. The plugin uses installed binaries and does not download a fallback. If a command is missing, `/bitbadges:setup` identifies the prerequisite for the task instead of treating every optional capability as a blocker. Run `/bitbadges:setup` once to confirm the wiring, and `/bitbadges:status` for a health check at any time. ## What You Get ### MCP Server (Auto-Wired) The plugin's `.mcp.json` registers `bitbadges-builder`, so there is no `claude mcp add` step: ```json { "mcpServers": { "bitbadges-builder": { "command": "bitbadges-builder", "args": [] } } } ``` The server runs the same SDK version as the installed CLI. If the client cannot find it, check its PATH or configure the absolute binary path. A running MCP server is not necessary to use the CLI skills. ### Skills (8) Each skill routes Claude to the right CLI command, MCP tool, or docs page for one workflow. None duplicates token-type knowledge from the SDK. | Skill | What it teaches | | --- | --- | | `build` | Discovers standards with `bb dev skills`, loads the installed schema and examples, and constructs with CLI presets. Uses MCP as an optional adapter | | `review` | Audit a transaction file or live collection for correctness, standards compliance, approval ordering, and UX issues. Wraps `bb check` and `review_collection` | | `simulate` | Dry-run a transaction. Returns events and per-address balance diffs. Always before broadcast. Wraps `simulate_transaction` | | `explain` | Plain-English description, audience-aware (user, developer, auditor). Wraps `explain_collection` and `bb explain` | | `query` | Collections, balances, accounts, claims, standards, and every API route. Discovers routes with `--help-json` first, then calls | | `address` | All six address operations: cosmos and EVM conversion, IBC backing, wrapper, mint-escrow, and alias derivations | | `claim` | Build or audit an open, code-gated, password-gated, or whitelist-gated claim. Additional ownership requirements use the appropriate approval primitives | | `broadcast` | Sign and broadcast. On rails: dry-run by default, explicit confirmation for live. Picks between chain binary, burner, browser bridge, and programmatic signer | For deeper instructions on a specific token type, the plugin sends Claude to the SDK, CLI, or docs rather than redefining them locally. ### Slash Commands | Command | What it does | | --- | --- | | `/bitbadges:setup` | Checks prerequisites for the selected task and guides local API configuration without asking for secrets in chat | | `/bitbadges:status` | Runs CLI diagnostics and distinguishes offline readiness from remote connectivity. Live MCP connectivity is checked through client tool discovery | ### Subagent `bitbadges-builder` is a focused builder agent. It uses CLI presets and canonical skills first, with MCP available when useful. It saves the proposal, reviews and simulates it, then chooses the signing path based on wallet ownership and granted authority. Use it for isolation from the main conversation: "Have the bitbadges-builder agent prepare an unsigned smart token proposal for review." ### SessionStart Pre-warm Hook The compatibility hook checks the installed CLI version quietly. It performs no package downloads or configuration changes. ## API Key The CLI configuration is shared with the MCP server. `/bitbadges:setup` reuses it without printing secrets and directs you to configure a key locally when remote access is needed. Get a key at [bitbadges.io/developer](https://bitbadges.io/developer). No key is needed for offline proposal construction. ## Migrate from a Manual MCP Setup If you previously registered the server manually, inspect `claude mcp list` after installing the plugin. Remove only a confirmed duplicate manual registration, using the scope shown by your client; inspect `claude mcp remove --help` before changing it: ```text claude mcp remove bitbadges-builder ``` `/bitbadges:setup` can help inspect the registrations. A matching server name alone does not establish that there is a duplicate. ## When You Do Not Need the Plugin The plugin is for Claude Code only. Other harnesses get the same coverage from the MCP server and the skill docs: - Cursor, Claude Desktop, other MCP clients: set up the `bitbadges-builder` server in your client ([MCP Builder Tools](mcp-tools.md)). The server exposes `get_skill_instructions({ "skillId": "smart-token" })` for on-demand loading, the same path the plugin uses. - Generic LLMs, shell scripts, CI: use the [CLI](../cli/README.md). For skill instructions, read the [Skills](skills/README.md) pages or run `bb dev skills smart-token`. - TypeScript developers: `npm install bitbadges` and use the [SDK](../sdk/README.md). The CLI is the base layer. Skill content is rendered in one place ([Skills](skills/README.md)) and consumed by reference from the plugin, the MCP server, and the CLI. ## Source - Plugin installation and public distribution: [BitBadges/bitbadges-plugin](https://github.com/BitBadges/bitbadges-plugin) - Contributor source: [packages/agent-plugin in the private monorepo](https://github.com/BitBadges/bitbadges-monorepo/tree/main/packages/agent-plugin) (repository access required). Installation does not require monorepo access. - MCP server: [bitbadgesjs-sdk/src/builder](https://github.com/BitBadges/bitbadgesjs/tree/main/packages/bitbadgesjs-sdk/src/builder) - CLI: [bitbadgesjs-sdk/src/cli](https://github.com/BitBadges/bitbadgesjs/tree/main/packages/bitbadgesjs-sdk/src/cli) - Skills source of truth: [skillInstructions.ts](https://github.com/BitBadges/bitbadgesjs/blob/main/packages/bitbadgesjs-sdk/src/builder/resources/skillInstructions.ts) ## File: agents/main-wallet-payments.md --- description: "An agent proposes an exact invoice payment or coin transfer; the human reviews and signs with their main wallet, then the agent confirms and reconciles the result." --- # Main-Wallet Payment Requests An agent can ask, “May I send 5 USDC to this merchant?” without holding the human's keys or receiving a standing allowance. It constructs the exact transaction, opens the browser review, and waits for the human's wallet decision. Each new payment requires its own authorization. ## Resolve the Purchase Before asking for a signature, establish the network, canonical asset denomination, exact amount, recipient, human signer, and purpose. If the merchant provides an invoice, obtain its actual collection ID and obligation reference. Check that its on-chain payouts match the agreed purchase. “USDC” alone does not identify a network asset. Display symbols are convenience inputs, not proof of issuer or backing. Resolve the denomination and decimals through the chosen network's registry and show the resulting base units in the transaction review. Keep fees separate from the 5 USDC recipient payout. ## Pay an Existing Invoice ```bash bb pay-requests show 46 --mainnet bb pay-requests status 46 --mainnet bb pay-requests pay 46 --creator "$PAYER" --obligation payment-1 --units 1 --mainnet --output-file payment.json bb check payment.json bb explain payment.json bb deploy payment.json --browser --expected-address "$PAYER" --mainnet ``` `$PAYER` must be the human wallet's actual address. Replace the example IDs. The standard helper validates the collection and binds the payment to its actual approval. For a partial invoice, units are quanta that scale every payout leg; calculate the requested units from the invoice terms instead of treating them as display coins. When the reviewed terms are already established, the inline equivalent is: ```bash bb pay-requests pay 46 --creator "$PAYER" --obligation payment-1 --units 1 --browser --mainnet ``` A merchant or manager must first publish the invoice collection. An agent can prepare its creation transaction, but cannot assume an unpublished collection has a known ID or that invoice creation itself requires no signature. A direct transfer is available when a persisted invoice is unnecessary. ## Direct Coin Transfer ```bash bb build send --from "$PAYER" --to "$RECIPIENT" --amount 5 --denom USDC --mainnet --output-file payment.json bb explain payment.json bb deploy payment.json --browser --expected-address "$PAYER" --mainnet ``` The inline form is `bb build send --from "$PAYER" --to "$RECIPIENT" --amount 5 --denom USDC --mainnet --browser`. The `send` builder uses `--from` as the expected signer. Verify the resolved asset and amount before proceeding. This is a bank transfer, not an invoice collection. It does not create invoice obligations, progress counters, refund rights, or recurring consent. Use [invoice standards](../standards/payments.md) when those finite payment-tracking semantics are needed. ## What the Browser Binds The versioned transaction request carries a request ID, expected signer, deployment network, Cosmos and EVM chain IDs, expiration, signing mode, and transaction messages. The page validates the request and supported message types. Explicit sender fields are preserved; omitted sender fields are populated only from the expected signer. The normalized messages shown for review must be the messages passed to the wallet. Wallet address, selected network, request expiration, and reviewed message identity are checked again before signing. A transaction review must not silently add a login transaction or replace an explicit sender with the currently connected account. The new page also accepts supported legacy CLI requests through a separate adapter. Supplied signer and chain fields are preserved and checked; missing values are pinned once from the selected wallet and page network for that review, with a finite page lifetime. Legacy requests cannot retroactively prove the original CLI network or an omitted expiry. This binding protects the application's handoff. It does not prove that a merchant's prose description is true or that delivery will occur. Local and mainnet configurations can share a Cosmos chain ID; the application's deployment label is not a cryptographic replay boundary in raw Cosmos signed bytes. ## Wallet Decision and Fees Give the person a short handoff before launching the browser: “Pay this invoice on mainnet from your wallet: 5 USDC to the reviewed merchant address. This is one payment, with no recurring allowance. Review the separate network fee in your wallet.” Use the actual proposal's terms; if it grants an allowance or has multiple recipients, describe those instead. Keep the CLI running until it receives the result. Use `--no-open` to print the signing URL when automatic opening is inconvenient. Open it in a browser on the same machine as the CLI, or use the documented SSH port forwarding. The callback uses localhost, so sending the link to a phone or closing the terminal can prevent the result from returning even after a successful payment. The human reviews all messages and confirms in the wallet. The frontend selects gas and fees at signing time. Browser `--fee`, `--fee-denom`, and `--gas` flags do not impose a fee cap; those CLI controls belong to other signing paths. Review the wallet's fee request separately from recipient payouts. Use ordinary sign-and-broadcast for payments. `--sign-only` is for compatible Cosmos adapters returning raw signed bytes. EVM paths that send during signing are rejected before invoking the wallet. The current callback transport accepts at most 4096 base64 characters of signed bytes; larger results return an explicit error and must use another supported signing flow. Do not treat this callback as a general large-transaction export channel. Declining before wallet dispatch means no wallet signing request should begin. Once wallet interaction is in flight, closing a page is not proof of cancellation or non-submission. A request expiry prevents starting another signing invocation; it does not revoke an already signed or submitted transaction. ## Confirm the Result Browser callbacks distinguish signing, submission, cancellation, error, and an unknown submission outcome. `outcome: "unknown"` includes `retrySafe: false`; reconcile it before another attempt. Submission is returned with `confirmed: false` and `verification: "unverified"`. The CLI validates the returned request identity, signer, network, and mode, but does not independently prove the signature contents or successful chain execution from the callback alone. ```bash bb tx status "$TX_HASH" --mainnet bb tx wait "$TX_HASH" --mainnet --timeout 120 bb pay-requests status 46 --mainnet ``` Inspect the chain execution result. The indexer may need time to reflect the confirmed payment. Store the hash and invoice obligation reference so a lost callback can be reconciled without paying again. On a timeout or ambiguous wallet error, inspect wallet activity and chain status before retrying. Reusable links intentionally accept repeat payments. | Observed result | Report to the person | Next step | | --- | --- | --- | | Unsigned proposal | Ready for review | Review terms before requesting a wallet signature | | Signed bytes | Signed, not submitted by this flow | Broadcast only through an authorized signing workflow | | Submitted hash | Submitted; confirmation pending | Inspect chain execution, then invoice progress | | Confirmed execution, stale invoice view | Confirmed; dashboard catching up | Wait for indexing; do not pay again | | Declined before wallet dispatch | Request declined | Leave the payment unsubmitted | | Timeout, lost callback, or uncertain wallet error | Outcome unknown | Reconcile wallet activity and chain state before another attempt | ### Recover a Request The CLI saves browser transaction requests and their callbacks in private local files before opening the signing page. It prints the request ID on stderr. Inspect them from a second terminal: ```bash bb dev requests list bb dev requests status "$REQUEST_ID" bb dev requests resume "$REQUEST_ID" ``` `status` reports the recorded result and checks the original listener. `resume` returns the **same** `signUrl` only while that listener is alive and the request has not expired or completed. Keep the original CLI running; this is not a background signing service. Neither command submits a transaction or creates a replacement request. Missing or expired listeners produce `outcome: "unknown"`, `canResume: false`, and `retrySafe: false`. Recorded callbacks remain unverified: a saved hash is not proof of successful execution. Use `bb tx status` / `bb tx wait` on the original network, then reconcile invoice or subscription state. Request files contain transaction details and signing links; keep them private. They live under the CLI configuration directory (`~/.bitbadges/signing-requests` by default; `BITBADGES_CONFIG_DIR` selects a separate directory). Restarting `deploy --browser` creates a new request, so never use it as an automatic retry after uncertainty. ## Recurring Consent Is Separate A personal-sign message such as “I authorize this agent” does not install an on-chain spending approval. A successful invoice payment does not authorize the next purchase. A payment link is not automatic billing. Use [Subscriptions](../standards/subscriptions.md) when the human intentionally authorizes recurring charges, and inspect its period, recipient, amount, expiry, and cancellation semantics separately. [Spending Authorization](spending-authorization.md) covers a distinct delegate-wallet design. Neither is required for the main-wallet request-per-payment flow. ## File: agents/mcp-tools.md --- description: "Reference for the MCP builder tools. Install, client configs, every tool with its key params, workflows, resources, and the CLI access path." --- # MCP Builder Tools The MCP builder tools let an AI assistant build, review, simulate, and query BitBadges transactions. The CLI is the primary entry point; MCP adapts the shared tool registry for clients that prefer structured tool calls. The installed registry in [`bitbadgesjs-sdk/src/builder/tools/`](https://github.com/bitbadges/bitbadgesjs/tree/main/packages/bitbadgesjs-sdk/src/builder/tools) is authoritative when this reference and an installed version differ. ```bash # Install globally npm install -g bitbadges # Start the MCP server from that same installation bitbadges-builder ``` To build from your own Node code with the same tools and no MCP client, use the [Programmatic Agent](programmatic-agent.md). For terminal workflows without an MCP client, use the [CLI](../cli/README.md). ## Schemas and Examples ```bash bb dev capabilities bb dev capabilities build_subscription bb dev tools call build_subscription --args-file subscription.json ``` The compact catalog lists operation IDs and CLI/MCP entry points. Requesting one ID includes its `inputSchema`; the standard builders also include a sample in `inputSchema.examples`. The equivalent MCP call is `get_capabilities` with `{"id":"build_subscription"}`. `schemaVersion` identifies the catalog format and `catalogHash` identifies its installed definitions. Eighteen existing standard builders are exposed through this adapter, including subscriptions, auctions, bounties, crowdfunds, product catalogs, smart tokens, credits, and approval templates. They use the same core functions as the CLI. PaymentRequestV2 remains available as `build_payment_request_v2`, including invoice substandards. The catalog also exposes standard actions through the installed CLI, including `standard_credit_tokens_quote` for exact credit purchase units. Native Cosmos commands remain CLI-only; inspect the installed catalog rather than guessing a tool name. The schemas enforce JSON shape and unknown-field rejection. Each builder also applies its existing runtime rules; schema validity alone does not prove a payment is authorized or will succeed on chain. IDs and integer base-unit amounts use strings where declared; older display-unit builder parameters use numbers. Returned approval amounts are encoded as decimal strings. Examples are unsigned proposals with sample addresses, IDs and metadata URLs; replace them, set the real signer, review, and simulate before requesting a signature. ## Client Configuration ### Claude Desktop Add to `claude_desktop_config.json`: ```json { "mcpServers": { "bitbadges-builder": { "command": "bitbadges-builder", "args": [], "env": { "BITBADGES_API_KEY": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" } } } } ``` The key is a fake example. Configure your own key from [bitbadges.io/developer](https://bitbadges.io/developer) locally. Building proposals does not require a mnemonic. Use [main-wallet requests](main-wallet-payments.md) for browser signing. ### Claude Code After the chain and CLI install (`curl -fsSL https://install.bitbadges.io | sh`), add the server by hand: ```bash claude mcp add bitbadges-builder -- bitbadges-builder ``` Or install the [Claude Code Plugin](claude-code-plugin.md), which wires the same server and adds 8 workflow skills plus `/bitbadges:setup` and `/bitbadges:status`: ```text /plugin marketplace add BitBadges/bitbadges-plugin /plugin install bitbadges ``` The plugin is a convenience layer. The CLI install is what runs underneath. ### Cursor Add to `.cursor/mcp.json`: ```json { "mcpServers": { "bitbadges-builder": { "command": "bitbadges-builder", "args": [], "env": { "BITBADGES_API_KEY": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" } } } } ``` ### Environment Variables | Variable | Required | Description | | --- | --- | --- | | `BITBADGES_API_KEY` | For queries, simulation, broadcast, and review links | Your BitBadges API key ([get one](https://bitbadges.io/developer)) | | `BITBADGES_API_URL` | No | Override the API base (default `https://api.bitbadges.io`) | | `BITBADGES_FRONTEND_URL` | No | Override the site base used in review links (default `https://bitbadges.io`) | | `BITBADGES_CONFIG_DIR` | No | Separate CLI configuration, sessions, and signing-request files; useful for isolated agent environments | | `BITBADGES_CLI_PATH` | No | Trusted installed CLI executable for standard actions; defaults to `bitbadges-cli` on PATH | The MCP server does not need wallet private keys or mnemonics. Signing happens through the separately authorized CLI or wallet flow. It does not read `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`; your client provides the model. ## Tools Params marked `*` are required. Session tools also accept `sessionId` and `creatorAddress` (`bb1` or `0x` form) for per-request isolation; those two are omitted from the tables. A complete call, as the client sends it and as `bb dev tools call add_approval --args-file ./approval.json` reads it. This adds a public mint of Demo Coin (collection token ID 1) with at most 10 units per address: ```json { "sessionId": "demo-coin", "creatorAddress": "bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d", "approvalId": "public-mint", "fromListId": "Mint", "toListId": "All", "initiatedByListId": "All", "tokenIds": [{ "start": "1", "end": "1" }], "transferTimes": [{ "start": "1", "end": "18446744073709551615" }], "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }], "approvalCriteria": { "overridesFromOutgoingApprovals": true, "overridesToIncomingApprovals": true, "approvalAmounts": { "overallApprovalAmount": "0", "perToAddressApprovalAmount": "10", "perFromAddressApprovalAmount": "0", "perInitiatedByAddressApprovalAmount": "0", "amountTrackerId": "public-mint", "resetTimeIntervals": { "startTime": "0", "intervalLength": "0" } } } } ``` The tool answers with the approval as stored in the session plus any validation notes. ### Standard Actions Prefer the high-level builder or action when it fits. The `standard_*` tools cover payment requests, subscriptions, smart tokens, credits, products, auctions, crowdfunds, bounties, and prediction markets. Inputs come from the CLI command definitions, and results preserve the CLI JSON envelope. They query state or prepare unsigned messages; they never sign or broadcast. ```bash bb dev capabilities standard_pay_requests_pay bb pay-requests pay 46 --creator "$PAYER" --obligation payment-1 --units 1 --mainnet ``` Equivalent MCP arguments for `standard_pay_requests_pay`: ```json { "collectionId": "46", "creator": "bb1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zql3w7", "obligation": "payment-1", "units": "1", "mainnet": true } ``` Replace the sample collection and payer. Action amounts are strings, preserving CLI decimal text; units follow that command's help. Signing, credential, endpoint, shell, and file-output arguments are excluded. The adapter starts `bitbadges-cli` directly with literal arguments and checks its capability hash before running the action. Install CLI and MCP from the same SDK version. `BITBADGES_CLI_PATH` can select a trusted installed CLI executable when the client cannot find it on PATH; it is operator configuration, not a tool argument. For subscriptions, `standard_subscriptions_claim` prepares one payment; `standard_subscriptions_subscribe` also requests recurring consent. Renewal and cancellation require a successful read of existing approvals so unrelated consent is preserved. Do not infer refunds or prorations from cancellation. For browser handoff use the CLI's `--browser` flow. `list_signing_requests` lists local request IDs; `signing_request_status` accepts `requestId` and optional `resume: true`. Resume returns the original signing URL only while its listener is active. These tools do not initiate payment or verify chain execution. See [request recovery](main-wallet-payments.md#recover-a-request). ### Session Builders Each tool sets one field on a session-scoped transaction. Calls in the same round can run in parallel. Tools that need the API key say so. | Tool | What it does | Key params | | --- | --- | --- | | `set_standards` | Set the collection's standards array, which selects the site's dedicated views | `standards*` (array, e.g. `["Subscriptions"]`, `["NFTs"]`, `["Smart Token"]`) | | `set_valid_token_ids` | Set which token ID ranges exist. Fungible tokens and subscriptions use one ID; NFTs use a range | `tokenIds*` (array of ranges) | | `set_default_balances` | Set default balances for all users. Almost always empty balances with every auto-approve flag true. Mint recipients need a matching incoming approval, an auto-approve flag, or an explicit collection-level override | `defaultBalances*` (object) | | `set_permissions` | Set collection permissions from a preset or a custom object. Fields are frozen (`permanentlyForbiddenTimes: FOREVER`) or neutral (`[]`) | `preset` (`fully-immutable`, `manager-controlled`, `locked-approvals` default), `permissions` (object, overrides preset) | | `set_invariants` | Set on-chain invariants. They cannot be removed after creation | `invariants*` (object or null; keys `noCustomOwnershipTimes`, `maxSupplyPerId`, `cosmosCoinBackedPath`) | | `set_manager` | Set the manager address. Defaults to the creator | `manager*` | | `set_collection_metadata` | Set name, description, and image. Auto-creates a metadata placeholder URI | `name*`, `description*`, `image*` (`IMAGE_N`, an `https://` or `ipfs://` URL, or a `data:image/svg+xml;base64` URI) | | `set_token_metadata` | Set metadata for token ID ranges. `{id}` works in the URI only | `tokenIds*`, `name*`, `description*`, `image*` | | `set_custom_data` | Set the on-chain custom data string (any JSON or text) | `customData*` | | `set_mint_escrow_coins` | Fund the mint escrow address at creation. Required for quest rewards and escrow payouts where `coinTransfers` use `overrideFromWithApproverAddress` | `coins*` (array; for quests `rewardAmount * maxClaims`) | | `add_approval` | Add a collection approval: who can transfer what, when, under which conditions. Remove and re-add with the same `approvalId` to replace in place | `approvalId*`, `fromListId*` (`Mint`, `!Mint`, or an address), `toListId` (default `All`), `initiatedByListId`, `tokenIds`, `transferTimes`, `ownershipTimes`, `approvalCriteria` (object, non-default fields only; `overridesFromOutgoingApprovals` must be true for Mint approvals) | | `add_preset_approval` | Add a collection approval from a named preset instead of hand-writing the approval criteria. Output is identical in shape to `add_approval` | `presetId*` (e.g. `credit-token.scaled`), `params*` (per-preset schema), `overrides` (deep merge; arrays replace, objects merge) | | `list_presets` | List named approval presets with `presetId`, `name`, `description`, and `paramsSchema` | `skill` (filter by skill id, e.g. `credit-token`) | | `remove_approval` | Remove a collection approval by id. Order is preserved on re-add | `approvalId*` | | `set_approval_metadata` | Set a name and description on an approval. Image is always empty for approvals | `approvalId*`, `name*`, `description*` | | `add_alias_path` | Add an alias path for ICS20-backed tokens or liquidity pools. Required for smart tokens. Decimals must match the IBC denom | `aliasPath*` (object), `pathName`, `pathDescription`, `pathImage`, `denomUnitName`, `denomUnitDescription`, `denomUnitImage` (off-chain, routed to `metadataPlaceholders`) | | `remove_alias_path` | Remove an alias path by denom | `denom*` | | `add_cosmos_wrapper_path` | Add a wrapper path that mints and burns a new ICS20 coin from collection tokens. Advanced; most cases want smart tokens, pools, or `coinTransfers`. Approvals for the wrapper address need `allowSpecialWrapping: true` and `mustPrioritize: true` | `wrapperPath*` (object), plus the same off-chain `pathName`, `pathDescription`, `pathImage`, `denomUnitName`, `denomUnitDescription`, and `denomUnitImage` params as `add_alias_path` | | `remove_cosmos_wrapper_path` | Remove a wrapper path by denom | `denom*` | | `add_transfer` | Append a `MsgTransferTokens` after the collection message for auto-mint at creation. `collectionId` is set to `"0"` (the new collection). Needs a matching mint approval | `transfers*` (array of from, to, balances, prioritized approval) | | `remove_transfer` | Remove a transfer message by index. `messages[0]` is the collection and cannot be removed | `index*` (>= 1) | | `set_is_archived` | Archive or unarchive. Archived collections stay on-chain but are hidden from browsing | `isArchived*` | | `get_transaction` | Return the assembled transaction JSON with `metadataPlaceholders`. Numbers become strings. Blank `image` fields are auto-filled with a deterministic SVG seeded by the collection name | none | | `get_review_url` | Final step: upload the transaction to the open preview endpoint and return a short bitbadges.io link the user opens to review and sign. Needs the API key to upload; the person opening the link needs none. Links expire after 1 hour. | `transaction` (defaults to the session), `frontendUrl` | | `reset_session` | Clear all session state and start from a blank collection. Call it before building a second collection in the same conversation; session state is global and persists, so the new collection would otherwise inherit the previous approvals, metadata, alias paths, and transfers | `sessionId` (omit for the default session) | `generate_placeholder_art` (`seed*`, `style`, `monogram`) still exists in source but is not in the MCP catalog: `get_transaction` fills blank images for you. ### Helper Builders | Tool | What it does | Key params | | --- | --- | --- | | `build_claim` | Build a claim document for `POST /api/v0/claims`: code-gated, password-gated, whitelist-gated, or open | `claimType*`, `name*`, `maxUses*`, `description`, `numCodes`, `password`, `whitelist`, `maxUsesPerAddress`, `action` (links a collection approval), `showInSearchResults`, `categories` | | `build_transfer` | Build a `MsgTransferTokens` by querying the collection and constructing the right `prioritizedApprovals` and `coinTransfers`. Supports mint, transfer, deposit (IBC to token), withdraw (token to IBC). Needs the API key | `collectionId*`, `fromAddress*` (`Mint` to mint), `toAddress*`, `tokenIds`, `amount` (default `"1"`), `intent` (`mint`, `transfer`, `deposit`, `withdraw`) | | `build_dynamic_store` | Build transaction JSON for dynamic stores: create, update, delete, set values. Dynamic stores are on-chain allowlists usable in `dynamicStoreChallenges` | `action*` (`create`, `update`, `delete`, `set_value`, `batch_set_values`), `creator*`, `storeId`, `defaultValue`, `globalEnabled`, `uri`, `customData`, `address`, `value`, `entries` | ### Review and Analysis | Tool | What it does | Key params | | --- | --- | --- | | `review_collection` | Deterministic review of a transaction or on-chain collection. Merges audit, standards, and UX findings into one `ReviewResult` with one verdict. Each finding has `code`, `severity`, `source`, `category`, and localized `title`, `detail`, `recommendation` | `collection*` (message, its value, a `{ messages }` transaction, or a raw collection), `context` (`onChainCollection`, `skipSources`, `hideAgentOnly`) | | `flag_review_item` | Flag an assumption, substitution, or unsupported request for the user to check before broadcast. Flags surface in the review-and-sign flow | `kind*` (`assumption`, `substitution`, `unsupported_request`, `clarification_needed`, `design_choice`, `other`), `severity*` (`low`, `medium`, `high`), `message*`, `chosen*`, `alternative`, `fieldPath` | | `explain_collection` | Human-readable explanation with optional Q&A. Covers what it is, how to get tokens, what the manager can change, trust signals, and risk. No API key | `collection*`, `question`, `audience` (`user` default, `developer`, `auditor`) | | `analyze_collection` | Structured analysis of transferability, approvals, permissions, and how to obtain or transfer tokens. Feeds `MsgTransferTokens` construction. Needs the API key | `collectionId*` | ### Simulation and Validation | Tool | What it does | Key params | | --- | --- | --- | | `simulate_transaction` | Dry-run without broadcasting. Returns raw events, parsed transfer events (coin, token, IBC), and per-address net balance changes. Defaults to the session transaction. Needs the API key | `transaction` or `transactionJson` | | `validate_transaction` | Check a transaction against the critical rules: numbers as strings, required fields, list IDs. Defaults to the session transaction | `transaction` or `transactionJson` | ### Queries All query tools need `BITBADGES_API_KEY`. | Tool | What it does | Key params | | --- | --- | --- | | `query_collection` | Fetch a collection. Use `fields` to shrink the response | `collectionId*`, `includeMetadata` (default true), `fields` (array of top-level fields) | | `query_balance` | Fetch the balance array, or one amount at the current time when `tokenId` is set | `collectionId*`, `address*`, `tokenId` | | `query_dynamic_store` | Read a dynamic store: details, one address value, a paginated value list, or all stores by creator | `action*` (`get_store`, `get_value`, `list_values`, `list_by_creator`), `storeId`, `address`, `bookmark` | | `verify_ownership` | Check that an address meets ownership requirements. Shorthand for one collection, or a full `AssetConditionGroup` for `$and` / `$or` / `$not` | `address*`, `collectionId`, `tokenId` (default `"1"`), `tokenIdEnd`, `minAmount` (default `"1"`), `requirements` (JSON string) | | `search` | Search collections, accounts, and tokens | `query*` | | `search_plugins` | Find off-chain claim plugins by text, fetch by id, or list a creator's public plugins. Any plugin is fetchable by id without auth | `searchValue`, `pluginIds`, `creatorAddress`, `bookmark` | | `lookup_token_info` | Symbol, IBC denom, decimals, and pre-generated backing address for a token | `query*` (symbol like `USDC` or an `ibc/...` denom) | ### Component Generators Stateless helpers that return one piece of a collection. | Tool | What it does | Key params | | --- | --- | --- | | `generate_approval` | Build an approval by pattern | `approvalType*` (`public-mint`, `manager-mint`, `smart-token-backing`, `smart-token-unbacking`, `subscription`, `free-transfer`, `restricted-transfer`), `approvalId*`, `tokenIds`, `backingAddress`, `paymentAmount`, `paymentDenom`, `paymentRecipient`, `maxPerUser`, `totalMax`, `fromListId`, `toListId`, `initiatedByListId` | | `generate_permissions` | Build a permissions object from a preset | `preset*` (`fully-immutable`, `manager-controlled`, `token-locked`, `custom`), `customPermissions` | | `generate_backing_address` | Deterministic IBC backing address for a denom, plus list IDs for smart token approvals | `ibcDenom*` (denom or symbol) | | `generate_alias_path` | Alias path config for swappable tokens and DEX display | `symbol*`, `decimals*`, `tokenId` (default `"1"`), `metadataUri`, `name`, `description` | | `generate_wrapper_address` | Deterministic wrapper address for a wrapper path denom. No private key; protocol-controlled | `denom*` | | `generate_unique_id` | Collision-free IDs like `prefix_a1b2c3d4` for new approvals and trackers. Keep original IDs on updates | `prefix*`, `count` (default 1) | ### Utilities | Tool | What it does | Key params | | --- | --- | --- | | `validate_address` | Check an address and detect its chain type | `address*` | | `convert_address` | Convert between `0x` and `bb1` formats | `address*`, `targetFormat` (`eth`, `bitbadges`) | | `get_current_timestamp` | Current time in milliseconds with common offsets and durations | `offsetMs`, `offsetDays`, `offsetHours` | | `diagnose_error` | Map a transaction error to a diagnosis and fix | `error*`, `context` | | `search_knowledge_base` | Ranked snippets across embedded docs, learnings, recipes, error patterns, and critical rules | `query*`, `category` (`all`, `docs`, `learnings`, `recipes`, `errors`, `rules`) | ### Instructions and Docs | Tool | What it does | Key params | | --- | --- | --- | | `get_skill_instructions` | Build instructions for one skill. Skill ids: `address-list`, `auction`, `auto-mint`, `bb-402`, `bounty`, `burnable`, `credit-token`, `crowdfund`, `custom-2fa`, `fungible-token`, `immutability`, `liquidity-pools`, `minting`, `multi-sig-voting`, `nft-collection`, `payment-protocol`, `payment-request`, `prediction-market`, `product-catalog`, `quest`, `smart-token`, `subscription`, `tradable` | `skillId*` | | `fetch_docs` | Keyword search over the live docs export on docs.bitbadges.io. Returns the top matching sections | `topic*` | Rendered skill pages: [Skills](skills/README.md). ## Workflows ### Session-Based Build Ask your agent: ```text Build a fungible token called Demo Coin with a 1,000,000 supply cap and a public mint of up to 10 per address. Use the session tools, run validate, review, and simulate in parallel, fix any critical findings, then call get_review_url and give me the link. ``` The prompt above produces this chain: ```text set_standards + set_valid_token_ids + set_invariants + add_approval + set_permissions + set_default_balances + set_collection_metadata + set_token_metadata -> (optional) add_transfer (auto-mint at creation) -> validate_transaction + review_collection + simulate_transaction (in parallel) -> fix errors with remove_approval + re-add (max 3 attempts) -> get_transaction (final JSON) -> get_review_url (link the user opens to review and sign) ``` 1. Build. Call the per-field tools in parallel: standards, token IDs, invariants, approvals, permissions, metadata, balances. 2. Auto-mint (optional). Call `add_transfer` to append a `MsgTransferTokens` next to the collection creation. 3. Verify. Call `validate_transaction`, `review_collection`, and `simulate_transaction` in parallel. Fix errors with a targeted `remove_approval` and re-add. 4. Export. Call `get_transaction` for the final JSON. 5. Hand off. Call `get_review_url` and give the user `reviewUrl`. Prefer the link over pasting JSON: it is short and cannot be corrupted in transit. ### Query and Verification (No Signing) ```text query_collection -> verify_ownership -> (act on the result) ``` ### Auto-Mint at Creation `add_transfer` mints to specific addresses in the same transaction as the collection creation. The transaction then holds two messages: `MsgCreateCollection` and `MsgTransferTokens`. (The session holds it as `MsgUniversalUpdateCollection`; `get_transaction` narrows it on the way out.) Use it for "mint 100 tokens to myself", "distribute tokens to the team", or "auto-mint at creation". 1. Build the collection with a mint approval (`add_approval` with `fromListId: "Mint"` and `initiatedByListId: `). 2. Call `add_transfer` with the recipient addresses, balances, and `prioritizedApprovals` that reference the mint approval. 3. Verify and export as normal. The transaction contains both messages. Maximum 4 transfer messages per transaction. ## Hand Off to the Browser The builder never signs or broadcasts. Three exits: - `get_review_url` returns `reviewUrl`, where the user reviews and signs with a browser wallet. It is backed by a `prv_` code from `POST /api/v0/builder/preview`. Uploading the preview needs `BITBADGES_API_KEY`; opening the returned link needs none, because the unguessable code is the secret. The code expires in 1 hour. `BITBADGES_FRONTEND_URL` or the `frontendUrl` param points the link at testnet or a local site; a testnet `BITBADGES_API_URL` infers `https://testnet.bitbadges.io`. - Save `get_transaction` output to a file and run `bb preview tx.json --open`, or `bb deploy --browser` / `--burner` from the [CLI](../cli/deploy.md). - Sign with the [SDK signing client](../sdk/transactions/signing-client.md). ## Resources The server also exposes embedded documents as MCP resources. Read them with your client's resource support or with `bb dev resources read bitbadges://recipes/all`. | Resource URI | Name | Description | | --- | --- | --- | | `bitbadges://tokens/registry` | Token registry | IBC denoms, symbols, decimals, and pre-generated backing addresses | | `bitbadges://rules/critical` | Critical rules | Rules every transaction must follow | | `bitbadges://skills/all` | Skill instructions | Instructions for all builder skills | | `bitbadges://docs/concepts` | Core concepts | Transferability, approvals, permissions, balances, address lists | | `bitbadges://docs/examples` | Full examples | Complete transaction JSON for NFT collections, fungible tokens, and smart tokens | | `bitbadges://recipes/all` | Code recipes and decision matrices | Snippets and decision matrices for common operations | | `bitbadges://learnings/all` | Learnings and gotchas | Known gotchas, tips, and discoveries | | `bitbadges://errors/patterns` | Error patterns | Error messages mapped to diagnoses and fixes | | `bitbadges://docs/frontend` | Reference frontend patterns | Patterns from the reference site (Next.js and Ant Design) | | `bitbadges://workflows/all` | Workflow chains | Step-by-step tool chains for multi-step operations | | `bitbadges://schema/token-builder` | Token builder schema | Annotated schema for the session builders: design axes, field reference, approval patterns, validation checklist | ## Call Tools from the CLI The same registry is reachable from `bb dev` as plain function calls, with no MCP round-trip. ```bash bb dev tools list # full schemas, as JSON bb dev tools list --names # `{ ok, data: { names: [...] } }` envelope; pipe to jq -r '.data.names[]' bb dev tools call get_current_timestamp bb dev tools call get_skill_instructions --args '{"skillId":"smart-token"}' bb dev tools call set_collection_metadata --args-file ./metadata.json --session demo ``` | Flag | Description | | --- | --- | | `--args ` | Tool arguments as inline JSON | | `--args-file ` | Tool arguments from a JSON file | | `--session ` | Session id for stateful tools, persisted to `~/.bitbadges/sessions/.json`. Defaults to `--args.sessionId` or the built-in default session | | `--raw` | Print the structured result instead of the formatted text block | Stateful tools (`set_*`, `add_*`, `remove_*`, `get_transaction`) read and write the named session. Sessions survive across invocations, so an agent can compose a collection across many calls: ```bash SESSION=demo-coin bb dev tools call set_standards --session $SESSION --args '{"standards":["Fungible Tokens"]}' bb dev tools call set_valid_token_ids --session $SESSION --args '{"tokenIds":[{"start":"1","end":"1"}]}' bb dev tools call set_collection_metadata --session $SESSION --args '{"name":"Demo Coin","description":"One million units of token ID 1.","image":"ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/coin.png"}' bb dev tools call add_approval --session $SESSION --args-file ./approval.json # the public-mint call from the Tools section bb dev tools call get_transaction --session $SESSION ``` Unknown tool names exit `1` and print the available tools on stderr. ```bash bb session list # session ids on disk bb session show demo # snapshot as JSON bb session reset demo # delete the file bb dev resources list # full metadata as JSON bb dev resources list --uris # URIs only bb dev resources read bitbadges://recipes/all ``` Flag-based template builders (`bb build