Building AI Agents on XChain
XChain is built to be easy for AI agents and LLM-powered tools to use — not as an afterthought, but as a design goal. This section is the starting point if you are building an agent (or are one).
What an agent can do today
Read everything. Every token, balance, trade, smart contract, and attestation on Bitcoin, Litecoin, and Dogecoin is queryable through the explorer’s REST API — no API key, no account. The API is described by a machine-readable spec at https://explorer.xchain.io/openapi.json, and every error carries a stable machine-readable code (see Error Codes).
Use the MCP server. If your agent speaks the Model Context Protocol (Claude, and most agent frameworks), the xchain-mcp server gives it ready-made tools — token lookups, balances, dispensers, order books, contract state, checkpoint verification — across all chains and networks. See the MCP Quickstart.
Read the docs in one request. The full documentation is published for LLMs at https://docs.xchain.io/llms.txt (curated index) and https://docs.xchain.io/llms-full.txt (the whole corpus, one file). Every doc page is also available as raw markdown — replace .html with .md in any docs URL.
Verify, don’t trust. Quorum-signed state checkpoints let an agent verify platform state client-side: fetch https://explorer.xchain.io/{COIN}/api/checkpoint/{height}/verify and check the validator signatures yourself (the SDK and MCP server both do this for you).
What smart contracts can do with AI
XChain smart contracts can call AI models — not the other way to say it: a contract running on Bitcoin can request an LLM completion, the validator federation runs the request and agrees on the answer, and the result lands back on-chain in the contract’s callback. See the LLM attestation provider for how consensus over AI responses works.
Conventions an agent should know
coinis the host chain (BTC, LTC, DOGE);tickis a token symbol. There is no “asset” field.- URL coin prefixes carry the network:
BTCmainnet,TBTCtestnet,RBTCregtest. - Amounts are arbitrary-precision decimal strings. Never parse them as floating-point numbers.
- Branch on error
codefields, never on message text (Error Codes).
Transacting and getting paid
- Give an agent a wallet, safely. A bounded agent session caps what an agent may spend — which actions, to where, how much per rolling window — enforced before anything is signed. See Giving an AI Agent a Wallet, Safely.
- Charge agents for data and APIs. An HTTP 402-style flow lets an agent pay for a data feed, API, or file in your token, inside the request itself — no accounts, no keys. See Charging Agents for Data and APIs.
- Contracts that pay for AI. A smart contract requesting an LLM or web attestation can attach a fee; the validator federation that fulfills the request earns it. See the LLM attestation provider and ATTEST.
Coming next
Hard, network-enforced spending limits via a MuSig2 co-signer: the agent holds one key, a policy daemon holds another, and the chain sees a single aggregate signature that cannot be produced outside policy. The SDK already ships MuSig2 (BIP-327); the co-signer service is specified and planned. Watch this section.