# bb84 protocol for autonomous agents — version 1

Canonical URL: https://bb84.com/agent/protocol.md · Published 2026-11-17 · Chain: bb84 L2, `eip155:42069000`
Reference clients: https://bb84.com/agent/bb84.py (Python ≥ 3.8, standard library only) · https://bb84.com/agent/bb84.ts (TypeScript, Node ≥ 18, `@noble/hashes`)
Also available through the bb84 MCP server as tool `get_protocol` and resource `bb84://protocol`. Human documentation: https://bb84.com/developers

This document is written for machines. It states every byte an implementation has to produce and every
rule the chain enforces. Both reference clients pass the test vectors in §12; run `python3 bb84.py selftest`
or `node bb84.js selftest` before trusting a copy.

## 0. Read this first

bb84 accounts have no private keys and no signatures. An account is a **one-time address (OTA)** derived
from the head of a keccak-256 **hash chain**; every spend reveals the next element of the chain inside a
transaction. The chain validates everything. Therefore:

- **You can use bb84 without the MCP server** if, and only if, you have your own runtime and can keep a
  32-byte secret **private and durable**. The wallet state (§11) is the money: whoever reads it can spend
  every balance, and nothing can revoke it short of emptying the wallet.
- **An assistant inside a chat must not do this.** It has no private storage; a secret in a transcript,
  prompt, log or ticket is a secret lost. Chat assistants use the MCP server
  (https://bb84.com/api/connect/mcp): the user's phone, or an on-chain capped AI budget, holds the keys.
- Everything below is public and unauthenticated: public HTTP endpoints with per-IP rate limits (§9) relay
  raw transactions to the chain, which accepts or refuses them by the rules in §5–§7.

## 1. System overview

| Item | Value |
|---|---|
| Chain | bb84 L2 (OP-Stack rollup on Ethereum mainnet), chainId `42069000`, block time 2 s |
| Transaction types | `0x7c` HashCommitTx, `0x7f` HashRevealTx (EIP-2718 typed; no ECDSA types for users) |
| Assets | USDC `0x50590ee131edc98a7213c91ae82e3e8987b9b5ee`, EURC `0x47dbbf8233cd91c16360bdb69e325f771fd9a667` — ERC-20, 6 decimals. ETH is not needed: hash transactions are gas-free (§5.5) |
| Hash function | keccak-256 everywhere (Ethereum's Keccak, padding `0x01…0x80`, **not** SHA3-256) |
| NullifierTree | `0x4200000000000000000000000000000000000042` — account state (§4.6) |
| StealthPool | `0x4200000000000000000000000000000000000044` — `registerCommitmentFor(address,bytes32)` (§7.4) |
| HandleRegistry | `0x4200000000000000000000000000000000000046` — legacy on-chain usernames (not used by this protocol) |
| OTA delete address | `0x4200000000000000000000000000000000000047` — a reveal to it deletes the account for good (§4.5) |
| MerchantRegistry | `0x4200000000000000000000000000000000000048` — slot 0 mapping: registered merchants (§7.3) |
| PaymentFeeConfig | `0x4200000000000000000000000000000000000049` — slot 0 `feeBps` (currently 50 = 0.5 %), slot 1 fee collector |
| CommitKeyRegistry | `0x420000000000000000000000000000000000004a` — pseudo-address for commit-key anchoring (§6) |
| Names | `<label>.bb84.eth` (ENS, resolvable on Ethereum mainnet via CCIP-read) and `<label>.bb84.com` |
| Public relay | `https://bb84.com/api/connect/web/…` (§9.1) · name service `https://bb84.com/api/ens/…` (§8, §9.2) |

Raw JSON-RPC (`https://bb84.com/rpc`) requires an app key and is **not** part of this protocol; the relay
endpoints expose everything an agent needs.

## 2. Notation

`‖` is byte concatenation. `keccak(x)` is keccak-256. `u32be(n)` / `u64be(n)` are big-endian fixed-width
integers. `hex` strings are lowercase, addresses are 20 bytes written `0x…`. `D_<name> = keccak(ascii(name))`
is a 32-byte domain separator. `RLP` is Ethereum's RLP; integers are encoded as their minimal big-endian
bytes (zero = empty string `0x80`), addresses as 20-byte strings, hashes as 32-byte strings.

Domains used: `D_OTA_SPEND = keccak("OP_OTA_SPEND_v1")`, `D_OTA_VIEW = keccak("OP_OTA_VIEW_v1")`,
`D_HASH_ADDR = keccak("OP_HASH_ADDR_v1")`, `D_NULLIFIER = keccak("OP_NULLIFIER_v1")`,
`D_COMMIT_BIND = keccak("OP_COMMIT_BIND_v1")`, `D_COMMIT_KEY = keccak("OP_OTA_COMMITKEY_v1")`.

## 3. Keys, hash chain, address

Root secrets of a wallet: `spendSK` (32 random bytes), `viewSK` (32 random bytes, reserved; not used by
this protocol but part of the state so the derivation matches the bb84 app), `r` (32 random bytes, one per
chain).

```
chain[0]        = keccak(D_OTA_SPEND ‖ spendSK ‖ r)
chain[k]        = keccak(chain[k-1])            for k = 1 … L,   L = 1000 (CHAIN_LENGTH)
commitment      = chain[L]                       ("chain head")
address         = last 20 bytes of keccak(D_HASH_ADDR ‖ commitment)
```

`L = 1000` for every account (StealthPool.OTA_CHAIN_LENGTH; a recipient activated with another depth is
treated as suspect, §7.2). The address is fixed by the **first** commitment; a chain renewal (§4.4) keeps the
address. Spend step number k (1-based) reveals `chain[L − k]`; the node checks
`keccak(revealed) == lastReveal` and stores `lastReveal = revealed`, `chainDepth −= 1`.

Never derive the next preimage from a local counter: read `depth` from the chain (§9.1) and reveal
`chain[depth − 1]`. The depth is the single source of truth and survives crashes, retries and parallel wallets.

## 4. Account lifecycle

### 4.1 Create
Generate `spendSK`, `viewSK`, `r`; derive the chain, `commitment`, `address` (§3). Store the state (§11) before
anything else.

### 4.2 Publish the commitment
`POST https://bb84.com/api/ens/commitment` with JSON `{"address": "0x…", "commitment": "0x<64 hex>"}` → 200
`{"address","commitment"}`. Only the one commitment that derives to the address is accepted; re-publishing is
idempotent. New entries are budgeted per client network (§9.3). The published commitment lets a **payer**
activate the account while paying it (§7.4). Publish right after creation; without it nobody can pay a fresh
address except through an L1 deposit.

### 4.3 Name (optional but recommended)
See §8. Claim a chosen name **before** publishing the commitment and before the first payment (the still
unpublished commitment is the proof of ownership), or take the server-assigned name
(`GET /api/ens/name/<address>`). Names make the account payable as `<label>.bb84.eth`, `<label>.bb84.com`
and via the link `https://bb84.com/pay/<label>.bb84.eth`.

### 4.4 Activation, spending, renewal
- **Activation** = `NullifierTree.commitmentOf[address] != 0`. It happens when the account first receives
  money: the payer (bb84 app, web wallet, this client, any merchant plugin) calls
  `StealthPool.registerCommitmentFor(address, publishedCommitment)` in a spend step of their own (§7.4), or an
  L1 deposit registers it. Until then the account can hold balances but cannot send; `depth` reads 0.
- **Spending** = one commit + one reveal (§5). Each step consumes one chain element and one nonce pair.
  Housekeeping steps (registering a recipient, anchoring a commit key) are spend steps too.
- **Renewal**: on the last element (`depth == 1`) the reveal must carry `newCommitment = head of a fresh chain`
  (new random `r`, same `spendSK`, `L = 1000`) and `newChainLength = 1000`; the node renews the account in the
  same transaction (`commitmentOf = newCommitment`, `lastReveal = newCommitment`, `chainDepth = 1000`). Setting
  `newCommitment` on any other step is invalid (`EarlyRenew`). An account whose last reveal carries no renewal
  ends with `depth 0` and can never spend again — money sent to it is locked. Persist the new `r` **before**
  sending the renewal reveal.
- A reveal that executes but reverts (e.g. token balance too low) still consumes the chain element and the
  pending commit: the step is gone, the balance unchanged.

### 4.5 Deletion
A reveal to `0x…0047` with empty data deletes the account: NullifierTree state is zeroed, the name is
released, and the node refuses every later transaction from that address. Money sent to a deleted address is
lost. Deletion requires the account to be at least 1 hour old (first reveal). This client does not delete.

### 4.6 On-chain state (NullifierTree storage, read via the relay §9.1)
Solidity mappings keyed by address: slot 2 `commitmentOf` (bytes32), slot 3 `lastReveal` (bytes32), slot 4
`chainDepth` (uint32), slot 73/74 pending commit + expiry block, slot 76 `creationTimestamp` (first reveal),
slot 77 `commitKeyLast` (bytes32), slot 78 `commitKeyDepth` (uint32). Mapping slot =
`keccak(pad32(address) ‖ pad32(slotNumber))`.

## 5. Transactions

Both types are typed transactions: `raw = type ‖ RLP(fields)`, submitted as `0x` hex; the transaction hash is
`keccak(raw)`. All amounts are integers. `chainId = 42069000`.

### 5.1 Nonces
A spend step uses two consecutive nonces of the account: the **commit** carries `N` (the account's current
nonce, `eth_getTransactionCount` "latest"), the **reveal** carries `N + 1`. Every binding (digest, nullifier,
hashCommit) uses the **reveal** nonce `N + 1`.

### 5.2 Reveal digest, nullifier, hashCommit
```
txDigest   = keccak(RLP([chainId, from, nonce_reveal, to, value, gas, gasFeeCap, gasTipCap, data, newCommitment, newChainLength]))
nullifier  = keccak(D_NULLIFIER   ‖ preImage ‖ u64be(nonce_reveal) ‖ txDigest)
hashCommit = keccak(D_COMMIT_BIND ‖ nullifier ‖ preImage ‖ txDigest ‖ u64be(nonce_reveal))
```
`to` is the 20-byte target (RLP empty string for contract creation — not used here). `newCommitment` is 32
zero bytes and `newChainLength` 0 except on a renewal step.

### 5.3 HashCommitTx (type 0x7c)
```
0x7c ‖ RLP([chainId, from, nonce_commit, hashCommit, gas, gasFeeCap, gasTipCap, expireAfterBlocks (, commitPreImage)])
```
- `gas`: wallets use 100000. `expireAfterBlocks` is a **uint8** (max 255); wallets use 250 (≈ 8 minutes at
  2 s blocks); 0 means the node default of 5. The reveal must be included within that many blocks after the
  commit, or the commit expires and a new step (new commit, same preimage, new nonce pair) is needed.
- `commitPreImage` (32 bytes) is **only present** when the account has an active commit key (§6). Without a key
  the list has exactly 8 fields.
- Consensus: the account must be registered and not deleted; **first commit wins** — while an unexpired
  pending commit exists, every further commit from the account is rejected (`PendingExists`) until the reveal
  consumes it or it expires.

### 5.4 HashRevealTx (type 0x7f)
```
0x7f ‖ RLP([chainId, from, nonce_reveal, to, value, gas, gasFeeCap, gasTipCap, data, nullifier, preImage, viewTag, newCommitment, newChainLength])
```
`viewTag` is 0. Consensus checks, in order: account registered; `chainDepth > 0`; `keccak(preImage) ==
lastReveal`; `nullifier` as in §5.2; nullifier not spent; renewal fields only at `depth == 1` and with
`newChainLength != 0`; `hashCommit` of the pending (or same-block) commit equals the recomputed value and the
commit has not expired (a reveal without a matching commit is invalid since 2026-11-10). The nonce rule of
§5.1 is enforced by the ordinary account nonce. After execution — even if the EVM call reverted — the node
stores `lastReveal = preImage`, decrements `chainDepth`, marks the nullifier spent, clears the pending commit,
sets `creationTimestamp` on the first reveal, and applies a renewal.

### 5.5 Fees and limits
- Hash transactions are **gas-free**: the node debits nothing (commits always; reveals whenever `to` is set,
  which covers every payment, registration, anchoring and deletion). `gasFeeCap` and `gasTipCap` must still be
  set; the pool refuses a hash transaction with `gasFeeCap > 1 gwei` (`MaxHashTxFeeCap`). Use the relay's
  `fees` endpoint (§9.1) and clamp to 1 gwei; on "underpriced" double both (tip ≤ fee cap) up to the cap.
- From 2026-11-24 00:00 UTC a gas-free hash transaction is invalid if `gas > 500000` or `data > 4096 bytes`.
  Wallets use gas 80000 (friends-and-family transfer), 160000 (goods & services), 200000 (recipient
  registration), 60000 (self-targeted housekeeping); commits 100000. Data is at most 68 + 1 + 280 bytes (§7.1).
- Per account the pool admits at most **10 transactions per minute** (sliding window); the relay allows
  120 sends per 10 minutes per IP (§9.3).
- A payment therefore costs the payer nothing but chain steps: one step per transfer, plus one for a fresh
  recipient's registration (§7.4), plus one when a commit key is (re-)anchored (§6). Goods & services payments
  carry a 0.5 % fee taken from the recipient's side (§7.3).

### 5.6 Fork timestamps (L2 block time, consensus)
`HashCommitFirstWinsTime 1792540800` (2026-10-21), `HashCommitRequiredTime 1794268800` (2026-11-10),
`HashCommitAuthTime 1794873600` (2026-11-17), `GasFreeHashTxStrictTime 1795478400` (2026-11-24). All are
active or scheduled; a client written to this document is valid before and after each of them.

## 6. Commit keys (authenticated commits)

Since 2026-11-17 an account can carry a second hash chain, the **commit key**, so that nobody else can submit
commits for it (a foreign commit would, via first-commit-wins, block the owner for up to 255 blocks, again and
again). Accounts without a key keep accepting unauthenticated commits; a key is optional but recommended for
any account that holds money.

```
seed_e      = keccak(D_COMMIT_KEY ‖ spendSK ‖ address(20) ‖ u32be(epoch))
element_i   = keccak^i(seed_e)                       i = 0 … 2048
anchor      = element_2048                           (COMMIT_KEY_LENGTH = 2048)
```
- **Anchor** (one spend step): a reveal to `0x…004a` with `value 0` and `data = anchor(32) ‖ u32be(2048)`
  (exactly 36 bytes, anchor and depth non-zero). The node stores `commitKeyLast = anchor`,
  `commitKeyDepth = 2048`. A new anchor replaces any previous key.
- **Authenticated commit**: while `commitKeyLast != 0 && commitKeyDepth > 0` ("keyed") every commit of the
  account **must** carry `commitPreImage = element_{depth−1}` with `keccak(commitPreImage) == commitKeyLast`
  (`AuthRequired` / `InvalidAuth` otherwise). After it the node sets `commitKeyLast = commitPreImage`,
  `commitKeyDepth −= 1`.
- Rule matrix: not keyed and no `commitPreImage` → accepted; not keyed but `commitKeyLast != 0` (exhausted
  key) and a `commitPreImage` given → `KeyExhausted` (send unauthenticated commits and re-anchor); no key at all
  but `commitPreImage` given → `NoCommitKey`; keyed and no `commitPreImage` → `AuthRequired`.
- **Re-anchor** with `epoch + 1` once `commitKeyDepth ≤ 64`; never reuse an epoch (its elements are public).
  To find the current epoch from chain state, search epochs 0…31: `keccak(element_{depth−1}) == commitKeyLast`
  (or `seed_e == commitKeyLast` at depth 0).
- Read `commitKey {last, depth}` from the relay (§9.1). The reference clients anchor epoch 0 before the first
  payment of a fresh account (when at least 3 chain steps remain) and re-anchor automatically.

## 7. Payments

### 7.1 Transfer calldata
```
data = 0xa9059cbb ‖ pad32(recipient) ‖ u256be(amount)            (68 bytes: ERC-20 transfer(address,uint256))
     [‖ paymentType(1) ‖ memo(UTF-8, ≤ 280 bytes)]
```
`paymentType` is `0x00` friends & family or `0x01` goods & services. With an empty memo the data is the bare
68 bytes (friends & family) or 69 bytes with `0x01` (goods & services). The node strips everything after byte
68 before executing the token call and stores the full data in the transaction, so wallets read the memo back
from the transaction input. Cut a memo at ≤ 280 bytes only on a UTF-8 character boundary. The reveal's `to` is
the token contract, `value` is 0. Amounts are in base units (`12.50 USDC = 12500000`).

### 7.2 Recipient checks (do them before every payment)
Read the recipient's state from the relay (§9.1):
1. `deleted` → do not pay (funds would be lost).
2. `registered && depth == 0` → do not pay ("locked": it can never spend again).
3. `registered && unrevealed && depth != 1000` → "suspect": it was activated by someone else with an unusual
   depth and never spent; pay only if the user explicitly accepts the risk.
4. `!registered && !isContract && !isMerchant` → it needs registration first (§7.4) using its
   `publishedCommitment`; if none is published, do not pay (the money would arrive, but the owner could never
   spend it until someone registers it).
Contracts (`isContract`) and registered merchants (`isMerchant`) need no registration.

### 7.3 Goods & services and merchants
A payment marked goods & services (`0x01`) transfers the full amount from the payer; the node forwards
`feeBps / 10000` of it (currently 0.5 %) from the recipient to the fee collector in the same transaction, so
the recipient receives 99.5 %. Payments to a registered merchant (`isMerchant`) must be marked goods &
services (the reference clients do this automatically); it is what buyer protection and merchant tooling
expect. Friends & family payments carry no fee.

### 7.4 Registering a fresh recipient
One spend step with `to = StealthPool (0x…0044)`, `value 0`, gas 200000 and
```
data = 0x79176c17 ‖ pad32(recipient) ‖ publishedCommitment(32)     // registerCommitmentFor(address,bytes32)
```
The contract registers the commitment with chain length 1000 if the recipient is not registered yet (and is a
no-op otherwise), so a race with the owner's own activation cannot fail the step. The node rejects a
commitment that does not derive to the address. Then pay with a normal transfer step.

### 7.5 Reference order of a payment
`anchor commit key if due (§6)` → `register recipient if needed (§7.4)` → `transfer (§7.1)`. Check first
that `depth ≥ number of steps` and `balance ≥ amount`, so that nothing is sent when the payment cannot
complete. Each step: build commit + reveal with the fee caps from `fees`, send the commit, wait for its
receipt (≤ 90 s; it stays revealable for `expireAfterBlocks`), send the reveal, wait for its receipt, check
`status == 0x1`. If the reveal is not confirmed in time, do **not** retry blindly: read `depth`; if it moved,
the step landed.

## 8. Names

`<label>.bb84.eth` — `label` matches `^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$` (1–32 chars). One name per
address. Not claimable: system words (bb84, admin, support, …), punycode (`xn--`), the auto-name shape
`adjective-noun-number` (e.g. `swift-moon-142`) and the AI-budget prefixes `claude-`, `chatgpt-`, `gemini-`,
`copilot-`, `ai-` (those name AI budgets managed by the MCP server).

| Call | Purpose |
|---|---|
| `POST /api/ens/register {address, label, commitment}` | Claim `label` for a **fresh** account (never activated, commitment not yet published): the commitment that derives to the address is the proof. 200 `{…}`; 409 taken/reserved/`_FRESH_LOCKED`; later renames need the app's on-chain ownership proof. |
| `GET /api/ens/name/<address>` | The account's name; assigns a random auto-name on first call (budgeted per network, §9.3). |
| `GET /api/ens/label/<address>` | The label without assigning one: `{"label": null}` if none. |
| `GET /api/ens/address/<label>` | Resolve: 200 `{address, name, commitment?}`; 404 unknown; 409 `{"reserved": true}` or `{"deleted": true}` (never pay a deleted name). |
| `GET /api/ens/check/<label>` | Availability: `available | taken | reserved | auto | invalid` (never reveals the holder). |
| `GET /api/ens/commitment/<address>` / `POST /api/ens/commitment` | Published commitment (§4.2); 404 none or deleted. |
| `GET /api/ens/profile/<address>` | Public profile (display name, avatar, location), set only from the bb84 app with an ownership proof. |

Every name is a real ENS name: `bb84.eth`'s resolver answers via CCIP-read on Ethereum mainnet;
`addr(node, 2189552648)` (ENSIP-11 coin type `0x80000000 | 42069000`) is the L2 address, text records `url`,
`description`, `name`, `avatar`, `location`, `com.bb84.pay`, `com.bb84.merchant`; `payment-preference`
(ENSIP-31) lists USDC and EURC on `eip155:42069000`. `<label>.bb84.com` resolves to the same account
(DNSSEC import). Payment link: `https://bb84.com/pay/<label>.bb84.eth[?amount=…&asset=USDC|EURC&memo=…]`.

## 9. Endpoints

### 9.1 Relay (`https://bb84.com/api/connect/web/…`, JSON, no authentication)
| Call | Answer |
|---|---|
| `GET chain/<address>` | `{address, registered, depth, nonce, isContract, isMerchant, deleted, unrevealed?, publishedCommitment, balances: {USDC, EURC} (base units as strings), name, commitKey: {last (0x-hex32), depth}}` — one call for your own state and for every recipient check |
| `GET fees` | `{gasFeeCap, gasTipCap, blockNumber}` — already clamped to the 1 gwei cap, as the wallets compute it |
| `POST send {raw}` | `{txHash}` — `raw` = `0x7c…` or `0x7f…` hex, ≤ 4 KB; 422 `{error, code: "rejected"}` with the node's reason when the pool refuses it (nothing was sent) |
| `GET tx/<txHash>` | `{receipt: null}` while pending, else `{receipt: {status ("0x1" ok / "0x0" reverted), blockNumber, txHash}}` |

Errors are `{"error": "<text>", "code": "<machine code>"?}` with an HTTP status ≥ 400; 429 means the IP's
budget is used up (wait, then retry).

### 9.2 Name service (`https://bb84.com/api/ens/…`) — see §8.

### 9.3 Limits (per client IP unless stated)
Relay reads 300 / 10 min; `send` 120 / 10 min; name service: 60 new names and 60 new commitments per hour per
network (over budget: 429 `{"rateLimited": true}` for addresses not yet registered on-chain — retry later),
`/api/ens/register` 10 / min; node: 10 hash transactions per account per minute; nginx: 100 requests/s.
Behave accordingly: poll receipts every 1.5 s, not faster; never loop on 429.

## 10. Receiving money, selling, and the MCP server

Share the name, the address or the pay link. Anyone paying with the bb84 app, the web wallet, a merchant plugin
or this client registers a fresh account automatically on first payment (§7.4). Deposits from Ethereum
mainnet are made through https://bb84.com (the L1 portal registers the commitment too). To sell a service to
other agents, serve HTTP 402 with the x402 scheme `bb84-prepaid` (https://bb84.com/api/x402/supported,
https://bb84.com/developers#x402) — the bb84 MCP server pays such requests on its users' behalf. To let a
human's bb84 app pay *you* a proposal, use the MCP server's `request_payment` / `propose_payment` flows
(MCP, OAuth 2.1, https://bb84.com/developers#mcp); they are for assistants acting for a user, not for a
wallet of your own.

## 11. Wallet state and security

The reference clients store one JSON object (file mode 0600):
```
{"version": 1, "chainId": 42069000, "spendSK": hex32, "viewSK": hex32, "r": hex32, "chainLength": 1000,
 "address": "0x…", "commitment": hex32, "label": "alice" | null, "commitKeyEpoch": 0, "createdAt": unix,
 "pendingRenewal": {"r": hex32, "commitment": hex32} | absent}
```
Everything else (the chain, commit-key elements) is recomputed. Rules: write the state **before** sending a
transaction that depends on it (new `r` before a renewal reveal, `commitKeyEpoch` after an anchor); keep one
writer per wallet (parallel senders will collide on nonces and chain depth); back the file up where only you
can read it; never print `spendSK`/`r`. The derivation equals the bb84 app's (`spendSK`, `viewSK`, `r`,
`chainLength` are its per-address fields), so a human could later import such an account into the app from a
backup; the reverse — exporting an app account into an agent — is a human's decision, not a protocol step.

What a leaked state file allows: spending every balance of this address and of every renewed chain of it
(renewals derive from `spendSK`). What it does not allow: anything about other wallets.

## 12. Test vectors

Wallet (fixed secrets):
```
spendSK     4a30ffbf97c7df9f07ec26e718a8f6cfaaa13d074dd0deddef47e3dde8d663ba
viewSK      722fed365ef7c360f5d431b36ef76148794d7f9611aa5e4128f0ffc59ff58f22
r           659298cde88f0e5b10d8b00b35eb2a2f14ed97bcb20f619d38425df6a02650d2
chain[0]    cafc5af443b7a8c8964080e75708241336feb636055a06c410d93bb2a2da9dd5
chain[999]  d08271239a2797952933f75c03a827f77597c64b5f373cac11336f6bb8ba3592
commitment  419d3b69febc6b506ddf7e7cb6f7cf4c428344822b6151031e1833781269caba   (= chain[1000])
address     0xb4b030d0d7d47943e039a6eddc5b711f8827efe4
```
Spend step: transfer 1.5 USDC (`1500000`) to `0x42ed65db186dfdbc1ba5f0e979dceaeb4f63014d`, goods & services,
memo `Kaffee · pr_0123456789abcdef01234567`; nonce 0 (commit) / 1 (reveal), gas 160000, gasFeeCap
1000000000, gasTipCap 1500000, preImage = chain[999], no commit key, no renewal:
```
data    a9059cbb00000000000000000000000042ed65db186dfdbc1ba5f0e979dceaeb4f63014d000000000000000000000000000000000000000000000000000000000016e360014b616666656520c2b72070725f303132333435363738396162636465663031323334353637
commit  7cf84b840281ec0894b4b030d0d7d47943e039a6eddc5b711f8827efe480a0c9b79dcea5bc0094fa4568976f981d1c28714fe04db66190d86bc13e668b3267830186a0843b9aca008316e36081fa
reveal  7ff9010f840281ec0894b4b030d0d7d47943e039a6eddc5b711f8827efe4019450590ee131edc98a7213c91ae82e3e8987b9b5ee8083027100843b9aca008316e360b86aa9059cbb00000000000000000000000042ed65db186dfdbc1ba5f0e979dceaeb4f63014d000000000000000000000000000000000000000000000000000000000016e360014b616666656520c2b72070725f303132333435363738396162636465663031323334353637a0478fb7cbb79211b19b3533af1c9319ca030dd83b04249f9a659348e8e23e8389a0d08271239a2797952933f75c03a827f77597c64b5f373cac11336f6bb8ba359280a0000000000000000000000000000000000000000000000000000000000000000080
```
Other constants: `keccak("") = c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`;
`keccak("abc") = 4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45`;
`registerCommitmentFor` selector `79176c17`; registration calldata for recipient
`0x42ed…014d` and commitment `0xab…ab` = `79176c17` ‖ `00…42ed65db186dfdbc1ba5f0e979dceaeb4f63014d` ‖ `ab`×32;
`toUnits("12.5") = 12500000`.

## 13. Conformance checklist for implementers

1. keccak-256 (Keccak padding) — vectors in §12.
2. Chain, commitment, address — §3, vectors.
3. RLP exactly as §5.3/§5.4 (8-field commit without key, 9 with; 14-field reveal); byte-identical to the vectors.
4. Preimage from on-chain `depth`, never a counter; nonces `N` / `N+1`.
5. Recipient checks §7.2 before every payment; registration §7.4; goods & services for merchants §7.3.
6. Commit key handling §6 (authenticated commits when keyed; anchor and re-anchor).
7. Renewal on the last element §4.4, with the new `r` persisted first.
8. Fee caps ≤ 1 gwei, gas and data within §5.5, polite polling §9.3.
9. Secrets never leave the agent's private storage (§0, §11).

## 14. Versioning

This is protocol version 1 (2026-11-17). Byte layouts and derivations are consensus and do not change
without a new chain fork; forks are listed in §5.6 with their activation timestamps. Endpoint additions are
backwards compatible; removals or changes of semantics bump the version number in the title and in the
reference clients' `PROTOCOL_VERSION`. Check https://bb84.com/agent/protocol.md for the current version.
