Path I
Use the research API
One HTTP call, zero SDK. Returns either a cited envelope (200) or an x402 challenge your agent can pay (402).
1curl -s "https://www.bucket.foundation/api/research?q=mitochondrial+atp+synthesis&tier=insight" \2 -H "accept: application/json"
response (payment challenge)
http
1HTTP/1.1 402 Payment Required2content-type: application/json3x-bucket-proxy: v14 5{6 "data": null,7 "receipt": {8 "tier": "insight",9 "status": "payment_required",10 "price_usd": 0.005,11 "asset": "USDC",12 "network": "base-sepolia",13 "pay_to": "0xa91115B1AB8412f380Fd62446F523559F668b96B",14 "challenge": "eyJ4NDAyVmVyc2lvbiI6Miwi...",15 "demo": true16 },17 "error": {18 "code": "payment_required",19 "message": "Pay the x402 challenge from receipt.challenge to unlock."20 }21}
Path II
Run a paying agent
Decode the 402 challenge, sign the EIP-712 payment, retry with X-PAYMENT. Full helper in the feed402 ref agent.
1// Node 20+ · npm i viem2import { createWalletClient, http, parseUnits } from "viem";3import { privateKeyToAccount } from "viem/accounts";4import { baseSepolia } from "viem/chains";5 6const account = privateKeyToAccount(process.env.WALLET_PK as `0x${string}`);7const client = createWalletClient({ account, chain: baseSepolia, transport: http() });8 9// 1. naive call — expect 402 back with an x402 challenge10const naive = await fetch(11 "https://www.bucket.foundation/api/research?q=" +12 encodeURIComponent("circadian disease") + "&tier=insight"13);14const env = await naive.json();15 16if (naive.status === 402) {17 // 2. decode challenge, sign EIP-712 payment intent, retry with X-PAYMENT header18 const challenge = JSON.parse(atob(env.receipt.challenge));19 const accepts = challenge.accepts[0];20 const payment = await signX402Payment(client, accepts); // see feed402 ref agent21 const paid = await fetch(naive.url, { headers: { "X-PAYMENT": payment } });22 const cited = await paid.json();23 24 console.log(cited.data); // the answer25 console.log(cited.citation); // doi · canonical_url · license26 console.log(cited.receipt); // tier · price · on-chain tx hash27}
1# python 3.11+ · pip install requests web3 eth-account2import base64, json, os, requests3from eth_account import Account4from eth_account.messages import encode_typed_data5 6acct = Account.from_key(os.environ["WALLET_PK"])7 8# 1. naive call — expect 4029r = requests.get(10 "https://www.bucket.foundation/api/research",11 params={"q": "mitochondrial disease", "tier": "insight"},12)13env = r.json()14 15if r.status_code == 402:16 # 2. decode x402 challenge, sign, retry17 challenge = json.loads(base64.b64decode(env["receipt"]["challenge"]))18 payment = sign_x402_payment(acct, challenge["accepts"][0]) # see feed402 ref19 paid = requests.get(r.url, headers={"X-PAYMENT": payment})20 cited = paid.json()21 print(cited["data"]) # the answer22 print(cited["citation"]) # doi · canonical_url · license23 print(cited["receipt"]) # tier · price · tx_hash
Path III
Become a data merchant
You own a corpus. You want citation revenue. Publish a feed402 manifest and register your wallet. No gatekeeper.
/.well-known/feed402.json
json
1{2 "name": "your-data-provider",3 "version": "1.0.0",4 "spec": "feed402/0.2",5 "chain": "base-sepolia",6 "wallet": "0xYOUR_BASE_WALLET_ADDRESS",7 8 "tiers": {9 "raw": { "path": "/raw", "price_usd": 0.05, "unit": "row" },10 "query": { "path": "/query", "price_usd": 0.01, "unit": "call" },11 "insight": { "path": "/insight", "price_usd": 0.002, "unit": "call" }12 },13 14 "citation_policy": "CC-BY-4.0",15 "citation_types": ["source"],16 "contact": "ops@your-domain.com"17}
- 01Clone feed402: git clone https://github.com/gianyrox/feed402
- 02Serve GET /.well-known/feed402.json with your tiers + Base wallet
- 03Wrap your data endpoint with x402 middleware (USDC on Base)
- 04Return the feed402 envelope { data, citation, receipt } on every paid call
- 05Post your manifest URL to ops@bucket.foundation — we index it
build the past · build history · bucket is the new renaissance