# OneSource - Blockchain Data API for AI Agents

> Three data families for AI agents: live Ethereum mainnet, Sepolia testnet, and Robinhood Chain RPC reads, plus Deepstate on-chain market data (order books, trades, candles, and analytics), plus The Standard Reserve (TSR), an on-chain reserve protocol on Robinhood Chain (supply, policy, epochs, auctions, branches, vaults, exit pressure). Pay per call or use batch/session mode: USDC on Base via x402, or pathUSD/USDC.e on Tempo via MPP. No API key required to start; a flat-rate monthly subscription is also available.

## Discovery

- [OpenAPI 3.1 spec, chain RPC family](https://api.onesource.io/openapi.json)
- [OpenAPI spec, Deepstate market-data family](https://api.onesource.io/deepstate/openapi.yaml)
- [OpenAPI spec, The Standard Reserve family](https://api.onesource.io/standard/openapi.yaml)
- [x402 well-known](https://api.onesource.io/.well-known/x402)
- [Pricing](https://api.onesource.io/api/pricing)
- [Networks](https://api.onesource.io/api/networks)

## Paid endpoints: chain RPC family

Deepstate market-data endpoints (`/deepstate/v1/*`) and The Standard Reserve endpoints (`/standard/v1/*`) are documented in their own specs above, not listed here.

- `GET /api/chain/allowance` ($0.003 USDC) - ERC20 allowance via allowance (eth_call) - how much a spender is approved to move from an owner's wallet
- `GET /api/chain/block-number` ($0.001 USDC) - Latest Ethereum block height - current chain tip via eth_blockNumber
- `GET /api/chain/block/{number}` ($0.003 USDC) - Fetch an Ethereum block header and transaction hashes by number, tag, or hex via eth_getBlockByNumber
- `POST /api/chain/call` ($0.005 USDC) - Simulate a read-only Ethereum contract call via eth_call - no transaction sent
- `GET /api/chain/chain-id` ($0.001 USDC) - Ethereum chain ID (EIP-155) via eth_chainId - confirm which chain a network is on
- `GET /api/chain/code/{address}` ($0.003 USDC) - Check if an Ethereum address is a contract via eth_getCode - returns deployed bytecode
- `GET /api/chain/contract/{address}` ($0.005 USDC) - Best-effort contract introspection via batched RPC - bytecode presence, token metadata, and ERC20-like/ERC721/ERC1155 classification
- `GET /api/chain/ens/{input}` ($0.005 USDC) - ENS resolve - turn a .eth name into an address, or an address into its primary .eth name, via eth_call on OneSource live Ethereum RPC
- `GET /api/chain/erc1155-balance` ($0.003 USDC) - ERC1155 token balance via balanceOf (eth_call) - how many copies of a token_id a wallet holds
- `GET /api/chain/erc20-balance` ($0.003 USDC) - ERC20 token balance for any Ethereum wallet - USDC, USDT, DAI, or any token - via balanceOf (eth_call) on OneSource live Ethereum RPC
- `GET /api/chain/erc20-transfers` ($0.005 USDC) - ERC20 Transfer logs via eth_getLogs - raw Transfer events for a token or wallet
- `GET /api/chain/erc721-tokens` ($0.008 USDC) - List every ERC721 NFT token_id a wallet owns in a collection via tokenOfOwnerByIndex (eth_call)
- `POST /api/chain/estimate-gas` ($0.004 USDC) - Estimate the gas a transaction will consume via eth_estimateGas before signing it
- `GET /api/chain/events` ($0.005 USDC) - Query Ethereum contract event logs via eth_getLogs - filter by contract, topic, and block range
- `GET /api/chain/live-balance` ($0.003 USDC) - Live wallet balance - native ETH plus up to 20 caller-supplied ERC20 tokens in one bounded RPC batch
- `GET /api/chain/network-info` ($0.001 USDC) - EVM network info - chain ID, block height, gas price, chain head age, and chain characteristics in one batched RPC call (eth_chainId + eth_blockNumber + eth_gasPrice + latest block header)
- `GET /api/chain/nft-metadata` ($0.008 USDC) - NFT metadata for ERC721 or ERC1155 tokens via eth_call, with IPFS, Arweave, data URI, and public HTTP(S) resolution
- `GET /api/chain/nft-owner` ($0.003 USDC) - Look up the current owner of an ERC721 NFT by token_id via ownerOf (eth_call)
- `GET /api/chain/nonce/{address}` ($0.003 USDC) - Next transaction nonce for any Ethereum wallet via eth_getTransactionCount - how many txs it has sent
- `GET /api/chain/pending` ($0.010 USDC) - Pending block - transactions not yet mined, via eth_getBlockByNumber("pending")
- `GET /api/chain/proxy/{address}` ($0.005 USDC) - Detect upgradeable proxy patterns (EIP-1967, UUPS, Transparent) via eth_getStorageAt - returns the implementation address behind a proxy
- `GET /api/chain/receipt/{hash}` ($0.005 USDC) - Transaction receipt via eth_getTransactionReceipt - status, gas, and event logs for a mined Ethereum transaction
- `GET /api/chain/storage` ($0.005 USDC) - Read a raw storage slot from any Ethereum contract via eth_getStorageAt
- `GET /api/chain/total-supply` ($0.003 USDC) - Total supply of an ERC20 or ERC721 token contract via totalSupply (eth_call)
- `GET /api/chain/tx/{hash}` ($0.008 USDC) - Full Ethereum transaction details by hash via eth_getTransactionByHash - from, to, value, calldata, block

## Calling

Each request without payment returns HTTP 402, advertising both protocols on the same route:

- `Payment-Required` (x402 v2): settled via [CDP's x402 facilitator](https://docs.cdp.coinbase.com/x402/welcome) on Base mainnet. This server is indexed in the [CDP x402 Bazaar](https://agentic.market) catalog, so agents using CDP's discovery API find it automatically.
- `WWW-Authenticate: Payment` ([MPP](https://mpp.dev), RFC 7235): settled directly on Tempo, no facilitator.

Pick whichever your client speaks: use [@x402/fetch](https://www.npmjs.com/package/@x402/fetch) or [mpp-go](https://github.com/tempoxyz/mpp-go) directly, or [AgentCash](https://agentcash.dev) (`npx agentcash try https://api.onesource.io`) which handles both flows automatically.

## Monthly subscription (no wallet required)

The same endpoints accept a OneSource API key as `Authorization: Bearer <key>`, billed as a flat monthly fee against a request quota rather than per call. No wallet, no stablecoin, no on-chain settlement: use this if the client cannot custody a private key, if billing has to be invoiced, or if per-call pricing at the rates above exceeds a flat monthly fee at your volume. Pricing and sign-up: [onesource.io/rest-api#pricing](https://onesource.io/rest-api#pricing).
