# Integra Protocol: the LCP profiles > The 58 profiles of @integraledger/lcp 0.6.3, each the normative rules of a pairing or a document, as lcp/profiles/ holds them. Index: https://lcp.integraledger.com/profiles/llms.txt. # README.md Source: https://lcp.integraledger.com/profiles/README.md # LCP profiles This folder holds the normative rules of every pairing `@integraledger/lcp` serves: how a payment protocol, checkout or transport carries an ATR's hash, what each party checks, and how a payment of that form is read back from its ledger. It is for anyone who implements a client, a resource server or a settler of a pairing, in any language. `@integraledger/lcp` is one implementation of these rules, and its vectors in `../vectors/` hold them as data. After this page you can find the profile that defines any pairing and read its rules in the terms they share. ## The profiles Each profile is one file, named by its id with `/` written as `-`, whose first line gives that id. A profile defines one or more pairings, each a form of one protocol. Whether a pairing is confirmed, its coverage and what a record of it proves are the package's registry data, which the [pairings reference](https://lcp.integraledger.com/reference/pairings) lists for every pairing. | Profile | Pairings it defines | |---|---| | [`ack/payment-request`](ack-payment-request.md) | `ack/payment-request` | | [`acp/checkout/session-id`](acp-checkout-session-id.md) | `acp/checkout/delegated`, `acp/checkout/undelegated` | | [`ap2/checkout-mandate`](ap2-checkout-mandate.md) | `ap2/checkout-mandate` | | [`ap2/checkout-mandate/x402`](ap2-checkout-mandate-x402.md) | `ap2/checkout-mandate/x402` | | [`card/mastercard-agent-pay`](card-mastercard-agent-pay.md) | `card/mastercard-agent-pay` | | [`card/mastercard-vi`](card-mastercard-vi.md) | `card/mastercard-vi/autonomous`, `card/mastercard-vi/immediate` | | [`card/seller-reference`](card-seller-reference.md) | `card/seller-reference` | | [`card/visa-tap`](card-visa-tap.md) | `card/visa-tap` | | [`card/visa-vic`](card-visa-vic.md) | `card/visa-vic` | | [`mpp/charge`](mpp-charge.md) | `mpp/charge/evm/authorization`, `mpp/charge/evm/permit2`, `mpp/charge/evm/transaction`, `mpp/charge/evm/hash`, `mpp/charge/usdc/evm`, `mpp/charge/usdc/gateway`, `mpp/charge/card`, `mpp/charge/stripe`, `mpp/charge/lightning`, `mpp/session/lightning` | | [`mpp/charge/nearintents`](mpp-charge-nearintents.md) | `mpp/charge/nearintents` | | [`mpp/charge/solana`](mpp-charge-solana.md) | `mpp/charge/solana`, `mpp/charge/solana/unsponsored` | | [`mpp/charge/tempo/split-memo`](mpp-charge-tempo-split-memo.md) | `mpp/charge/tempo/split-memo`, `mpp/charge/tempo/split-memo/push` | | [`mpp/charge/usdc/solana`](mpp-charge-usdc-solana.md) | `mpp/charge/usdc/solana` | | [`mpp/charge/usdc/stacks`](mpp-charge-usdc-stacks.md) | `mpp/charge/usdc/stacks` | | [`mpp/charge/xrpl`](mpp-charge-xrpl.md) | `mpp/charge/xrpl` | | [`mpp/method/lcp`](mpp-method-lcp.md) | `mpp/charge/lcp/hedera` | | [`mpp/session/evm-tempo`](mpp-session-evm-tempo.md) | `mpp/session/evm`, `mpp/session/tempo`, `mpp/subscription/tempo` | | [`mpp/session/hedera-solana-xrpl`](mpp-session-hedera-solana-xrpl.md) | `mpp/session/hedera/stock`, `mpp/session/solana/memo`, `mpp/session/solana/stock`, `mpp/session/xrpl`, `mpp/session/xrpl/stock` | | [`mpp/subscription/solana`](mpp-subscription-solana.md) | `mpp/subscription/solana` | | [`mpp/subscription/stripe`](mpp-subscription-stripe.md) | `mpp/subscription/stripe` | | [`spend-permissions/eip155`](spend-permissions-eip155.md) | `spend-permissions/eip155` | | [`ucp/checkout/agent-signed`](ucp-checkout-agent-signed.md) | `ucp/checkout/agent-signed` | | [`ucp/checkout/legal-context`](ucp-checkout-legal-context.md) | `ucp/checkout/ap2-mandate`, `ucp/checkout/unsigned`, `ucp/booking/ap2-mandate`, `ucp/booking/unsigned` | | [`x402/auth-capture/eip155`](x402-auth-capture-eip155.md) | `x402/auth-capture/eip155/eip3009`, `x402/auth-capture/eip155/permit2` | | [`x402/batch-settlement/cloudflare`](x402-batch-settlement-cloudflare.md) | `x402/batch-settlement/cloudflare` | | [`x402/batch-settlement/eip155`](x402-batch-settlement-eip155.md) | `x402/batch-settlement/eip155` | | [`x402/batch-settlement/solana`](x402-batch-settlement-solana.md) | `x402/batch-settlement/solana` | | [`x402/exact/algorand/note`](x402-exact-algorand-note.md) | `x402/exact/algorand` | | [`x402/exact/aptos`](x402-exact-aptos.md) | `x402/exact/aptos` | | [`x402/exact/cardano`](x402-exact-cardano.md) | `x402/exact/cardano`, `x402/exact/cardano/lock` | | [`x402/exact/casper`](x402-exact-casper.md) | `x402/exact/casper` | | [`x402/exact/ccd`](x402-exact-ccd.md) | `x402/exact/ccd` | | [`x402/exact/eip155/eip3009`](x402-exact-eip155-eip3009.md) | `x402/exact/eip155/eip3009` | | [`x402/exact/eip155/erc7710`](x402-exact-eip155-erc7710.md) | `x402/exact/eip155/erc7710` | | [`x402/exact/eip155/erc7710-salt`](x402-exact-eip155-erc7710-salt.md) | `x402/exact/eip155/erc7710-salt` | | [`x402/exact/eip155/gateway-batched`](x402-exact-eip155-gateway-batched.md) | `x402/exact/eip155/gateway-batched` | | [`x402/exact/eip155/permit2`](x402-exact-eip155-permit2.md) | `x402/exact/eip155/permit2` | | [`x402/exact/hedera`](x402-exact-hedera.md) | `x402/exact/hedera`, `x402/exact/hedera/transfer-executor` | | [`x402/exact/lnbtc/payment-hash`](x402-exact-lnbtc-payment-hash.md) | `x402/exact/lnbtc/payment-hash` | | [`x402/exact/near/memo`](x402-exact-near-memo.md) | `x402/exact/near` | | [`x402/exact/polkadot/lcp-assets-remark`](x402-exact-polkadot-lcp-assets-remark.md) | `x402/exact/polkadot/lcp-assets-remark` | | [`x402/exact/solana`](x402-exact-solana.md) | `x402/exact/solana` | | [`x402/exact/starknet`](x402-exact-starknet.md) | `x402/exact/starknet` | | [`x402/exact/stellar/precondition`](x402-exact-stellar-precondition.md) | `x402/exact/stellar/precondition` | | [`x402/exact/sui`](x402-exact-sui.md) | `x402/exact/sui` | | [`x402/exact/tron/lcp-trc20-memo`](x402-exact-tron-lcp-trc20-memo.md) | `x402/exact/tron/lcp-trc20-memo` | | [`x402/exact/tvm`](x402-exact-tvm.md) | `x402/exact/tvm` | | [`x402/exact/xrpl`](x402-exact-xrpl.md) | `x402/exact/xrpl` | | [`x402/upto/eip155/permit2`](x402-upto-eip155-permit2.md) | `x402/upto/eip155/permit2` | | [`x402/upto/solana`](x402-upto-solana.md) | `x402/upto/solana` | | [`x402/upto/xrpl`](x402-upto-xrpl.md) | `x402/upto/xrpl` | Five documents define no pairing: - [`read-status`](read-status.md): what the read of a landed payment or agreement answers, and the rules that choose the answer, for every pairing that has a read. - [`legal-context-return`](legal-context-return.md): what a sale paid after its agreement carries, and how the buyer's agent returns for the charge. - [`x402/request-commitment`](x402-request-commitment.md): the request an x402 challenge answers, committed in the ATR. - [`ucp/payment-handler/x402`](ucp-payment-handler-x402.md), with its schema [`ucp-payment-handler-x402.schema.json`](ucp-payment-handler-x402.schema.json): the UCP payment handler `com.integraledger.lcp.x402`, published at `https://lcp.integraledger.com/ucp/x402/2026-10-02`. - [The A2A extension](a2a-legal-context-v1.md) `https://lcp.integraledger.com/a2a/legal-context/v1`, published at that address. ## Terms every profile uses - **ATR, H and L.** The ATR, the Agentic Transaction Record, is the agreement's record. H is the SHA-256 of the ATR's exact bytes, written `0x` and 64 lowercase hex digits, and L is an `https` URL that serves those bytes. Before it signs or pays, a client fetches L, hashes the bytes it receives and compares the result with H as 32 bytes. - **H's LCP string** is `lcp:sha256:` followed by H, 77 bytes: the form H takes in a memo, a note or a text field. - **The agreement's value** is SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` followed by H's 32 bytes (`read-status`, rule 1). On a pairing whose single-use value is H, or H's low bits, an agreement carries this value, or its low bits, in H's place, so that an agreement and a payment under one H never share a single-use value. - **Coverage.** `full`: the payer's own signed act, on a public ledger, carries all of H, a 256-bit digest over a preimage that holds H, or on Starknet H's low 250 bits. `none`: no public act the payer signs carries H. A payment at coverage `none` follows an agreement carrying H, made on a pairing at coverage `full`; what it carries of H (its `link`: H, a pointer to the agreement, or nothing) is a link, never a proof. - **Confirmed.** Whether something outside lcp, a recorded run or a published sample, has shown the form as its profile defines it. - **Settler.** The party that submits a payment the buyer signed and pays its fee where the form says so; an x402 facilitator is one. - **The parts of an implementation.** A rule names the step that makes a check by the name lcp gives it: `read` (the client's reading of an offer), `advertise` (the seller's placing of H and L in an offer), `pairingsOf` (the pairings an MPP challenge offers), `build` and `complete` (the client's payment), `bound` (the resource server's check that the payment carries H), `reference` (the keys of a read), `status` (the read of what the ledger shows), `recover` (the value a landed transaction carries in H's place) and `fetchPresented` (the read of a payment its payer broadcast). "`bound` refuses X" means that a resource server refuses X before anything moves. An implementation in another language makes the same checks, in the same order, under whatever names it uses. ## How the rules are written - Each numbered rule is a requirement on the party it names, stated in the indicative: "the client does not sign" means that a client implementing the profile must not sign. "Should" marks a recommendation. The profiles use the keywords of BCP 14 (RFC 2119, RFC 8174) only where they quote another specification. - A rule cites another profile's rule by that profile's id and the rule's number (`mpp/charge` rule 5), and a rule of its own profile by the number alone (rule 5). - **The read kit.** The rule of a profile that names the cases of `read-status.json` that cannot arise on its pairing's ledger (headed *The read kit*, *Declared inapplicable to the read kit* or *Cases that cannot arise*) binds the conformance vectors an implementation runs, not the wire: a pairing's vectors skip a case of the kit only where that rule states it, each statement resting on a fact of the ledger or of the pairing's data (`read-status`, rule 28). --- # a2a-legal-context-v1.md Source: https://lcp.integraledger.com/profiles/a2a-legal-context-v1.md **LCP A2A extension `https://lcp.integraledger.com/a2a/legal-context/v1`.** This extension targets A2A 1.0. 1. A server that supports it declares it in `capabilities.extensions[]`, and echoes it in `A2A-Extensions` when a client requests it. The extension takes no `params`. 2. For a task with an ATR, the server puts `{"type":"sha256","value":H,"legalContextUrl":L}` in the Task's `metadata` under this URI. H is the SHA-256 of the ATR's exact bytes, as `0x` and 64 hex digits, and L is an `https` URL of at most 2048 characters that serves those bytes. The server writes the value when the request's `A2A-Extensions` names this URI; a server may also write it otherwise, and a client that did not activate the extension may ignore it. 3. The client fetches L, hashes what it receives and compares with H before paying. 4. A2A signs nothing per task: what binds H to the payment is the payment protocol used. --- # ack-payment-request.md Source: https://lcp.integraledger.com/profiles/ack-payment-request.md **LCP profile `ack/payment-request`.** This profile targets ACK protocol version 2025-05-04. 1. The server's Payment Request `id` is `lcp:sha256:H`, signed in its Payment Request token, and the 402 body carries `"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}` beside it. The body names the token `paymentRequestToken`, as ACK's SDKs write it from 0.10.0, or `paymentToken`, as they wrote it before (`agentcommercekit/ack` commit `27e3ffb`, 2025-09-01; at its parent `6fc3247`, `packages/ack-pay/src/create-payment-request-body.ts:28-31`). A reader takes either name; a body that carries both carries one token under both names, and one whose two members differ is refused as a malformed token is. 2. The client reads H from the signed token and compares it with `legalContext.value` as 32 decoded bytes, then fetches L, hashes what it receives and compares again; on any mismatch it does not pay. 3. The client signs nothing that carries H: ACK defines no payer signature. 4. After settlement the receipt's `credentialSubject` carries the token, under either name by the same rule (`create-payment-receipt.ts:30-33` at `6fc3247`; `:30` at `3db94d6`), with H as its `id`. 5. A stock ACK client reads the 402 body as an object of `paymentRequestToken` and `paymentRequest` alone and drops `legalContext` without refusing it (`demos/payments/src/index.ts:165-171` at `3db94d6`), so a buyer whose client is stock never sees L. A client that is to check the ATR before it pays, or to make an agreement first, reads `legalContext` itself. 6. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `ack/payment-request`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. This ATR's hash is the id of the seller's ACK Payment Request token, with the link beside it; a receipt for that request embeds the token. The token's signature is not verified here. ACK defines no payer signature, so nothing the payer signed carries the hash, and the payment, which the payer's side sends before it presents the receipt, is known from the seller's report alone. This does not show that the payer's approval carried the hash. --- # acp-checkout-session-id.md Source: https://lcp.integraledger.com/profiles/acp-checkout-session-id.md **LCP profile `acp/checkout/session-id`: the ATR hash as the ACP checkout session id.** This profile targets ACP 2026-04-17, and defines the pairings `acp/checkout/delegated` and `acp/checkout/undelegated`. 1. The merchant sets the checkout session's `id` to H, the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and sets `metadata.legal_context` = `{"type":"sha256","value":H,"legal_context_url":L}`, where L is an `https` URL that serves those bytes. 2. The agent fetches L, hashes the bytes received, compares the result with the session `id` as 32 decoded bytes, and does not pay on a mismatch. 3. On a handler that requires `delegate_payment`, the agent's `allowance.checkout_session_id` is that `id`, so the vault token it signs for names H. 4. One session binds one ATR. A change to the terms the ATR records needs a new session. 5. On `acp/checkout/delegated` the allowance's `checkout_session_id` carries H as a link, not as a field the payer reliably signs. ACP has the agent sign the `delegate_payment` request with a detached `Signature`, a MUST in one section of its delegate-payment RFC (`rfcs/rfc.delegate_payment.md:38` at ACP `7fdd78d`) and RECOMMENDED in another (`:53`); the PSP SHOULD verify it (`:275`); and the token is held to the allowance's reason, maximum amount, currency and expiry (`:64`), not to its session. So the pairing's `carrier.signed` is null and its `claims` false: `bound` reads H from the allowance as the checkout's link, which shows neither that the payer signed H nor which payment was made under it. 6. On `acp/checkout/undelegated` nothing the payer presents names H. The seller names the charge by its own reference for it, as `card-seller-reference.md` rule 5 states: `reference` takes `{"charge":R}`, R of 1 to 255 visible ASCII characters, with the handler option the checkout was offered on, `{"requires_delegate_payment":false}`, and gives `{"charge":R}`, the checkout being the session whose `id` is H. A presentation that is not an object whose `charge` has that form is `acp/charge-reference-malformed`; then an option whose `requires_delegate_payment` is not `false` is `acp/option-malformed`. Nothing the charge moved is compared with the option. 7. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `acp/checkout/delegated`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The checkout session this payment completed has this ATR's hash as its id, and its responses carried the ATR's link in metadata. The payment handler required delegate_payment, so ACP has the agent obtain a vault token whose allowance names this session as checkout_session_id, in a request the agent signs (a MUST in one section of ACP and RECOMMENDED in another) and the PSP SHOULD verify. No signature was verified here, nothing compares the agent's signer with the account that signed the agreement, and ACP does not require the PSP to hold the token to that session. The payment is known from the seller's report alone. This does not show that amount, payee or timing match the ATR's content. - `acp/checkout/undelegated`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The checkout session this payment completed has this ATR's hash as its id, and its responses carried the ATR's link in metadata. The payment handler did not require delegate_payment, so nothing the payer signed for the payment names the hash. The payment is known from the seller's report alone, which names it by the seller's own reference for the charge. --- # ap2-checkout-mandate-x402.md Source: https://lcp.integraledger.com/profiles/ap2-checkout-mandate-x402.md **LCP profile `ap2/checkout-mandate/x402`: an AP2 checkout paid with AP2's x402 payment credential, the ATR hash in the merchant's `checkout_jwt`.** This profile targets AP2 v0.2 (Checkout Mandates, `mandate.checkout.1`) and AP2's reference x402 flow at commit `e1ea56d` (`google-agentic-commerce/AP2`, `code/samples/python/src/roles/`). 1. H rides as `ap2/checkout-mandate` places it: the payload of the merchant-signed `checkout_jwt` carries `"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}`, and the closed Checkout Mandate commits to that `checkout_jwt` through `checkout_hash`. Every rule of that profile holds here. The checkout's `accepted_payment_methods` names the x402 method, `{"type":"x402","address":P,"network":N}`, as AP2's merchant writes it (`merchant_agent_mcp/server.py:755-768`): P is the account the payment pays. 2. The payment credential is AP2's x402 bundle, `{"payment_mandate_chain":C,"payment_nonce":n,"eip_3009_payload":{"signature":S,"authorization":{"from","to","value","validAfter","validBefore","nonce"}}}` (`x402_credentials_provider_mcp/server.py:205-219`): an EIP-3009 `TransferWithAuthorization` the payer signs, whose `nonce` is keccak-256 of the UTF-8 text of C, the payment mandate chain (`:162-163`). AP2's payment processor refuses any other nonce (`x402_psp_mcp/server.py:147-157`). So the payment the payer signs carries no H, and nothing a public ledger records of it carries H: the pairing is at coverage `none`, with its link in the mandate. An agreement carrying H, a payment of an x402 or MPP pairing whose payment is itself a public proof, is made first, and the merchant initiates this payment only once that agreement has landed. 3. What a payment shows: the closed Checkout Mandate commits to a `checkout_jwt` carrying H; the chain's closed Payment Mandate names that checkout, its `transaction_id` being the same hash of the `checkout_jwt` as the checkout mandate's `checkout_hash` (AP2 `docs/ap2/specification.md:154-155`, "bound to a particular Checkout using the cryptographic hash of the Checkout JWT"); and the bundle's authorization is bound to that chain by its nonce. Any holder can follow the chain: the authorization's nonce to the chain, the chain to `transaction_id`, `transaction_id` to the `checkout_jwt`, and the `checkout_jwt` to H. It does not show that the account that signed the agreement is the account that signed this authorization. 4. `bound` takes `{checkout_mandate, checkout_jwt, payment}`, `payment` being the bundle as the merchant receives it. It reads H as `ap2/checkout-mandate` does, from the mandate and the `checkout_jwt` presented beside it. It then refuses, `ap2/payment-not-bound`, a bundle whose authorization's `nonce` is not keccak-256 of the UTF-8 text of its `payment_mandate_chain`, compared as 32 bytes (AP2's payment processor compares the string `nonce.hex()` writes, `x402_psp_mcp/server.py:147-157`, so a nonce written with `0x` or in upper case, which lcp admits, that processor refuses), and a bundle whose chain does not name this checkout: the chain is read as the checkout mandate is, its last hop's disclosures resolved, and exactly one object of `vct` `mandate.payment.1` must name a `transaction_id` equal to the checkout mandate's `checkout_hash`. AP2 has the merchant's processor verify that the payment credential is scoped to the checkout (`specification.md:340-341`) and its credential provider compare `transaction_id` with the hash of the `checkout_jwt` (`x402_credentials_provider_mcp/server.py:138-139`); AP2's sample processor checks the open mandate's checkout hash alone (`x402_psp_mcp/server.py:134-136`), so without this check a bundle issued for another checkout, or a chain naming none, would answer with this sale's H. A chain that is not an SD-JWT presentation of at most two hops, or whose last hop holds two closed Payment Mandates, is `ap2/payment-malformed`. It verifies no signature: the mandates' signatures are the Credential Provider's checks, as AP2 defines, and the authorization's signature is the payment processor's. 5. `reference` takes the bundle with the payment method it answers, `{"type":"x402","address":P,"network":N,"asset":T}`: AP2's method as its merchant writes it, with T, the token under whose EIP-712 domain the authorization is signed, which AP2's method does not name (AP2's sample signs under USDC on Base Sepolia, its `DEFAULT_USDC_CONTRACT`, `x402_credentials_provider_mcp/server.py:173-178`), so the merchant adds it from its own configuration of the method, as x402's option names it `asset`. N is an `eip155` CAIP-2 id, or an x402 v1 EVM network name as AP2 writes it (`base-sepolia`: its merchant at `merchant_agent_mcp/server.py:763`, its x402 credential provider at `x402_credentials_provider_mcp/server.py:264`), which `reference` names in CAIP-2 by the chain id `@x402/evm` 2.31.0 maps it to (`EVM_NETWORK_CHAIN_ID_MAP`, its `src/constants.ts`, exported from `@x402/evm/v1`); `x402MethodNetwork` gives that CAIP-2 id for N, so every reader of the method names its network as `reference` does; a method without T, or with a network that is neither, is `ap2/option-malformed`. The reference holds the keys `x402/exact/eip155/eip3009`'s reference gives for the same authorization under an option of that network, token and payee: the network, the token, `validBefore`, the digest of `from`, `to` and `value`, the token's `AuthorizationUsed` and `Transfer` logs and the search by the nonce, the authorization's nonce standing where that pairing has H; the payee P; and the authorization's members as presented, `from`, `to`, `value`, `validAfter`, `validBefore` and `nonce`, none judged against the method. So this pairing's `status` (rule 8) reads the payment as the carried pairing reads an x402 EIP-3009 payment, the authorization's nonce being its single-use value: whoever reads the payment back finds it by the token's `AuthorizationUsed(from, nonce)`. 6. The merchant forwards the bundle to its payment processor, which submits the authorization (`merchant_agent_mcp/server.py:981-995`; `x402_psp_mcp/server.py`): the payee broadcasts. 7. The ATR's `ap2` slot names the checkout's `id`, as on `ap2/checkout-mandate`. 8. `status` reads the payment as `x402/exact/eip155/eip3009`'s rules 12 to 20 read it, the authorization's own nonce standing where that pairing has H, at coverage `none`: so the act is the payer's use of that nonce whatever it carries, and a `failed` answer does not wait for the search to be read whole. The payment is no agreement, and its nonce has no agreement's value. The read kit runs its cases through this `status` on an EIP-3009 ledger. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no authorization nonce. - `not-found`, and *at coverage none, a lookup read whole beside an item the search could not decode*: the read holds its single-use value and reads it at the `finalized` block and at the latest block, so it answers `instrument-unused` or `instrument-consumed` by that value, which no item the search could not decode changes. 9. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `ap2/checkout-mandate/x402`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken. This does not show that the account is this payment's payer. The payment paid `` of the token `` to `` in `` on ``: an EIP-3009 transfer authorization whose nonce is keccak-256 of the payment mandate chain it was presented with, as AP2's payment processor requires, and whose chain's closed Payment Mandate names, as its transaction_id, the checkout_hash of the closed AP2 Checkout Mandate presented. That checkout_hash is the SHA-256 of the checkout JWT presented beside it, and that JWT's payload carries this ATR's hash as its legalContext member; the payment itself carries no hash of this ATR. No mandate signature was verified here: AP2 has the Credential Provider verify the mandates. This does not show that amount, payee or timing match the ATR's content. --- # ap2-checkout-mandate.md Source: https://lcp.integraledger.com/profiles/ap2-checkout-mandate.md **LCP profile `ap2/checkout-mandate`: the ATR hash in the merchant's `checkout_jwt`.** This profile targets AP2 v0.2 (Checkout Mandates, `mandate.checkout.1`). 1. The payload of the merchant-signed `checkout_jwt` carries `"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}` and a string `id` naming the checkout. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The shopping agent fetches L, hashes the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not present the checkout for approval. 3. The closed Checkout Mandate commits to that `checkout_jwt` through `checkout_hash`, as AP2 defines. Nothing is added to the mandate. 4. The merchant refuses a mandate whose `checkout_hash` is not the hash of the `checkout_jwt` it last sent for that checkout, taken from its own records and not from the presentation, or whose `checkout_jwt` carries an H it did not issue for that checkout, or has seen claimed. Compared with the `checkout_jwt` presented beside it, the mandate shows only that the two agree. 5. The ATR's `ap2` slot names the checkout's `id`, and never contains the `checkout_jwt`. 6. AP2 has two ways a payment is made under the mandate (AP2 `e1ea56d`, `docs/ap2/specification.md:203-209`). Where the merchant initiates the charge with its own payment processor, the presentation is the mandate and the `checkout_jwt` beside it, and the merchant's side executes the payment. Where the payment method pushes funds to the merchant, the merchant "will instead receive confirmation of funds sent": the payer's side has sent the payment before the merchant sees it. AP2 gives that confirmation no member of the presentation and no schema of its own; this profile carries it beside the mandate as `payment_receipt`, AP2's Payment Receipt as the payer's side gives it (`code/sdk/schemas/ap2/payment_receipt.json` at `e1ea56d`), a JSON object, carried whole and read by nothing in this pairing. A presentation with `payment_receipt` is push funding, whose payment its payer's side sent; one without it is a charge the merchant initiates. This holds of a presentation made before any charge, as the seller's server makes it before it charges: AP2 returns a Payment Receipt once the processor has accepted or rejected the payment in every flow (`specification.md:159-161`, `:212`), so a presentation made after a charge, which may carry such a receipt, and one whose receipt's `status` is `Error`, are not told apart by it. A `payment_receipt` that is not a JSON object is refused before anything else of the presentation is read. That the confirmation is AP2's Payment Receipt is this profile's reading of AP2's text, which names the confirmation without defining it. 7. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `ap2/checkout-mandate`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The closed AP2 Checkout Mandate presented carries checkout_hash, the SHA-256 of the checkout JWT presented beside it, and that JWT's payload carries this ATR's hash as its legalContext member. AP2 has the mandate signed by the user's trusted surface, or by the agent under the user's open mandate presented before it in a chain. That signature, the open mandate's signature, its delegation to the agent's key (cnf) and the chain's link were not verified here, and nothing compares the mandate's signer with the account that signed the agreement: AP2 has the Credential Provider verify the Payment Mandate, whose transaction_id is the same hash, before a payment credential issues. The payment, whether the merchant initiated it or the payer's side sent it, is known from the seller's report alone. This does not show that amount, payee or timing match the ATR's content. --- # card-mastercard-agent-pay.md Source: https://lcp.integraledger.com/profiles/card-mastercard-agent-pay.md **LCP profile `card/mastercard-agent-pay`: the ATR hash in a Mastercard Agent Pay message signature.** Mastercard publishes no Agent Pay acceptance framework. This profile is built from the text Mastercard does publish, its Developer Playbook on preparing for agentic commerce (`https://developer.mastercard.com/merchant-cloud/documentation/tutorials-and-guides/agentic-commerce-guide/21/index.md`, cited `guide-21`, SHA-256 `612d6d0bd3192dc8…`, and `…/24/index.md`, cited `guide-24`, SHA-256 `9626052fd2d0a1df…`, both read 2026-11-16). Until a real sample shows an Agent Pay request with H in place, the form is not confirmed and nobody offers it. 1. Before payment the merchant shows the legal context as `card/visa-tap` rule 1 states it, and the agent checks it as that profile's rule 2 does. 2. The agent's message signature follows Web Bot Auth, as `guide-21:140-167` shows it: an RFC 9421 signature over at least `@authority` and `@path`, with `created`, `expires`, `keyid`, `alg`, `nonce` and `tag`. Its `tag` is Mastercard's, published in two spellings: `Agent-pay-auth` (`guide-21:149`, `:166`, `:172`, `:300`) and `agent-pay-auth` (`guide-24:386`). Both are read. 3. H rides as on `card/visa-tap` (its rule 3): in the signature's `nonce`, the base64 of H's 32 bytes followed by 32 random bytes; or, for an agent whose nonce does not carry H, in the merchant's checkout path, whose last segment is H and which the signature covers as `@path`, the nonce then not read, so an agent that draws 64 random nonce bytes, as the playbook's example request shows (`guide-21:165`), pays by the path. 4. `bound` reads every signature whose `tag` is the String `Agent-pay-auth` or `agent-pay-auth`, by `card/visa-tap`'s rule 4, with its parameter names read by that profile's rule 7. A signature tagged for Visa is not read here. 5. The playbook's own example request (`guide-21:156-167`) carries a nonce of 64 bytes, which `bound` reads as a hash the merchant did not issue; it is this profile's vector (`card.json`, `T6`). 6. The merchant refuses a request whose H it did not issue for this checkout, or whose H it has seen used. The card authorization does not carry H. 7. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `card/mastercard-agent-pay`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. Every Mastercard Agent Pay message signature in the agent's checkout request, tagged Agent-pay-auth or agent-pay-auth, covers this ATR's hash: its nonce, whose first 32 bytes are the hash, or the request's path, whose last segment is the hash. The seller checked where the hash rides and did not verify a signature here, and nothing compares the agent's key with the account that signed the agreement. The card authorization itself does not carry the hash. This does not show that amount, payee or timing match the ATR's content. --- # card-mastercard-vi.md Source: https://lcp.integraledger.com/profiles/card-mastercard-vi.md **LCP profile `card/mastercard-vi`: the ATR hash in a Verifiable Intent checkout.** This profile targets Verifiable Intent at commit `356c296` of `agent-intent/verifiable-intent` (2026-04-20): its credential format (`spec/credential-format.md`, cited `§`) and its Python reference SDK (`src/verifiable_intent/`). It defines the pairings `card/mastercard-vi/immediate` and `card/mastercard-vi/autonomous`. 1. The `checkout_jwt` payload has the member `"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}`, with `legalContextAgreementUrl` after the link where an agreement URL is given. Where the merchant writes the `checkout_jwt`, it writes the member. In Immediate mode the specification lets the agent create the `checkout_jwt` (§6.3): the merchant then shows `{"legalContext":…}` as `card/visa-tap` rule 1 states it, and lcp's `read` takes that object as it takes a `checkout_jwt`; lcp's `build`, given the checkout payload the agent creates, writes the member into it and returns it for the agent to sign as its `checkout_jwt`. 2. The wallet or agent fetches L, hashes what it receives and compares with H as 32 decoded bytes; on a mismatch it does not sign. 3. On a match the user's L2 (Immediate) or the agent's L3b (Autonomous) checkout mandate carries that `checkout_jwt` with `checkout_hash` = BASE64URL(SHA-256(ASCII(checkout_jwt))), and a payment mandate's `transaction_id` equals it (§6.2). 4. Immediate presents `l2`, the user's L2, whose header `typ` is `kb-sd-jwt` (§4.2). A full Autonomous L2, whose `typ` is `kb-sd-jwt+kb`, presented under Immediate is refused `card/vi-typ`. 5. Autonomous presents `l1`, `l2` and `l3b`, where `l2` is, byte for byte, the merchant's view of the user's L2 that §5.4 defines, `L2_base_jwt~checkout_disclosure~item_disclosure~`: the presentation L3b's `sd_hash` covers. Any other view is refused `card/vi-sd-hash-mismatch`, the reference SDK example's role view among them, which carries the checkout mandate with every acceptable item in the L2's order (`examples/helpers.py:233-273`; `examples/autonomous_flow.py:281-283`). 6. lcp verifies, in Autonomous mode, L3b's signature under the key L2's open checkout mandate delegates and L2's under L1's `cnf.jwk`, each over the bytes received; it does not verify L1's issuer signature, and in Immediate mode it verifies no signature. 7. The signer's rule. The reference SDK verifies each signature over its own re-encoding of the parsed JSON (`src/verifiable_intent/crypto/sd_jwt.py:117-118`), so a layer signed over other bytes passes lcp's check and fails a verifier built like it. A signer therefore signs JSON that is compact, with every non-ASCII character escaped as `\uXXXX` and members in insertion order, as Python's `json.dumps(…, separators=(",", ":"))` writes it. 8. The offer's lifetime. The layer the buyer's side signs after the offer must still find the offer open: the user's L2 in Immediate mode, valid 15 minutes (§7), and the agent's L3b in Autonomous mode, valid up to an hour (§7), each with the 300 seconds of clock skew §5.7 recommends. So an offer stays open at least 1,200 seconds for Immediate and 3,900 seconds for Autonomous: bounds this profile derives from §7 and §5.7, which the specification does not state itself. 9. No constraint type carries H: Verifiable Intent rejects open mandates with unknown constraint types. 10. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `card/mastercard-vi/autonomous`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. An agent signed a Verifiable Intent L3b checkout mandate whose checkout_hash is the SHA-256 of a checkout_jwt carrying this ATR's hash, with the key the presented L2 mandate delegates to it. The seller verified both ES256 signatures and the sd_hash links, but not the L1 issuer's signature, and nothing compares the L2 or L3b signer with the account that signed the agreement. The L2 signature does not cover the hash, and the seller did not see the L3a payment mandate the network received, whose transaction_id Verifiable Intent requires to equal this checkout_hash. This does not show that amount, payee or timing match the ATR's content. - `card/mastercard-vi/immediate`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The Verifiable Intent L2 mandate presented lists a checkout mandate whose checkout_hash is the SHA-256 of a checkout_jwt carrying this ATR's hash, and the payment mandate's transaction_id, where disclosed, equals it. The seller checked those values and did not verify the L2 mandate's signature, which Verifiable Intent has the payment network validate before authorization, and nothing compares the L2 mandate's signer with the account that signed the agreement. The card authorization itself does not carry the hash. This does not show that amount, payee or timing match the ATR's content. --- # card-seller-reference.md Source: https://lcp.integraledger.com/profiles/card-seller-reference.md **LCP profile `card/seller-reference`: the ATR hash in the seller's own processor metadata, the payment named by the seller's reference for the charge.** This profile defines the card checkout in which nothing the payer signs carries H, Amex's included: the seller writes the link into its own processor's record and names the charge by its own reference for it. 1. Before payment the seller shows `{"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}}`, where H is the SHA-256 of the ATR's exact bytes (`0x`, lowercase hex) and L an `https` URL serving them, with `legalContextAgreementUrl` after L where an agreement URL is given. The card option offered is `{"scheme":"seller-reference","checkout":C}`, C the seller's own checkout id, 1 to 128 visible ASCII characters. 2. The buyer's agent fetches L, hashes what it receives and compares with H as 32 decoded bytes; on a mismatch it does not pay. 3. Nothing the payer signs carries H: the card authorization does not, and no card network carries H in anything that reaches the network or the statement, so `build` and `bound` refuse `card/no-signed-place`. The pairing is at coverage `none`: an agreement carrying H, a payment of an x402 or MPP pairing whose payment is itself a public proof, is made first, and the seller charges only once that agreement has landed. 4. The seller writes `lcp:sha256:` + H in its processor's own metadata under the key `legal_context`: Stripe's `metadata`, Adyen's `metadata`, a Braintree custom field, Cybersource's `merchantDefinedInformation`. That value is a link, written by the payee, and never proof. 5. The seller names the charge its processor made by its own reference for it, the charge reference: the processor's identifier of the payment, such as a Stripe PaymentIntent's `id` (`pi_3MtwBwLkdIwHu7ix28a3tqPa` in Stripe's published PaymentIntent object) or an Adyen `pspReference`. What the seller presents of the charge is `{"charge":R}`, R being that reference, 1 to 255 visible ASCII characters (`MAX_CHARGE_REFERENCE`). 6. `reference` takes that presentation with the card option the charge answers and gives `{"checkout":C,"charge":R}`. A presentation that is not an object whose `charge` has rule 5's form is `card/charge-reference-malformed`; then an option that is not a card option of the `seller-reference` scheme is `card/option-malformed`. It compares nothing the charge moved with the option, and reads no payment: the payment is known from the seller's report alone, which names it by R. 7. The payee broadcasts: the seller submits the charge to its processor. That the processor returns the metadata unchanged has not been shown by a run, so the form is not confirmed. 8. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `card/seller-reference`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. This ATR's hash and link are for the seller to show the buyer before payment and to put in its processor's metadata under legal_context, beside the seller's own reference for the charge. Nothing the payer signed for this payment carries the hash, and the payment is known from the seller's report alone, which names it by that reference. This does not show that the payer's approval carried the hash. --- # card-visa-tap.md Source: https://lcp.integraledger.com/profiles/card-visa-tap.md **LCP profile `card/visa-tap`: the ATR hash in a Trusted Agent Protocol checkout request.** This profile targets Visa's Trusted Agent Protocol as its specification publishes it (`https://developer.visa.com/docs/trusted-agent-protocol/trusted-agent-protocol-specifications.md`, read 2026-11-16, SHA-256 `7f2408c64c2723c4…`) and its reference implementation, `visa/trusted-agent-protocol` at `16d59bd`. 1. Before payment the merchant shows `{"legalContext":{"type":"sha256","value":H,"legalContextUrl":L}}`, with `legalContextAgreementUrl` after the link where an agreement URL is given. H is the SHA-256 of the ATR's exact bytes (`0x`, lowercase hex) and L an `https` URL serving them. 2. The agent fetches L, hashes what it receives and compares with H as 32 decoded bytes; on a mismatch it does not pay. 3. On a match the agent's checkout request carries H in what its message signature covers, in one of two places, or both: - **The nonce.** The `nonce` parameter of its `agent-payer-auth` signature is the base64 (RFC 4648 §4, with padding) of 64 bytes: H's 32 bytes, then 32 bytes the agent draws at random. That is 88 characters, the shape of the specification's example nonce. Every signature in the request carries the same nonce, as the specification's nonce row asks. lcp's `build` gives the nonce. - **The checkout path,** for a stock agent, whose nonce does not carry H: Visa's reference agent draws its nonce as a UUID (`tap-agent/agent_app.py:1439`, `:1499`), and an agent may draw 64 random bytes, the shape of the specification's example nonce. The merchant's checkout path ends in a segment that is H, `0x` and 64 lowercase hex digits (for example `/checkout/0x…`), and the agent's signature covers `@path`, which the specification requires of every trusted agent. 4. `bound` takes the request's `Signature-Input` and `Signature` fields and, for the path, the request's absolute path without its query, as RFC 9421 §2.2.6 defines `@path`. It reads every signature whose `tag` is the String `agent-payer-auth`. There must be one, and one of them must have its `Signature` member. Each must carry H: by `@path`, listed with no parameters among its covered components, where the path's last segment is H, its nonce then not read; otherwise by its nonce, where the nonce is the base64 of 64 bytes. Every such signature must carry the same H. No signature, key, window or nonce use is verified here: that is the merchant's recognition of the agent. 5. Where the signature covers no path ending in a hash, any nonce of 64 bytes is read as H followed by random bytes. A request from an agent that draws such a nonce at random, as the specification's own example does, on a path that carries no H, therefore gives a hash the merchant did not issue, and the merchant refuses it at rule 6. On a checkout path that carries H the nonce is not read, so such an agent pays by the path (`card.json` `T2`). 6. The merchant refuses a request whose H it did not issue for this checkout, or whose H it has seen used. 7. The `Signature-Input` field is an RFC 9651 Dictionary. Beside RFC 9421's `keyid`, lcp admits one parameter name in another spelling, `keyId`, as Visa's reference agent writes it and its verifier reads it (`tap-agent/agent_app.py:1331`, `:1364`; `cdn-proxy/server.js:213-254`). No other name with an upper-case letter is admitted, and a signature that names both `keyid` and `keyId` is refused. 8. The card authorization does not carry H. The merchant's processor reference may carry `lcp:sha256:H` as its own record. 9. The requests TAP's specification and its reference implementation publish are this profile's refusal vectors (`card.json`, `T3`). None carries a hash a merchant issued. 10. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `card/visa-tap`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. Every TAP agent-payer-auth message signature in the agent's checkout request covers this ATR's hash: its nonce, whose first 32 bytes are the hash, or the request's path, whose last segment is the hash. The seller checked where the hash rides and did not verify a signature here, which belongs to its TAP recognition step, and nothing compares the agent's key with the account that signed the agreement. The card authorization itself does not carry the hash. This does not show that amount, payee or timing match the ATR's content. --- # card-visa-vic.md Source: https://lcp.integraledger.com/profiles/card-visa-vic.md **LCP profile `card/visa-vic`: the ATR hash as a Visa Intelligent Commerce transaction reference.** This profile targets the credential request of Visa Intelligent Commerce as Visa's reference agent makes it (`visa/vic-reference-agent` at `39bc93d`, cited from `reference-agent-backend/`). That Visa returns the value unchanged in the credential payload it signs for the merchant has not been shown by a run: until a sandbox response shows it, the form is not confirmed and nobody offers it. Visa's reference agent types the transaction reference as a UUID (`reference-agent-backend/src/schemas/commerce.py:72`), so that run may also find a 43-character base64url value refused. 1. Before payment the merchant shows the legal context as `card/visa-tap` rule 1 states it, and the agent checks it as that profile's rule 2 does. 2. On a match, when the agent asks Visa for the sale's payment credential, the `transactionReferenceId` of its `transactionData` entry, the per-sale reference the agent writes (`src/services/vdp_client.py:550`), is H's 32 bytes as unpadded base64url, 43 characters. lcp's `build` gives the value. The agent writes it into an API request, and Visa signs the credential payload that returns it: nothing the payer signs carries H, so the pairing's `carrier.signed` is null and its link is one Visa's signature, not the payer's, covers. H is not carried in `clientReferenceId`: Visa's reference agent sends there one fixed user id on every call (`src/utils/constants.py:17`; `src/services/vdp_client.py:454`, `:492`, `:542`, `:568`), so it names no sale. 3. `bound` takes `{"transactionReferenceId": …}`, the value as the merchant reads it from the credential payload Visa signs for the sale, and returns H. The payload's signature, and where in it the value sits, are the merchant's to verify and read; no run has shown them yet. 4. The merchant refuses a value whose H it did not issue for this checkout, or whose H it has seen used. The card authorization does not carry H. 5. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `card/visa-vic`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The agent's Visa Intelligent Commerce credential request carried this ATR's hash as its transactionReferenceId, which the seller read from the credential payload Visa signs for the sale. Verifying that payload is the seller's and was not done here, and nothing compares the agent or the cardholder with the account that signed the agreement. The card authorization itself does not carry the hash. This does not show that amount, payee or timing match the ATR's content. --- # legal-context-return.md Source: https://lcp.integraledger.com/profiles/legal-context-return.md **LCP profile `legal-context-return`: the return after an agreement.** A sale whose charge is paid only after its agreement is recorded (an agreement first) has its buyer make the agreement, then return to the resource server for the charge. This profile fixes what the first response carries, how the buyer's agent returns, and how each agreement option names the charges it serves. 1. **The first response** of such a sale carries H, the ATR's link and the agreement's URL, in the members the sale's protocol places them in: on x402, `extensions.legalContext.info` (`value`, `legalContextUrl`, `legalContextAgreementUrl`); on MPP, each challenge's `opaque` (`legalContext`, `legalContextUrl`, `legalContextAgreementUrl`). It carries no charge option the payer could pay before the agreement. 2. **The `Legal-Context` request header.** A buyer's agent that has made the agreement repeats its request with the header `Legal-Context`, whose value is an RFC 9651 Item: the bare item is a token, H's LCP string `lcp:sha256:0x` followed by H's 64 lowercase hex digits; the one parameter the header may carry is `rv`, the sale's return value (rule 5) as a byte sequence. No other parameter is admitted. The value is parsed as RFC 9651 parses an Item (section 4.2): spaces before and after the item and after each `;`, and none elsewhere; every parameter's value parsed as a bare item (sections 4.2.4 to 4.2.10); a parameter given more than once counting as the last given (section 4.2.3.2); and `rv`'s base64 read with its `=` padding absent and with bits set past its last byte, which section 4.2.7 says a parser should not refuse, and with no character outside the standard base64 alphabet. A value that does not parse, whose token is not H's LCP string in lowercase hex, that carries another parameter, or whose `rv` is not a byte sequence of 32 bytes is refused `return/header-malformed`; so is an H or a return value of another length given to the writer, which writes `rv` padded. Examples: `Legal-Context: lcp:sha256:0xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad`, and with a return value, `…15ad;rv=::`. A checkout protocol's own session id serves in place of the header where the protocol has one. 3. **The check.** A resource server serves a request as a return only where the header's H is the H its own record holds for the request, and, where the sale has a return value, the header's `rv` is that value. lcp exports the check, pure, as `checkLegalContextReturn(value, record)`: the value parsed as rule 2 parses it (`return/header-malformed`: a header that does not parse is no return); its H held to the record's H (`return/not-this-sale`); and its return value held to the record's, compared in constant time, since it is a bearer secret, an `rv` given for a sale that has none and none given for a sale that has one refused alike (`return/value-mismatch`). A return to a sale whose charge is a Lightning invoice that is refused gets no invoice. 4. **Over MCP**, where a tool call's result has no response header, the first response's tool result carries the header's value (H, with `rv` where the sale has one) in its `_meta` under the key `com.integraledger.lcp/legal-context` (`LEGAL_CONTEXT_META`), and the buyer's agent returns it under the same key in the `params._meta` of each later tool call of the sale. No request commitment covers `params._meta` (`x402/request-commitment`, rule 5). The value's syntax and its check are the header's (rules 2 and 3). 5. **The return value.** Where the sale's charge is paid by a bearer value, such as a Lightning preimage, which every node on the payment's route learns, the first response also carries a return value: 32 bytes drawn at random for the sale by the resource server and kept in its own record, in no ATR and on no ledger. On HTTP the first response carries it in a `Legal-Context` response header of rule 2's syntax, with H. The buyer's agent sends it with H only to that resource server, on the return and on every later request of the sale, and the resource server answers none that lacks it. The form that needs it is the Lightning profiles'. 6. **The charges an agreement option serves.** Each agreement option offered names the sale's charge options whose `agreementOn` admits it, so that a buyer pays an agreement that serves the charge it means to pay. Each charge option is named `/`: the option at index `i` of the charge options the ATR's binding slot of that name holds, for every binding slot that holds them: `x402/` for `accepts` of the `x402` slot, `mpp/` for `challenges` of the `mpp` slot, `ack/` for `paymentOptions` of the `ack` slot, and `acp/`, `ap2/`, `card/` and `ucp/` for `options` of the slot of that name, so that a buyer that holds the ATR finds each one, a charge option withheld from the first response among them. A card or checkout sale whose agreement is offered as an x402 option or an MPP challenge names its card or checkout options so. A name resolves against the ATR: its slot is the ATR's binding slot, the member after `atrVersion` and `id`, and its index is below the number of charge options that slot holds. On an x402 option the member is `extra.legalContextServes`, an array of 1 to 32 distinct such names; on an MPP challenge it is the `opaque` member `legalContextServes`, those names joined by one space. The member is part of the option as issued, so the digest a resource server records for the option covers it. An option that is not an object, an x402 `extra` that is not an object, an MPP `opaque` that is not base64url of a map of strings, or a member that is not 1 to 32 distinct such names (an index from 0 to 31 with no leading zero, the MPP names joined by exactly one space) is refused `return/serves-malformed`; so is a name that does not resolve against the ATR's bytes where a reader is given them. lcp exports the read as `servesOf(option, atr?)`. 7. The vectors are `legal-context-return.json`: the header written and read, each refusal with one member of a good header changed, the serves member read and refused, alone and against a card ATR whose `card` slot holds three options, and the check: one return that passes and one for each of its refusals, the last a Lightning sale's return without its return value. Their oracle is RFC 9651's parsing algorithm, with each byte sequence decoded by Python's `base64`, and the bare items before an overwritten `rv` are RFC 9651 section 3.3's own examples. --- # mpp-charge-nearintents.md Source: https://lcp.integraledger.com/profiles/mpp-charge-nearintents.md **LCP profile `mpp/charge/nearintents`: the ATR hash in a NEAR Intents charge's `externalId`, after the agreement.** Rules 1–3, 5, 10 and 11 of `mpp/charge` apply to the challenge. The method is MPP's NEAR Intents charge (`draft-nearintents-charge-01`); the vectors are `mpp-charge-nearintents.json`. 1. **Coverage `none`.** The buyer's deposit, sent on the origin network to a deposit address the NEAR Intents backend issues for one quote, carries nothing of H, and the buyer signs nothing that carries it. H rides in the challenge request's `externalId`, as `lcp:sha256:0x` + 64 lowercase hex of H, which the resource server writes: a link, never a proof (`link: h`). The pairing is paid only after an agreement carrying H is recorded, on any agreement option the resource server offers (`agreementOn: any`), an MPP one where it offers one. 2. **No network of its own.** The deposit moves on the network `methodDetails.originNetwork` names and the backend's payout on `methodDetails.destinationNetwork`; `network` gives the origin network. The pairing is offered on whatever networks the backend serves. 3. **Absent from the first response.** The response that carries H, the ATR's link and the agreement's URL carries the agreement options and no challenge of this pairing: no deposit address exists before a quote, and none is quoted before the agreement is recorded. 4. **What the ATR names.** The ATR is assembled before any quote, so its `mpp` slot holds the challenge by the seller's fixed members alone: `currency`; `methodDetails`' `originNetwork`, `destinationNetwork`, `destinationAsset`, `destinationRecipient` and `amountOut`; and `description`, `slippageTolerance`, `settlementBackend` and `credentialTypes` where the seller sets them; with the challenge's `realm`, `method`, `intent`, `digest`, `header` and `opaque` as `mpp/charge` rule 5 reads them. `unplaced` leaves out the carrier `externalId`; the quote's `recipient`, `amount`, `methodDetails.minAmountIn`, `methodDetails.depositMemo` and `methodDetails.timeEstimate`; `methodDetails.refundTo`, which the server sets for each payer before it asks for the quote (draft, Method Details); and the challenge's `expires`, the quote's deadline. `tie` binds, and `issuedDigest` digests, the challenge as `unplaced` gives it, so every quote for one H gives one slot entry and one issued digest, and the quote's members are held by the resource server's own record of the quote (rule 9), not by lcp's check. 5. **`advertiseBeforeCarrier`, at issue.** With no quote present, it checks that the challenge carries as strings the fixed members the draft requires (`currency`, `originNetwork`, `destinationNetwork`, `destinationAsset`, `destinationRecipient`, `amountOut`), else `mpp/request-malformed`, and places H: the id and `opaque` of `mpp/charge` rules 1 and 2, and `externalId`. A challenge without `expires` is placed and given back without one. The quote's members are not read. This challenge is the one the ATR names; it is not sent. 6. **`advertise`, at each quote.** It places H in `externalId` of the quoted challenge, with its id and `opaque`, once the challenge carries as strings every member the draft requires (`amount`, `currency`, `recipient`, and `methodDetails`' four fixed members above with `minAmountIn` and `refundTo`), else `mpp/request-malformed`, and holds the quoted challenge to the challenge the ATR names, which it takes after the agreement URL: the slot's entry, the challenge rule 5 placed, or the seller's challenge before any quote. The two are compared as `unplaced` gives them, every bound member, `opaque` by its members other than the LCP ones. A quote whose fixed members differ, or one given no challenge to hold it to, is refused `near/fixed-members-differ`; an `externalId` already holding another value is refused `near/carrier-occupied`. No challenge without `recipient` is sent. 7. **The credential.** The payer broadcasts its deposit, then presents MPP's `hash` credential (`broadcaster` answers `payer`); any other `type` is refused `near/not-hash-credential`. `bound` reads H from the echoed challenge's `externalId` and holds it to the H the challenge's id and `opaque` name (`mpp/carrier-not-challenge`; an `externalId` that is not an LCP string is `near/memo-not-lcp`). 8. **`reference`.** Given the credential and the challenge it answers, it holds the credential as `bound` does, then refuses one whose echoed challenge is not that challenge, member by member, `request` and `opaque` by their decoded members, or given an option that is not a challenge, `mpp/challenge-not-option`, the one code for a credential that answers another challenge. It names the deposit by the origin network and its hash in that network's spelling, the draft's canonical transaction identifier rules (Replay Protection): on `eip155`, `0x` and 64 lowercase hex digits, read case-insensitively with or without `0x`; on `bip122`, 64 lowercase hex digits without `0x`, read the same way; on `near`, base58 of a 32-byte hash, and on `solana`, base58 of a 64-byte signature, each kept exactly; on any other namespace, for which the draft gives no rule, the hash as presented, in visible ASCII. A hash not so spelled is `mpp/credential-malformed`. The pairing has no `status`, so the reference names no payee. 9. **The resource server's order.** 1. After the agreement is recorded, it asks the backend for a quote and issues the challenge: `recipient` the quote's single-use deposit address, `expires` at or before the quote's deadline (draft, Challenge Expiry), `externalId` H's LCP string, placed by rule 6. 2. The ATR does not name the deposit address, and the challenge's id is set from H, so what ties an address to its challenge is the resource server's own record of the quote. It keeps one quote for each H, so no two sales share a deposit address; instances that share a quote store key it by H. 3. It offers a challenge for H only while its own record holds no payment taken for H, and it answers itself, before the method's own server runs, a credential whose challenge has passed `expires`, whose deposit address its record holds as spent, or whose H's payment is taken, never with a fresh challenge for that H. 4. A deposit presented in time: lcp's two checks (`mpp/charge` rule 10), then the method's verification, which moves nothing since the payer has broadcast, then its record that H's payment is taken. 5. A quote that expires unpaid is replaced by a fresh challenge under the same ATR. A quote is unpaid only where the backend's status for its address, read after its deadline, shows no deposit; a deposit it shows is a late deposit, and no new quote is made for H while one is shown. 6. A deposit sent in time and presented after `expires` is not handed to the method's server. The resource server takes it as a payment its payer broadcast only where the echoed `recipient` is the address of a quote its own record holds for this H and the backend's status for that address, polled to a terminal status, lists the presented hash at `SUCCESS` (draft, Settlement Procedure); until then the payment is pending. The address is never taken from the credential alone: rule 6 holds the fixed members only. 7. A deposit the backend refunds (`FAILED`, `REFUNDED`, `INCOMPLETE_DEPOSIT`) is never taken, presented in time or late. The buyer pays again on a fresh challenge under the same ATR (draft, Client Recovery): a fresh quote changes only members the ATR does not name, so it binds no new terms. 10. **No read.** No public payer-signed act carries H, and the deposit pays the quote's address and not the payee, so lcp declares no `read`, `status`, `recover` or `fetchPresented` for the pairing. It declares inapplicable every case of the read kit that reads (`read-status.md`): no case of the kit runs through it, and it has no form. The resource server's own record settles it. 11. What a record of this pairing proves: before this payment was reported, an agreement transaction carrying this ATR's hash was signed on a network, recorded in a transaction; this shows neither that its signer is the payer nor when the deposit was made. The seller's MPP challenge carried the hash in its `externalId`. The deposit carries no hash, and its payer signed nothing that does. The seller reported it paid. `nonce` is `unshown`, and `confirmed` is `no` until a recorded run shows the form. --- # mpp-charge-solana.md Source: https://lcp.integraledger.com/profiles/mpp-charge-solana.md **LCP profile `mpp/charge/solana` and `mpp/charge/solana/unsponsored`: the ATR hash as the Solana charge's Memo instruction.** Rules 1–3 and 5 of `mpp/charge` apply to the challenge. 1. The request's `externalId` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes. A request whose `externalId` is present with another value is refused `svm/carrier-occupied`: the scheme has one memo, and a seller's own reference belongs in the ATR's content. 2. MPP says the client SHOULD, not MUST, write the memo; this profile makes it required. The client writes `externalId` as a Memo Program instruction (`MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` or `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH`) of the transaction it signs. 3. Among the transaction's top-level Memo instructions, exactly one has data that parses as an LCP string. It is spelled exactly as rule 1 gives, in lowercase hex, else `svm/carrier-not-canonical`, and it equals the echoed request's `externalId`. Other Memo instructions, such as split labels, are not read. 4. `type="bundle"`: the carrier is read from the last transaction, which contains the confidential `Transfer`. MPP: *"A server that does include a memo MUST treat the resulting order-id linkage as an explicit privacy trade-off, and MUST verify any memo present in the bundle matches the value it issued."* 5. `type="signature"`: the client has already broadcast, so the server reads the landed transaction and applies rule 3 to it. The money has moved before the check, so a failed check is reported to the seller, never a refusal. 6. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, whose one LCP-form Memo instruction is the hash's LCP string, final at `finalized` with no error. It paid each transfer it made from the buyer's account, recorded with its mint or lamports, amount and recipient, one of zero included, the recipient being the owner the transaction's token balances name; as a payment, one of them reached an account the option's payee owns. The memo is in the transaction's instruction data on chain. It compares no amount, mint or time with the ATR's terms. 7. A challenge whose `methodDetails.feePayer` is `true`, with the fee payer's key in `feePayerKey`, is `mpp/charge/solana`. The stock client refuses to broadcast under it from `@solana/mpp` 0.6.0 (`src/client/Charge.ts:79-83` at 0.7.0), so it admits the `transaction` and `bundle` credentials, which the server or its settler co-signs as fee payer and submits; a `signature` credential, which a client before 0.6.0 set to broadcast pushes, is a payment that has already moved, read under rule 5. Every challenge of `mpp/charge/solana` sets `feePayer: true`. Any other challenge, `feePayer` absent or `false`, is `mpp/charge/solana/unsponsored`: its payer can broadcast, so it is never an agreement option. `pairingsOf` names one of the two for each challenge. 8. The agreement, on `mpp/charge/solana` alone: its floor is 1 base unit, since the request's `amount` is a positive integer; the fee is paid by the seller's settler, the fee payer `feePayerKey` names, which is the message's first signer; the transaction must land with `meta.err` null, and one that landed with an error is no agreement; and a transaction the payee signed is no agreement. 9. The client builds the highest message version both `methodDetails.transactionVersions` and lcp admit: version 1 where the list holds 1, version 0 where it holds 0 alone or is absent, as `@solana/mpp` builds it where a challenge lists it, in a release later than 0.7.0 (`pay-kit` `86400da`, `typescript/packages/mpp/src/client/Charge.ts:211-220`); `@solana/mpp` 0.7.0 builds version 0 alone; a list that admits neither is refused at the filter (`svm/input-malformed`). `bound` and `reference` decode legacy, version 0 and version 1 messages, and refuse one whose version the challenge does not admit, `svm/version-not-admitted`: a payment the option does not admit is no answer to it. The server accepts exactly the versions the challenge lists, the list absent being `[0]`, and refuses a `legacy` message whatever the list holds, before it co-signs (`pay-kit` `86400da`, `typescript/packages/mpp/src/utils/transaction-versions.ts:15-16`, `:218-226`; `src/server/Charge.ts:424-433`, `:1077-1081`), so lcp refuses `legacy` on every challenge, before anything moves. A challenge carrying `splits` is refused at the filter, `svm/input-malformed`: lcp's client writes no split legs. 10. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the owner, as the transaction's token balances name it (`meta.postTokenBalances`), of the token account a transfer from the buyer's token account reaches, top-level or inner, and for `sol` the account a System `transfer` from the buyer's account reaches; a payment counts where one such transfer reaches the option's payee, zero included, and an agreement is held to no account; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 11. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. --- # mpp-charge-tempo-split-memo.md Source: https://lcp.integraledger.com/profiles/mpp-charge-tempo-split-memo.md **LCP profile `mpp/charge/tempo/split-memo`: the ATR hash as a split's memo in an MPP Tempo charge.** Two pairings: `mpp/charge/tempo/split-memo`, the pull form, whose signed transaction the resource server's settler broadcasts, and `mpp/charge/tempo/split-memo/push`, the push form, whose transaction the payer broadcasts and names by its hash. The challenge carries H as `mpp/charge` rules 1, 2, 3 and 5 say. The retired ids `mpp/charge/tempo/memo` and `mpp/charge/tempo/push`, which carried seven bytes of H in the attribution memo, are never reused: no form carries part of H. **The challenge** 1. The resource server places one split that carries H: `methodDetails.splits` holds `{recipient, amount: "1", memo: H}`, `recipient` the request's own `recipient`, `amount` one base unit of `currency`, and `memo` H's 32 bytes as `0x` and 64 hex digits. The seller's own splits number at most nine beside it, so that the challenge holds at most the ten splits MPP's Tempo charge admits, and the primary transfer is `amount` less every split. A charge's `amount` is therefore above 1 plus the seller's own splits. The split carrying H is the challenge's carrier: the ATR's `mpp` slot and the issued digest read the challenge without it (`mpp/charge` rule 5). 2. The challenge names `methodDetails.chainId` always, as an integer: `4217` on Tempo mainnet (`eip155:4217`), `42431` on Moderato (`eip155:42431`); a challenge without one, or with one that is not a positive integer, is refused `mpp/chain-id-required`, since MPP's Tempo charge draft reads an absent one as Moderato. It names `feePayer`, `true` where the resource server's settler pays the fee and `false` where the payer pays it in the fee token: the payer signs with the fee payer's slot open, so who pays is fixed in the challenge. 3. The pull form's challenge names `supportedModes: ["pull"]`, which stock `mppx` honours from 0.5.13; a list holding `push` names the push form, and a challenge without `supportedModes` names both. Which form a challenge offers is read from `supportedModes` alone. A payment that already moved under a challenge naming pull alone is read as the push form: its `hash` credential is read by the push form's codec. 4. A challenge is refused, and none is placed, where it carries `methodDetails.zones` (no form defines where a Tempo Zone payment's H rides), where it sets `machineTokenEnabled` (the stock client's swap route can move the memo out of the split), where it carries `methodDetails.memo` (`mpp/carrier-taken`: the carrier is the split), or where its amount is zero (the stock client then signs an off-chain proof and moves nothing). **The payment** 5. The stock client (`mppx` 0.17.6, pympp 0.20.0) builds one Tempo transaction from the challenge: the primary `transferWithMemo` to `recipient`, whose memo is MPP's attribution memo, and one call for each split, each split's `memo` copied into its transfer. So the payer's own signed transaction carries all of H, in the split's `transferWithMemo` call. lcp's client builds nothing for this form. 6. Where the challenge has the fee paid for the payer (`feePayer: true`), a stock signer sends the transaction as a `0x78` envelope: the `0x76` envelope's list with the sender's 20-byte address in the fee payer's slot, item 11. The sender signed the `0x76` form with the fee token empty and that slot `0x00`. lcp reads both envelopes, recovers the sender from the `0x76` form, and refuses a `0x78` envelope whose item 11 names another account (`tempo/tx-malformed`). 7. `bound` requires exactly one `transferWithMemo` call to `currency` whose memo is H, in a transaction of at most 65,536 bytes signed for the challenge's `chainId`; none is `tempo/memo-not-bound` and more than one `tempo/ambiguous`. A `source` the credential carries names the transaction's sender. `bound` checks how the payment carries H, never what it pays: the split's recipient and amount, like every split's, are held to the request by the stock `tempo` validation the settler runs, which also checks the attribution memo. On the push form the server first reads the named transaction's receipt, a read that moves nothing, and `bound` reads H there; a missing receipt or a failed read is a read to repeat, never a refusal. 8. The single-use value is the Tempo transaction's own nonce, fixed by its nonce key (TIP-1009): key 2^256 − 1 is the expiring nonce, whose value is the hash over the transaction's sender-signed fields followed by the sender's address (`expiringNonceHash`), which no fee payer's signature or fee token changes, marked in the nonce precompile `0x4e4F4E4345000000000000000000000000000000` at slot `keccak256(hash ‖ uint256(1))` under the transaction's `validBefore` and cleared only after it; key 0 is the protocol nonce, read by `eth_getTransactionCount`; any other key is a 2D nonce lane, read by the precompile's `getNonce(sender, nonceKey)`. The protocol nonce and a lane are consumed where they answer above the signed nonce. The chain takes the value before the transaction's calls run, outside their checkpoint, so a transaction a block includes has consumed its value whatever their result: the protocol nonce of one whose first call is a call, a lane's nonce and the expiring nonce alike (tempoxyz/tempo@c8b89f9b `crates/evm/src/handler.rs:1116-1257`, `apply_nonce`). The stock client signs the expiring nonce, with `validBefore` at most 25 seconds ahead. The signed `validBefore` bounds the value, and a transaction that signs none has no bound: it is searched until its hold ends and is never `failed`. The challenge's `expires` is not signed and bounds nothing. **The read** (`read-status`) 9. The reference names the network, the payer (the sender: recovered from the signed bytes on pull, read from the landed transaction on push), the signed `validBefore`, the payment presented (on pull, the hash over the fields its sender signed, in the `0x76` form whatever envelope carried it, as `expiringNonceHash` computes it; on push, the transaction the credential names), and the option's payee, the request's `recipient`. 10. The search for H reads, from the position the caller gives to the latest head the endpoint serves, in pages of at most 10,000 blocks, halved for an endpoint that refuses a page's range (a range refused at one block is `unreadable`, `transport`), the logs of every contract with topics `[TransferWithMemo, payer, any, H]`, by a filter that names no address, and the receive-policy guard `0xB10C000000000000000000000000000000000000`'s `TransferBlocked` logs by that event alone, each receipt decoded (`ClaimReceiptV1`, version 1) and kept where its originator is the payer and its memo is H, since a transfer a receive policy held emits no `TransferWithMemo`; a receipt the read cannot decode holds the search at its block (`read-status`, *Absence is proven, never inferred*). Each hit is read whole and tested against the act asked about: on pull, the landed transaction's sender-signed fields equal the presented transaction's; on push, the transaction is the one the credential names. A value read consumed whose transaction the search has not found is found in the first block at which the value reads consumed, by halving the blocks from the position given to the block it was read consumed at (from block 0 where it is already consumed at the position given, so that the answer is `before-position`), and in that block's transactions as the payer's transaction over that value, on the protocol nonce a transaction of another type than Tempo's among them, whose signed bytes carry the nonce and whose sender the node names the payer; its receipt decides. An agreement and a charge of this form both carry H as the split's memo, each in its own transaction: an act the caller gives under the same H is never settled on (`read-status` rule 11). 11. Success is the receipt's `status` 1 for the act's own transaction, whose sender is the payer, and in it a token's `TransferWithMemo` from the payer with memo H, or, where the payee's receive policy held that transfer, the guard's `TransferBlocked` whose receipt names the payer as originator and H as memo. What moved is every token transfer the transaction's calls make from the payer, the primary and every split, each with its token, its recipient, its amount and its log's position among the receipt's logs, a held transfer recorded as moved to the guard; the one-unit split alone is never the payment. On a charge the act pays where one of those transfers goes to the request's `recipient`, whatever its token and amount, zero included (`read-status` rule 9); a transaction of the payer carrying H with no transfer to the `recipient`, one whose every transfer to it a receive policy held among them, pays nothing (`other-account`) and, having consumed the value, answers `failed`, `instrument-consumed`, at the final mark, as the stock server finds no transfer to the recipient in it either. An agreement is held to no account, so one held this way counts. A `TransferWithMemo` with memo H in a transaction another account sent, a spender's `transferFromWithMemo` among them, is a foreign item, `other-signer`, and one the payee's own account sent is `payee-signed`; a transaction of another type than Tempo's that carries H is of another kind (`other-kind`). 12. A reverted transaction of the payer's own is included and its nonce consumed: the chain consumes a transaction's value before its calls run, and their revert does not restore it. It moved nothing; the account it names is the recipient of the transfers it signed. Read at the final mark, one that carries H and, on a charge, names the request's `recipient` answers `failed`, `transaction-failed`, and any other answers `failed`, `instrument-consumed`; the payer signs again. 13. Marks: one, `finalized`, a state and not a count, the default and the final mark; `status` takes no other finality (`unreadable`, `unparseable`). A follower node's head is final; a validator node's head can be a notarized block above `finalized`, and a transaction found there is `pending`, `below-mark`, named at `latest`, never `settled`. The position recorded at issue is the `finalized` block's number. The value is read at the `finalized` block and at `latest`, each at the last block whose timestamp is below `validBefore` where that head's timestamp is at or past it, since a later read shows nothing: unconsumed at both, its bound not passed by the `finalized` block's timestamp, `instrument-live`; the `finalized` block's timestamp at or past `validBefore`, the value unconsumed at the last block below it and the search read whole, `instrument-unused`; a bound passed at `latest` alone is `below-mark`. On pull the reference holds the value; on push it is read from the signed bytes the endpoint returns for the named transaction (`eth_getRawTransactionByHash`), which must hash to that name, and where the endpoint returns none the read holds no value. A read of the value below the latest head needs the endpoint to hold that block's state, which a header it serves does not show: such a read that fails answers `unreadable`, `history-gap`, unless the reader names the failure another reason. The cost: a value read consumed whose transaction the search did not find costs one read of the value for each halving and one block's transactions. 14. The read kit's cases (`read-status` rule 28) that cannot arise on its ledger: on both forms, *an act read at the finality asked for, below the final mark*, since no finality below `finalized`, Tempo's one mark, is asked; by the case's words, *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every log and transaction the read meets is in a block, which places it; and *a read that did not read the value at the latest head*, since each reads the value at `latest` whenever it reads it at `finalized`. On the pull form also `not-found`, since the read holds what the payer signed, its transaction, and reads that value, and so *a read with no means to read the single-use value*. On the push form also *a read with no means to read the single-use value that meets a failed result of the payer's*, since the read meets a failed result of the payer's only as the transaction the credential names, which consumed its value whatever its result (rule 8). 15. One transaction can pay two sales of this form: each sale's read names as what moved every transfer the transaction makes from the payer, the other sale's included. Where the two options name two accounts, each read settles on the transaction by its own transfer to its own payee. Where they name one account, both reads settle on the same transaction and name the same transfers, so a caller that counts each transfer for one sale alone settles only one of them: a buyer that pays two such sales of one seller in one transaction has paid the second without its settlement, and its recourse is that seller. **The agreement** 16. The pull form's payment can itself be an agreement. Its floor is 2 base units: the one-unit split carrying H and a primary of at least one unit, both to the payee. Under `feePayer: true` the resource server's settler pays the fee, and under `false` the payer, in the fee token. Success is rule 11's. A reverted transaction is no agreement (rule 12), nor is a `TransferWithMemo` with memo H in a transaction another account sent, nor a transaction the payee's own account sent. The push form is not offered as an agreement. **What a record proves** 17. "paid" where value moved, with the account it reached, and "signed" where nothing moved: the payer's own signed Tempo transaction carries all of H as the memo of a `transferWithMemo` call, and the chain verified the payer's signature when it executed the call. This does not show that the amount, the payee, the asset or the timing match the ATR's content. --- # mpp-charge-usdc-solana.md Source: https://lcp.integraledger.com/profiles/mpp-charge-usdc-solana.md **LCP profile `mpp/charge/usdc/solana`: the ATR hash as the Memo instruction of a `usdc` charge on Solana.** MPP's `charge` intent under the `usdc` method, which no stock client implements; lcp's client builds it. Rules 1–3 and 5 of `mpp/charge` apply to the challenge. 1. The request's `externalId` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes; a request whose `externalId` is present with another value is refused `svm/carrier-occupied`. lcp's client writes it as one Memo Program instruction of the transaction the buyer signs. 2. Among the transaction's top-level Memo instructions exactly one holds an LCP string, spelled as rule 1 gives, equal to the echoed request's `externalId` and naming the H of the challenge's id, as `mpp/charge/solana` rule 3 states. The credential is `type="transaction"` alone; the settler broadcasts. 3. The client builds the highest message version both `methodDetails.transactionVersions` and lcp admit: version 1 where the list holds 1, version 0 where it holds 0 alone or is absent, as `@solana/mpp` builds it where a challenge lists it, in a release later than 0.7.0 (`pay-kit` `86400da`, `typescript/packages/mpp/src/client/Charge.ts:211-220`); a list that admits neither is refused at the filter (`svm/input-malformed`). `bound` and `reference` decode legacy, version 0 and version 1 messages, and refuse one whose version the challenge does not admit, `svm/version-not-admitted`: a payment the option does not admit is no answer to it. The server accepts exactly the versions the challenge lists, the list absent being `[0]`, and refuses a `legacy` message whatever the list holds, before it co-signs (`pay-kit` `86400da`, `typescript/packages/mpp/src/utils/transaction-versions.ts:15-16`, `:218-226`; `src/server/Charge.ts:424-433`, `:1077-1081`), so lcp refuses `legacy` on every challenge, before anything moves. 4. The agreement: its floor is 1 base unit, since the request's `amount` is a positive integer; the fee is paid by the settler where the challenge names it fee payer, else by the buyer; it succeeds as `mpp/charge/solana` rule 8 states. 5. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the owner, as the transaction's token balances name it (`meta.postTokenBalances`), of the token account a transfer from the buyer's token account reaches, top-level or inner; a payment counts where one such transfer reaches the option's payee, zero included, and an agreement is held to no account; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 6. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. 7. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, whose one LCP-form Memo instruction is the hash's LCP string, final at `finalized` with no error. It paid each transfer it made from the buyer's account, recorded with its mint or lamports, amount and recipient, one of zero included, the recipient being the owner the transaction's token balances name; as a payment, one of them reached an account the option's payee owns. The memo is in the transaction's instruction data on chain. It compares no amount, mint or time with the ATR's terms. --- # mpp-charge-usdc-stacks.md Source: https://lcp.integraledger.com/profiles/mpp-charge-usdc-stacks.md **LCP profile `mpp/charge/usdc/stacks`: the ATR hash as the SIP-010 `transfer` memo of MPP's `usdc` Stacks charge, and the read of the payment by its origin and the nonce the origin signed.** Rules 1–3 and 5 of `mpp/charge` apply to the challenge. The read's answers and the rules that choose them are the profile `read-status`'s; this profile states how this pairing's read finds what those rules name. **The payment** 1. SIP-010's `transfer` takes `(memo (optional (buff 34)))`, and the `usdc` Stacks profile requires exactly the Clarity arguments `(uint amount, principal sender, principal recipient, (optional (buff 34)) memo)`. The memo is H's 32 raw bytes: the `lcp:` string is 77 bytes and does not fit. 2. The usdc specification does not fix the memo's value; this profile makes it `some` of H's 32 bytes, serialized `0x0a0200000020` ‖ H. 3. The transaction is a contract call to the profile's token contract named `transfer`, with post-condition mode Deny and anchor mode OnChainOnly, signed by the payer's Stacks wallet. Its chain id is the profile's `chainId`, and its version is that network's, as stacks-core's `validation.rs` requires: 0x00 on chain id 1 (CAIP-2's `stacks:1`, mainnet) and 0x80 on any other. 4. A transaction of 1 to 16,384 bytes is read (`MAX_STACKS_TX_BYTES`, the package's own bound on the work of decoding one). The origin signs a standard authorization, and pays its own fee, or a sponsored one, whose fee a sponsor pays: the sponsor fills its spending condition, which the origin signs in the empty form (P2PKH, a zero signer, nonce and fee, a compressed key encoding and a zero signature), and signs after the origin (`@stacks/transactions` 7.6.0 `dist/esm/authorization.js:220-225`, `:295-301`). Which the payment takes is the resource server's choice in its offer; the binding of H and the read are the same for both. A sponsor's signature changes the transaction's id, so the id of a sponsored payment is fixed only once the sponsor has signed. 5. The settler broadcasts the transaction, sponsoring it where it is sponsored, over the bytes the origin presented. It keys its record of an instrument on the network, the origin, the nonce and the SHA-512/256 of the transaction as the origin presented it, so that two signed bodies at one nonce never share a record: a second body at a used nonce is another instrument, whose read answers `instrument-consumed` naming the transaction that consumed the nonce, and a repeat is the identical bytes, which a settler may sponsor again under a new id. The form has no validity window: a Stacks transaction has no expiry, and a signed payment never broadcast stays payable for as long as the origin leaves its nonce unused. **The agreement** 6. The payment can itself be the agreement: its floor is 1 base unit of the offer's asset, the `usdc` method asking a positive integer; the fee is the sponsor's on a sponsored authorization and the origin's on a standard one; the transaction must succeed, as rule 9 states; and a transaction whose origin is the option's payee is no agreement and pays nothing, the sponsor's signature being the fee payer's and never the test. **The reference** 7. `reference` gives, from the presented credential and the challenge it answers: the network; `origin`, the origin's c32 address, its signer's hash160 at its hash mode's version on the transaction's network; `nonce`, the origin's nonce as a decimal string; `payee`, the challenge's `recipient`, the key of the read's two party tests and no search key, which the challenge's filter takes only as a Stacks node writes a principal, c32check in uppercase with no alias digit, so that it is the spelling the endpoint names accounts in (a recipient in any other spelling, lowercase or with `O`, `I` or `L` among them, which c32 decoding reads as another spelling of a canonical principal, is `mpp/request-malformed`); `signed`, the digest of what the origin signed (rule 15); and, on a standard authorization only, `transaction`, the transaction's id, a hint the read takes first. It names no contract and no asset. A credential whose echoed challenge is not the challenge given, member by member, its `request` and `opaque` by their decoded members, is `mpp/challenge-not-option`. The read takes H beside the reference. **The read** 8. The read goes through a Stacks Blockchain API endpoint (`stacks-api-rest`), stacks-blockchain-api 9.9.0's routes: the transaction by its id with its events and its bytes; the origin's `last_executed_tx_nonce` at the tip or at a block height (`/extended/v1/address//nonces`); the lookup by origin and nonce (`/extended/v1/tx/?from_address=&nonce=`); the origin's transactions in ascending order; a block's transactions (`/extended/v1/tx/block_height/`); the tip's Stacks and Bitcoin heights; and the Bitcoin height of the burn block of the tenure after a block's. The routes of the lookup, the nonce and the block are deprecated upstream, each naming a successor; this profile pins 9.9.0's. A 404 for a height a route does not know is `unreadable`, `history-gap`, never absence. 9. **What succeeded means.** A transaction counts only on the canonical chain and included, with status `success`, `abort_by_response` or `abort_by_post_condition`. It succeeded with status `success`. `abort_by_response` and `abort_by_post_condition` are included with a failed result, the fee paid, and consume the origin's nonce. `problematic_skipped` is not included and consumes nothing; a transaction not on the canonical chain, unmined or dropped decides nothing. None of these is a foreign item. 10. **Marks and positions.** Two marks: `block`, the transaction's block, and `bitcoin`, the final one, once at least 6 Bitcoin blocks stand on the Bitcoin block that anchors the block, the anchoring block among them. The Stacks state as of the start of tenure N is anchored at Bitcoin block N + 1, so the count starts at the Bitcoin block after the burn block of the first tenure that starts after the block's own and builds on it, and never at the block's own tenure's burn block: the block is at `bitcoin` where the tip's Bitcoin height less that burn block's height is at least 6. Stacks' documentation names no depth (*Bitcoin Finality*, *Bitcoin Reorgs*); 6 is Bitcoin's common one. A position is a Stacks block height; a transaction in a microblock no anchor block confirms (`is_unanchored`) has no block that places it. 11. **Which transaction decides.** The origin's transaction at the signed nonce, on the canonical chain and included, decides, read whole by its id with its events; and, for the act asked about, any act of the origin's the search for H (rule 13) finds. The reference's `transaction` is read first and decides only where it is that transaction; any other transaction met decides nothing. The origin is the API's sender, never the sponsor. Where the origin's last executed nonce at the tip, the latest head the endpoint serves, is below the signed nonce, or it has none, the nonce is unconsumed, there and so at the final mark. Where it is at or past the signed nonce, the lookup finds the transaction at that nonce, each of its results read whole; for nonce 0, which the route does not filter, a scan of the origin's transactions in ascending order to the first at a higher nonce. A lookup or scan answer naming another origin's transaction, or for a nonce other than 0 another nonce's, is not the route's documented answer and proves nothing. Every result at a nonce is read: two that decide at one nonce are an answer no chain gives, `unreadable`, `unparseable` at the signed nonce, and items the search could not decode at a nonce of the search (rule 13). Where neither finds it, the fallback bisects the origin's nonce by block height, from the position given, or from height 1 where none is given or the nonce at the position already reaches the signed one, to the first block where it reaches the nonce, and reads every page of that block's transactions for the origin's at the nonce. A nonce read consumed whose transaction none of these finds answers `search-incomplete`, never `not-found` or `failed`. 12. **The forms that carry H.** A transaction carries H in this pairing's form where it calls `transfer` with `(some H)` as its fourth argument, or where it is a token transfer whose 34-byte memo field is H followed by two zero bytes; it carries H in another form where a contract call holds `(some H)` or H as a 32-byte buffer in any other argument or function, which makes it an act of another kind. The account a transaction names is the recipient of the `fungible_token_asset` `transfer` events of the called contract's tokens, the call's recipient and memo arguments only locating them, or the token transfer's recipient: the payee's where one of them is the option's payee, another where none is, and none where it moved nothing. What moved is each such event's asset, amount and recipient, or the token transfer's, with `STX` as its asset, each named by its transaction and its place there, the event's index among the transaction's events as the endpoint lists them, or `payload` for the token transfer, the transaction's own payload; it is recorded as observed and compared with nothing but by its recipient, on a payment. The signer is the origin; an origin that is the option's payee makes the transaction payee-signed, on either act. A transaction included with a failed result moved nothing, so the account it names is the one the origin signed it to pay: the recipient argument of its `transfer` call, or the token transfer's recipient. The origin's transaction at the signed nonce included with a failed result is the act's own failed result, `transaction-failed`, only where it carries H in this pairing's form and, for the act `payment`, names the payee's account; any other, one that carries no H among them, consumed the nonce and is the transaction of an `instrument-consumed` answer (profile `read-status`, rule 20). 13. **The search for H.** Where the transaction at the signed nonce is not the act asked about at the finality asked for, the read searches every nonce the origin executed after the position it starts from, through the last it executed at the tip: each transaction of an origin takes its next nonce, so those are its acts. The search starts at the search position an earlier answer returned, else at the nonce after the one the origin had executed at the height of the position given, else at nonce 0; each nonce is found as rule 11 finds the signed one. It reads at most 32 nonces in one read (`MAX_SEARCH_NONCES`) and answers `search-incomplete` with the next nonce to read as its search position, and stops there too at a nonce whose transaction it does not find. An act of this kind found at another nonce is the act asked about, unless it is an other act the caller gave, by its transaction or by a reference naming its origin and nonce or its id; any other that carries H is a foreign item, with its reason. A transaction a lookup names whose answer the reader gives out of its documented form is an item the search could not decode: the answer names it, the search is held at its nonce, and the search reads on; at the signed nonce, or as the reference's own transaction, which the read names, it is `unreadable`, `unparseable`. 14. **What is not yet shown.** A search from a position given reads its first nonce from the nonce route at that position's height. That the route's `last_executed_tx_nonce` at a height is the last nonce the origin executed at or before that block is read at source (stacks-blockchain-api 9.9.0 `src/api/routes/v1/address.ts:765-772`) and not yet shown by a run, so such a search proves no absence and is never read whole: it answers no `failed` but `before-position` until a run shows the route's answer, and a range it read to its end gives no search position, the next read reading it again from its start. A search from nonce 0, or from a search position, reads no nonce at a height for its range. 15. **The payment presented.** A `settled` answer states `presented`: `yes` where the landed transaction's origin signed what the presented one's did, `no` where it did not, and `unshown` where the reader gives no bytes whose SHA-512/256 is the landed transaction's id. A reference without `signed` is no reference: `status` answers `unreadable`, `unparseable`, with nothing read. What the origin signed is compared by its digest: SHA-512/256 over the initial signature hash, the SHA-512/256 of the transaction with the origin's spending condition cleared (its nonce and fee zero, a single signature's 65 bytes zero or a multisignature's auth fields an empty list) and, on a sponsored authorization, the sponsor's spending condition in the empty form of rule 4, followed by the flag 0x04 and the origin's fee and nonce, 8 bytes each, big-endian (`@stacks/transactions` 7.6.0 `dist/esm/authorization.js:55-70`, `:178-188`; `dist/esm/transaction.js:30-34`, `:43-51`). So copies of one payment signed by other quorums, or sponsored by another sponsor, read `yes`, and the sponsor's account and fee are no member. **Declared inapplicable to the read kit** 16. Declared inapplicable to the read kit (profile `read-status`, rule 28): `instrument-unused`, since a Stacks transaction has no expiry; and `not-found`, since the read holds the single-use value, the origin's nonce, and answers it unconsumed `pending`, `instrument-live`, and consumed with its transaction not found `pending`, `search-incomplete` (rule 11). The two are declared by their premises, by the case's words: every case that reads the value with its validity passed, since a Stacks transaction has no expiry; and *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since the read holds the nonce and reads it at the latest head's height (rule 11). The search from a position rests on the nonce read at a height, not yet shown (rule 14), and answers no `failed` but `before-position` until a run shows it; with no position given it starts at nonce 0, so the kit's `failed` cases, which give none, run. This pairing's read-kit form skips those cases and no other, and makes two cases in this ledger's own spelling, where the rule that decides them treats the two alike: a transaction another account signed that consumed the value is the origin's, since only the origin's own transaction takes its nonce (rule 16 of `read-status` decides `before-position` before it asks who signed), and a second act of the payer that meets every test is at another nonce, since two at one nonce are an answer no chain gives (rule 21 asks nothing of the nonce). **What a record proves** 17. The payer signed a Stacks transaction whose origin is the payer and which carries this ATR's hash as the `(some H)` memo of a SIP-010 `transfer`, or as a token transfer's memo; the chain verified the origin's signature, the transaction executed with status `success` on the canonical chain, and the memo is in the mined transaction on chain. Where it made a transfer, one of zero included, it paid that transfer's recipient, named in the record; the origin, never a sponsor, is the signer. This does not show that the contract is a SIP-010 token, or that the amount, the asset or the timing match the ATR's content. --- # mpp-charge-xrpl.md Source: https://lcp.integraledger.com/profiles/mpp-charge-xrpl.md **LCP profile `mpp/charge/xrpl`: the ATR hash as the charge Payment's `InvoiceID`.** Rules 1–3 and 5 of `mpp/charge` apply to the challenge. 1. The request's `methodDetails.invoiceId` is H's 32 bytes as 64 uppercase hex digits. A request whose `invoiceId` is present with another value is refused `xrpl/carrier-occupied`: the `Payment` has one `InvoiceID`, and a seller's own reference belongs in the ATR's content. 2. The request is the stock `xrpl-mpp-sdk` 0.1.0-beta.4 charge request (`dist/chunk-L6LVAN2P.js:17-90`). `methodDetails.network` names `mainnet`, `testnet` or `devnet`, the networks `xrpl:0`, `xrpl:1` and `xrpl:2`; it has no default (`xrpl/network-missing`, else `xrpl/network-malformed`). `currency` is a string, as the stock schema has it: `XRP`, an issued currency as `CUR:issuer` or as the JSON text of `{"currency","issuer"}`, or an MPT as the JSON text of `{"mpt_issuance_id"}` (`dist/chunk-JQG7ATQA.js:170-183`); an object is refused `mpp/request-malformed`. lcp reads these forms whole, where the stock `parseCurrency` reads the first two parts of a `CUR:issuer` text with more colons and the two members of a JSON text that holds others: a text with a second colon, or a JSON text with any other member, is refused `mpp/request-malformed` before anything moves, lcp's own stricter reading, so that no part of the currency the challenge names goes unread. `amount` is drops for XRP and the value otherwise. `methodDetails.memos` is absent, or an array of objects whose only members are the optional strings `type`, `format` and `data`; `destinationTag` and `sourceTag` are numbers where present. 3. The payer signs one `Payment`, as the stock client writes it (`dist/client/index.js:333-346`): `InvoiceID` the request's `invoiceId`, which is H; `Destination` the request's `recipient`, with its `destinationTag`; `Amount` from `currency` as the stock `buildAmount` writes it, drops, an issued amount, or an MPT amount, where lcp's build writes an issued amount's `SendMax` equal to it and the stock client computes `SendMax` from the issuer's transfer rate and its slippage and finds paths (`dist/client/index.js:42-104`), so that lcp's build fails with a `tec` result where the issuer charges a transfer fee; `SourceTag` the request's `sourceTag`, or 593184257, the stock `MPP_SOURCE_TAG`; `Memos` from `memos` where it holds any, each member's UTF-8 in uppercase hex (`:391-399`); a `LastLedgerSequence`; and no `NetworkID`, each network the challenge can name having an id of at most 1024. It may be single-signed or multisigned. 4. The credential names its payer by `source`, `did:pkh:xrpl:{network}:{address}`, the network as `methodDetails.network` names it, as the stock client writes it and the stock server reads and requires it before anything else. Its payload is `{"type":"transaction","blob"}`, the signed blob the seller's server submits (pull), or `{"type":"hash","hash"}`, a transaction the payer broadcast itself (push), which no challenge member excludes, the mode being the stock client's own setting. A `hash` credential is read by its hash once the transaction is in a validated ledger (`fetchPresented`), and only then checked. 5. The server refuses a credential whose signed `InvoiceID` is not the request's `invoiceId` and H (`xrpl/carrier-mismatch`), whose blob carries a `NetworkID` (`xrpl/network-mismatch`), whose `transaction` payload's blob is over 8,192 hex digits, 4,096 bytes, the most the stock server's schema takes (`dist/chunk-L6LVAN2P.js:16`, `:24`), a large multisigned quorum's among them (`xrpl/blob-too-large`), or whose blob is over 16,384 bytes, lcp's bound on any XRPL blob it decodes (`xrpl/blob-too-large`), or whose signed transaction is not a `Payment` (`xrpl/not-payment`), before anything moves; rule 10 of `mpp/charge` orders the checks, the server's own record that this H's act is now taken, and then the stock server's verification and broadcast. **The reference.** 6. `reference` gives the network, the transaction's hash, H, the payee (the `recipient` of the challenge it is given, the key of the two party tests), and, for a `transaction` credential, the payer's instrument as signed, as the profile `x402/exact/xrpl` rule 7 states it; a `hash` credential gives the transaction it names alone, and the read finds the instrument from it. It refuses a credential whose echoed challenge is not that challenge, compared by RFC 8785 form (`mpp/challenge-not-option`). A payment of this pairing is never an agreement. **The read.** 7. The read is that of the profile `x402/exact/xrpl`, rules 9 to 15, with MPP's `InvoiceID`, H itself, as the carrier: one mark, `validated`; found by the payer's instrument; what moved, the signer and the authority; the lapse; the search for H through the payer's `account_tx`, which lists every transaction of the payer's account, so that a search read whole proves absence; and the history. A `Payment` that took the instrument and paid another account than the payee's is `instrument-consumed` (read-status rule 9). 8. A payment presented by its hash alone is first looked up by that hash (`tx`) from the issue ledger to the validated ledger; once found it names the instrument, and the read is rule 7's, `presented` `yes` where the act is the transaction the credential names and `no` where it is another. Where the lookup is read whole and finds nothing, the answer is `pending`, `not-found`: the read holds no sequence number or ticket for that payment. **The read kit.** 9. Declared inapplicable to the read kit: *an act read at the finality asked for, below the final mark*, since a seller names `validated` alone; *each transfer of what moved is named by its transaction and its place in it*, since each transaction the read takes holds one transfer, a `Payment` delivering one amount to its one `Destination`; and *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since a `Payment` of zero is malformed and a partial payment that delivers nothing does not succeed. A case is named by its reason, or by the opening words of its text in `read-status.json`, and is made in the ledger's own spelling as the profile `x402/exact/xrpl` rule 16 states. 10. What a record of this pairing proves: the payer signed an XRPL `Payment` whose `InvoiceID` is this ATR's hash, and it is in a validated ledger with `tesSUCCESS`: it paid the amount `meta.delivered_amount` states to the account its `Destination` names. This does not show that amount, destination, asset or timing match the ATR's content. --- # mpp-charge.md Source: https://lcp.integraledger.com/profiles/mpp-charge.md **LCP profile `mpp/charge`: the ATR hash in an MPP challenge.** It defines the pairings its rules 4 and 6 to 9 name; each other MPP profile states which of its rules apply to that profile's challenges. 1. The challenge's `opaque` map carries `legalContext` = `lcp:sha256:` + H and `legalContextUrl`, an `https` URL that serves the ATR's exact bytes. 2. The challenge `id` is the base64url (no padding) of H's 32 bytes, then `.` and the challenge's position, 0 to 31, except that a Tempo `subscription` challenge's id is exactly the base64url (no padding) of H. The resource server gives each challenge of a sale its own position, its charge challenges and its agreement challenges together, so that a sale holds at most 32 challenges and no two share an id; a response that would hold two challenges with one id is refused. The resource server records each challenge's id when it issues it, and a credential whose echoed id is not, whole, the id recorded for that challenge is refused (`mpp/id-not-ours`): the part after H is the position, so one issued challenge yields one payment number on every form whose single-use value derives from the id. Every agreement challenge states `expires`, and one without it is not composed (`mpp/expires-required`); composed anew once that `expires` has passed (rule 5), it takes the position, and so the id, of the challenge it replaces, so a sale's challenges never take more positions than it first issued. 3. The client fetches the URL, computes SHA-256 over the bytes received, and compares it with H as 32 bytes. On a mismatch it does not sign. 4. EVM `authorization` and `permit2` (`mpp/charge/evm/authorization`, `mpp/charge/evm/permit2`): the signed nonce, and on `permit2` the witness `challengeHash` as well as the permit's `nonce`, is keccak256(UTF-8(JSON.stringify([id, realm]))), the id and realm framed as a JSON array of two strings, as MPP's `mppx` SDK computes it from 0.13.1. A nonce or witness that is keccak256 of the id's UTF-8 followed by the realm's is refused, and so is a permit whose `nonce` is not that value (`mpp/nonce-not-challenge-hash`): the read keys the charge on the payer's Permit2 bit at it. 5. The ATR's `mpp` slot holds the challenge's bound parameters (`realm`, `method`, `intent`, `request`, `expires`, `digest`, `header`, `opaque`) as issued, so the id is bound to them through H. The issued digest of a challenge is SHA-256 over the RFC 8785 form of those parameters, with `request` decoded and its carrier removed, and `opaque` decoded without its `legalContext`, `legalContextUrl` and `legalContextAgreementUrl` members, omitted when that leaves it empty. For a pairing whose quote or invoice the resource server writes after H (`nearintents`; Lightning's charge and session), the slot holds, and the issued digest covers, the challenge without the members written after H, so the challenge the server sends once they are written has the digest of the one the ATR binds. An agreement challenge, which no slot holds, is held to the digest the resource server recorded for its agreement option; its bound parameters, `expires` among them, are repeated exactly at every re-challenge, and once that `expires` has passed while no agreement payment has been taken for H and the offer has not expired, the option is composed anew and its digest recorded in place of the old. 6. EVM `transaction` and `hash` (`mpp/charge/evm/transaction`, `mpp/charge/evm/hash`) carry H in no signed or landed value. When `opaque` carries `legalContextAgreementUrl`, the client first pays that URL, whose payment carries H, and pays the challenge only after its 200 receipt. A `hash` challenge, whose payer broadcasts the payment itself, is absent from every response the resource server sends before the agreement for its H is recorded. 7. **Lightning** (`method="lightning"`; `mpp/charge/lightning`, and the session `mpp/session/lightning`): the challenge's BOLT11 invoice (`methodDetails.invoice`, or `depositInvoice` for a session) decodes strictly by BOLT 11, as `decodeBolt11` decodes it (exactly one `p` and one `s` field, at most one `n`, and a signature that verifies by the `n` key or by public-key recovery), and has exactly one `h` field, equal to H, and no `d`; the request carries `paymentHash` equal to the invoice's. The client checks, as BOLT11 requires, that `h` is the SHA-256 of the ATR it fetched before paying. 8. **`usdc`, EVM and Gateway** (`mpp/charge/usdc/evm`, `mpp/charge/usdc/gateway`): the signed nonce, or the TransferSpec salt, is usdc's derivation over the challenge `id`, so it commits to H. As v00 of the `usdc` draft requires, an EVM profile's `decimals` is 6 (else `mpp/request-malformed`), and its `credentialTypes` is absent or `["authorization"]`, a Gateway profile's absent or `["transfer"]` (else `mpp/credential-types`). An EVM profile's `request.currency` is the native USDC token contract Circle publishes for its `chainId`, as the draft requires servers to verify; lcp holds Circle's published table (*USDC Contract Addresses*, read on 2026-11-17), and refuses a currency that is not that chain's token, or a chain the table lacks, `mpp/usdc-not-native`. On Gateway the salt rides in the burn intent the payer signs, and the destination network's mint carries the whole TransferSpec; its read is the Gateway Minter's `AttestationUsed(token, recipient, transferSpecHash, sourceDomain, sourceDepositor, sourceSigner, value)` whose third topic is the TransferSpec's keccak-256 hash, rebuilt from the challenge with its salt recomputed, or the minter's `isTransferSpecHashUsed(hash)`; the mint's recipient, the TransferSpec's `destinationRecipient`, is the account the payment names; and its lapse is the intent's signed `maxBlockHeight` passed on the source network at that network's final mark with the hash unused on the destination's minter. This package's client signs a `maxBlockHeight` that lapses: `build` takes `sourceNetwork`, the CAIP-2 network the burn intent spends from, the `burnIntentExpirationHeight` that Circle Gateway's `GET /v1/info` serves for that network, the lowest expiration Gateway accepts, and the source Gateway Wallet's `withdrawalDelay()` in blocks, each a decimal string below 2^256, and writes into its request the height plus 100 seconds counted in that network's blocks at the pace of the delay's 7 days, ceil(`withdrawalDelay` × 100 / 604,800); an input absent or malformed, or a sum above 2^256 − 1, is `mpp/input-malformed`; `complete` refuses a credential whose `sourceNetwork` is not the one the height was read for (`mpp/input-malformed`), and a signed burn intent whose `maxBlockHeight` is not that value (`mpp/max-block-height-changed`). The Gateway signing request also carries `challengeRequest`, the chosen challenge's `request` as issued, whose `usdcRequestHash` is the preimage's `requestHash`, so a client shows the amount, the currency, the destination network and the `maxFee` the burn intent grants and holds the hash to them. Circle's own client signs 2^256 − 1, an intent that never lapses (`@circle-fin/x402-batching` 4.0.0, `GatewayClient.createBurnIntent`). The vectors are `mpp-charge-usdc-gateway.json`'s `ceiling`. Until a run shows that read, the Gateway form is at coverage `none`, its salt a link, and it follows an agreement. **Stacks** (`mpp/charge/usdc/stacks`, whose profile is `mpp/charge/usdc/stacks`): the SIP-010 `transfer` memo is `some` of H's 32 bytes. 9. **`card` and `stripe`** (`mpp/charge/card`, `mpp/charge/stripe`): the request's `externalId`, or `methodDetails.metadata.legal_context`, is `lcp:sha256:` + H. The buyer's card or Stripe token does not carry H; the challenge and the seller's reference do. 10. **The server's order.** A resource server makes these steps in this order, and nothing before step 4 can move money: 1. Two checks, which a stock MPP server does not make. The challenge belongs to this agreement: its id and `opaque` name H (rules 1 and 2), its id is, whole, the id the server recorded when it issued that challenge (rule 2), and its issued digest equals the one the server recorded for H (rule 5), or, for an agreement challenge, which states `expires`, the one it recorded for its agreement option. A credential of an agreement challenge since composed anew in the same position passes the id check and is refused at the digest, whose bound members hold `expires` and not the id. The payment carries H: the pairing's own check of how its credential carries H, or its link, in the pairing's form, which never judges what the payment pays (its amount, asset or payee). For a credential whose payer already broadcast the payment, the server first reads the landed transaction, a read that moves nothing, and the check reads H there. For a pairing whose payer signs nothing that carries H (rules 6 and 9), the second check is the pairing's link, where it has one, and the server's own record that the agreement for this H is recorded. 2. Validation that moves nothing, where the method's library separates it from its broadcast. 3. The server's own record that this H's act, its agreement or its payment, is now taken, made once for each H and act. A later credential of an open channel is held to its channel and makes no such record. The record stands until the payment's instrument is shown consumed or lapsed. 4. Only then any call that can move money: a broadcast, a one-step verification that settles, or a processor's charge, made by whichever party broadcasts. What a payment pays is checked only by the verification of the party asked to settle it, under its own protocol. Before it places H, each pairing's `advertise` holds the challenge to that pairing as `pairingsOf` names it, and a challenge that does not offer the pairing is refused (`mpp/not-this-pairing`). The vectors are `mpp-server-checks.json`. 11. **An echoed `opaque` that is an object.** A credential whose echoed challenge carries `opaque` as the object of its members, as `mppx` releases before 0.6.4 write it, is read by those members, each a string: every check above reads it as it reads the base64url form. Any other value of `opaque` is refused. 12. **An MPP payment that is an x402 payment.** Where the payer's signed act is the same on both protocols, the `evm` method's `authorization` credential and the `usdc` method's EVM credential, the credential and its challenge map to x402's `exact` scheme with EIP-3009, which an x402 facilitator settles: `PaymentRequirements` `{scheme: "exact", network: "eip155:" + chainId, amount, asset: currency, payTo: recipient, maxTimeoutSeconds, extra: {name, version}}`, with `amount`, `currency` and `recipient` the request's and `chainId` its `methodDetails` (on `usdc`, `methodDetails.evm`); `PaymentPayload` `{x402Version: 2, accepted: those requirements, payload: {signature, authorization: {from, to, value, validAfter, validBefore, nonce}}}`, the credential's own members. The token's EIP-712 `name` and `version`, which x402's verification reads from `extra` and no MPP challenge carries, are the resource server's input. `maxTimeoutSeconds` is the challenge's `expires` less `issued`, the Unix second at which the resource server issued the challenge, which it gives beside the token's name and version; it is never the window the payer signed, which this package's builds of both forms open at 0 and close at `expires`, so that the window's length is `expires` itself. A challenge with no `expires` offers neither form and is refused (`mpp/expires-required`), and an `issued` that is not an integer second before `expires` is refused (`mpp/input-malformed`). x402's verification reads no `maxTimeoutSeconds`, which its schema requires to be positive, and accepts the payment while its `validBefore` is at least 6 seconds ahead. Only the nonce's derivation differs (rules 4 and 8), which x402's facilitator does not check. Splits, a Permit2 witness, a Gateway burn intent and every non-EVM form have no x402 twin and are not mapped. The vectors are `mpp-x402-mapping.json`, which hold x402's own verification of each mapped payment. 13. **Tempo:** a charge carries H as the memo of a split the resource server places, in the transaction the payer signs; profile `mpp/charge/tempo/split-memo`. A Tempo charge challenge offers its forms by `supportedModes` alone, and one that carries `methodDetails.zones` or sets `machineTokenEnabled` is refused. Its read takes the transaction's nonce by its nonce key at Tempo's one mark, `finalized`, and at the latest head, and searches the receive-policy guard's held transfers beside `TransferWithMemo` (that profile, rules 8 and 10 to 13). 14. **The agreement, on `evm` `authorization`, `usdc` EVM and `evm` `permit2`.** Each pairing's payment can itself be an agreement: an agreement challenge has its own id, so its own nonce or witness, apart from every charge's. The floor is 0 on `authorization`, offered as 0 only where the network's settler declares that it takes zero and otherwise 1 base unit; 1 base unit on `usdc`, whose draft asks a positive amount; and 1 base unit on `permit2`, whose primary transfer must be above zero. The settler pays the fee. Success is a receipt whose `status` is 1 and in which the token emitted `AuthorizationUsed(authorizer, nonce)`, the nonce derived from the agreement challenge and the authorizer the payer, paired with its `Transfer` (rule 15); on `permit2`, the payer's `Transfer` in a transaction whose input carries the derived value as the nonce, or the challenge's witness word, of the Permit2 call whose owner is the payer, and the payer's bit for the call's own nonce set at that block and unset before. A reverted settlement, or a successful transaction with no such use, consumes nothing and is no agreement; a cancellation consumes the nonce for that authorizer on that token for good. 15. **The read** (`read-status`), on the EVM pairings. Marks: `latest`, `safe` and `finalized`, the final one `finalized`. The position recorded at issue is the `finalized` block's number. On every pairing the read takes only an asset contract's own `Transfer`: on Arc each USDC transfer also emits a `Transfer` from the system emitter `0xfffffffffffffffffffffffffffffffffffffffe`, in 18 decimals, and a plain native send emits that log alone; it is neither paired, nor recorded as what moved, nor a second transfer. A transaction with a failed result moved nothing, and the account it names is the destination in what the payer signed: the recipient its decoded call names. - `authorization` and `usdc` EVM: the single-use value is the derived nonce, which each token keeps for itself. The search reads every contract's `AuthorizationUsed` with the payer and that nonce as topics, by a filter that names no address, from the position the caller gives to the latest head, in pages of at most 10,000 blocks, halved for an endpoint that refuses a page's range (a range refused at one block is `unreadable`, `transport`); a hit on a contract other than `currency` counts only where the payer's signature over the authorization its transaction carries verifies in that contract's EIP-712 domain, by ecrecover or by the payer's ERC-1271 `isValidSignature`, as the `x402/exact/eip155/eip3009` profile's rule 13 states, counts for nothing only where it is shown not to be the payer's, and otherwise holds the search at it. A cancellation is `currency`'s `AuthorizationCanceled` with that nonce. Below the position given, a nonce read consumed there is traced to the transaction that consumed it as that profile's rule 19 states, by `currency`'s `[AuthorizationUsed, payer, nonce]` and `[AuthorizationCanceled, payer, nonce]` in the first block it reads consumed at, each read of the nonce at a block whose state the endpoint does not hold answering `unreadable`, `history-gap`. A use is paired with its `Transfer` by the token's two logs where the transaction holds one use and one transfer of that authorizer on that contract, and otherwise by decoding the call that consumed it. On a charge the act pays where that `Transfer` goes to the request's `recipient`, whatever its token and value. The value is read at the `finalized` block and at the latest head. The lapse: `authorizationState(payer, nonce)` false on `currency` at a `finalized` block whose timestamp is at or past `validBefore`, and at the latest head, with the search read whole. The payment presented is the token, `from`, `to`, `value` and `nonce`, read from the two paired logs; the window is no member. Cases that cannot arise on these pairings (`read-status` rule 28): `transaction-failed` and the cases opening *a failed result that consumed the value*, since a reverted settlement consumes no authorization nonce; `not-found`, since each read holds its single-use value; *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since each read holds its single-use value and reads it at a `finalized` block and at the latest block; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every log and transaction the read meets is in a block; and *each transfer of what moved is named by its transaction and its place*, since an EIP-3009 use moves one transfer. - `permit2`: the search reads every contract's `Transfer` from the payer, a hit counting only where its transaction's input carries, in a Permit2 witness call whose owner is the payer, decoded, naming the hit's token, recipient and amount, the derived value as its nonce or the witness word of a challenge of the sale's issue, the EIP-712 hash of `PaymentWitness{challengeHash, externalId}` (draft-evm-charge-00 at tempoxyz/mpp-specs 08e7dd87, lines 449-483), and the payer's bit for the call's own nonce is set at the hit's block and unset at the block before. The witness words are the presented permit's and, where the caller gives `reference` the issue beside the chosen challenge (`issue`: the charge challenges as the ATR's `mpp` slots hold them and the agreement challenges as the resource server issued them for H), those of each of its challenges whose method is `evm`, whose intent is `charge`, whose request admits `permit2` and whose `methodDetails.chainId` is the chosen one's, each fixing its id, realm and `externalId` at the issue; `reference` refuses an issue holding a challenge whose id is not of H, `mpp/id-not-ours`, and names each word it counts (`witnesses`). A call under another nonce or another challenge of the issue carrying such a word is an act carrying H that consumed no value of the reference's; a cancellation is Permit2's `UnorderedNonceInvalidation` with the payer as owner; a transaction that carries the value in no such call but holds the payer's EIP-3009 use of it that the token logged, the `authorization` charge of the same challenge, holds an act of another kind, which consumes no Permit2 bit. The value is read at the `finalized` block and at the latest head. The lapse: the bit unset at a `finalized` block past `deadline`, and at the latest head. Cases that cannot arise: `transaction-failed` and the cases opening *a failed result that consumed the value*, since a reverted settlement consumes no Permit2 bit; `not-found`, since the read holds its value; *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since it holds its value and reads it at a `finalized` block and at the latest block; the three cases of *an act the read cannot place against the position given* and *an item the search could not decode that gives no position*, as above; and *an act the option's payee signed*, *an act carrying H under another account's signature*, *a transaction for which two reasons hold* and *the settled act's answer names every foreign item*, since each gives an act carrying H that another account signed and that consumed nothing, and the search reads the payer's own transfers and cancellations, so every act it meets is the payer's. - `transaction` and `hash` (coverage `none`): the act is the transaction the credential carries or names. What it moved is recorded with each recipient, and it pays where one transfer goes to the request's `recipient`. One that reverted is `transaction-failed` at the final mark where the `transfer` call that is the transaction's own pays the `recipient`, and otherwise `failed`, `instrument-consumed`, since its inclusion consumed the payer's nonce; one that succeeded with no transfer to the `recipient` is `failed`, `instrument-consumed`, `other-account`. A relayed transaction that never lands signs no bound and is never `failed` by lapse; while the named transaction is not found the answer is `pending`, `not-found`, where the reader shows it holds the history. On `hash` the payment presented is the transaction the credential names. The case that cannot arise: *at coverage none, a lookup read whole beside an item the search could not decode*, since each read reads the transaction the claim names and makes no search. 16. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `mpp/charge/evm/authorization`: The payer signed an EIP-3009 transfer authorization whose nonce is keccak256 of this challenge's id and realm, and the id is this ATR's hash in base64url with the challenge's position. The token contract verified the signature when it executed the transfer, and the nonce is on chain as the nonce topic of its AuthorizationUsed event. A holder of the ATR and the realm can confirm the hash from that nonce; the chain alone does not reveal it. This does not show that amount, payee, asset or timing match the ATR's content. - `mpp/charge/evm/permit2`: The payer signed a Permit2 transfer, single or batch, whose witness carries keccak256 of this challenge's id and realm, and the id is this ATR's hash in base64url with the challenge's position. Permit2 verified the signature when it executed the transfer; a batch's transfers all executed in that one call. The witness is in the settlement transaction's calldata only as a hash, and no event carries it. This does not show that amount, payee, asset, splits or timing match the ATR's content. - `mpp/charge/evm/transaction`: Before this payment, an account signed an agreement carrying this ATR's hash on ``, recorded in ``; that shows neither that the account is the payer nor when this charge was taken. The payment is an ERC-20 transfer signed as a whole transaction (`transaction`), or broadcast by its signer and named by its hash (`hash`), answering a challenge whose id and opaque carry this ATR's hash. The payment transaction does not carry the hash; the read found that the named transaction succeeded and moved a token to the challenge's recipient. This does not show that amount, payee, asset or timing match the ATR's content. - `mpp/charge/evm/hash`: Before this payment, an account signed an agreement carrying this ATR's hash on ``, recorded in ``; that shows neither that the account is the payer nor when this charge was taken. The payment is an ERC-20 transfer signed as a whole transaction (`transaction`), or broadcast by its signer and named by its hash (`hash`), answering a challenge whose id and opaque carry this ATR's hash. The payment transaction does not carry the hash; the read found that the named transaction succeeded and moved a token to the challenge's recipient. This does not show that amount, payee, asset or timing match the ATR's content. - `mpp/charge/usdc/evm`: The payer signed an EIP-3009 authorization whose nonce is keccak256 of the JCS of this challenge's id, realm and request hash, and the id is this ATR's hash in base64url with the challenge's position. The token contract verified the signature when it executed the transfer, and the nonce is on chain in its AuthorizationUsed event. A holder of the ATR, the realm and the request can confirm the hash; the chain alone does not reveal it. This does not show that amount, payee, asset or timing match the ATR's content. - `mpp/charge/usdc/gateway`: The payer signed a Circle Gateway burn intent whose TransferSpec salt is keccak256 of the JCS of this challenge's id and parameters, and the id is this ATR's hash in base64url with the challenge's position. The signature is not verified here. The salt travels inside the TransferSpec that the destination mint carries, and the Gateway Minter emits that TransferSpec's keccak256 hash; this record reads no chain, and settlement is the seller's report. This does not show that amount, payee, asset or timing match the ATR's content. - `mpp/charge/card`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The seller's MPP challenge carried this ATR's hash in its id and its opaque reference, bound to the challenge by the seller's own server, and the credential presented echoed that challenge. The seller also placed the hash in the request's externalId. Nothing the payer or its card signed carries the hash, and the payment is known from the seller's report alone. This does not show that the payer's approval carried the hash. - `mpp/charge/stripe`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The seller's MPP challenge carried this ATR's hash in its id and its opaque reference, bound to the challenge by the seller's own server, and the credential presented echoed that challenge. The seller also placed the hash in the PaymentIntent's metadata under legal_context. Nothing the payer or its Stripe token signed carries the hash, and the payment is known from the seller's report alone. This does not show that the payer's approval carried the hash. - `mpp/charge/lightning`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The seller's node's BOLT11 invoice's description hash is this ATR's hash, and the ATR commits its payment hash. The invoice is decoded strictly and its signer is recovered; no payee key is compared with that signer, and the payer signed nothing that carries the hash. The preimage, which every node on the payment's route learns, shows that the secret behind the hash left the seller's custody, never who paid, and to anyone but the seller's node not that the invoice was paid; no public ledger shows the payment. Settlement is the seller's report. This does not show that amount, payee or timing match the ATR's content. - `mpp/session/lightning`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The seller's node's BOLT11 invoice's description hash is this ATR's hash, and the ATR commits its payment hash. The invoice is decoded strictly and its signer is recovered; no payee key is compared with that signer, and the payer signed nothing that carries the hash. The preimage, which every node on the payment's route learns, shows that the secret behind the hash left the seller's custody, never who paid, and to anyone but the seller's node not that the invoice was paid; no public ledger shows the payment. Settlement is the seller's report. This does not show that amount, payee or timing match the ATR's content. The close is the seller's report. --- # mpp-method-lcp.md Source: https://lcp.integraledger.com/profiles/mpp-method-lcp.md **LCP profile `mpp/method/lcp`: the `lcp` MPP payment method, a ledger transfer the buyer signs whole, which carries H in a field the payer signs.** It serves the `charge` intent on one rail, Hedera, as the pairing `mpp/charge/lcp/hedera`. Its request schema also names a `stellar` rail (rule 3), which lcp checks and serves no pairing for: this profile specifies no Stellar payment, and a `stellar` challenge is refused (rule 4). Rules 1 to 3 and 5 of `mpp/charge` apply to its challenge, and rule 10 of `mpp/charge` is the order of its server's checks. **The method.** 1. **The name.** The method identifier is `lcp`, lowercase ASCII letters as MPP's method identifier is written (draft-httpauth-payment-01, *Method Identifier Format*), with the `charge` intent alone. The rail is named in the request's `methodDetails.rail`, `hedera` or `stellar`. A rail that is served is its own pairing, whose id's third segment is the method and fourth the rail: `hedera` is served, as `mpp/charge/lcp/hedera`, and `stellar` is not (rule 4). The method has no `methodDetails.version`: absent, it is version 1 (draft-httpauth-payment-01, *Versioning*). The method exists for rails whose stock MPP client would itself broadcast a payment that carries no H; no stock client implements it, so a stock client shown its challenge does not pay it. Its specification is this profile, which holds what MPP asks of a payment method's specification: the identifier, the request schema (rules 3 and 4), the payload schema (rule 5), the verification procedure (rule 7), the settlement procedure (rule 7, step 4) and the security considerations (rules 9 and 11). 2. **The challenge** is an MPP challenge with `method="lcp"` and `intent="charge"`. Its `id` is the base64url of H's 32 bytes, `.`, and the challenge's position; its `opaque` holds the seller's own members with `legalContext`, `legalContextUrl` and, where the sale has one, `legalContextAgreementUrl`; its `request` is the request below, written as its RFC 8785 form in base64url without padding; and its `expires`, an RFC 3339 date-time, is required. No request member carries H: H rides in the `id` and the `opaque`, and in what the payer signs. The challenge is tied to the agreement by its `id`, its `opaque` and the ATR's `mpp` slot, as every challenge `mpp/charge` places is, and no attribution memo and no server secret takes part. 3. **The request** is the `charge` intent's (draft-payment-intent-charge-00, *Request Schema*), so a client that does not know the method can still show what it asks: `amount`, `currency` and `recipient`, with `description` and `externalId` where given, which nothing writes to the ledger; and `methodDetails`, which holds `rail`, `network`, `supportedModes` and, on Hedera, `feePayer` and `feePayerAccountId`. The schema is closed: a request member, or a `methodDetails` member, that this rule does not list is refused, `splits` among them, since a seller that declared a split would see it bound and never paid. | Member | Hedera | Stellar (checked; no pairing) | |---|---|---| | `amount` | a decimal string of base units, at least 1 and below 2^63, with no sign and no leading zero | a decimal string of base units, zero admitted and below 2^127, with no sign and no leading zero | | `currency` | an HTS token id, `shard.realm.num`, or HBAR as `0.0.0` | the asset contract's address, `C…` | | `recipient` | the payee's account id, `shard.realm.num` | the payee's plain account, `G…`; a muxed address, `M…`, is refused | | `description`, `externalId` | optional strings | optional strings | | `methodDetails.rail` | `hedera` | `stellar` | | `methodDetails.network` | `hedera:mainnet`, `hedera:testnet`, `hedera:previewnet` or `hedera:devnet` | `stellar:pubnet` or `stellar:testnet` | | `methodDetails.supportedModes` | exactly `["pull"]` | exactly `["pull"]` | | `methodDetails.feePayer`, `methodDetails.feePayerAccountId` | `feePayer` `true` with `feePayerAccountId`, the account id the transaction id must name, where the party that submits pays the fee; both absent, or `feePayer` `false` alone, where the buyer pays it | `feePayer` absent or `false`; `feePayerAccountId` absent | `supportedModes` is the stock Tempo method's member, and `pull` its value for a server that takes the signed bytes and submits them (draft-tempo-charge-00). `feePayer` and `feePayerAccountId` are the names MPP's Hedera charge foresees for a server that pays the fee (draft-hedera-charge-00, *Fee Delegation (Future)*); on Stellar a server that pays the fee rebuilds the transaction, and the rebuilt one carries no H, so `feePayer` `true` is refused there. 4. **The filter.** `pairingsOf` names `mpp/charge/lcp/hedera` for a `hedera` challenge that meets rules 2 and 3, and refuses any other, before any challenge is sent, with the first of these codes that holds: `mpp/not-this-pairing` where the method or intent is not `lcp` and `charge` or `rail` is neither `hedera` nor `stellar`; `mpp/expires-required` where the challenge has no `expires`, or one that is not a date-time; `mpp/modes-not-pull` where `supportedModes` is absent or not exactly `["pull"]`; `/network-malformed` where `network` is not one of the rail's; `/option-malformed` for any other fault of rule 3; and, last, `mpp/not-this-pairing` for a `stellar` challenge that passes every other check, since no Stellar rail is served. `bound`, `reference`, `fetchPresented` and the client hold the challenge they are given to the same filter, with the same code, so these refusals stand for an echoed challenge a client altered. 5. **The credential** is MPP's: the echoed challenge, an optional `source`, a DID of the payer on which no check rests, and the payload. The method offers one payload type, `{"type":"transaction","transaction"}`, `transaction` being the base64 of the bytes the payer signed, which the party that submits sends unchanged. A payment its payer broadcast all the same carries all of H and has moved, so a credential that names it is not refused for its type: its payload is the stock one for a landed payment, `{"type":"hash","transactionId"}` on Hedera (draft-hedera-charge-00), the pairing's `fetchPresented` reads the landed transaction over a reader the caller supplies, `landedTx` names it, every check of rule 7 is made on what landed, and nothing is sent. So each rail's `broadcaster` answers `payee` for a `transaction` credential and `payer` for a `hash` one, and a resource server that must offer no form its payer broadcasts is served by `supportedModes`, which names pull alone. A payload of another type is refused `mpp/credential-type`. A credential over 64 KiB as JSON, or nested more than 16 arrays and objects deep, is refused `mpp/credential-malformed`. 6. **The client.** lcp's `build` holds no key and calls no network. It takes the chosen challenge and H, holds the challenge as `bound` holds an echoed one, with `bound`'s code for each fault, refuses one whose `id` does not derive from that H (`mpp/id-not-ours`) and one the filter refuses, for the filter's reason, reads `rail` and builds that rail's act (rule 12) from the request and the buyer's inputs, and returns what is to be signed. Its `complete` takes the signed bytes, writes the credential with the payload type `transaction` and the challenge as held, and measures it against the credential bound before it returns it (`mpp/credential-malformed`). It never broadcasts and never writes a `hash` credential. Before anything is signed, the buyer's software fetches the record at `legalContextUrl`, hashes the bytes received and compares them with H; on a mismatch it does not sign. 7. **What a server checks, and in what order**, every check before step 4 moving nothing: 1. lcp's two checks. The challenge belongs to the agreement: the credential's shape; its `id` derives from H and equals, whole, the id the resource server recorded when it issued the challenge; its `opaque` names that H; its `request` decodes; its method, intent and `rail` are the pairing's and it passes the filter (rule 4); and its bound members equal those issued for H, against the ATR's `mpp` slot for a charge and against the digest the resource server recorded for its agreement option for an agreement challenge. Then the payment carries H, the pairing's `bound`. For a `hash` credential `fetchPresented` first reads the landed transaction, and `bound` reads H there. 2. Validation that moves nothing, lcp's own, since no stock server accepts either form: the pairing's `validate`, on the bytes the payer signed, or on what landed for a `hash` credential, the challenge and a clock reading the caller gives, in Unix seconds, since lcp reads no clock. It checks that the transaction is the rail's act and no other; that its asset, payee and amount are the request's, which the `charge` intent asks a server to verify (draft-payment-intent-charge-00, *Server Responsibilities*); and the rail's own checks (rule 15). Where a rail has a check that reads the ledger, it is made over a reader the caller supplies; without a reader it is not made, and validation never answers that it passed: its answer names each check it did not make, and a party submits only on an answer that names none. A reader that fails leaves the check not made, never a pass and never a refusal of the payment. 3. The resource server's own record that this H's act, its agreement or its payment, is now taken, made once for each H and act. It stands until the instrument is shown consumed or lapsed, so a submission the network refuses before its ledger does not strand the buyer. 4. Only then the submission, by the party that broadcasts, a settler or the seller's own server, which sends the buyer's bytes unchanged and keys its record by the instrument the rail names (rule 17). A `hash` credential has no step 4: it takes step 1's first check, then `fetchPresented`, then step 1's second check, then step 2 on what landed, then step 3. A payment that fails a check of a `hash` credential has still moved: the refusal states which check its landed transaction failed. After a submission, what the ledger shows is read by the pairing's `status`, whose answers and reasons are `read-status`'s; a settler's answer names a transaction, and it is the read that shows it succeeded. 8. **Problem types.** A refusal is given MPP's problem type by lcp's one mapping, `problem`: `malformed-credential` for `mpp/credential-malformed`, `mpp/request-malformed` and `mpp/opaque-malformed`; `invalid-challenge` for `mpp/id-not-ours`; 500 `internal-payment-error` for a read to repeat (`/unreadable`, `/not-found`), a reader that is not for the challenge's network (`/wrong-reader`) and a `hash` credential whose landed transaction has not been read (`/read-first`); and `verification-failed` for every other code, an expired authorization among them. The method adds no problem type. 9. **What is not a refusal of the method.** That the echoed challenge's bound members differ from what was issued for H is the resource server's finding, since it holds the record. A challenge whose `expires` has passed is the resource server's to answer, by MPP's status table. A second presentation for an H whose act is taken is the resource server's record, step 3. A submission the network refuses before its ledger, and a transaction that failed on the ledger, are no refusals: the party that submits answers what the chain shows, by the reasons of `read-status`, and `status` reports the same. 10. **The receipt** is MPP's `Payment-Receipt`, issued on success alone and written by the resource server: `status` `success`, `method` `lcp`, `timestamp` (RFC 3339), `reference`, the rail's (rule 19), and `externalId`, the request's, where given. It carries no H: the reference names the transaction, and the transaction carries H. 11. **What the method does not carry.** No intent but `charge`, and no session or subscription; no rail but Hedera (a `stellar` request is checked by rule 3 and names no pairing); no offer of push, a mode other than `pull` or a client that broadcasts; no attribution memo, the carrier being H itself; no server secret and no keyed challenge id; no partial H; no splits; no `version` member; no key, signature or broadcast in lcp. **The Hedera rail, `mpp/charge/lcp/hedera`.** 12. **What the buyer signs.** One `TransactionBody` whose `transactionID` names the account rule 13 names and a valid start the buyer chooses, with nonce 0 and not scheduled; whose `nodeAccountID` is the node the buyer chooses; whose `transactionFee` is the most the fee payer pays; whose `transactionValidDuration` is at most 180 seconds, lcp's client writing 120; whose `memo` is H's LCP string, `lcp:sha256:0x` and the 64 lowercase hex digits of H, 77 bytes of the 100 a memo holds; and whose `cryptoTransfer` is one debit of the buyer and one credit of the request's `recipient` by the request's `amount`, in HBAR where `currency` is `0.0.0` and otherwise in the token `currency` names, with no allowance spent. Where the buyer signed the same body for several nodes, the payload is the SDK's `TransactionList` of them, taken only where every body equals the first in every field but `nodeAccountID`; otherwise it is refused `hedera/list-inconsistent`. A transaction id is written `shard.realm.num@seconds.nanos`, as the SDK spells it, and `shard.realm.num-seconds-nanos`, the nanoseconds in nine digits, as the Mirror Node spells it, in whose spelling every read key is. 13. **Who pays the fee, and who is the buyer.** The account the transaction id names pays the fee. Where `feePayer` is `true` it is `feePayerAccountId`, the submitter's account: the buyer signs the body, the submitter checks the debited account and adds its own signature over the same body, and submits. Where `feePayer` is absent or `false` it is the buyer's account, the body is complete with the buyer's signature alone, and the submitter needs no key. The debited account is the buyer's in both: where `feePayer` is `true` it is never the account the transaction id names, and where it is not it is that account. On Hedera one signature by an account's key authorises both its fee and any debit of it, so a body that debited the fee payer's own account would be paid by the fee payer's signature with nothing of the buyer's; such a body is refused `hedera/payer-not-buyer` before the submitter signs, by `validate` and again by the submitter. 14. **`bound`**, the check that the payment carries H, reads the memo of the body the payer signed and compares it byte for byte with H's LCP string in lowercase hex, H being the hash the echoed challenge's `id` derives from: an empty memo is refused `hedera/no-memo`, and any other memo `hedera/memo-not-lcp`, one with an uppercase hex digit or another H among them, since the read settles only on that exact string. Bytes that are not the base64 of a wire `Transaction` or `TransactionList` whose signed body decodes, a crypto transfer of HBAR and token rows alone where it has a transfer, are refused `hedera/tx-malformed`; bytes over 8,192 bytes `hedera/tx-too-large`; a `Transaction` that uses the deprecated body fields `hedera/deprecated-fields`; and a body whose valid duration is above 180 seconds `hedera/valid-duration`. For a `hash` credential `bound` reads the memo of the landed entry `fetchPresented` wrote, and before that read it is refused `hedera/read-first`. `bound` reads no transfer, amount, payer or signature. 15. **`validate`**, on a `transaction` credential, after `bound`'s checks, with the first of these codes that holds: `hedera/transfer-mismatch` where the body is no crypto transfer, or its rows are not exactly one debit and one credit in one asset, or the credit is not of the request's `recipient`, the asset not the request's `currency` or the amount not the request's `amount`, or a row spends an allowance (`is_approval`), or the debited account is the `recipient`; `hedera/payer-not-buyer` where the debited account does not stand to the transaction id's account as rule 13 states; `hedera/transaction-id-mismatch` where `feePayer` is `true` and the transaction id does not name `feePayerAccountId`, or the id is scheduled or has a nonce other than 0; `hedera/valid-start-future` where the valid start is later than the clock reading, which the chain refuses, since it takes no valid start later than its consensus time; and `hedera/expired` where the valid start plus the valid duration is earlier than the clock reading. A clock reading that is not a non-negative safe integer is refused `mpp/input-malformed`. Nothing is read from the ledger: the stock Hedera charge reads nothing before it executes (draft-hedera-charge-00, *Pull Mode Verification*), and a Mirror Node's accounts and token associations trail consensus, so a check on them could refuse a body that would land; a body that fails when the network handles it is the read's `transaction-failed`, and the payee's account and its association are the payee's preconditions (rule 23). So `validate` answers no check not made. A body names no network: the network is the one whose submitter sends it, and for a `hash` credential the reader's. On a `hash` credential `validate` makes the first three checks on the landed entry, its HBAR rows read as rule 20 reads them, the node's and the fee accounts' rows set aside, and the id read from its `transaction_id`, `nonce` and `scheduled`; the two clock checks are not made, the payment having landed. 16. **`fetchPresented` and `landedTx`.** For a `hash` credential, `fetchPresented` holds the echoed challenge to the filter, reads the credential's `transactionId`, which must be `shard.realm.num@seconds.nanos` (`hedera/tx-malformed`), through a reader for the challenge's `network` (`hedera/wrong-reader`), by `GET /api/v1/transactions/{id}`: a read that fails or answers out of its form is `hedera/unreadable` and an id with no entry that decides `hedera/not-found`, each a read to repeat; entries that decide with no `SUCCESS` among them are `hedera/not-success`, the transaction having failed. It writes the `SUCCESS` entry onto the credential under `FETCHED` and returns it; a `transaction` credential comes back unchanged. `landedTx` gives a `hash` credential's transaction id in the Mirror Node's spelling. 17. **The instrument** a settler's record is keyed by is the network, the debited account, the transaction id, and the SHA-256 digest of the signed body's bytes (`bodyBytes`), so that two bodies under one transaction id are two instruments. The single-use value is the transaction id: the chain takes one transaction under it. Who can land a second body under it turns on who pays the fee: where the submitter pays, the id names its account, and only its key can; where the buyer pays, the buyer can broadcast the same bytes itself, or land another body under the id before the submitter submits. A second body under a used id is another instrument, and its answer is the read's `instrument-consumed`. A signed payment stays payable for its valid duration, counted from its valid start, which the chain holds to its `transaction.maxValidDuration`, 180 seconds. 18. **The reference** a read takes holds, from the body presented: the network, the challenge's; the transaction id in the Mirror Node's spelling; the valid start, to the nanosecond, and the valid duration; the memo; the SHA-256 digest of the signed body's bytes, `bodyDigest`, which with the network, the debited account and the transaction id is the instrument of rule 17; the debited account, the payer, which is the signer the read names and the search's key; and the node of each body the list holds, the maximum fee and the transfer rows, the rest of the payment presented. From the challenge the payment answers it takes the `recipient`, the payee, the key of the read's two party tests. `reference` refuses a credential whose echoed challenge is not the challenge it is given, by its `id`, whole, or by the members fixed at issue, `mpp/challenge-not-option`; a body whose rows debit no account or more than one, `hedera/transfer-mismatch`; and one whose debited account does not stand to the transaction id's account as rule 13 states, `hedera/payer-not-buyer`. For a `hash` credential it takes the same members, but the digest, which the Mirror Node does not serve, from the landed entry `fetchPresented` wrote, its rows read as rule 20 reads them, and before that read refuses `hedera/read-first`. The reference holds no member for comparing an amount or an asset with the challenge. 19. **The receipt's `reference`** is the transaction id as the SDK spells it, `shard.realm.num@seconds.nanos`, the nanoseconds in nine digits, as MPP's Hedera charge spells a receipt's reference (draft-hedera-charge-00, *Receipt Generation*); the Mirror Node's spelling is derived from it. 20. **Succeeded** means that the Mirror Node's entry for the transaction id with `nonce` 0 and `scheduled` false has `result` `SUCCESS`; its `memo_base64` decodes to exactly H's LCP string in lowercase hex; and its `transfers` or `token_transfers` debit the buyer with `is_approval` false, the buyer being the one account the signed body debits, what they credit recorded as observed. HBAR rows are read with each account's `staking_reward_transfers` row taken out and `charged_tx_fee` added back to the account the transaction id names, since `transfers` holds each account's total change, fee and reward included. 21. **The read** (`status`, under the profile `read-status`) is the read of the profile `x402/exact/hedera`, rules 11 to 14, on the same signed body and the same Mirror Node entries: one mark, `consensus`, which is final; found by the transaction id; the mirror's latest consensus timestamp read first; an entry under the id decides unless it is a `DUPLICATE_TRANSACTION`, an `INVALID_NODE_ACCOUNT` or an `INVALID_PAYER_SIGNATURE`; the lapse, the valid start plus the valid duration strictly before that timestamp; the search for H over the buyer's transactions before every `failed` but `before-position`; and, until a run shows the three facts that search rests on, no `failed` answer but `before-position`, the read answering `pending`, `search-incomplete`. A `settled` answer states `presented`: for a `transaction` credential, by the members of the body as that profile's rule 12 compares them; for a `hash` credential, which presents the transaction its payer broadcast and nothing beside it, `yes` where the act is the transaction the credential names and `no` where it is another. An act whose debited accounts include the option's payee is the payee's own signature and no act of the payer's. A transfer of zero debits no account and needs no signature of the buyer's. 22. **The agreement.** A payment of this pairing can itself be the agreement, held by its binding alone: its smallest amount is 1 tinybar, or 1 unit of an HTS token, since a transfer of zero debits no account and needs no signature of the buyer's; its fee is paid by the account the transaction id names, the submitter where `feePayer` is `true`, the default, or the buyer; it must succeed, as rule 20 states, and no failed result under the id is an agreement; and a body the payee's own account signed is no agreement, whatever it moved. An agreement is held to no account. 23. **The payee's preconditions,** which no validation reads: the account exists; for an HTS asset it is associated with the token or holds a free automatic association; it does not require a receiver's signature, since a credited account with `receiverSigRequired` set must sign the transaction; and for an HTS token it is granted KYC where the token has a KYC key, and is not frozen for the token. A payment that fails for want of one consumed its transaction id and is answered `transaction-failed`. 24. **The read kit.** The cases of `read-status.json` run through this pairing's read; a case is skipped only where this rule states that it cannot arise, and these are its statements: every case that answers `below-mark`, since every record the mirror serves is final; every case that answers `not-found`, since the read holds the single-use value, the transaction id, and reads the entries under it, an id with no entry that decides being `pending`, `instrument-live`, until the lapse; *an act read at the finality asked for, below the final mark*, *a value unconsumed at the final mark and consumed at the latest head*, *a value whose validity passed, unconsumed at the final mark and consumed at the latest head* and *a read that did not read the value at the latest head*, since the mirror's one mark is its latest consensus timestamp, read first, at which the id is read; *a value read consumed whose transaction the search has not found*, since the id is read consumed only by an entry under it, which names the transaction; *a read with no means to read the single-use value*, since the read holds the id; *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since a transfer of zero debits no account and the buyer is the account the body debits; *the settled act's answer names every foreign item*, *instrument-live is answered before search-incomplete* and *instrument-live is answered before an item the search could not decode*, since the search is made only before a `failed`; *an act the read cannot place against the position given*, its three cases, and *an item the search could not decode that gives no position*, since every entry carries its consensus timestamp; and, while the search proves no absence (rule 21), every case at coverage `full` that answers `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the search's gate holds, the vectors holding the read's answer, `search-incomplete`. *search-incomplete is answered before not-found* is run: the read holds the id, so the case is the id read with no entry under it that decides, past its lapse, while the search for H has a page left to read. A second act of the payer is run, made under its own transaction id. 25. **What a record of this pairing proves:** the payer's own signed act carries this ATR's hash: a Hedera crypto transfer whose memo is the hash's LCP string reached consensus with SUCCESS, debiting the payer, the one account its rows debit, and paid the account it credits, recorded with the asset and amount it moved. The memo is in the public transaction record, readable by transaction id. It compares no amount, asset or time with the ATR's terms. **The vectors.** Each file names its oracle in its `about`. 26. `mpp-method-lcp.json` holds the method's challenges, as `mppx` 0.17.6's `Challenge` serializer writes them and its parser reads them back, their requests' bytes in the RFC 8785 form `canonicalize` 5.1.0 writes; the filter's rows, each a good challenge with one member changed and the code rule 4 gives, which no party outside this profile can decide, so each is this profile's schema applied to a challenge whose encoding `mppx` and `canonicalize` fixed; and a credential of each payload type and a receipt, as `mppx` 0.17.6's `Credential` and `Receipt` codecs write them. 27. `mpp-method-lcp-hedera.json` holds the Hedera rail's bodies and signed transactions, each built, frozen and signed by hiero-sdk-python 0.2.10's `TransferTransaction` outside this package, the command in the file's `about`: the bodies `build` writes, the submitter paying the fee, the buyer paying it, and an HTS token with and without its decimals; the payments `validate` takes; a refusal of each code of rules 14 and 15, each a good transaction with one member changed, built the same way, or, where no SDK writes the bytes, stated as made by hand; the credential's own refusals of rules 4, 5 and 16; the order of rule 7, in which a presentation that fails several checks is refused at the first; a `hash` credential with the Mirror Node's recorded testnet entry of `0.0.3229-1791145265-469000038` (2026-10-04), whose memo is no LCP string, and that entry with its memo H's LCP string; the receipt; and the buyer gate's rows. `broadcaster.json` holds the pairing's two kinds of credential. **What this costs, stated.** 28. Where the buyer pays the fee, it can replace its payment after the server answered, by another body under the same transaction id: the read answers `settled` on what that body moved to the payee's account, or, on a charge, where it credits no account the challenge names as payee, `failed`, `instrument-consumed`. It is the cost of settling with an instrument the payer controls, and a seller avoids it by paying the fee, the default. 29. `validate` reads nothing, so a body whose payee does not meet the preconditions of rule 23 passes it and fails when the network handles it, consuming its transaction id: `transaction-failed`. 30. What the Mirror Node does not show of a body is not compared, so a landed body that differs from the presented one only there reads `presented` `yes`. 31. Until a run shows the three facts the search for H rests on, the read answers `pending`, `search-incomplete`, where it would answer `failed`, but for `before-position`. 32. A `hash` credential's `transactionId` is read only in the spelling with nine digits of nanoseconds; another spelling is refused `hedera/tx-malformed`. 33. The pairing's `confirmed` is `yes`: a recorded run on Hedera testnet showed a body of this form landing with H's LCP string as its memo, `SUCCESS`, in `hedera:testnet` transaction `0.0.11505931-1795155780-000000000`. **Every refusal of the method and of its Hedera rail,** each with the MPP problem type `problem` gives it (rule 8). A refusal of a `transaction` credential is given before anything moves; for a `hash` credential the payment has moved, and the same codes say which check its landed transaction failed. | Refused | Code | Problem type | Rule | |---|---|---|---| | The credential is not an object with a challenge and a payload, or is over the credential bound | `mpp/credential-malformed` | `malformed-credential` | 5 | | The echoed `request` does not decode | `mpp/request-malformed` | `malformed-credential` | 2 | | The echoed `opaque` is not a map of strings | `mpp/opaque-malformed` | `malformed-credential` | 2 | | The `id` does not derive from an H, or is not the id recorded at issue | `mpp/id-not-ours` | `invalid-challenge` | 2, 7 | | The `opaque` is absent or names another H | `mpp/opaque-not-this-hash` | `verification-failed` | 2 | | The method or intent is not `lcp` and `charge`, `rail` is neither `hedera` nor `stellar`, or the request is a `stellar` one that passes every other check | `mpp/not-this-pairing` | `verification-failed` | 4 | | No `expires`, or one that is not a date-time | `mpp/expires-required` | `verification-failed` | 4 | | `supportedModes` absent or not exactly `["pull"]` | `mpp/modes-not-pull` | `verification-failed` | 4 | | `payload.type` is neither `transaction` nor `hash` | `mpp/credential-type` | `verification-failed` | 5 | | A `hash` credential whose landed transaction has not been read | `hedera/read-first` | 500 `internal-payment-error` | 14, 16 | | The reader is not for the challenge's network | `hedera/wrong-reader` | 500 `internal-payment-error` | 16 | | The landed transaction cannot be read now, or has no entry that decides | `hedera/unreadable`, `hedera/not-found` | 500 `internal-payment-error` | 16 | | The landed transaction failed | `hedera/not-success` | `verification-failed` | 16 | | A `network` that is not one of the rail's | `hedera/network-malformed` | `verification-failed` | 4 | | Any other fault of the request's schema | `hedera/option-malformed` | `verification-failed` | 3, 4 | | A `stellar` request whose `network` is not `stellar:pubnet` or `stellar:testnet` | `stellar/network-malformed` | `verification-failed` | 3, 4 | | Any other fault of a `stellar` request's schema | `stellar/option-malformed` | `verification-failed` | 3, 4 | | The bytes do not decode as one signed transaction, are over the size bound, are a list whose bodies differ in more than the node, use the deprecated fields, or hold a valid duration above 180 seconds | `hedera/tx-malformed`, `hedera/tx-too-large`, `hedera/list-inconsistent`, `hedera/deprecated-fields`, `hedera/valid-duration` | `verification-failed` | 14 | | The body has no memo | `hedera/no-memo` | `verification-failed` | 14 | | The memo is not byte for byte H's LCP string in lowercase hex | `hedera/memo-not-lcp` | `verification-failed` | 14 | | The transfer is not one debit and one credit of the `recipient` in the request's asset and amount, spends an allowance, or debits the `recipient` | `hedera/transfer-mismatch` | `verification-failed` | 15 | | The debited account does not stand to the transaction id's account as `feePayer` states | `hedera/payer-not-buyer` | `verification-failed` | 13, 15 | | The transaction id does not name `feePayerAccountId` where `feePayer` is `true`, is scheduled, or has a nonce other than 0 | `hedera/transaction-id-mismatch` | `verification-failed` | 15 | | The valid start is later than the clock reading | `hedera/valid-start-future` | `verification-failed` | 15 | | The valid start plus the valid duration is earlier than the clock reading | `hedera/expired` | `verification-failed` | 15 | | The clock reading is not a non-negative safe integer, or the client's inputs are not of their form | `mpp/input-malformed` | `verification-failed` | 6, 15 | | The credential's echoed challenge is not the challenge `reference` is given | `mpp/challenge-not-option` | `verification-failed` | 18 | --- # mpp-session-evm-tempo.md Source: https://lcp.integraledger.com/profiles/mpp-session-evm-tempo.md **LCP profile `mpp/session/evm-tempo`: the ATR hash in an MPP session or subscription opening.** 1. The challenge carries H as `mpp/charge` rules 1, 3 and 5 say. The id is rule 2's, except that a Tempo `subscription` challenge's id is exactly the base64url (no padding) of H. 2. Session (`evm`, `tempo`): the client opens a new channel whose `salt` is H's 32 bytes. EVM `authorization`: the EIP-3009 nonce is keccak256(abi.encode(from, recipient, currency, H, authorizedSigner)), as MPP requires. lcp exports it as `evmSessionAuthorizationNonce`, and `build`'s `authorization` funding carries `opening`, `{payee, salt, authorizedSigner}`, so a client shows the payee and the authorized signer and holds the nonce to them. EVM `permit2`: the witness `salt` is H. The challenge lcp places for an EVM session names `credentialTypes`, without `hash`, since an absent member admits `hash`: an opening funded by a `hash`, a transaction the buyer's client broadcasts, is no part of `mpp/session/evm`, which does not offer it; the opening is an `authorization` or a `permit2` the resource server's settler submits. Tempo: the signed `open` call's salt is H, and a Tempo v2 descriptor carries it. The v1 escrow takes the deposit from the payer with the currency's `transferFrom`, which reverts without the payer's allowance, so the v1 opening's transaction calls the currency's `approve(escrow, deposit)` before the `open`: `build`'s v1 `tempo-call` funding carries that call as `approve`, `{to, data}`, the transaction's first call, and the `open` as `call`. The TIP-20 channel reserve's v2 `open` takes the deposit without an allowance, and its funding carries no `approve`. Where the seller pays the fee, a stock signer sends the opening as the `0x78` envelope `mpp/charge/tempo/split-memo` rule 6 states, read as the `0x76` form its sender signed. 3. A session challenge naming `channelId` resumes a channel. The client pays it with a voucher only for a channel it opened for an ATR it compared. 4. Subscription (`tempo`): the key authorization's `witness` is the id's 32 bytes, which is H. 5. One ATR covers the whole session or subscription. Vouchers, top-ups and renewals carry no new ATR. 6. **The read of an opening** (`read-status`). The opening is found by the escrow's `ChannelOpened` naming the channel id, under each session version's event: on v2 the TIP-20 channel reserve's, its salt data word 3; on the v1 escrow `ChannelOpened(bytes32 channelId, address payer, address payee, address token, address authorizedSigner, bytes32 salt, uint256 deposit)`, the first three indexed, topic `0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94`, its salt data word 2, as the v1 escrows deployed on Tempo emit it, `0x33b901018174DDabE4841042ab76ba85D4e24f25` on chain 4217 and `0xe1c4d3dce17BC111181DdF716F75Bae49e61a336` on chain 42431, whose `computeChannelId` gives the channel id `evmChannelId` computes; the salt is H. On EVM the escrow emits no event, and the opening is found by its funding: an `authorization` by the currency's `AuthorizationUsed` of the payer and the nonce, a `permit2` by every contract's `Transfer` from the payer to the escrow, each transaction decoded for the escrow's `openWithAuthorization` or `openWithPermit2` call, whose salt is H; an `open` the payer sends itself, funded by a `hash`, is an act of another kind. A decoded call counts only where the receipt shows the escrow ran it: an `openWithAuthorization` by its token's `AuthorizationUsed` of its `from` and the nonce the escrow recomputes over the call's from, payee, token, salt and authorized signer, an `openWithPermit2` or an `open` only as the transaction's own call to the escrow, each with its deposit's `Transfer` to the escrow; a call carrying H or the funding's nonce that the receipt does not show so makes the transaction an item the read cannot decode, which holds the search, so a `permit2` opening sent through a batch is never counted. A value read consumed at the position given whose consumer the search did not meet is found in the first block it reads consumed at, by halving from block 0, by the funding's own logs there. Its value is the funding's, `authorizationState(payer, nonce)` on the currency, or the payer's Permit2 bit at the nonce it signed, one across its tokens, read at `finalized` and at `latest`. The deposit goes to the escrow, whose channel `payee` and token are recorded as the beneficiary and the asset the opening names, and the escrow, by the address that logs the opening on Tempo and that the deposit's `Transfer` reaches on EVM, as its contract: the opening pays where that `payee` is the challenge's `recipient`, the token compared with nothing. The payer is the sender of the Tempo transaction, in its `0x76` form whatever envelope carried it, or the account an EVM opening's authorization or permit is signed by. The payment presented is, on Tempo, the fields the sender signed, compared by the hash `expiringNonceHash` computes over them, and on EVM the authorization or permit the payer signed. The channel id is a digest over the payee and the token as well as H, and an `authorization` opening's nonce one over the recipient and the token as well, so neither search is a search for H: a session's read answers no `failed` but `before-position`, and where its single-use value would answer `failed` it answers `pending`, `search-incomplete`. So `instrument-unused`, `instrument-consumed` and `transaction-failed` cannot arise on `mpp/session/tempo` or `mpp/session/evm` (`read-status` rule 28). On Tempo the opening's value is its transaction's nonce, read by its nonce key as `mpp/charge/tempo/split-memo` rule 8 reads it, at `finalized` and at `latest`, each at the last block below the opening's `validBefore` where that head is past it; a value read consumed whose transaction the search did not meet is found in the first block it reads consumed at. Marks: on EVM chains `latest`, `safe` and `finalized`, the final one `finalized`; on Tempo one, `finalized`, the head being final, `status` taking no other finality, and an opening above it `pending`, `below-mark`. 7. **The read of an activation** (`mpp/subscription/tempo`). The activation is found by the account keychain's `KeyAuthorizationWitness` whose account topic is the payer's account, the one whose root key signed the key authorization, and whose witness topic is H; the search reads that event's logs carrying H from the position given to the latest head, the account topic left open, and a witness log under another account is a foreign item, since H is public and any account can authorize a key with it. The activation names its recipient, the one account the key authorization the landed transaction carries lets the key pay, recorded as the account it names (`named`); one that names none, or several, or allows any, a call scope with no selector rules among them, names no account. It pays where that account is the option's payee, whatever moved. A key authorization for another key than the challenge's is an act of another kind. Every token transfer from the payer's account in the same transaction, the `currency` transfer among them, is recorded as what moved, a transfer the receive-policy guard held as moved to the guard, nothing where there is none. The payment presented is the signed key authorization, compared whole with the one the landed transaction carries. A transaction whose signed bytes the endpoint does not return, or that do not decode, is an item the search could not decode. The read holds a single-use value, the key slot the presented key authorization names in the payer's keychain: `getKey(account, keyId)` on the keychain through `eth_call`, read at `finalized` and at `latest`, consumed where it names the key or reads it revoked. The keychain registers a key id for an account once: it refuses a key id it holds or has revoked, and a key authorization whose `expiry` is not after the block's timestamp (tempoxyz/tempo@c8b89f9b `crates/precompiles/src/account_keychain/mod.rs:316-334`), and keeps a revoked key's entry as revoked (`:484-490`); a transaction whose key authorization it refuses is invalid and not included (`crates/evm/src/handler.rs:925-933`). It registers the key before the transaction's calls run and outside their checkpoint, so a reverted activation registers it (`crates/evm/src/handler.rs:831-834`, `:1270-1272`), and the slot shows an activation whatever its result. A slot read consumed whose transaction the search did not meet is found in the first block at which it reads consumed, by reading the slot at blocks halving the range from the position given, or, where it reads consumed at the position given, from block 0, and in that block's signed transactions as the payer's whose key authorization names the key id or whose own call to the keychain authorizes it (`authorizeKey`, `authorizeAdminKey`; such a call counts only where its transaction succeeded); where none is found, a transaction of that block the read cannot decode holds the search. The transaction so found is read whole, its receipt deciding: a reverted activation whose key authorization carries H and names the option's payee is `failed`, `transaction-failed`; any other that consumed the slot `instrument-consumed`; one at or before the position given `before-position`. The slot's bound is the key authorization's `expiry`, where it signs one: the keychain never clears a slot and registers no key whose expiry is not after the block's timestamp, so a slot unconsumed at a head past `expiry` is never consumed by the presented key authorization, `instrument-unused` once the search is read whole; one that signs none has no bound and is never `instrument-unused`. The presented key authorization can also be cancelled without its slot: the payer's account can burn a witness (`burnKeyAuthorizationWitness`, `crates/precompiles/src/account_keychain/mod.rs:457-465`), after which the keychain refuses every key authorization of that account carrying it, and a transaction carrying one is invalid and not included (`:1198-1221`; `crates/evm/src/handler.rs:925-933`). So the read's single-use value is the slot together with H's burn mark for the payer's account, `isKeyAuthorizationWitnessBurned(account, H)` on the keychain (`crates/contracts/src/precompiles/account_keychain.rs:214-215`), read at `finalized` and at `latest` beside the slot, the value consumed where either reads consumed. A burn mark read burned whose transaction the search did not meet is found in the first block at which it reads burned, located as the slot's consumer is, by the keychain's `KeyAuthorizationWitnessBurned` log there naming the account and H (`:106-107`): it consumed the value, so the answer is `failed`, `instrument-consumed`, naming the burn, which carries H, as of another kind, and one at or before the position given is `before-position`; where that block holds no such log, the search is held, `search-incomplete`. So the search for H needs to meet only the acts carrying H that succeeded, whose receipts keep their logs: a failed one under another key consumed none of this value. Each read of the slot or the burn mark needs the endpoint to hold that block's state, one that does not answering `unreadable`, `history-gap`; the read costs two reads of the slot and two of the burn mark, and one for each halving where the slot reads consumed, or the mark burned, and its transaction was not met. 8. **The read kit's cases** (`read-status` rule 28) that cannot arise. On `mpp/session/tempo`: `not-found`, since the read holds what the payer signed, its opening's transaction, and reads that value; *an act read at the finality asked for, below the final mark*, since no finality below `finalized`, Tempo's one mark, is asked; `instrument-unused`, `instrument-consumed` and `transaction-failed`, since it answers no `failed` but `before-position` while no search for an opening is stated (rule 6); by the case's words, *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every log and transaction the read meets is in a block, which places it; *a read that did not read the value at the latest head*, since it reads the value at `latest` whenever it reads it at `finalized`; and *each transfer of what moved is named by its transaction and its place* and *an act carrying H that names no account*, since an opening moves one deposit, from the payer to the escrow, and names its channel's `payee`. On `mpp/session/evm`: `not-found`, *a read with no means to read the single-use value* and, since it states no search, *search-incomplete is answered before not-found*, the three `failed` reasons, the three unplaceable acts, the undecodable item with no position, *a read that did not read the value at the latest head* and the one deposit's two cases, for the same reasons. *An act the option's payee signed*, *an act carrying H under another account's signature*, *a transaction for which two reasons hold* and *the settled act's answer names every foreign item* arise on it: each open call the receipt shows run in a transaction its search meets is read with its own signer, the authorization's `from` or the Permit2 owner, never the transaction's sender, so an opening carrying H that the payee or another account funded beside the payer's funding is a foreign item. On `mpp/subscription/tempo`: `not-found`, *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since its read holds its single-use value, the key slot the presented key authorization names, and reads it at `finalized` and at `latest` (rule 7); *an act carrying H that names no account and consumed nothing*, *an act the caller gave as another act under the same H*, *transactions carrying H with a failed result, the payer's own and one the payee signed* and the two cases opening *a failed result that left the value unconsumed*, whose facts each give an act of the payer's of the pairing's kind that consumed nothing, since an act is of that kind only where its key authorization names the issued key id, and the keychain registers that key's slot whatever the transaction's result, a transaction whose key authorization it refuses being not included, so every such act consumed the value; the payer's key authorization for another key id that carries H consumes nothing of the slot and is an act of another kind, met by the search where it succeeded and named `other-kind`; *an act read at the finality asked for, below the final mark*, since no finality below `finalized`, Tempo's one mark, is asked; and the three unplaceable acts and the undecodable item with no position, since every log and transaction the read meets is in a block, which places it. --- # mpp-session-hedera-solana-xrpl.md Source: https://lcp.integraledger.com/profiles/mpp-session-hedera-solana-xrpl.md **LCP profile `mpp/session/hedera-solana-xrpl`: the ATR hash at a session's opening, or, on the Hedera, Solana and XRPL stock sessions, an agreement recorded before it.** Clauses 1–3 and 5 of `mpp/charge` apply to the opening challenge. One ATR covers the whole channel. 1. `hedera`: the stock session, `mpp/session/hedera/stock`, at coverage `none`. The stock client sends `approve` and the escrow's `open` itself, with a random `salt`, so nothing the payer signs carries H: the session is served only after an agreement on its own network is recorded, and its opening counts for the sale only where it comes after that agreement and the account that opened it signed the agreement, which the server compares. `pairingsOf` names it for a `session` challenge on `hedera` that names no `channelId`, whose `chainId` is absent, 295 or 296, and whose `currency`, `recipient` and `escrowContract` are addresses; its network, which `network` and `sessionResume` give, is `hedera:mainnet` for a `chainId` of 295 or none and `hedera:testnet` for 296; `bound` finds no signed place for H. `reference` takes the read keys from the opening's credential and the payee from the `recipient` of the challenge it is given, and refuses one that is not, by the members fixed at issue, the challenge the credential echoes, `mpp/challenge-not-option`. The read (`status`, under the profile `read-status`) takes the opening by the `txHash` its credential names, through the network's JSON-RPC relay, at one mark, `finalized`, every block the relay serves being final; a network that declares no relay is not served. A revert is read with the mirror's contract result for the hash (`GET /api/v1/contracts/results/{transactionIdOrHash}`, its `result`), since on Hedera only a transaction executed in the EVM takes the sender nonce it signed, one that failed the node's validations before the EVM leaving it as it was (HIP-844, *Rationale*). A revert executed in the EVM, `CONTRACT_REVERT_EXECUTED`, is `transaction-failed` where the call its sender signed is the escrow's `open` to the challenge's `recipient`, and `instrument-consumed` otherwise, a revert moving nothing. Any other failed result, or none on the mirror, shows no nonce taken, a status such as `INSUFFICIENT_GAS` coming both before and in the EVM (HIP-844, *Backward Compatibility*), and the same signed bytes can still land under the same hash: the read, holding no nonce state, answers it `pending`, `search-incomplete`, never `failed`, at or before the position given as after it. The mirror's REST interface serves no signer nonce after a transaction, its contract result naming only the `result`, the `status` and the wrapped transaction's own `nonce`. The cost, stated: an opening that failed in the EVM under another status, out of gas among them, is answered `pending` as one refused before the EVM is, never `failed`. A receipt holding exactly one `ChannelOpened` from the escrow naming the channel, whose members give the channel id it names, is the opening: its signer is the account id the mirror resolves the log's `payer` to (`GET /api/v1/accounts/{address}`), an address it resolves to no account being another account; it is the payee's own act where that is the account the `recipient` resolves to; it names the payee where the log's `payee` is the `recipient` or resolves to the same account; and what moved is the deposit, its beneficiary the log's `payee`, as the account id the mirror resolves it to where it resolves to one, and no contract recorded, the read resolving no id for the escrow, named by the transaction and the log's place among the receipt's logs, its token and amount compared with nothing. What was presented is the transaction the credential names, so a `settled` answer, which names it, states `presented` `yes`. Any other receipt that succeeded is no opening of the channel, `instrument-consumed`. No receipt is `pending`, `not-found`, where the mirror holds the blocks after the position given, by the number of its oldest block or an archival declaration, and `unreadable`, `history-gap`, otherwise. Declared inapplicable to the read kit: `below-mark`, every block the relay serves being final; `instrument-live`, `instrument-unused` and `search-incomplete`, the read reading no nonce state, making no search and stating no lapse, the one case of `search-incomplete` at coverage `none` being a search's item it could not decode; a revert executed in the EVM arises, and any other failed opening answers `pending`, `search-incomplete`. 2. `solana`, `@solana/mpp` 0.7.0's session, its members in the request itself (`src/Methods.ts:258-301`), as two pairings. A challenge whose `modes` is exactly `["pull"]` and whose `pullVoucherStrategy` is `clientVoucher` is `mpp/session/solana/memo`: the stock client opens in the first mode listed and under it composes an `open` whose fee payer and rent payer is the challenge's `operator`, the seller's key (`src/client/Session.ts:767`; `src/client/PaymentChannels.ts:104-173`, `:198-215`), so the buyer's client cannot broadcast it alone, and the seller's server, set to `openTxSubmitter: "server"`, co-signs and submits it (`src/server/Session.ts:110`, `:472-485`). lcp's client composes that stock `open` and adds one Memo Program instruction whose data is H's LCP string, `lcp:sha256:0x` and 64 lowercase hex digits; it states the composed transaction's size, its two signatures included, and refuses one past the 1,232-byte packet before signing (`svm/tx-too-large`). Before the server submits anything it refuses an open action that carries no `transaction`, which the stock server-opened opener writes (`src/client/PaymentChannels.ts:254-263`), and an `open` without the memo, a stock `open` among them (`svm/no-carrier`); an `open` whose fee payer or rent payer is not the `operator`, or whose payer is (`svm/open-not-operator`); and a memo spelled otherwise (`svm/carrier-not-canonical`), more than one (`svm/memo-count`), or one naming another H than the challenge's id (`mpp/carrier-not-challenge`). The stock server's check of the `open` finds the payment-channels instruction among the transaction's instructions and refuses no other (`src/server/session/on-chain.ts:569-581`). A challenge whose `pullVoucherStrategy` is `operatedVoucher` is refused at `pairingsOf`, `svm/operated-voucher`: its stock opening is a token delegation, which deposits nothing and may broadcast nothing (`src/client/Session.ts:769-777`; `src/server/Session.ts:524-548`). Under any other challenge the buyer's client broadcasts the stock `open`, whose salt is a random number, and the pairing is `mpp/session/solana/stock`, at coverage `none` with no link: the agreement is made first, on the session's network, and the opening counts only where it comes after the agreement was recorded and the account that opened it signed the agreement, that account being the `open`'s `payer`, account 0, whose token account funds the deposit (`src/client/Session.ts:795`; `src/client/PaymentChannels.ts:153`), never its `authorizedSigner`, the session key that signs vouchers. Its `bound` answers `mpp/no-signed-place`, and the read names the opening by its signature. Where a client writes the session bearer proof of draft-solana-session-00 (`sessionProof`), its `sessionChallengeId` is the opening challenge's `id`; `@solana/mpp` 0.7.0 writes none. Their read: `mpp/session/solana/memo`'s is the one `x402/upto/solana`'s profile states, its act the opening, its deposit counting where the payee its `open` names, account 2, is the option's payee or its distribution holds that payee, the stock `open` naming the challenge's `recipient` as its payee and the `splits` as its distribution, none where the challenge has none (`src/client/PaymentChannels.ts:420`, `:437-440`); `mpp/session/solana/stock`'s, at coverage `none`, looks up the opening named by its signature at `finalized` and at the latest head, `confirmed`, which is no mark, and makes no search, the opening being the act whether or not it carries H. Declared inapplicable to the read kit, cases the read cannot meet on Solana: on both, the case settled at a finality asked for below the final mark, since a seller names `finalized` alone, and an act of the pairing's kind that names no account, since every `open` names its payee; on the memo session, while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, and each transfer of what moved is named by its transaction and its place in it, since its act is an opening that holds exactly one `open`, whose one deposit into the channel's token account is what moved, a transaction holding more being no act of this pairing; and, both reads holding the signed message, a read that did not read the value at the latest head and a value whose validity passed, unconsumed at the final mark and consumed at the latest head. 3. `xrpl`, two pairings. `mpp/session/xrpl`, the in-band opening, at coverage `full`: the `PaymentChannelCreate`, which the payer signs, single-signed or multisigned, and the seller's server submits, carries exactly one memo whose `MemoData` is the UTF-8 of `lcp:sha256:` followed by H (none, `xrpl/no-memo`; more than one, or more than 8 memos, `xrpl/memo-count`), deposits XRP, the only currency of an XRPL session (`xrpl/currency-not-xrp`), and carries no `NetworkID`, as rippled's `preflight0` requires on each network the challenge names, whose ids are at most 1024 (a blob that carries one is refused `xrpl/network-mismatch`); a stock client writes no memo, and its opening is refused before the server submits it. `build` writes the opening's credential, and `buildWithin` each voucher and the close, naming the channel's payer, the opening's `Account`, by `source`, `did:pkh:xrpl:{network}:{address}`, with the network the credential's challenge names, since the stock server refuses a voucher or a close without `source` and holds its address to the channel's `Account` (`xrpl-mpp-sdk` 0.1.0-beta.4, `dist/chunk-ZKD7D3D6.js:149-170`, `dist/channel/server/index.js:225` and `:591-600`). `mpp/session/xrpl/stock`, the stock session, at coverage `none`: the stock client opens the channel itself, out of band, with no memo, so nothing the payer signs carries H, and the session is served only after an agreement on its own network is recorded; its credentials are vouchers and the close, each naming its channel and its payer by `source`, `did:pkh:xrpl:{network}:{address}`, and an `open` credential, which the server would submit with no memo, is refused before anything is submitted (`mpp/session-action`). Each pairing's `reference` refuses a credential whose echoed challenge is not the challenge it is given (`mpp/challenge-not-option`). The read (`status`, under the profile `read-status`) of the in-band opening is that of the profile `x402/exact/xrpl`, rules 9 to 15, by the create's `Sequence` or ticket, with the one LCP memo as the carrier and the create's `Amount`, XRP, as what moved, one deposit per transaction, its `Destination` the channel's beneficiary and the channel's id its contract: one mark, `validated`, and a search read whole proving absence, `account_tx` listing every transaction of the payer's account (`x402/exact/xrpl`, rule 15). The stock session's read takes the channel the voucher names: its `PayChannel` at the validated ledger (`ledger_entry`), then the `PaymentChannelCreate` whose metadata creates that entry, in the `account_tx` of the channel's `Account`, or, where the validated ledger does not show the channel, of the payer `source` names, from the ledger the create must come after to the latest ledger the server serves. That create is the act where its `Account` is the payer and its `Destination` the payee, `presented` `yes`; one another account opened, or one to another account, is `failed`, `instrument-consumed`; one found at or before the position, `failed`, `before-position`. A channel the validated ledger shows whose create the search, read whole, does not hold was created at or before the position, since `account_tx` lists every transaction of the account, a delegated create and an inner `Batch` create among them: `failed`, `before-position`; on a server whose `complete_ledgers` does not hold the range, or that refuses `account_tx` for ledgers it does not hold (`x402/exact/xrpl`, rule 14), `unreadable`, `history-gap`, never absence. A channel the validated ledger does not show whose create the search, read whole, does not hold is `pending`, `not-found`. The seller's server broadcasts every payment the stock session takes: it redeems the vouchers and submits the close's `PaymentChannelClaim` from the recipient's wallet (`xrpl-mpp-sdk` 0.1.0-beta.4, `dist/channel/server/index.js:686-697`), the opening being no credential of the pairing, so its `broadcaster` answers `payee`. A reported close of the in-band session is read by the transaction it names (`tx`): `settled` where its metadata deletes the channel, and it tests no party, the close being the payee's own transaction. Declared inapplicable to the read kit: on both, *an act read at the finality asked for, below the final mark*, since a seller names `validated` alone, and *each transfer of what moved is named by its transaction and its place in it*, since a `PaymentChannelCreate` makes one deposit; on the in-band opening, `not-found`, since the payment carries the signed transaction, so the read holds its sequence number or ticket, *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since a `PaymentChannelCreate` of zero is malformed; on the stock session, `instrument-live`, `instrument-unused` and `transaction-failed`, since a create whose metadata creates the channel's entry has landed and succeeded. 4. On `solana`'s memo session and on `xrpl`, the server refuses an opening that lacks its carrier, before it broadcasts where the method lets it. --- # mpp-subscription-solana.md Source: https://lcp.integraledger.com/profiles/mpp-subscription-solana.md **LCP profile `mpp/subscription/solana`: the ATR hash as the Memo instruction of a Solana subscription's activation.** MPP's `subscription` intent under the `solana` method, as `@solana/pay-kit` 0.13.1 defines it (`dist/chunk-SSATEZ72.js:1988-2064`), on the subscriptions program whose instructions `@solana/subscriptions` 0.5.0, which pay-kit bundles, lays out. Rules 1–3 and 5 of `mpp/charge` apply to the challenge. 1. The request's `externalId` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes. A request whose `externalId` is present with another value is refused `svm/carrier-occupied`. 2. The stock client writes `externalId` as a Memo Program instruction (`MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr`) of the activation, the transaction it signs, after `transfer_subscription` (`dist/chunk-SSATEZ72.js:2444-2447`); a memo past 566 bytes is refused there (`:2534-2538`), and here at the filter. 3. The stock server never reads the Memo, so the resource server makes this check before the stock verify, as `bound`: among the activation's top-level Memo instructions, exactly one has data that parses as an LCP string, spelled exactly as rule 1 gives (`svm/carrier-not-canonical`), equal to the echoed request's `externalId` (`svm/carrier-mismatch`) and naming the H of the challenge's id (`mpp/carrier-not-challenge`). None is `svm/no-carrier`, more than one `svm/memo-count`. 4. The challenge: `amount` a positive u64; `currency` and `recipient` base58 keys; `periodUnit` `day` or `week` and `periodCount` a decimal integer, at most 365 days or 52 weeks, as the stock client maps the period to the program's 1 to 8,760 hours (`dist/chunk-SSATEZ72.js:2166-2189`); `subscriptionExpires`, where present, an RFC 3339 date-time; in `methodDetails`: `decimals` an integer from 0 to 255; `mint`, `planAddress`, `puller` and `subscriptionProgram` keys, `subscriptionProgram` the program the activation's `subscribe` is read under; `tokenProgram` Token or Token-2022; `recentBlockhash` a key where present; `splits`, which the plan's own destinations govern, where present an array of objects each with a number `bps` and a key `recipient`; `network` `mainnet`, `devnet` or `localnet` (absent: mainnet), `localnet` naming no CAIP-2 network, so that a read or a reference on it is `svm/network-undeclared`; and `feePayer` a boolean, `true` only with a `feePayerKey`. Any other challenge is refused `mpp/request-malformed`. 5. The credential is `type="transaction"`, the base64 of the activation the subscriber signed, beside the payer's `authentication` proof, which lcp does not read. Its `transfer_subscription` takes the challenge's `puller`, the seller's key, as its caller and signer (`dist/chunk-SSATEZ72.js:2393-2394`, `:2431-2443`), so the client cannot broadcast it alone: the seller's server co-signs and submits it, and the pairing's `broadcaster` answers `payee`. A `type="proof"` credential, the payer's reusable proof naming the subscription as `subscriptionDelegation` (`:2008-2014`), is within the subscription: `channel.kind` answers `within` and `channel.ref` names that subscription. `bound` refuses a credential of another type than `transaction`, `signature` and `proof` included, `mpp/credential-type`. 6. The sale is the activation: the transaction that subscribes the payer to the plan and collects the first period. Renewals are the seller's later pulls; none carries H, none is read, and a credential within the subscription is refused `mpp/not-bound-within`. The activation's `subscribe` is the instruction of the request's `subscriptionProgram` whose data begins with the discriminator 11, `SubscribeData` following it; it names the subscriber, the merchant, the plan and the subscription, in that order (`@solana/subscriptions` 0.5.0 `dist/index.js:2254-2325`). The subscription a payment opens is its fourth account, the PDA of `["subscription", plan, subscriber]` (`@solana/pay-kit` 0.13.1 `dist/chunk-SSATEZ72.js:2202-2213`). The buyer `reference` names, whose account the read's search pages and whose signature is the act's, is the subscriber that instruction names first, a writable signer, whose token account `transfer_subscription` debits; never the `puller`, which signs beside it, a signer taken by its place being no party: past the fee payer `@solana/kit` 8.4.0 orders the signers by address (`transaction-messages/src/compile/v0/accounts.ts:225-236`). An activation with no one `subscribe` instruction of the request's program is `svm/open-not-found`. 7. The instrument is `reusable`: a bearer proof of the subscription is presented again. The pairing is never an agreement option. 8. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, a subscription's activation, whose one LCP-form Memo instruction is the hash's LCP string, final at `finalized` with no error, which paid the first period to an account the option's payee owns, recorded with its mint and amount. The memo is in the transaction's instruction data on chain. Renewals are the seller's later pulls, which do not carry the hash. It compares no amount, mint, period or time with the ATR's terms. 9. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the owner, as the transaction's token balances name it (`meta.postTokenBalances`), of the token account a transfer from the buyer's token account reaches, top-level or inner; a payment counts where one such transfer reaches the option's payee, zero included, and an agreement is held to no account; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 10. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. --- # mpp-subscription-stripe.md Source: https://lcp.integraledger.com/profiles/mpp-subscription-stripe.md **LCP profile `mpp/subscription/stripe`: the ATR hash in the metadata of the payment that activates a Stripe subscription taken over MPP.** This profile defines how lcp places H in an MPP challenge of the `subscription` intent on the `stripe` method, and what the seller's server keeps of the subscription. No subscription request on the `stripe` method is published, so its members beyond the carrier are the seller's own, read as lcp's filter reads them; the charge on `stripe` is `mpp-charge.md`'s (rule 9). 1. Before payment the seller's MPP challenge carries H as every lcp challenge does (`mpp-charge.md`, rules 1 to 3): its `opaque` map carries `legalContext` and `legalContextUrl`, its id is H's base64url with its position, and the client checks the URL's bytes against H before it pays. The request's `methodDetails.metadata` also carries `legal_context`, whose value is `lcp:sha256:` + H. The metadata stays within Stripe's bounds: at most 50 keys, key names of at most 40 characters without square brackets, values of at most 500 characters; a challenge whose metadata could not take the key is refused `mpp/metadata-malformed`. 2. The pairing is at coverage `none`: nothing the payer or its shared payment token signs carries H, so `build` and `bound` refuse `mpp/no-signed-place`. An agreement carrying H, a payment of an x402 or MPP pairing whose payment is itself a public proof, is made first, and the seller's server creates the subscription only once that agreement has landed. 3. The seller's server creates the Stripe subscription with the payer's shared payment token and writes `legal_context` into the metadata of the payment that activates it. That activation is the subscription's one sale: one ATR covers every billing period, and every payment the seller reports on this pairing is the activation (`channel.kind` answers `open`). Later invoices are Stripe's own off-session charges under the same terms and carry no H (`channel.boundWithin` refuses `mpp/not-bound-within`); a charge on new terms is a new ATR. 4. The subscription's key is read from the activation receipt the seller's server answered the opening with, its `Payment-Receipt` payload: `channel.ref` gives `{"network":"stripe","channel":S}`, S being the receipt's `stripeSubscription`, a Stripe ID of 1 to 255 visible ASCII characters. No receipt is `mpp/receipt-missing`; a receipt whose `method` is not `stripe`, whose `status` is not `success`, or which names no such ID is `mpp/receipt-malformed`. The credential presented is not read for the key. 5. The subscription request carries no expiry, and no close is reported: `channel.until` gives none, and the subscription ends as Stripe ends it, which nothing here reads. 6. The payee broadcasts: the seller's server creates the subscription with Stripe. Nothing here reads a Stripe payment; the activation is known from the seller's report alone. 7. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `mpp/subscription/stripe`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The seller's MPP challenge carried this ATR's hash in its id and its opaque reference, bound to the challenge by the seller's own server, and the credential presented echoed that challenge. The seller also placed the hash in the metadata under legal_context of the payment that activates the subscription. Nothing the payer or its Stripe token signed carries the hash, and the activation is known from the seller's report alone. This does not show that the payer's approval carried the hash. --- # read-status.md Source: https://lcp.integraledger.com/profiles/read-status.md **LCP profile `read-status`: what a read of a landed payment or agreement answers, and the rules that choose the answer.** A pairing whose payment or agreement lands on a public ledger has a read, `status`, and a recovery, `recover`. Both read the ledger through a reader the caller supplies; the package calls no network on its own. This profile states what `status` takes, what identifies the act it is asked about, the answers and their reasons, and the rules that choose between them. Each pairing's own profile states how its read finds what these rules name: the single-use value its payer signs, the search for H, the marks of its ledger, the account an act names and what it moved. The vectors are `read-status.json`, and those of the agreement's value (rule 1) are `core-vectors.json`'s `agreementValue`. **What `status` takes** 1. The **reference**: the network, the payer and the single-use value the payer signed (an authorization nonce, a sequence number or ticket, an account nonce, or a transaction id where the ledger derives it from the signed content alone; for an agreement on a pairing whose single-use value is H itself or H's low bits, the **agreement's value**: SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` followed by H's 32 bytes, written as H is, `0x` and 64 lowercase hex digits, or that digest's low bits where the pairing takes H's low bits, so that an agreement and a payment under one H never share a single-use value), by which the read finds the payer's own act; and the **option's payee**, which the pairing's `reference` takes from the option the payment answers, given beside the presented payment. The payee is the key of the read's two party tests (rules 8 and 9) and is no search key. The reference holds no member whose only use is to compare an amount or an asset with the option. 2. The **act** asked about: `payment` or `agreement`. An agreement is the payer's own act under an option offered as an agreement; a payment is the pairing's charge. For an agreement on a pairing whose single-use value is H itself or H's low bits, the single-use value the read takes is the agreement's value (rule 1), which that pairing's profile places where it places H. 3. The **finality** asked for: one of the pairing's marks, the states of a transaction its endpoints tell apart, from the lowest, the transaction included at the head of the ledger, to the final one. Where a ledger's endpoints name no such states, its marks are counts of confirmations and the final one is the ledger's own security parameter. 4. Where the caller gives one, a **position** the transaction must come after, in the pairing's own spelling of a ledger position. The caller gives it only as a final position: the read cannot tell whether a position is final, and reads the one given as final. 5. For a search, the **search position** an earlier `pending` answer returned. The next call takes it as given, and the search resumes from it. 6. Where the caller gives them, **other acts under the same H**, each by its reference or by its transaction, none of which is the act asked about. An agreement and the charge it is made for are two such acts. One given by its transaction holds no search, whether or not the read can decode it (rule 19). **What identifies the act** 7. The act is identified by its binding and its parties, and by nothing else it carries: - **its binding:** the ledger verified the payer's own signature over the bytes that hold H, or, for an agreement on the pairings rule 2 names, over its own single-use value; a log or a transfer a third party can cause is never that act. At coverage `none`, the act is the transaction the reference names; - **success:** the ledger records the transaction as succeeded, as the pairing's profile defines success; - **its pairing, network and kind:** the reference's pairing and network, and the act's kind; - **its position:** a ledger position after the one the caller gives, where the caller gives one. 8. **The signer is not the option's payee**, on either act. An act the payee signed is no act of the payer's, whatever it moved. 9. **For the act `payment`, the act names the payee's account**, the account the option names, as the pairing identifies the destination of an act: a transfer to that account, one of the act's transfers where it makes several, whatever amount or asset it moved, zero included; or an opening, a deposit into a contract, or an activation that names that account as its beneficiary or recipient. A transfer to another account names no payee, zero included, and neither does an act that names no account. A transaction with a failed result moved nothing, so the account it names is the destination in what the payer signed, as the pairing identifies it, and its answer states nothing moved. An agreement is a proof and not a payment, and is held to no account. 10. **The read compares nothing else** the act moved with the option: neither its amount, its asset nor its time. An act that meets rules 7 to 9 is the act asked about whatever amount or asset it moved, and is answered `settled` with what it moved. What a payment pays is checked by the verification of the party asked to settle it, by its protocol, and by no read. The decimals an answer states for an amount, and the flag of a partial payment (rule 13), are observed and compared with nothing. 11. An act the caller names as another act under the same H (rule 6) is never the act asked about. **The answer** 12. `status` answers one of four states, with one reason from a closed list: | State | Reason | Means | |---|---|---| | `settled` | | the act asked about, read at the finality asked for or above it, stating whether it is the payment presented (rule 13) | | `pending` | `below-mark` | the act found, and not yet at the finality asked for; or a transaction whose facts would answer `failed` found below the final mark | | | `instrument-live` | the read holds the single-use value and reads it unconsumed at the final mark and at the latest head the endpoint serves, its validity not passed or absent: the signed act can still land | | | `search-incomplete` | the search has range left to read; or it met an item it cannot decode and found nothing else that decides, its position held at that item, the answer naming that item and each other it could not decode; or the value was read consumed and the search has not found the transaction that consumed it | | | `not-found` | the lookup or the search was read whole, the endpoint answered in the form it documents for a missing item, and the read cannot read the single-use value | | `failed` | `instrument-unused` | the validity passed with the single-use value unconsumed | | | `instrument-consumed` | another transaction consumed the single-use value | | | `transaction-failed` | the act was included with a failed result that consumed the single-use value | | | `before-position` | the act is at or before the position the caller gave | | `unreadable` | `history-gap` | the reader did not show that it holds the history the act would be in | | | `transport` | a read did not complete | | | `unparseable` | an answer, or an item the read names by its id, its digest or its number, could not be decoded | | | `too-large` | an answer exceeded the reader's bound | | | `chain-mismatch` | the reader answers for another network than the reference's | 13. With its state and reason the answer gives: on every `settled` answer, **`presented`**, whether the act is the payment the reference was built from, under whatever transaction hash it landed, as the pairing's profile states the comparison: `yes` where every member its form names of the message the payer signed in the landed act equals the one the presented payment holds; `no` where a member differs; `unshown` where the read cannot read every member. A read never states `yes` without that comparison, and a reference holds the members of the payment presented that its read compares. Only `yes` identifies the payment presented: H, or the act's single-use value, never identifies it alone, since a payer can sign several messages over one single-use value and any one of them can land. The comparison is with what was presented, never with the offer, so it judges no term, and it decides no answer: an act that meets rules 7 to 9 is `settled` whatever `presented` states. Each pairing's profile names the members its form compares; for a credential that names only a transaction its payer broadcast, what was presented is that transaction. Beside it the answer gives: the transaction it names, where it names one; its ledger position in the pairing's own spelling; the finality it read at; what moved, as observed, each transfer or deposit with its asset, amount and recipient (`to`, the account it reached; on a deposit into a contract, as the pairing's profile states, the beneficiary the contract names or the contract itself), the number of decimals its amount is written in where the ledger states it for the asset (`decimals`, the amount in the asset's own unit being the amount times ten to the minus `decimals`), `partial` where the ledger records that the payer signed the payment as one that may deliver less than it names, the amount then being what it delivered, on a deposit into a contract that contract in the chain's own spelling (`contract`, absent on a transfer) and, where the contract names the payment's beneficiary, that account (`beneficiary`), and named by its transaction and its place in it, in the pairing's own spelling (on EVM the position of its `Transfer` log among the receipt's logs, elsewhere the position of the instruction, operation, output or event it was read from), so that two answers that name one transfer are told from two transfers, an act that moved nothing giving none; the account the act names apart from what it moved (`named`), where its pairing's profile records one; the signer and any authority the ledger records for the signer; on a `pending` answer, the search position, where the search has one; on a `search-incomplete` answer, each item the search could not decode, by its transaction (rule 19); and the foreign items the read met. An `instrument-consumed` answer names the transaction that consumed the value and what it moved, and, where that transaction carries H, the reason of rule 14 that holds for it. **Foreign items** 14. A foreign item is a transaction that carries H, succeeded, and is not the act asked about, for which one of these reasons holds. It is named, as rule 13 names the act, by its transaction, its ledger position, its signer and any authority the ledger records for the signer, what it moved, and the account it names apart from what it moved, with the first reason that holds: | Reason | The transaction | |---|---| | `payee-signed` | is signed by the option's payee | | `other-signer` | carries H under the signature of another account than the one the reference names for the act | | `given` | is one of the other acts under the same H the caller gave | | `other-kind` | is an act of another pairing or kind than the act asked about | | `other-account` | is an act `payment` that does not name the option's payee's account: a transfer to another account, or an act that names none | 15. A transaction that carries H and did not succeed, whoever signed it, is no foreign item, and neither is one for which no reason holds: a second act of the payer that meets every test of the act asked about, where the answer settles on another, is named in no answer. A stranger's transfer to the payee carries no H and is no foreign item. A foreign item decides nothing, and never stops a search. Each reason is worded by the act, the reference and the option, and names no party beyond payer and payee. **The rules that choose the answer** 16. `before-position` is decided before any other reason: a transaction at or before the position the caller gave that would otherwise settle the act, consume its single-use value, or answer `transaction-failed` answers `failed`, `before-position`. A read that cannot place such a transaction against the position given does not settle on it: it answers `pending`, `search-incomplete`, and an act asked about found so answers no `failed` either, whatever else the read found. 17. `failed` comes only from a read at the ledger's final mark, whatever finality was asked for. Below it, the same facts answer `pending`, `below-mark`. 18. `not-found` is answered only where the reader shows that it holds the history the act would be in, by answering a read at the position the caller gave, or, where the caller gave none, by the statement its pairing's profile names; and only in the form the reader documents for a missing item. Otherwise the answer is `unreadable`, `history-gap`. An error, a pruned answer or a timeout is never absence. 19. `search-incomplete` carries the search's position, and the next call takes it. A search that met an item it cannot decode, however it found that item (by H, by the payer's account or by a topic), and found nothing else that decides, is not complete: it answers `search-incomplete`, on every pairing, its position held at that item, from which the next call resumes, since it read the rest of its range (where the read gives no position for that item, the answer gives none, and the next call reads the range again), and the answer names by its transaction that item and each other it could not decode in the rest of the range. One such item never fails a read, and at coverage `full` it holds every `failed` but `before-position` (rule 24). An item the caller gives by its transaction as another act under the same H holds no search, whether or not the read can decode it, being never the act asked about; where the read cannot decode it, it is named among the foreign items, `given`, by its transaction alone, its signer and what it moved unread. Only an item the read names, by its id, its digest or its number, that cannot be decoded is `unreadable`, `unparseable`. The cost, stated: a stranger who fills a range with items the read cannot decode lengthens each answer, and each call that gives them back, by one transaction for each. 20. Where a failed result leaves the single-use value unconsumed, the answer is `pending`, `instrument-live`, as rule 22 holds it, until the validity passes. Where a failed result consumed it, the answer is `transaction-failed` only where the transaction is the act asked about but for its result, by rules 7 to 9: at coverage `full` it carries H, and for the act `payment` it names the payee's account as the destination in what the payer signed (rule 9), never from what its result moved, which is nothing. Any other transaction whose failed result consumed the value, the payer's own call at the signed value that carries no H among them, is the transaction of an `instrument-consumed` answer, named with the reason of rule 14 that holds for it where it carries H. 21. A transaction that succeeded and is not the act asked about decides nothing for it. It is the transaction of an `instrument-consumed` answer where it consumed the act's single-use value; a foreign item where it carries H and a reason of rule 14 holds, a payment act of the payer's that does not name the payee's account among them; and otherwise named in no answer. An act the caller names as another act under the same H is never settled on: it is the transaction of an `instrument-consumed` answer where it consumed the act's single-use value, and otherwise a foreign item. 22. The `pending` reasons are answered in one order, the first that holds: `below-mark`, `instrument-live`, `search-incomplete`, `not-found`. `instrument-live` holds only where the read reads the single-use value unconsumed at the final mark and at the latest head the endpoint serves: a value unconsumed at the final mark and consumed at the latest head answers `below-mark` where the search has found the act that consumed it, and otherwise `search-incomplete`, so an act landed above the final head is never answered as one that can still land; and a read that did not read the value at the latest head never answers `instrument-live`. The cost, stated: one more read of the value, at the latest head, for each read that would answer `instrument-live`. 23. A single-use value read consumed, at the final mark or at the latest head, whose transaction the search has not found is never `failed` and never `not-found`: it is `pending`, `search-incomplete`. A read with no means to read the single-use value never answers `failed`, apart from `before-position`; nor `not-found` where it meets a transaction of the payer's with a failed result that it does not show consumed the value, the act asked about or another: the value may have been taken by it, or the signed act may still land, and the read shows neither, so the answer is `pending`, `search-incomplete`. 24. At coverage `full`, `failed`, for every reason but `before-position`, comes only once the search for H is read whole and has found no act asked about. An act it finds is answered `settled`; a search not read whole answers `pending`, `search-incomplete`. 25. The search for H covers every act of the payer in the pairing and network that carries H, whatever it moved, from the position the caller gives to the latest head the endpoint serves at the read. One found above the final head answers `pending`, `below-mark`. A search an index narrows to one asset, payee or token is never read whole. A search whose completeness rests on a fact the pairing's profile states as not yet shown proves no absence until a run shows that fact. 26. Where the single-use value is H, or a value derived from H alone, and the payer holds one such value for the pairing's every asset on the network, the read of that value at the final mark and at the latest head is the search, read whole by those two reads, and such a read reports no item it could not decode: no item changes its answer, the value admitting no act but one that consumed it. A nonce each token keeps for itself, as EIP-3009's is, is not. Every other pairing's search is the one its profile states; where its profile states none, the read answers `pending`, `search-incomplete`, where it would answer `failed`. **Recovery** 27. `recover` reads H back from a landed transaction for any holder of an ATR and a transaction id. It takes `{network, tx, option}`: the network, the transaction id in the pairing's spelling, and the chosen x402 option or MPP challenge as the ATR's binding slot holds it. Which member of the option the read needs is the pairing's, stated in its profile. It returns the value the transaction carries in H's place: H, or H's low bits where the pairing carries them; and from an agreement's transaction on a pairing whose agreement has its own value (rule 2), the agreement's value (rule 1), since a digest is not read back to H. A holder of the ATR computes the agreement's value from its own H and compares the two. **The read kit** 28. The vectors of this profile are the cases common to every pairing's read, each on both acts where the act changes the answer. A pairing's own vectors run every case through its own read, those at the pairing's coverage, on the act `agreement` only where its payment can be an agreement, and report how many cases they ran and how many they skipped. They skip a case only where the pairing's profile states that it cannot arise there; a case skipped without that statement fails. The profile names a case in one of three ways: by its reason, which takes every case whose answer on the act carries it; by the opening words of its text in these vectors; or by a fact its facts give, a single-use value or a validity passed, which takes every case that gives it. The statement rests on a fact of the ledger or of the pairing's data (one form on the network, every item placed, one transaction under a value, one mark, no transfer of zero), or on a fact of what the read does (it always holds the single-use value and reads it at the final mark and at the latest head, or holds none; it makes its search only before a `failed`; at coverage `none` it makes none), and the profile states the two alike, each with the rule of its own that states the fact. A read that holds no single-use value states every case whose facts give one. A pairing's vectors make a case in the ledger's own spelling where the rule that decides the case treats the two alike, as rule 9 treats an act that names no account and one that pays another account, and as rule 16 decides `before-position` before anything asks who signed the transaction that consumed the value; they skip only a case the profile states. While a pairing's search proves no absence until a run shows the fact its completeness rests on (rule 25), its profile states each case at coverage `full` whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed` and whose search rests on that fact; the pairing's vectors hold the answer its read gives such a case, `pending`, `search-incomplete`; no read takes the fact as shown, from its caller or from a test; and the statement goes once the run shows the fact. The cost, stated: until that run, the pairing's vectors run none of its `failed` answers but `before-position` through its read. Every `settled` answer states `presented`; a read is held to its value only in the cases whose expected answer states it, the cases about the comparison, and in every other case answers whatever its comparison gives, a case about the marks or the search stating none. --- # spend-permissions-eip155.md Source: https://lcp.integraledger.com/profiles/spend-permissions-eip155.md **LCP profile `spend-permissions/eip155`: an account's approval of a Spend Permission whose `salt` is H, as the agreement of a sale.** A Spend Permission lets a spender draw a token from an account, up to an allowance in each period between a start and an end, under the account's approval recorded by the SpendPermissionManager contract (`coinbase/spend-permissions` at `e0004e63`, `src/SpendPermissionManager.sol`; the line numbers below are that file's). Neither x402 nor MPP carries a Spend Permission, so this profile defines the whole exchange: the offer in a `402` response, the account's act, the return of the approved permission, the resource server's checks, and the read of the approval. Its codec is the entry point `@integraledger/lcp/spend-permissions`. H rides in the permission's `salt`, all of H, a member of the EIP-712 hash the account signs or of the call the account makes. The pairing is at coverage `full`: the account's own act, on a public ledger, binds H. The approval moves nothing: its one act is an agreement, the sale's own, and never a charge. The spender's later draws (`spend`, `:420`) move money under terms already bound, and this profile defines no read of them. **The wire** 1. Every integer member is written as a JSON string of decimal digits with no sign and no leading zero (`"0"` alone for zero), as Coinbase's developer platform writes the permission's members in the body of its `createSpendPermission` call (`@coinbase/cdp-sdk` 1.60.0, `src/client/evm/evm.ts:410-414`). An address is `0x` and 40 hex digits in either case, compared by its bytes. `extraData` is `0x` and an even number of hex digits. A network is `eip155:`. 2. The permission has the nine members of the contract's `SpendPermission` (`:29-48`): `account`, `spender`, `token`, `allowance` (a uint160), `period`, `start` and `end` (each a uint48, seconds), `salt` (a uint256) and `extraData` (bytes). No other member is taken. **The offer** 3. The resource server answers the request with `402` and a JSON body whose member `spendPermission` holds: - `network`, the network the permission is approved on; - `manager`, the address of the SpendPermissionManager there; - `permission`, every member of the permission but `account`: `spender` the resource server's own account, `token`, `allowance`, `period`, `start`, `end`, `salt` and `extraData`, `salt` being H written as rule 1 writes a uint256; - `accepts`, a non-empty array of distinct routes, each `"signature"` or `"transaction"` (rules 6 and 7); - `legalContext`, `{"type":"sha256","value":H,"legalContextUrl":L}`, L the link to the ATR. No other member is written in `spendPermission` or in `permission`, and the body holds no member but `spendPermission` and, on a refusal, `error` (rule 13). A body over 65,536 bytes as JSON is not read. 4. The offer meets the manager's own refusals, since one it refuses reverts every approval (`_approve`, `:630-653`): `token` is not the zero address (`ZeroToken`), `spender` is not the zero address (`ZeroSpender`), `period` and `allowance` are not zero (`ZeroPeriod`, `ZeroAllowance`), and `start` is less than `end` (`InvalidStartEnd`). `token` is not an ERC-721 contract (`ERC721TokenNotSupported`, `:634-639`): no codec can tell that without a read of the token, so the resource server offers only a token it knows is none. `advertise` and `read` refuse an offer that breaks any other of these. **The account's act** 5. The client fetches the ATR from L, hashes it, and compares the hash with H; it requires `salt` = H and `legalContext.value` = H, and otherwise signs nothing. It then adds `account`, the account that approves, which is never `spender`. 6. On the route `"signature"`, the account signs the permission as the EIP-712 typed data `SpendPermission(address account,address spender,address token,uint160 allowance,uint48 period,uint48 start,uint48 end,uint256 salt,bytes extraData)` (`:92-94`) in the manager's domain: `name` `"Spend Permission Manager"`, `version` `"1"` (`:772-775`), `chainId` the network's, and `verifyingContract` `manager`. The digest it signs is the manager's `getHash` of the permission (`:561-578`), the permission's hash. 7. On the route `"transaction"`, the account itself calls the manager's `approve` with the permission (`:277-283`), as `createSpendPermission` does through a user operation of the account (`@coinbase/cdp-sdk` 1.60.0, `src/client/evm/evm.ts:394-431`), and waits for that call to succeed. **The return** 8. The client repeats the request with the header field `Spend-Permission`, whose value is the base64url without padding (RFC 4648 §5, in its canonical form) of the UTF-8 of a JSON object holding `network`, `manager`, the whole `permission`, `account` among its members, and exactly one of: - `signature`, the account's signature over the permission's hash, `0x` and its bytes in hex, which may be an ERC-1271 or ERC-6492 signature of a contract account; or - `transaction`, the hash of the transaction that carried the approval: for a user operation, the transaction that included it (`@coinbase/cdp-sdk` 1.60.0, `src/actions/evm/waitForUserOperation.ts:94`), never the user operation's own hash (`src/client/evm/evm.ts:424`). The value decodes to at most 65,536 bytes of well-formed UTF-8, one JSON object and nothing after it, nested at most 64 levels deep, holding no member the object does not name. A signature holds at most 8,192 bytes. **The resource server's checks, before it submits or serves** 9. In this order, each refusing with its code (rule 13): 1. the header decodes as rule 8 states (`spend-permissions/header-malformed`; a `signature` that is not 1 to 8,192 bytes of hex, `spend-permissions/signature-invalid`); 2. `network`, `manager` and every member of `permission` but `account` equal the offer's, `salt` among them, so that `salt` is H (`spend-permissions/not-bound`); 3. the route is one the offer's `accepts` names (`spend-permissions/route-not-accepted`); 4. `account` is not `spender` (`spend-permissions/account-is-spender`): an approval the payee signs proves no agreement; 5. `end` is later than the resource server's clock (`spend-permissions/ended`). The resource server also holds that `salt` is an H it issued for this request and has not seen used, from its own record. A resource server that keeps, for each offer it issued, only a digest makes check 2 by it: the offer's issued digest is SHA-256 over the RFC 8785 form of `{"network":…,"manager":…,"permission":{…}}`, `permission` holding `spender`, `token`, `allowance`, `period`, `start`, `end` and `extraData` as rule 1 writes them, addresses and `extraData` in lowercase hex: the members the resource server fixes at issue. It leaves out `salt`, which is H, and `account`, the account's, so the offer as the resource server issues it before H is placed, the offer the `402` body places and a return of it on either route have one digest, and an offer that differs in one member it covers has another. A return whose digest is one the resource server recorded, and whose `salt` is the H it issued with that offer, passes check 2. The digest leaves out `accepts` too, which a return does not carry: a resource server that keeps only the digest keeps beside it the routes it accepts, for check 3. `issuedDigest` takes the offer as `advertise` takes it, the offer as `read` takes it and a return as rule 8 takes it, and refuses any other value as `spend-permissions/option-malformed`. 10. On `"signature"`, the resource server then submits `approveWithSignature` (`:293-306`) itself, as spender, paying its fee; anyone may call it, and the manager verifies the account's signature over the permission's hash, reverting `InvalidSignature` where it fails. On `"transaction"`, nothing is submitted. 11. The transaction that should hold the approval, the one the return names or the resource server's own submission, is read: it holds the approval where its receipt's `status` is 1 and it holds the manager's `SpendPermissionApproved` for the permission's hash (`spend-permissions/not-approved` otherwise); where it holds none and the manager reads the permission revoked in the state after its block (`isRevoked`, `:485-487`), the code is `spend-permissions/revoked`. **The proof** 12. The proof is the manager's `SpendPermissionApproved(bytes32 indexed hash, SpendPermission spendPermission)` (`:132`) in a transaction whose receipt's `status` is 1, found by `hash`, the permission's hash, its data holding the permission whole. The manager emits it once for a hash, on the approval that first marks the hash approved (`:655-665`): a repeat approval, and an approval of a revoked permission, return in a successful transaction with no event, and a reverted approval changes nothing. `_approve` compares no member with the block's time (`:630-666`), so an approval can land at any time, after `end` included, and the approval has no lapse. A revocation, by the account (`revoke`, `:397-399`) or by the spender (`revokeAsSpender`, `:406-411`), emits `SpendPermissionRevoked(bytes32 indexed hash, SpendPermission spendPermission)` (`:138`) once for a hash (`:675-684`), and a permission revoked before its approval can no longer be approved. **Errors** 13. A return the resource server refuses is answered `402` with the offer again and one code, in the body's member `error` beside `spendPermission`, as x402's `PaymentRequired` carries its own: `spend-permissions/not-bound`, `spend-permissions/signature-invalid`, `spend-permissions/not-approved`, `spend-permissions/revoked` or `spend-permissions/ended`; and, for a return that does not decode, takes a route the offer does not accept or names `spender` as its `account`, the code rule 9 gives it. **The read** `status` reads the act `agreement`, the pairing's one act, through a JSON-RPC endpoint the caller supplies: a receipt, a transaction, `eth_call`, `eth_getLogs`, and blocks by mark with their times. 14. **The reference.** `reference` gives the network, `manager`, H (the permission's `salt`), the permission's hash, the permission whole as presented, `account` as the signer of H, `spender` as the option's payee, and, on `"transaction"`, the transaction the return names. It refuses a return whose `network`, `manager` or offered permission members differ from the offer it is given (`spend-permissions/not-bound`). 15. **The single-use value** is the permission's hash, which the manager marks approved once: `isApproved(permission)` or `isRevoked(permission)` (`:476-487`), read at the `finalized` block and at the latest block. It is consumed where either reads true. It has no lapse by time (rule 12), so the read answers no `instrument-unused`: an unapproved permission is `pending`, `instrument-live`, for as long as the caller asks. 16. **The search** reads the manager's logs `[SpendPermissionApproved, hash]` and `[SpendPermissionRevoked, hash]`, from the block after the position the caller gives to the latest head, in pages of at most 10,000 blocks, at most eight pages a call, and answers its position where range is left. Where the value reads consumed and the search finds no transaction that consumed it, the value is read at the position given, and, consumed there, the first block at which it reads consumed is found by halving, and the same two logs in that block name the transaction: `failed`, `before-position`. 17. **The act** is the transaction whose receipt's `status` is 1 and that holds the manager's `SpendPermissionApproved` for the hash, its permission decoding whole, hashing to the hash, and carrying `salt` = H. Its signer of H is the permission's `account`, never the transaction's sender, which may be the spender, a bundler or a relayer; the party tests read `account` against the reference's `account` and `spender`, the option's payee. It moved nothing, and its answer names nothing moved. 18. **A revocation** is the transaction that holds the manager's `SpendPermissionRevoked` for the hash: it consumed the value where no approval came first, and is the transaction of a `failed`, `instrument-consumed` answer once the search for the hash is read whole. Its signer is the account where the transaction's input holds the manager's `revoke` or `approveWithRevoke` call revoking the permission, the spender where it holds `revokeAsSpender`'s, and unread otherwise. 19. **`presented`** compares the permission whole, its nine members, as the approval's event carries it, with the permission the reference holds: `yes` where all are equal, `no` where one differs. 20. **Marks.** `latest`, `safe` and `finalized`; final `finalized`, a state the endpoint reports. `failed` is answered only at `finalized`. Asked about the act `payment`, which the pairing has none of, `status` answers `unreadable`, `unparseable`, with nothing read. **The agreement** 21. The approval is an agreement and never a charge (`only`). Its floor is zero: it moves nothing. Its fee is paid by the party that submits it: the resource server, as spender, on `"signature"`; the account, or the paymaster its user operation names, on `"transaction"`. It succeeded where rule 17 holds. An approval whose `account` is the option's payee, the spender, is no agreement (rule 9, check 4). **What a record proves** 22. That the account named signed a Spend Permission whose `salt` is this ATR's hash, naming the payee as spender, and that the SpendPermissionManager approved it: the hash is on chain in the permission the manager's `SpendPermissionApproved` event carries in the approval's transaction. The approval moves nothing; it does not show that any amount was later spent, nor that the allowance, period, token or timing match the ATR's content. **The costs** 23. An approval the account makes of another permission carrying H is named in no answer unless the caller gives it, and decides nothing, being no act the offer constructs: the search reads only the events of the permission's hash. 24. An unapproved permission has no lapse: its read answers `pending`, `instrument-live`, for as long as the caller asks, and the resource server bounds how long it waits. 25. Whether `token` is an ERC-721 contract, which the manager refuses, and whether the account's signature verifies, which the manager checks when the approval is submitted, are not read before it: a return that passes rule 9 can still revert, and then the transaction holds no approval (rule 11). **The vectors** 26. `vectors/spend-permissions-eip155.json` holds the permission's hash on two networks, the manager's typehash, selectors, event topics and call and event encodings, the offer the resource server places and the buyer reads, the typed data and the `approve` call `build` gives, both routes' headers, rule 9's issued digest of the offer as issued, as placed and as returned on both routes and of the offer with each member it covers changed, and a refusal row for each check of rules 3, 4, 8, 9, 11 and 14 and of `build`, each a good input with one member changed and the code the profile gives it. Every hash and encoding is viem 2.57.4's (`hashTypedData`, `toFunctionSelector`, `encodeFunctionData`, `encodeEventTopics`, `encodeAbiParameters`) over the types and ABI that SpendPermissionManager.sol states, each header Node's base64url, and each issued digest Python 3.12.3's `json` and `hashlib` over the members rule 9 names; no outside tool gives a refusal code, so each refusal row names the rule it follows. Recorded runs on `eip155:84532` (Base Sepolia) showed the exchange on both routes, each the approval of a permission whose `salt` is H, read `settled` at `finalized` with `presented` `yes`: the route `"transaction"`, a smart account's approval through a user operation, in transaction `0x5062e7014d8f52009a3ff7284b931ad19a7808baf179516406f24b550c5360c0` (block 60156388, 2026-11-17); and the route `"signature"`, the account's signature submitted by the spender through `approveWithSignature`, in transaction `0xfc55d672c94a4c07fdff80c5124a065be2f616475455119bb22a2172dc685914` (block 60521753, 2026-11-18). The pairing's `confirmed` is `yes`. **The read kit** 27. Read for the act `agreement` alone. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no approval (rule 12). - `not-found`, and *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*: the read holds its single-use value and reads it at a `finalized` block and at the latest block (rule 15). - `instrument-unused`: the approval has no lapse by time (rule 12). - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *A payment act carrying H that transferred zero*, *an act carrying H that transferred zero*, *a payment act carrying H that moved another asset and amount*, *an act carrying H that transferred to another account* and *each transfer of what moved is named by its transaction and its place*: the approval moves nothing (rule 17). - *An act carrying H that names no account*, *an act the option's payee signed*, *an act carrying H under another account's signature*, *an act of another pairing or kind carrying H*, *a transaction for which two reasons hold*, *a second act of the payer that meets every test* and *the settled act's answer names every foreign item*: the search reads the manager's events for the permission's hash, which commits to every member of the permission as offered, `account` among them, which the exchange holds apart from `spender` (rule 9), and the manager emits `SpendPermissionApproved` once for a hash (rule 12), so every act the search meets is that permission's one approval, signed by its `account`; the cost is rule 23's. - Every case whose facts give a validity passed: the approval has no lapse by time (rule 12). - *A search that met an item it cannot decode*, *the answer names every item the search could not decode*, *the search's range left to read and an item it could not decode*, *an act the search found is settled, whatever items it could not decode* and *instrument-live is answered before an item the search could not decode*: the search meets only the manager's own events for the hash, written in the manager's ABI. - *An act whose signed message differs in a member from the payment presented*: the search keys on the permission's hash, which commits to every member `presented` compares (rule 19), so the act it meets is the permission presented. - *An act the caller gave as another act under the same H* that consumed nothing: the manager emits `SpendPermissionApproved` once for a hash, on the approval that consumes it (rule 12). The cost: the read does not fetch a transaction the caller gives, so such a transaction is named in no answer. *Search-incomplete is answered before not-found* arises: the search is a log search that can be left with range to read (rule 16), and its case is made with the approval in that range. A consumer of the value is the approval, which only the account makes or signs, so the read kit's case of a consumer another account signed is made as the account's. --- # ucp-checkout-agent-signed.md Source: https://lcp.integraledger.com/profiles/ucp-checkout-agent-signed.md **LCP profile `ucp/checkout/agent-signed`: the ATR hash in a member of the platform's signed request.** This profile targets UCP `v2026-08-25` (`Universal-Commerce-Protocol/ucp`, tag `v2026-08-25`, `docs/specification/signatures.md`), and is the `ucp/checkout/legal-context` profile with one rule added. 1. The checkout response carries the `legal_context` link of `ucp/checkout/legal-context`, and every rule of that profile holds. 2. The platform's request that completes the checkout carries, at the top level of its JSON body, the member `"legal_context":{"type":"sha256","value":H}`, H being the hash of the checkout's link as 32 decoded bytes, written as `0x` and 64 lowercase hex digits. The member belongs to the extension `com.integraledger.lcp.legal_context`, which the business and the platform both declare in their profiles, as UCP has vendors name their extensions. 3. The platform signs the request with HTTP Message Signatures (RFC 9421), as UCP has platforms sign their requests (`signatures.md:424-460`, `:861-866`): a request with a body carries `Content-Digest: sha-256=:B:`, B being the standard base64 of the SHA-256 of the body's raw bytes (RFC 9530; `signatures.md:410-421`), and the signature covers `content-digest`. UCP's request verification requires `content-digest` among the covered components of a request with a body, checks the header against the body's bytes, and verifies the signature with the key the platform's profile publishes (`signatures.md:704-730`). A platform that does not sign its requests uses `ucp/checkout/unsigned`. 4. What is presented to lcp is `{body, contentDigest}`: the request body as received, as text, at most 1 MiB, and the value of its `Content-Digest` field. `bound` refuses a `contentDigest` that is not exactly `sha-256=:` followed by the base64 of the SHA-256 of the body's UTF-8 bytes and `:`, the comparison UCP's verifier makes, `ucp/content-digest-mismatch`; then reads H from the body's one `legal_context` member. It verifies no signature and reads no key: the business verifies the platform's signature as UCP defines before it takes the request, and so `bound` reads H only from bytes that signature covers. 5. The business refuses a request whose H it did not issue for that checkout, or has seen claimed. The H in the request shows that the platform's key signed a request naming the ATR; it does not show that the account that signed the agreement holds that key, nor that the buyer approved the request. 6. The business's payment handler executes the payment: the payee broadcasts. Nothing here reads a card or handler payment, and nothing the payer signs on a public ledger carries H, so the pairing is at coverage `none`: an agreement carrying H, a payment of an x402 or MPP pairing whose payment is itself a public proof, is made first, and the business completes the checkout only once that agreement has landed. 7. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `ucp/checkout/agent-signed`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The checkout response carried this ATR's hash and link as its legal_context link, and the platform's request that completed the checkout carried the hash in its legal_context member, with a Content-Digest that is the SHA-256 of that request's body. The platform's RFC 9421 signature over the request, which UCP has the business verify with the key in the platform's profile, was not verified here, and nothing ties that key to the account that signed the agreement. The seller reported the payment. This does not show that amount, payee or timing match the ATR's content. --- # ucp-checkout-legal-context.md Source: https://lcp.integraledger.com/profiles/ucp-checkout-legal-context.md **LCP profile `ucp/checkout/legal-context`: the ATR hash as a UCP link.** It defines the pairings `ucp/checkout/ap2-mandate` and `ucp/booking/ap2-mandate`, under UCP's AP2 Mandates extension, and `ucp/checkout/unsigned` and `ucp/booking/unsigned`, without it. A booking session is read as a checkout is, by its own `id`: its option is `{"booking":B}`, B of 1 to 256 characters, where a checkout's is `{"checkout":C}`. 1. The checkout response carries one `links[]` entry `{"type":"legal_context","url":L,"title":"lcp:sha256:"+H}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The entry is written before `ap2.merchant_authorization` is computed, so the business's signature covers it. 3. The platform fetches L, hashes the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not present the checkout for approval. 4. Under the AP2 Mandates extension the checkout mandate commits to the checkout, and so to H. Without it, the buyer's approval is not signed, and a record of the payment says so. 5. The checkout `id` is the business's own and is never H. Each checkout state that changes the terms carries the entry of its own ATR, whose binding slot names the checkout: its `ucp` slot, by the checkout `id`; or, where the checkout is paid through a payment handler whose pairing commits to the request, the committed request's path. 6. Under the AP2 Mandates extension the checkout JWT whose hash, `checkout_hash`, the buyer's checkout mandate carries, and which is presented beside the mandate, is the business's detached `ap2.merchant_authorization` with its payload reinserted: `header.payload.signature`, where `header` and `signature` are the two segments of `ap2.merchant_authorization` and `payload` is the base64url, without padding, of the RFC 8785 form of the checkout without its `ap2` member, the bytes that signature covers (UCP 2026-08-25, `docs/specification/payment/extensions/ap2-mandates.md`, *Business Authorization*, `sign_checkout`, at tag `v2026-08-25`, commit `87dd4b1`). UCP does not say which bytes are the checkout JWT; this is the second of the two readings its open issue 905 sets out, and this item is provisional until that issue is settled. The checkout's `legal_context` link is read from that payload. 7. A business does not validate `ap2.checkout_mandate` against the pattern UCP's schema gives it at `v2026-08-25` (`source/schemas/common/payment_ap2_mandate.json:18`): that pattern refuses the presentation AP2's SDK writes, whose hops are joined by `~~` and whose closed mandate ends in `~` (AP2 `v0.2.0`, `code/sdk/python/ap2/sdk/mandate.py:396-400`). The mandate is read as AP2 writes it: one SD-JWT, or the open mandate and the closed mandate joined by `~~`. 8. Without the AP2 Mandates extension (`ucp/checkout/unsigned`) nothing the payer presents carries H. The business names the charge by its own reference for it, as `card-seller-reference.md` rule 5 states: `reference` takes `{"charge":R}`, R of 1 to 255 visible ASCII characters, with the checkout option the charge answers, `{"checkout":C}`, and gives `{"checkout":C,"charge":R}`. A presentation that is not an object whose `charge` has that form is `ucp/charge-reference-malformed`; then an option that is not `{"checkout":C}`, C of 1 to 256 characters, is `ucp/option-malformed`. Nothing the charge moved is compared with the option. 9. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `ucp/checkout/ap2-mandate`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The checkout carried this ATR's hash and link as its legal_context link. The checkout mandate presented under UCP's AP2 Mandates extension carries checkout_hash, the SHA-256 of the checkout JWT presented beside it, and the hash was read from that JWT's checkout. The mandate's signature, and, where an open mandate precedes it in a chain, that mandate's signature, its delegation (cnf) and the chain's link, were not verified here, and nothing compares the mandate's signer with the account that signed the agreement; the PSP verifies the payment mandate over the same checkout hash. The payment is known from the seller's report alone. This does not show that amount, payee or timing match the ATR's content. - `ucp/checkout/unsigned`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The checkout response carried this ATR's hash and link as its legal_context link. UCP without the AP2 Mandates extension defines no buyer signature, so the payer's approval did not sign the hash. The payment is known from the seller's report alone, which names it by the seller's own reference for the charge. - `ucp/booking/ap2-mandate`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The booking carried this ATR's hash and link as its legal_context link. The checkout mandate presented under UCP's AP2 Mandates extension carries checkout_hash, the SHA-256 of the booking JWT presented beside it, and the hash was read from that JWT's booking. The mandate's signature, and, where an open mandate precedes it in a chain, that mandate's signature, its delegation (cnf) and the chain's link, were not verified here, and nothing compares the mandate's signer with the account that signed the agreement; the PSP verifies the payment mandate over the same booking hash. The payment is known from the seller's report alone. This does not show that amount, payee or timing match the ATR's content. - `ucp/booking/unsigned`: An account signed an agreement transaction carrying this ATR's hash on ``, recorded in ``, before this payment was taken or reported. This shows neither that the account is this payment's payer nor when this payment was taken, which nothing here reads. The booking response carried this ATR's hash and link as its legal_context link. UCP without the AP2 Mandates extension defines no buyer signature, so the payer's approval did not sign the hash. The payment is known from the seller's report alone. --- # ucp-payment-handler-x402.md Source: https://lcp.integraledger.com/profiles/ucp-payment-handler-x402.md **LCP profile `ucp/payment-handler/x402`: the x402 payment handler for UCP, `com.integraledger.lcp.x402`.** - **Handler name:** `com.integraledger.lcp.x402` - **Version:** `2026-10-02` - **Specification:** `https://lcp.integraledger.com/ucp/x402/2026-10-02`, this document - **Schema:** `https://lcp.integraledger.com/ucp/x402/2026-10-02/schema.json` - **UCP:** `2026-08-25` ## Introduction A UCP checkout is paid in x402: the platform's wallet signs an x402 version 2 payment for one option the checkout offers, and the business settles it on chain. Without AP2 mandates, the payment carries the hash of the Agentic Transaction Record (ATR) that states the checkout's terms, and a payment the buyer approves that carries that hash is proof that the buyer accepted that record. 1. The credential is the buyer's signed x402 payment, whole: `{type: "x402", x402Version: 2, paymentPayload, paymentRequirements}`. Its `x402Version`, `paymentPayload` and `paymentRequirements` are the members Finance District's `xyz.fd.prism_payment` credential requires; this handler adds `type: "x402"`, and, without AP2 mandates, the payment carries H. 2. What this handler adds, without AP2 mandates: the payment carries H, the SHA-256 of the ATR's exact bytes, in the place the LCP profile of its x402 pairing defines (for `exact` with EIP-3009, the authorization's `nonce`), and the ATR names the checkout. A payment made for one checkout completes no other, and the settled transaction commits to the terms the buyer read. 3. The checkout carries H as well, in its `links[]`, as `ucp/checkout/legal-context` defines. 4. Two schemes: `exact`, a payment now; and `auth-capture`, an authorization into an escrow that the business captures later, offered only on a network where that escrow is deployed. 5. The handler has no provider. Nothing is needed from anyone but the business, its x402 facilitator and the platform's wallet. 6. Under UCP's AP2 Mandates extension, `dev.ucp.common.payment.ap2_mandate`, the buyer's checkout mandate commits to the checkout the business signed, whose `legal_context` link carries H, and the buyer first pays an agreement step, one of the agreement options the business declares, in x402 or in MPP, whose payment carries H. [Under AP2 mandates](#under-ap2-mandates) states the rules. ## Participants | Participant | Role | Prerequisites | |---|---|---| | **Business** | Advertises the handler; issues an ATR for each state of the checkout's terms; offers x402 options that pay its own address; checks and settles the payment. | Yes: an address on the network, a facilitator, an ATR host. | | **Platform** | Discovers the handler; checks the ATR against H; has its wallet sign one option; completes the checkout. | Yes: a wallet that signs x402 version 2 and places H. | | **Facilitator** | An x402 facilitator that verifies and settles the payment on the network. The business may settle itself. | It serves the option's scheme and network. | | **ATR host** | Serves the ATR's exact bytes over `https` at L. The business may host it. | No. | No member of this handler is named `merchant_*`. ```text Platform Business ATR host Facilitator | create, update checkout | | | |------------------------------>| assemble the ATR, H | | |<----- ready_for_complete -----| config: x402 challenge with H; links[]: H | | GET L -------------------------------------------------> | | |<---------------------------------- the ATR's bytes ---------| | | SHA-256 of the bytes = H; the wallet signs an option carrying H | | complete_checkout: x402 instrument --->| | | | | check H and the option ----------------------->| | |<------------------------------ settled ---------| |<----- completed, order -------| | | ``` ## Business integration ### Prerequisites 1. An address on the network that receives the token. Every option names it as `payTo`. 2. An x402 facilitator that verifies and settles the option's scheme on the network, or the business's own settlement. 3. An `https` URL, L, for each ATR, that serves its exact bytes. 4. An implementation of LCP that assembles the ATR, hashes it and places H. `@integraledger/lcp` does each step. 5. Under AP2 mandates: a signing key in its profile's `keys[]`, for `ap2.merchant_authorization`; and an agreement step for each ATR. No identity is assigned: `identity.access_token` is not used. ### Handler configuration The schema's `$defs["com.integraledger.lcp.x402"]` holds `business_schema`, `platform_schema` and `response_schema`, each composed over UCP's `payment_handler.json`, and `payment_instrument`, the `x402` instrument. The shapes they use are in its `$defs`: `business_config`, `platform_config`, `response_config`, `instrument` and `credential`. | Config variant | Context | Purpose | |---|---|---| | `business_config` | the business's profile | The network, the token and the schemes it is paid in. | | `platform_config` | a platform's profile | The networks and schemes the platform's wallet pays. | | `response_config` | a checkout response, from `ready_for_complete` | The x402 `PaymentRequired` that carries H, with the business config's `environment` and `network`. | #### Business config fields | Field | Type | Required | Description | |---|---|---|---| | `environment` | `"sandbox"` or `"production"` | Yes | `sandbox`: a test network, and a token with no value. | | `x402Version` | `2` | Yes | The x402 version of every payment. | | `network` | string, CAIP-2 | Yes | The network every option is on. | | `asset` | object | Yes | The token: `address`, as x402's `asset` writes it; `symbol`; `decimals`. | | `schemes` | array of `"exact"`, `"auth-capture"` | Yes | The schemes offered. `auth-capture` only where the escrow is deployed. | The business config has no other member. #### Response config fields The response config is an x402 version 2 `PaymentRequired`, with two members added. | Field | Type | Required | Description | |---|---|---|---| | `x402Version` | `2` | Yes | x402's. | | `resource` | object | Yes | x402's. `resource.url` is the checkout's URL: with UCP's REST binding, `{endpoint}/checkout-sessions/{id}`. | | `accepts` | array, 1 to 32 | Yes | x402 `PaymentRequirements`, each with `scheme` `exact` or `auth-capture`, `network` equal to `network`, and `payTo` the business's address. | | `extensions` | object | Yes | `extensions.legalContext` is `{info, schema}`, and `info` is `{"type":"sha256","value":H,"legalContextUrl":L}`, as LCP's x402 profiles place it. | | `error` | string | No | x402's. | | `environment`, `network` | | Yes | The business config's. | #### Example: the business's declaration, in its profile ```json { "com.integraledger.lcp.x402": [ { "id": "lcp_x402", "version": "2026-10-02", "spec": "https://lcp.integraledger.com/ucp/x402/2026-10-02", "schema": "https://lcp.integraledger.com/ucp/x402/2026-10-02/schema.json", "available_instruments": [{"type": "x402"}], "config": { "environment": "sandbox", "x402Version": 2, "network": "eip155:84532", "asset": {"address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "symbol": "USDC", "decimals": 6}, "schemes": ["exact", "auth-capture"] } } ] } ``` ### The checkout 1. Until the checkout is `ready_for_complete` it has no ATR, and the handler's `config` in its responses is the business config. 2. At `ready_for_complete` the business assembles the ATR for the checkout's terms. Its binding slot is the x402 pairing's, `x402: {accepts, request}`. `accepts` holds the options exactly as offered. `request` names a `POST` to the checkout's completion path, the path of `resource.url` followed by `/complete`, so the ATR names the checkout. Its `bodyDigest` is SHA-256 over the business's statement of the checkout's terms, not over the completion request's body, which carries the payment; a platform checks the ATR's `request.path`, as [Payment protocol](#payment-protocol) step 3 says. Under AP2 mandates the slot names the checkout's `id` instead: [Under AP2 mandates](#under-ap2-mandates). 3. Each option is offered under an x402 pairing of LCP in which the payment carries H, or a value from which H is confirmed. A pairing whose payment carries neither (`http-advisory`) is not offered. 4. The handler's `config` is then the response config for that ATR, and the checkout's `links[]` carries `{"type":"legal_context","url":L,"title":"lcp:sha256:"+H}`. 5. A change to the terms issues a new ATR, with a new H, a new `config` and a new link. Without AP2 mandates, a payment carrying an earlier H does not complete the checkout. 6. The handler causes no UCP Actions. #### Example: the ATR's binding slot ```json { "x402": { "accepts": [ { "scheme": "exact", "network": "eip155:84532", "amount": "18000000", "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "payTo": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "maxTimeoutSeconds": 300, "extra": {"name": "USDC", "version": "2"} } ], "request": { "method": "POST", "path": "/checkout-sessions/chk_123/complete", "query": "", "bodyDigest": "0xe0f8f6e3f07bd19912a82edcb45f5bedbcdd1c2d4787f306e7117b8f0c5df993" } } } ``` `bodyDigest` is the SHA-256 of the business's statement of the checkout's terms, which the ATR also carries as its `terms` slot. In these examples the statement is these 123 bytes of UTF-8: ```text {"checkout":"chk_123","line_items":[{"title":"Example item","quantity":1}],"total":{"amount":"18000000","currency":"USDC"}} ``` With the id `208d7a9d-09c1-4bbd-89f6-ee4cd908d6e3`, this binding slot and that `terms` slot, the ATR is the 613 bytes of UTF-8 below, one line with no line break. H is their SHA-256, `0xd0262479b711503122aca9bd59ca8dcd33975b678c5a14e64f35d3f5da80db4a`. ```text {"atrVersion":"1","id":"208d7a9d-09c1-4bbd-89f6-ee4cd908d6e3","x402":{"accepts":[{"scheme":"exact","network":"eip155:84532","amount":"18000000","asset":"0x036CbD53842c5426634e7929541eC2318f3dCF7e","payTo":"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed","maxTimeoutSeconds":300,"extra":{"name":"USDC","version":"2"}}],"request":{"method":"POST","path":"/checkout-sessions/chk_123/complete","query":"","bodyDigest":"0xe0f8f6e3f07bd19912a82edcb45f5bedbcdd1c2d4787f306e7117b8f0c5df993"}},"terms":{"checkout":"chk_123","line_items":[{"title":"Example item","quantity":1}],"total":{"amount":"18000000","currency":"USDC"}}} ``` #### Example: the handler in the checkout at `ready_for_complete` ```json { "com.integraledger.lcp.x402": [ { "id": "lcp_x402", "version": "2026-10-02", "available_instruments": [{"type": "x402"}], "config": { "x402Version": 2, "resource": { "url": "https://shop.example/checkout-sessions/chk_123", "description": "Example item", "mimeType": "application/json" }, "accepts": [ { "scheme": "exact", "network": "eip155:84532", "amount": "18000000", "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "payTo": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "maxTimeoutSeconds": 300, "extra": {"name": "USDC", "version": "2"} } ], "extensions": { "legalContext": { "info": { "type": "sha256", "value": "0xd0262479b711503122aca9bd59ca8dcd33975b678c5a14e64f35d3f5da80db4a", "legalContextUrl": "https://shop.example/atr/a607cd85-b6c6-4a54-826e-1aca54309f5b" }, "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "type": {"const": "sha256"}, "value": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"}, "legalContextUrl": {"type": "string", "pattern": "^https://"} }, "required": ["type", "value", "legalContextUrl"] } } }, "environment": "sandbox", "network": "eip155:84532" } } ] } ``` With, in the checkout's `links[]`: ```json { "links": [ { "type": "legal_context", "url": "https://shop.example/atr/a607cd85-b6c6-4a54-826e-1aca54309f5b", "title": "lcp:sha256:0xd0262479b711503122aca9bd59ca8dcd33975b678c5a14e64f35d3f5da80db4a" } ] } ``` ### Processing payments On completion the business: 1. **Validates the handler.** Exactly one instrument, whose `handler_id` is the `id` of this handler in the checkout, and whose `type` is `x402`. Otherwise `instrument-invalid`. 2. **Ensures idempotency.** A checkout already completed returns its earlier result. A payment is never settled twice. 3. **Reads the credential.** `type` is `x402`, `x402Version` is `2`, and `paymentPayload.accepted` equals `paymentRequirements`. Otherwise `credential-malformed`. 4. **Checks the option.** `paymentRequirements` is one of `accepts` in the checkout's current `config`, member for member. Otherwise `not-this-checkout`. 5. **Checks the binding.** The payment carries the checkout's current H where the LCP profile of the option's pairing puts it: for `exact` with EIP-3009, `authorization.nonce` is H; for `auth-capture`, the escrow payment's salt, or its salt nonce. A payment carrying an earlier H of this checkout is `agreement-changed`; any other is `not-this-checkout`. Under AP2 mandates, rules 5 and 6 of [Under AP2 mandates](#under-ap2-mandates) check the binding. 6. **Checks the checkout is still open.** One that has expired is `checkout-expired`. 7. **Settles.** It has the facilitator verify and settle the payment, and maps x402's reasons as [Errors](#errors) says. 8. **Returns the checkout.** A settlement broadcast and not yet confirmed (x402's `settlement_pending`) leaves it `complete_in_progress`. Once the settlement is confirmed, it is `completed`, with its `order`. ### Under AP2 mandates When the checkout negotiates UCP's AP2 Mandates extension, `dev.ucp.common.payment.ap2_mandate`, every checkout response carries the business's `ap2.merchant_authorization`, and `complete` carries the buyer's checkout mandate in `ap2.checkout_mandate`, as the extension says. The checkout mandate commits to the checkout the business signed, and that checkout's `legal_context` link carries H; an agreement step the buyer pays first puts H on chain. The payment mandate, and how the payment is bound to it, are outside this handler: the business's payment service provider verifies the payment mandate as AP2 says. These rules replace rules 2 and 3 of [The checkout](#the-checkout) and step 5 of [Processing payments](#processing-payments). Every other rule holds. 1. **The ATR** is issued under LCP's `ucp/checkout/ap2-mandate` pairing. Its binding slot is `ucp: {options: [{checkout: }]}`, the checkout's own `id`, and it commits to no request. 2. **The agreement step** is a resource at an `https` URL, A, that offers the agreement options the business declares: x402 options, MPP challenges, or both, each of a pairing whose payment can itself be an agreement (its LCP registry data has `agreement`), carrying H where that pairing's profile places it, on any network the business declares. One is served for each ATR, by the business or on its behalf. 3. **The links.** The checkout's `links[]` carries the `legal_context` link, then `{"type":"legal_context_agreement","url":A}`. Both are written before `ap2.merchant_authorization` is computed, so the business's signature covers them. 4. **The options.** The handler's `config` is the response config, and carries H and L as it does without the extension. 5. **The checkout mandate binds H.** The business reads H from the checkout mandate's closed hop, its last SD-JWT, and the `checkout_jwt` it discloses, as `ucp/checkout/ap2-mandate`'s `bound` reads them: `checkout_hash` is the base64url SHA-256 of `checkout_jwt`, and H is the hash the title of that checkout's `legal_context` link names (`lcp:sha256:` + H). It is the checkout's current H: a checkout mandate over an earlier state of the checkout is `mandate_scope_mismatch`. 6. **The agreement step comes first.** The business settles the payment only once the agreement step's payment, carrying H, has settled. Until then it answers `agreement_payment_required`, and nothing is taken. On completion the business verifies the checkout mandate, as the extension's Business Verification says: its first SD-JWT with the key its `kid` names in the platform's profile `keys[]`, each later one with the key the one before it delegates to (`cnf`), and none expired. UCP does not define the checkout mandate's `checkout_jwt`. This handler defines it as the business's own `ap2.merchant_authorization` with its payload attached (the checkout without `ap2`, in RFC 8785 form, base64url), and a platform paying through this handler builds it this way. That payload is the checkout's current state: the same `id`, `line_items`, `totals` and `legal_context` link. A refusal is one of [the errors under AP2 mandates](#errors). #### Example: the checkout's links, under AP2 mandates The same checkout under AP2 mandates has its own ATR, whose slot is `ucp`, and so its own H. With the id `505dc606-ae1e-46fc-a2a1-7ba4a631af01` and the same `terms` slot, the ATR is the 237 bytes of UTF-8 below, one line with no line break, and H is their SHA-256, `0x5edc1ae18d4f65db95af85043c3881556089ee20f5e7d81f74036db33f0b530b`. ```text {"atrVersion":"1","id":"505dc606-ae1e-46fc-a2a1-7ba4a631af01","ucp":{"options":[{"checkout":"chk_123"}]},"terms":{"checkout":"chk_123","line_items":[{"title":"Example item","quantity":1}],"total":{"amount":"18000000","currency":"USDC"}}} ``` Its links: ```json { "links": [ { "type": "legal_context", "url": "https://shop.example/atr/8cff6478-8ecc-42ea-b9b2-3b6eeea921f2", "title": "lcp:sha256:0x5edc1ae18d4f65db95af85043c3881556089ee20f5e7d81f74036db33f0b530b" }, { "type": "legal_context_agreement", "url": "https://shop.example/agreement/17c0aed5-43d4-437f-8af1-ee5950883d96" } ] } ``` ## Platform integration ### Prerequisites 1. A wallet that signs x402 version 2 payments for the network and scheme. 2. Without AP2 mandates, the wallet places H as the LCP profile of the option's pairing says: a wallet that draws a random nonce produces a payment this handler refuses (`not-this-checkout`). 3. Under AP2 mandates: a key in its profile's `keys[]` that issues the mandates, and a wallet that also pays the agreement step. No identity is assigned: `identity.access_token` is not used. ### Handler configuration #### Platform config fields | Field | Type | Required | Description | |---|---|---|---| | `environment` | `"sandbox"` or `"production"` | No | The environment the platform pays in. | | `x402Version` | `2` | No | The x402 version its wallet signs. | | `networks` | array of CAIP-2 strings | No | The networks its wallet pays on. | | `schemes` | array of `"exact"`, `"auth-capture"` | No | The schemes its wallet signs. | Other members are the platform's own. #### Example: a platform's declaration, in its profile ```json { "com.integraledger.lcp.x402": [ { "id": "wallet_x402", "version": "2026-10-02", "spec": "https://lcp.integraledger.com/ucp/x402/2026-10-02", "schema": "https://lcp.integraledger.com/ucp/x402/2026-10-02/schema.json", "available_instruments": [{"type": "x402"}], "config": {"environment": "sandbox", "x402Version": 2, "networks": ["eip155:84532"], "schemes": ["exact"]} } ] } ``` ### Payment protocol 1. **Discover the handler.** `com.integraledger.lcp.x402` is in the business's `/.well-known/ucp`, and its `network`, `asset` and `schemes` are ones the wallet pays. The schema is fetched only from its declared URL, and a redirect is not followed. 2. **Create the checkout,** and update it until it is `ready_for_complete`. The handler's `config` is then the response config. 3. **Check the ATR.** Take H and L from `config.extensions.legalContext.info`. Check that the checkout's `legal_context` link carries the same H. Fetch L, compute SHA-256 over the bytes received, and compare the result with H as 32 bytes. Check that the ATR names the checkout: its `x402.request.path` is the checkout's completion path, or, under AP2 mandates, its `ucp` slot holds the checkout's `id`. On any mismatch, do not pay. 4. **Show the terms.** Show the buyer the ATR's terms. 5. **Sign.** Choose one option of `accepts`. The wallet signs it with H where the profile of the option's pairing puts it, and echoes `extensions` unchanged. Under AP2 mandates, steps 5 and 6 are [Paying under AP2 mandates](#paying-under-ap2-mandates). 6. **Complete the checkout** with one instrument: `id`, `handler_id` the `id` of this handler in the checkout, `type` `x402`, and the credential `{type: "x402", x402Version: 2, paymentPayload, paymentRequirements}`, where `paymentPayload` is the wallet's signed payment and `paymentRequirements` the option it signed. 7. **Read the answer.** `completed`, with the order; `complete_in_progress`, then get the checkout again; or an error in `messages[]`. #### Example: the instrument at completion The payer is the first development account of Foundry's Anvil, a published test key, `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`, whose address is `from`. The wallet signs EIP-712 `TransferWithAuthorization` with the authorization's members as its message, H as its `nonce`, in the token's domain `{"name":"USDC","version":"2","chainId":84532,"verifyingContract":"0x036CbD53842c5426634e7929541eC2318f3dCF7e"}`, and the signature recovers to `from`. ```json { "payment": { "instruments": [ { "id": "instr_1", "handler_id": "lcp_x402", "type": "x402", "credential": { "type": "x402", "x402Version": 2, "paymentPayload": { "x402Version": 2, "resource": { "url": "https://shop.example/checkout-sessions/chk_123", "description": "Example item", "mimeType": "application/json" }, "accepted": { "scheme": "exact", "network": "eip155:84532", "amount": "18000000", "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "payTo": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "maxTimeoutSeconds": 300, "extra": {"name": "USDC", "version": "2"} }, "payload": { "signature": "0xcf36ddef865a9f2f93f70b685f0b1bdcac9018faa15a0df6c427e48be7766a1b491c4d98fbf65fb738c67c596967334669bad8b36fbdbb0c39da021af075961c1b", "authorization": { "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "to": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "value": "18000000", "validAfter": "0", "validBefore": "1791000000", "nonce": "0xd0262479b711503122aca9bd59ca8dcd33975b678c5a14e64f35d3f5da80db4a" } }, "extensions": { "legalContext": { "info": { "type": "sha256", "value": "0xd0262479b711503122aca9bd59ca8dcd33975b678c5a14e64f35d3f5da80db4a", "legalContextUrl": "https://shop.example/atr/a607cd85-b6c6-4a54-826e-1aca54309f5b" }, "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "type": {"const": "sha256"}, "value": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"}, "legalContextUrl": {"type": "string", "pattern": "^https://"} }, "required": ["type", "value", "legalContextUrl"] } } } }, "paymentRequirements": { "scheme": "exact", "network": "eip155:84532", "amount": "18000000", "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "payTo": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", "maxTimeoutSeconds": 300, "extra": {"name": "USDC", "version": "2"} } } } ] } } ``` ### Paying under AP2 mandates When the checkout negotiates the extension, these steps take the place of steps 5 and 6: 1. **Pay the agreement step first.** Fetch A, the url of the checkout's `legal_context_agreement` link, and check that the agreement options it offers, x402 options or MPP challenges, carry the same H. Pay one the wallet can pay, as its pairing's LCP profile says, and wait for its receipt. 2. **Make the checkout mandate,** once the buyer approves, after checking `ap2.merchant_authorization` as the extension says: `mandate.checkout.1`, whose `checkout_jwt` is `ap2.merchant_authorization` with its payload attached (the checkout without `ap2`, in RFC 8785 form, base64url), and whose `checkout_hash` is the base64url SHA-256 of `checkout_jwt`. 3. **Sign.** Choose one option of `accepts`. The wallet signs it, and echoes `extensions` unchanged. 4. **Complete the checkout** with `ap2.checkout_mandate`, and one instrument as step 6 says. 5. **Read the answer** as step 7 says. `agreement_payment_required` means the agreement step's payment has not settled yet: complete again with the same payment once it has. ## Errors A failure answers with one error in the checkout's `messages[]`: `code` `payment_failed`, `path` the instrument's, the severity below, and `content`, UCP's human-readable message, which, under this handler, begins with the failure's name. The checkout's `status` follows from the severity, as UCP's checkout says. | Failure | When | Severity | |---|---|---| | `instrument-invalid` | Not exactly one instrument, or one through a handler the checkout did not advertise. | `recoverable` | | `credential-malformed` | The credential is not an x402 version 2 payment of this form. | `recoverable` | | `not-this-checkout` | The payment does not carry this checkout's H, or pays an option the `config` did not offer. | `recoverable` | | `agreement-changed` | The terms changed after the payment was signed: it carries an earlier H of this checkout. | `requires_buyer_review` | | `payment-invalid` | The facilitator refused the payment as invalid. | `recoverable` | | `payment-expired` | The authorization is not valid now. | `recoverable` | | `insufficient-funds` | The paying account does not hold enough of the token. | `recoverable` | | `settle-failed` | Nothing was broadcast, or the transfer failed on chain. Nothing was taken. | `recoverable` | | `checkout-expired` | The checkout expired before it was paid. | `unrecoverable` | `agreement-changed` is `requires_buyer_review`, not the `recoverable` UCP asks of standard errors: the buyer reviews the new terms before paying. x402's reasons, as the facilitator returns them: | x402 reason | Failure | |---|---| | `insufficient_funds` | `insufficient-funds` | | one ending `_valid_before` or `_valid_after` | `payment-expired` | | `unexpected_settle_error`, `invalid_transaction_state` | `settle-failed` | | any other | `payment-invalid` | `settlement_pending` is not a failure: the checkout is `complete_in_progress`. Under AP2 mandates, a checkout mandate refused at completion, or an agreement step whose payment has not settled, answers with one error, `recoverable`: the checkout keeps its state, and the platform may complete again. Its `code` is one of the extension's, at the mandate's `path`, `$.ap2.checkout_mandate`, or this handler's `agreement_payment_required`, at the `path` its row gives. | Code | When | |---|---| | `mandate_required` | `ap2.checkout_mandate` is missing. | | `agent_missing_key` | The platform's profile has no key with the `kid` of a mandate's first SD-JWT. | | `mandate_invalid_signature` | A mandate's signature does not verify, or it does not hold exactly one mandate of its type. | | `mandate_expired` | A mandate has expired. | | `merchant_authorization_invalid` | The `checkout_jwt` is not the business's own signature over a checkout. | | `mandate_scope_mismatch` | The checkout mandate commits to another state of the checkout. | | `agreement_payment_required` | The agreement step's payment has not settled. The `path` is `$.links[?(@.type=='legal_context_agreement')]`. Nothing was taken. | ## Security Considerations | Requirement | Description | |---|---| | **Binding required** | Without AP2 mandates, the credential is bound to the checkout through H: the payment carries H, and H is the hash of an ATR whose binding slot names the checkout's completion. | | **Binding placement** | H is inside the value the payer signs, not beside it. The credential carries no `binding` object, and the business reads none. | | **Binding verified** | The platform checks the ATR's bytes against H before it signs. Without AP2 mandates, the business checks the payment's H before it settles. | | **Binding under AP2 mandates** | The buyer's checkout mandate commits to the checkout the business signed, whose `legal_context` link carries H. H itself is on chain in the agreement step's payment, which settles before the checkout's. | | **One claim** | Each ATR carries a random id, so H is unique to it. A payment carrying H completes its checkout once. | | **Expiry** | The authorization is valid only inside its own window (`validAfter`, `validBefore`), which the wallet sets within the option's `maxTimeoutSeconds`. An expired checkout takes no payment. | | **The payee** | The business settles only an option it offered, so the token goes to that option's `payTo`. | | **The bytes delivered** | The platform hashes the bytes it received from L, never a parsed or re-serialised copy. | | **What the ATR shows** | Anyone with L can read the ATR, and H is public once the payment settles. The ATR holds only what both parties may show. | | **Data residency** | The credential's members that this handler defines hold the payer's address and signature, and no other personal data. | ## References - **Handler specification:** `https://lcp.integraledger.com/ucp/x402/2026-10-02` - **Handler schema:** `https://lcp.integraledger.com/ucp/x402/2026-10-02/schema.json` (the configs, the instrument and the credential) - **LCP profiles:** `ucp/checkout/legal-context`, `x402/exact/eip155/eip3009`, `x402/auth-capture/eip155`, and the profile of each x402 pairing and of each pairing an agreement step offers, at `https://github.com/IntegraLedger/integra-protocol/tree/main/lcp/profiles` - **x402 version 2:** `https://github.com/x402-foundation/x402/blob/main/specs/x402-specification-v2.md` - **UCP's payment handler guide:** `https://ucp.dev/2026-08-25/specification/payment/guide/` - **UCP's AP2 Mandates extension:** `https://ucp.dev/2026-08-25/specification/payment/extensions/ap2-mandates/` - **AP2 version 0.2:** `https://github.com/google-agentic-commerce/AP2/tree/v0.2.0` - **Finance District's `xyz.fd.prism_payment`:** `https://prism-gw.fd.xyz/ucp/prism.md` --- # x402-auth-capture-eip155.md Source: https://lcp.integraledger.com/profiles/x402-auth-capture-eip155.md **LCP profile `x402/auth-capture/eip155`: the ATR hash as the escrow payment's salt.** This profile covers `x402/auth-capture/eip155/eip3009` and `x402/auth-capture/eip155/permit2`: x402's `auth-capture` scheme, the commerce-payments escrow flow, on an EVM chain, the payer's token authorization redeemed by the escrow deployment's EIP-3009 or Permit2 collector. H is in the escrow payment's `PaymentInfo.salt`, so both pairings are at coverage `full`. The hold is the payment; capture, void, refund and reclaim are the operator's and the payer's, and this profile defines no read of them. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client uses H as its random 32 bytes: `salt` = H when `receiverAuthorizer` and `policy` are both zero; otherwise `saltNonce` = H and `salt` is the scheme's commitment over it. `build`'s signing request carries, beside the typed data, `paymentInfo` (its payer the zero address, as the collectors hash it) and `escrow`, whose `paymentHash` under the typed data's chain id is the signed nonce, so a client shows the operator, the receiver and both expiries the signature grants and holds the nonce to them. 4. The server refuses a payment whose salt or saltNonce is not an H it issued for that request, or whose signed nonce does not commit to it. 5. The salt is in the escrow's `PaymentAuthorized` or `PaymentCharged` data, and a holder of the ATR confirms H from it. `recover` takes `{network, tx, option}`, of which it reads the option's escrow deployment (`extra.authCaptureEscrow`, v1.1's where absent); it reads the transaction's receipt and returns the `PaymentInfo.salt`, data word 11, of the escrow's `PaymentAuthorized` or `PaymentCharged` logs whose token collector, data word 13, is that deployment's collector for the pairing's scheme, which alone redeems the authorization the payer signed: the value the transaction carries in H's place, which is H where the option binds neither a receiver authorizer nor a policy, and otherwise the commitment over the two and H, which a holder of the ATR computes from the option and its own H and compares, since a commitment is not read back to H. No such log is `evm/no-escrow-payment`, more than one distinct salt `evm/ambiguous`, a reverted transaction `evm/reverted`, each only at or below the `finalized` mark and `evm/not-final` above it; an option that names no deployment of the escrow is `evm/wrong-reader`, with nothing read. 6. The option filter takes the escrow deployments v1.1 (escrow `0xf96815976523E00e65Be8f34cA5e64b4f41EB19c`) and v1.0 (escrow `0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff`), the `escrow` flow and the `authorization` flow, which settles as the escrow's `charge`, and refuses `autoCapture`. The option's `extra.assetTransferMethod` is absent or `eip3009` on `x402/auth-capture/eip155/eip3009`, and `permit2` on `x402/auth-capture/eip155/permit2`. The token authorization the payer signs, an EIP-3009 `ReceiveWithAuthorization` to the deployment's EIP-3009 collector or a Permit2 permit whose spender is its Permit2 collector, has as its nonce the escrow's payment hash of the `PaymentInfo` with the payer set to zero, so the nonce fixes every member of `PaymentInfo`, the salt among them. The payment hash with the payer is the payment's id. **The reference** 7. `reference` gives the network, the scheme (`eip3009` or `permit2`), the token, the payer (`PaymentInfo.payer`, the token authorization's signer), the escrow deployment and the event of the option's flow (`PaymentAuthorized` for `escrow`, `PaymentCharged` for `authorization`), the payment id, the signed nonce, the salt, `preApprovalExpiry`, H, the option's payee and the transaction a settler names, a hint. It refuses a payment whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** `status` reads through a JSON-RPC endpoint the caller supplies: receipts, transactions, `eth_call`, blocks by mark with their timestamps, and `eth_getLogs`. 8. **The single-use value** is the signed nonce, read at the `finalized` block and at the latest block: `authorizationState(payer, nonce)` on the token on `eip3009`, the payer's Permit2 bit on `permit2`. It is a digest over H and the offer's other members, so its read is no search for H, and none is defined: every answer that would be `failed` is `pending`, `search-incomplete`. 9. **Found by.** The escrow's `PaymentAuthorized` and `PaymentCharged` logs, by the deployment's escrow address and topic, from the block after the position given to the latest head, in pages as `x402/exact/eip155/eip3009` reads them. Each is decoded as the payment hash in topic 1 and data words holding `PaymentInfo`'s twelve members (operator, payer, receiver, token, maxAmount, the three expiries, the two fee bounds, the fee receiver, salt), the amount and the token collector, and is an act carrying H where its salt is the reference's. Every payment of every user of the escrow emits these events, so the read tests each log's salt, data word 11, from the log itself, before it reads that transaction's receipt, and reads a receipt only for a log whose salt is the reference's or whose data holds no such word. An escrow log the read cannot decode holds the search. 10. **The act.** The option's flow's event through the deployment's collector for the pairing's scheme, which alone redeems the token authorization the payer signed, is an act of this kind; another event, or one through another collector, is an act of another kind. An event through that collector whose payment hash is the presented one consumed the payer's nonce. The signer of H is its `PaymentInfo.payer`, never the transaction's sender, which is the operator. 11. **The account an act names, and what moved.** The deposit counts where its `PaymentInfo.receiver` is the option's payee. What moved is the event's token and amount to that receiver, recorded as its beneficiary, with the escrow that emits the event as its contract, named by the transaction and the event's log's place among the receipt's logs: the escrow records a deposit as one event naming one amount. 12. **A reverted transaction** consumed nothing: the read finds the inline `PaymentInfo` whose last word is the salt in its input and answers a failed result naming the account its `receiver` names. 13. **The payment presented** is the `PaymentInfo` whole, compared by its payment hash: `presented` is `yes` where the event's payment hash is the presented one, and `no` otherwise. Since the signed nonce fixes every member of the token authorization the collector redeems, an act that consumed it signed the very message presented. The escrow's events are read by their salt, so a second `PaymentInfo` the payer signed carrying H, another member giving it another payment hash, through the deployment's collector and naming the payee as its `receiver`, is an act of this payment though it consumed nothing, and settles it with `presented` `no`. 14. **Lapse.** `preApprovalExpiry`: the escrow takes the authorization only before it. The nonce unconsumed at a `finalized` block past it is not answered `failed` while no search for H is defined (rule 8). **Below the position given.** Where the nonce reads consumed and the search has found no transaction that consumed it, the read reads the nonce at the position given. Consumed there, it was consumed at or before that position: the read finds the first block at which it reads consumed, halving the range from the network's first block, reads in that block the escrow's `PaymentAuthorized` and `PaymentCharged` logs whose topic 1 is the presented payment hash, and classifies their transactions as rules 9 to 12 do. One that consumed the nonce answers `failed`, `before-position`, naming it, the one `failed` this read answers; none found answers `pending`, `search-incomplete`, since no search after the position given that met none shows a transaction at or before it. The cost: one read of the nonce at the position given and one for each halving, each needing an endpoint that holds that block's state (one that does not is `unreadable`, `history-gap`), and one block's logs. 15. **Marks.** `latest`, `safe` and `finalized`; final `finalized`. There is no agreement on these pairings: a hold is no agreement. **What a record proves** 16. That the payer signed a token authorization whose nonce commits, through the escrow's `PaymentInfo`, to a salt that is this ATR's hash when unbound, or a commitment over it with the receiver authorizer and the policy when bound; that the token contract or Permit2 verified the signature when the escrow collected the payment, and that the escrow's event in the settlement transaction carries that salt. When bound, a holder of the ATR, the receiver authorizer and the policy can confirm the hash from the salt; the chain alone does not reveal it. The record covers that first collection. **The read kit** 17. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no authorization nonce or Permit2 bit. - `not-found`: the read holds its single-use value. - `instrument-unused` and `instrument-consumed`: the single-use value is a digest over H and the offer's other members, so its read is no search for H, and the read defines none (rule 8). - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *A read that did not read the value at the latest head*: the read reads the value at a `finalized` block and at the latest block. - *Each transfer of what moved is named by its transaction and its place*: the escrow records each act as one event naming one amount and one `receiver`. --- # x402-batch-settlement-cloudflare.md Source: https://lcp.integraledger.com/profiles/x402-batch-settlement-cloudflare.md **LCP profile `x402/batch-settlement/cloudflare`: Cloudflare's Pay Per Crawl, a 402 written by a third party, carrying no H.** This pairing is the codec of Cloudflare's Pay Per Crawl as x402 describes it: an option on the network `cloudflare:402` whose `payTo` is `merchant`, whose `asset` is a three-letter currency code and whose `extra` names a `version`. Cloudflare, not the resource server, writes the 402 and bills the crawler's registered identity off chain, so the seller's H never reaches the buyer through it, and no public ledger records the payment. The pairing is at coverage `none` (`link` `none`), has no `status`, and is no agreement. 1. The codec reads and writes the payment as x402 v2 frames it: `build` gives `{x402Version: 2, payload: {amount, asset}, accepted, extensions}` for an option the filter takes, where the document's `extensions.legalContext` names the H it is given (`x402/legal-context-conflict` otherwise); `bound` returns the H the payment's echoed `extensions.legalContext` names, which only locates the sale and is no proof. 2. The filter takes an option whose amount is a positive amount and whose `maxTimeoutSeconds` is a positive safe integer, and refuses another (`x402/option-malformed`). 3. Cloudflare verifies the agent's HTTP message signature over the request, with the key the agent registered with it, and bills that identity; lcp reads no such signature and no ledger. 4. Because Cloudflare writes the 402, a resource server behind it cannot put its own `extensions.legalContext` in it, so a payment through it carries no H the seller issued; lcp keeps the codec for a resource server that writes the option itself. 5. **What a record proves**, as the pairing's `data.proves` states it: - `x402/batch-settlement/cloudflare`: The request whose payment echoed this ATR's hash in the legalContext entry of x402's extensions was signed with an HTTP message signature key registered with Cloudflare, which Cloudflare verifies, billing that key's registered identity off chain. The echoed hash only locates the sale: the pairing follows no agreement, and no public ledger records the payment. This does not show that amount, asset or timing match the ATR's content. **The read kit** 6. The pairing has no read, so no form runs the read kit through it. --- # x402-batch-settlement-eip155.md Source: https://lcp.integraledger.com/profiles/x402-batch-settlement-eip155.md **LCP profile `x402/batch-settlement/eip155`: the ATR hash as the channel configuration's salt, or, in the scheme's refund-authorizer mode, as the deposit authorization's salt.** This pairing serves x402's `batch-settlement` scheme on an EVM chain through x402's channel contract (`0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003`). H is the channel configuration's salt, which the channel id commits to and every signature of the channel signs; in the scheme's refund-authorizer mode, whose channel salt carries the refund authorizer, H is the salt of the opening deposit's token authorization, which the payer signs. Either way the payer's own signed act binds all of H, so the pairing is at coverage `full`. The opening deposit is the payment; every later credential of the channel is within it, or its close, and no agreement is made on it. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client opens a new channel whose `ChannelConfig.salt` = H, deposits into it, and echoes `extensions` unchanged. In the refund-authorizer mode (rule 7) it opens a new channel whose salt packs the refund authorizer, and signs the deposit with H as the authorization's salt. The opening's `build` gives, beside its two signing requests, `config`, the `ChannelConfig` whose `batchChannelId` under the requests' chain id is the `channelId` both sign, so a client shows the receiver and the authorizers they grant and holds the channel id to them. It also gives `authSalt`, the deposit authorization's salt (the caller's, or H in the refund-authorizer mode): the ERC-3009 deposit's nonce is `erc3009DepositNonce(channelId, authSalt)`, the Permit2 deposit's nonce `authSalt` as a uint256. 4. The server refuses an opening whose salt is not an H it issued for that request and has not seen claimed, or whose `channelConfig` does not hash to `voucher.channelId`; in the refund-authorizer mode, one whose deposit authorization's salt, or Permit2 nonce, is not such an H, or whose channel salt does not end in the refund authorizer it announced. 5. H is on chain as the salt in `ChannelCreated(channelId, config)` from `x402BatchSettlement`; the deposit authorization and every voucher sign `channelId`, which commits to H. In the refund-authorizer mode H is in the deposit call's collector data, and the token's `AuthorizationUsed` nonce, `keccak256(abi.encode(channelId, H))`, or Permit2's nonce H, is what the payer's signature consumed. 6. x402 says the salt *"Differentiates channels with identical parameters"*; H is unique per ATR, so it keeps that role. One ATR covers the whole channel; a new agreement opens a new channel. A client that draws its own salt is refused by rule 4. In the refund-authorizer mode the salt's 12 bytes of entropy keep that role, and the payer's signature over H binds the channel's one agreement at its opening. 7. The filter takes a zero price, and the opening's `build` refuses it: on the channel a deposit opens, the scheme's server requires the opening voucher to claim 0 and its facilitator requires more than 0. The deposit is an ERC-3009 `ReceiveWithAuthorization` whose nonce is `keccak256(abi.encode(channelId, authSalt))`, or a Permit2 permit whose nonce the payment's `permit2Authorization.nonce` gives. lcp writes the channel salt as H and reads H there, with the caller's `authSalt` as the authorization's salt or the permit's nonce. **The refund-authorizer mode** is an option whose `extra.voucherManager` is `"facilitator"` and whose `extra.refundAuthorizer` is an address other than the zero address, as `@x402/evm` 2.31.0's client marks it (`buildChannelConfig`, `dist/esm/chunk-AEYKXGQA.mjs:232-250`) and its server announces it (`batch-settlement/server/index.mjs:2412-2423`). In that mode the channel salt is `bytes12(entropy) ‖ bytes20(refundAuthorizer)`, the entropy's first 12 bytes or, where those are all zero, its last 12, as that client packs it (`packRefundAuthorizerSalt`, `dist/esm/chunk-7DJ4WEQ5.mjs:218-223`); lcp's `build` takes the caller's `authSalt` as the entropy, and writes H as `erc3009Authorization.salt`, so that the ERC-3009 nonce is `keccak256(abi.encode(channelId, H))`, or as the Permit2 permit's nonce. `bound` and `reference` read H there, and refuse a channel salt that does not end in the option's refund authorizer (`x402/channel-id-mismatch`). A later payment of such a channel carries no H, which only the opening's deposit authorization carries: `channel.boundWithin` refuses it (`x402/not-bound-within`), and `buildWithin` holds the channel's salt to the refund authorizer in H's place. An option whose `extra.refundAuthorizer` is present and is not an address is refused (`x402/option-malformed`). The option alone marks the mode: nothing the payer signs does, so a payment presented under an option of the other mode is read in that mode, and its server refuses what it reads there by rule 4. **The reference** 8. `reference` of an opening gives the network, the deposit method (`eip3009` or `permit2`), the token, the channel's id and its configuration whole (payer, payer authorizer, receiver, receiver authorizer, withdrawal delay, salt), the deposit authorization's nonce, its `validBefore` or `deadline` and the deposit's amount, H, in the refund-authorizer mode the option's refund authorizer, the option's payee and the transaction a settler names, a hint. It refuses a payment that is not an opening (`x402/not-an-opening`) and one whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`), after the payment's own refusals and the option's payee's. `status` reads a reference only where its configuration hashes to its channel id, its salt is H or, in the refund-authorizer mode, ends in its refund authorizer with its nonce H's, and its network is `eip155:` and a chain id; any other reference is `unreadable`, `unparseable`. **The read** `status` reads through a JSON-RPC endpoint the caller supplies: receipts, transactions, `eth_call`, blocks by mark with their timestamps, and `eth_getLogs`. 9. **The single-use value** is the deposit authorization's nonce, read at the `finalized` block and at the latest block: `authorizationState(payer, nonce)` on the token, or the payer's Permit2 bit. It is a digest over the channel id (on Permit2 in the refund-authorizer mode, H itself, in the one nonce space Permit2 keeps for the payer), and the read defines no search for H: every answer that would be `failed` is `pending`, `search-incomplete`. 10. **Found by.** The channel contract's `ChannelCreated` logs, by topic, each tested by its configuration's salt, and its `Deposited` logs of the reference's channel, from the block after the position given to the latest head, in pages as `x402/exact/eip155/eip3009` reads them. The receipt of a `ChannelCreated` is read only where its configuration's salt is H or its data is not the seven words of a configuration, so that a read fetches no receipt of another channel's opening. A `Deposited` into the reference's channel is the opening where its transaction consumed the deposit authorization's nonce: the token's `AuthorizationUsed(payer, nonce)` on ERC-3009, or on Permit2 the nonce in the transaction's input with the payer's bit set at its block and unset before. Any other deposit into the channel is a later credential of it, an act of another kind. A `ChannelCreated` of another channel whose salt is H is an opening of another channel carrying H, with the first `Deposited` of that channel after it as what it moved. In the refund-authorizer mode the reference's own channel salt carries no H, and its opening is the `Deposited` that consumed the deposit authorization's nonce; another channel's opening whose salt is H still carries H, and is read so. A log of the contract the read cannot decode holds the search. A reverted transaction consumed nothing: the read finds the inline channel configuration whose last word is the salt in its input and answers a failed result naming the account its `receiver` names. 11. **Who signed, the account, and what moved.** The channel's payer signed its salt and the deposit authorization; the deposit counts where the channel's `receiver` is the option's payee. The payer, the receiver and the token are the channel's as landed: those of the channel's `ChannelCreated` in the transaction, where the deposit opened it, and otherwise those of the reference's configuration, which hashes to the channel id the landed `Deposited` names. The channel contract takes a deposit through any collector and checks only that its own balance rose by the amount, so the opening is its payer's act by the transaction's use of the deposit authorization's nonce, and any other deposit, another channel's opening whose salt is H or a later deposit into the reference's channel, is its payer's act only where the transaction holds the payer's transfer of its amount, a `Transfer` emitted by the channel's token from the channel's payer to the ERC-3009 deposit collector or to the channel contract (the two collectors the scheme names move only what the payer signed); without it the act names no signer, and is a foreign item of another signer. What moved is the deposit's amount, the first word of its `Deposited` log, to that receiver, recorded as its beneficiary, with the channel contract that emits the `Deposited` log as its contract, named by the transaction and the log's place among the receipt's logs: the channel contract records a deposit as one event naming one amount. On Arc the system emitter's `Transfer` log is never read. 12. **The payment presented** is the deposit into the channel: `presented` is `yes` where the act's channel id and amount equal the presented opening's, and `no` where one differs. 13. **Lapse.** The deposit authorization's `validBefore` (ERC-3009) or `deadline` (Permit2); the nonce unconsumed at a `finalized` block past it is not answered `failed` while no search for H is defined (rule 9). **Below the position given.** Where the nonce reads consumed and the search has found no transaction that consumed it, the read reads the nonce at the position given. Consumed there, it was consumed at or before that position: the read finds the first block at which it reads consumed, halving the range from the network's first block, reads in that block the channel contract's `ChannelCreated` and `Deposited` logs whose topic 1 is the reference's channel id, and classifies their transactions as rule 10 do. One that consumed the nonce answers `failed`, `before-position`, naming it, the one `failed` this read answers; none found answers `pending`, `search-incomplete`, since no search after the position given that met none shows a transaction at or before it. The cost: one read of the nonce at the position given and one for each halving, each needing an endpoint that holds that block's state (one that does not is `unreadable`, `history-gap`), and one block's logs. 14. **Marks.** `latest`, `safe` and `finalized`; final `finalized`. 15. **`recover`** takes the transaction and the option, and finds the opening: the one `ChannelCreated` log of the channel contract in the transaction whose data hashes to its id, with the payer's transfer of the deposit, the channel's `Deposited` and a `Transfer` of its amount emitted by the channel's token from the channel's payer to the ERC-3009 deposit collector (`0x4020806089470a89826cB9fB1f4059150b550004`) or, through Permit2, to the channel contract. The channel contract takes a deposit through any collector; the two the scheme names move only what the payer signed. It returns that channel's salt; under an option in the refund-authorizer mode, whose channel salt must end in the option's refund authorizer, it returns the salt, or the permit's nonce, of the transaction's one `deposit` call with that channel's configuration through one of the scheme's two deposit collectors, found at any byte offset of its input (collector data `abi.encode(validAfter, validBefore, salt, signature)` or `abi.encode(nonce, deadline, signature, permitData)`, `@x402/evm` 2.31.0 `dist/esm/chunk-W6ON4LG2.mjs:8-31`), counted only where the token logged `AuthorizationUsed(payer, keccak256(abi.encode(channelId, salt)))` in the transaction, or Permit2 set the payer's bit for that nonce at its block and not at the block before. It refuses with `evm/no-channel-created` where there is no such log, `evm/ambiguous` where there are several or several such calls, `evm/no-payer-deposit` without the payer's transfer, `evm/no-deposit-call`, `evm/no-authorization-use` and `evm/nonce-not-used` in the mode, and `evm/reverted` for a reverted transaction, each only at or below the `finalized` mark. **What a record proves** 16. That the payer signed a token authorization for a deposit into an x402 batch-settlement channel whose id, the EIP-712 hash of the channel's configuration, commits to this ATR's hash as the configuration's salt, or, in the refund-authorizer mode, whose own salt is this ATR's hash; that the token contract or Permit2 verified that signature when the channel contract collected the deposit; that the hash is on chain as the salt in the channel's `ChannelCreated` event, or in the mode in the deposit call; and that each voucher in this channel signs a commitment to the channel, and so, outside that mode, to the hash. This does not show that the amount, payee, asset or timing match the ATR's content. **The read kit** 17. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no authorization nonce or Permit2 bit. - `not-found`: the read holds its single-use value. - `instrument-unused` and `instrument-consumed`: the single-use value is a digest over the channel id, or on Permit2 in the refund-authorizer mode H in the one nonce space Permit2 keeps for the payer, and the read defines no search for H (rule 9). - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *A read that did not read the value at the latest head*: the read reads the value at a `finalized` block and at the latest block. - *Each transfer of what moved is named by its transaction and its place*: the channel contract records each opening as one `Deposited` naming one amount. --- # x402-batch-settlement-solana.md Source: https://lcp.integraledger.com/profiles/x402-batch-settlement-solana.md **LCP profile `x402/batch-settlement/solana`: the ATR hash as the seller Memo instruction of a payment channel's opening.** x402's `batch-settlement` scheme on Solana (`scheme_batch_settlement_svm.md` at `x402-foundation/x402` `751590a2`). 1. The option's `extra.memo` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes, which the stock client writes as the seller Memo instruction of the channel's opening, beside the scheme's own receiver-authorizer memo (`@x402/svm` 2.30.0, `src/batch-settlement/client/builders.ts:94`). `bound` holds the presented `accepted` to the option filter and refuses a transaction unless exactly one of its top-level Memo instructions holds an LCP string and it is H's, the receiver-authorizer memo beside it not read, or whose payment-channels instruction is no `open` (`x402/not-an-opening`): no LCP-form memo is `svm/no-carrier`, more than one `svm/memo-count`, one spelled otherwise `svm/carrier-not-canonical`, one other than `extra.memo` `svm/carrier-mismatch`; a durable nonce account loaded from an address table is `svm/nonce-account-not-static`. `reference` names the message's digest, the buyer, the fee payer, H, the option's payee and the blockhash or durable nonce, and refuses a payment whose `accepted` is not the option it is given, `x402/accepted-not-option`. 2. Deposits after the opening, vouchers and the close carry no H, and the instrument is `unshown`: no vector or run shows yet that the signed opening lands once. 3. The client builds the highest message version both `extra.transactionVersions` and lcp admit: version 1 where the list holds 1, version 0 where it holds 0 alone or is absent, as a stock client does (`@x402/svm` at `88b66dd4`, `utils.ts:200-203`); a list that admits neither is refused at the filter (`x402/option-malformed`). `bound` and `reference` decode legacy, version 0 and version 1 messages, and refuse one whose version the list does not admit, `svm/version-not-admitted`, `legacy` being admitted where the list holds 0 and the list absent being `[0]`, as `@x402/svm` 2.31.0's facilitator admits it (`isAcceptedTransactionVersion`): a payment the option does not admit is no answer to it. 4. An option carrying `extra.splits` is refused at the filter, `svm/input-malformed`, before the buyer signs: no Solana build writes split legs, and each pays the whole amount to `payTo`. 5. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the payee and the distribution the `open` names, its payee being its third account, a seed of the channel's address, which the program's `distribute` pays: its deposit counts where its payee is the option's payee or its distribution holds that payee, an `open` with no distribution among them, and is recorded with the option's payee as its beneficiary where the `open` names it, else the distribution's first recipient, or the `open`'s payee where the distribution is empty, and the channel's account as its contract; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 6. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); each transfer of what moved is named by its transaction and its place in it, since the act is an opening that holds exactly one `open`, whose one deposit into the channel's token account is what moved, a transaction holding more being no act of this pairing; an act of the pairing's kind that names no account, since every `open` names its payee; and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. 7. The payment-channels program is on devnet only: on mainnet the pairing waits until a read shows the program deployed there. It is never an agreement option. 8. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, whose seller Memo instruction (`extra.memo`), beside the scheme's receiver-authorizer memo, is the hash's LCP string, final at `finalized` with no error, which deposited the amount its `open` names into a payment channel whose payee or distribution names the option's payee, recorded with its mint and amount. The memo is in the transaction's instruction data on chain. It compares no amount, mint or time with the ATR's terms. --- # x402-exact-algorand-note.md Source: https://lcp.integraledger.com/profiles/x402-exact-algorand-note.md **LCP profile `x402/exact/algorand/note`: the ATR hash as the Algorand payment's note.** This profile defines the pairing `x402/exact/algorand`. 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client builds the `exact` payment as x402's Algorand scheme defines it. It sets the `note` of `paymentGroup[paymentIndex]` to exactly the 77 ASCII bytes `lcp:sha256:` followed by H ([LCP §8.1](https://github.com/legal-context-protocol/legal-context-protocol/blob/main/spec/legal-context-protocol-v1.md#81-naming-conventions)), and echoes `extensions` unchanged. The option's `network` is `algorand:` and the first 32 characters of the network's genesis hash in base64url (CAIP-2); a payment whose genesis hash does not match it is refused `avm/network-mismatch`. Its `amount` may be `"0"`: the scheme sets no floor. 4. The server refuses a payment whose payment-transaction note does not decode to an H that it issued for that request and has not seen claimed. It also refuses, before anything moves, a payment entry that a logic signature authorises (`avm/logic-signature`) and one that names an asset sender, `asnd` (`avm/clawback`): under a logic signature no key signs the transaction, and a transfer that names `asnd` moves that account's holding by the act of the asset's clawback address, so neither is the payer's signed act. A logic signature a Falcon key delegated (`lsig.pqsig`) is refused `avm/txn-malformed` first: the x402 facilitator's decoder reads no `pqsig` there either, so it and algod read two transactions (rule 8). 5. H is on chain in the confirmed transaction's note. An Indexer search with `note-prefix` equal to the base64 of that string returns it, and also returns any other transaction that wrote the same note. The read of rule 9 does not use that parameter, which the Indexer's default configuration disables. 6. x402's Algorand scheme leaves the note to the client, and the steward's client writes its own (`x402-payment-v2-`). A client that does not implement this profile is refused by rule 4. **The settler, the signer and the agreement** 7. The settler is the resource server's x402 facilitator. It checks the group (at most 16 entries, the scheme's bound), the payment entry's `aamt`, `arcv` and `xaid` against the requirements, the amount by equality, and that the entry is signed; where the option names `extra.feePayer` it signs its own zero-ALGO payment, which carries the group's fee, and the buyer's transfer carries a zero fee bound to the group; with no fee payer the buyer pays its own transfer's fee. The choice is fixed in what the buyer signs. The settler submits the group, and a confirmation it reports is a hint: the read of rule 9 decides. 8. The signer is `sgnr` where the payer's account is rekeyed and `snd` otherwise. Its authority is a key's signature over the transaction: a plain signature, a multisignature, or a Falcon signature (`pqsig`), by the account's own key or by the key it is rekeyed to. The x402 facilitator's decoder reads no `pqsig`, so an entry that sets it has one reader, algod's, as lcp reads it: lcp takes it where `pqsig` is its one signature, the scheme is Falcon-1024's, `f1`, and the key and signature are within 1,793 and 1,538 bytes, under the transaction's own id, and a settler other than the facilitator submits it as lcp read it, the node being its second reader. lcp's client writes no Falcon signature: `complete` takes a 64-byte Ed25519 signature alone, so a payer whose key is Falcon-1024's has its own wallet write the `pqsig` envelope over the transaction lcp built, under that transaction's own id. A logic signature, whether a key delegated it or it is a contract account's, is no such authority, and a transfer that names `asnd` is not the holder's act: one that lands is read and described, and is never the payer's act. Such a transaction is reported as a foreign item with its signer and its authority, named by the Indexer's signature member that is set (`sig`, `multisig`, `logicsig` or `pqsig`), and an inner transaction, which no key signed, with the authority `none`. 9. The pairing's payment can itself be an agreement. Its floor is zero; the fee is the settler's where the option names `extra.feePayer`, else the buyer's; the transaction must be confirmed, which on Algorand is final and means it succeeded, since a group applies whole or not at all and no failed transaction is included; and an act whose signer is the option's payee, or whose `snd` is the payee, is no agreement and no payment. **The read** (the profile `read-status`) 10. `reference` gives the network, the transaction id (the base32 of SHA-512/256 of `"TX"` and the transaction's canonical encoding, which covers the note and not the signature), the last valid round as a decimal string, H, the payer `snd`, the signer, and the option's payee, `payTo`, for the two party tests. It refuses a payment whose `accepted` is not the option it is given (`x402/accepted-not-option`). 11. The single-use value is the transaction id within its validity rounds. The read holds it: `GET /v2/transactions?txid=` on an Indexer. The one mark is the confirmed round, which is final. The position is the confirmed round. A signed payment is payable through its `lastValid` round, at most 1,000 rounds after its `firstValid`; the bound is in rounds. 12. **Succeeded** means the transaction is confirmed under its id in a round after the position the caller gives. It is the act asked about where it is a top-level asset transfer, its note is exactly H's LCP string, its `snd` is the reference's, it names no `asnd`, its authority is a key's signature (rule 8), its signer is not the payee, and, on the act `payment`, its `arcv` is the payee; `xaid`, `aamt` and, where set, `aclose` with the close amount are recorded as observed, whatever asset or amount moved, zero included. A transaction confirmed under the claimed id that fails any of these consumed the id and is not the act asked about. 13. **The history.** Absence is answered only where the Indexer holds the rounds from the position the caller gives: the reader states that its Indexer is declared archival, or the Indexer answers `/v2/blocks/{round}?header-only=true` at that position. Otherwise an id not found is `unreadable`, `history-gap`. 14. **The lapse.** An id not found, in an answer whose `current-round` is not past `lastValid`, is `pending`, `instrument-live`. Past `lastValid`, or where the id landed as a transaction that is not the act asked about, the answer needs the search for H (rule 15) read whole and finding no act asked about: then `failed`, `instrument-unused` or `instrument-consumed`; an act the search finds is `settled`, its `presented` `no`. 15. **The search for H.** The payer's transactions, `GET /v2/accounts/{snd}/transactions`, from `min-round` one past the position the caller gives, returned newest first and paged by the `next` token; the call takes only `min-round`, `max-round`, `limit` and `next`. The read matches H on each transaction's note, and on each of its inner transactions' notes, byte for byte. The range is read in sub-ranges: a sub-range's top is the `current-round` of its first page; each later page is asked with `max-round` at that top and must answer a `current-round` at or past it; a sub-range ends at the first page that holds no transaction, a short page not being its end. The search is complete when it is read whole from the position given to the top of a sub-range at or past the round of the id's lookup. Its position is the round through which it is read whole, with the top and the `next` token of a sub-range under way; at most 32 pages are read in one call. A page answering a `current-round` below its top leaves the search incomplete, its position held at that page. An item the reader cannot parse is named by its id, the rest of the range is read, and the search is held at that item's page, which the next call reads again, unless the caller gave that transaction as another act under the same H. A page that fails is `unreadable`, `transport`. Where the read runs no search, a search position the caller gives is carried back unchanged. A top-level asset transfer it finds that is the act asked about (rule 12) settles; any other transaction carrying H is a foreign item. The search reads every transaction of the payer's account, sent or received, so a busy or flooded account lengthens it. 16. **Not yet shown.** That the Indexer holds every transaction of the rounds after a header it answers, and the Indexer's paging as rule 15 reads it, are not yet shown by a run; nor is a payment whose entry a Falcon signature authorises (rule 8) taken by the node under the id lcp computes. Until a run shows it, no server or settler states a Falcon-authorised payer as one it takes. Until a run shows them, a search read whole proves no absence: where the read would answer `failed` for any reason but `before-position`, it answers `pending`, `search-incomplete`. 17. **The payment presented.** A `settled` answer states `presented`: `yes` where the act is the transaction the reference was built from, whose id covers the whole transaction the payer signed, its signature apart; `no` where it is another. Each transfer of what moved is named by its transaction id and its place, the member naming the account it reached: `arcv`, or `aclose` for a holding closed to it, after the path of `inner-txns` indexes that leads to an inner transaction (`inner-txns/0/arcv`). 18. **The read kit.** These cases of `read-status.json` cannot arise on this read, and the read kit skips them. By their reason: `below-mark`, since the Indexer serves confirmed rounds alone; `not-found`, since the read holds the single-use value, the transaction id within its validity rounds, and answers its absence `pending`, `instrument-live`, or `unreadable`, `history-gap` (rules 13 and 14); and `transaction-failed`, since Algorand includes no failed transaction. By the case's words: *an act read at the finality asked for, below the final mark*, *a value unconsumed at the final mark and consumed at the latest head* and *a value whose validity passed, unconsumed at the final mark and consumed at the latest head*, since the Indexer's one round is the final mark and the latest head; *transactions carrying H with a failed result*, *a failed result that left the value unconsumed* (its two cases), *a failed result that consumed the value* (its two cases) and *a read with no means to read the single-use value*, since no failed transaction is included; *a value read consumed whose transaction the search has not found* and *a read that did not read the value at the latest head*, since the id is read consumed only by finding its transaction, at that one round; and *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every transaction is in a round. And, while the search proves no absence (rule 16), the cases its gate holds: each case at coverage `full` whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete`, as the pairing's vectors hold; that declaration goes when a run shows the facts of rule 16. 19. **What a record proves.** That the payer's account authorized, with a key's signature (rule 8), an asset transfer whose note is H, confirmed and final. Where it transferred, one of zero included, that the payer paid the account `arcv` names; it shows nothing of the amount, asset or timing the ATR states. As an agreement, that this account signed the transfer carrying H. --- # x402-exact-aptos.md Source: https://lcp.integraledger.com/profiles/x402-exact-aptos.md **LCP profile `x402/exact/aptos`: x402's stock Aptos payment, paid after its agreement.** This pairing serves x402's `exact` scheme on Aptos as its stock client writes it. No field of that payment carries H, so the pairing is at coverage `none`: the payment is taken only after an agreement carrying H is recorded, by any agreement option the resource server declares (`agreementOn` `any`), and the read finds the payment by what the payer signed, never by H. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, as in the profile `x402/exact/eip155/eip3009`, and an `exact` option on an `aptos:` network whose chain id is 1 to 255, with no `extra.assetTransferMethod`, `extra.paymentFlow` absent or `"authorization"`, `asset` and `payTo` as `0x` and 64 hex digits, and an amount below 2^64. 2. The payer signs one Aptos transaction, the scheme's own: an entry function call of `0x1::primary_fungible_store::transfer`, or `0x1::fungible_asset::transfer`, with the type argument `0x1::fungible_asset::Metadata` and three arguments, the asset, the payee and the amount. An entry function's arguments are fixed, so none holds H. With the option's `extra.feePayer` the payer signs the fee-payer form, and the settler adds the fee payer's signature. `payload.transaction` is the base64 of the BCS bytes, or of x402's reference form, `{"transaction": [bytes], "senderAuthenticator": [bytes]}`; the transaction is at most 64 KiB, the chain's `max_transaction_size_in_bytes`. 3. The payment echoes `extensions` unchanged; `bound` returns the echoed H, which only locates the sale and is no proof. 4. A settler checks the payment by the scheme's own verification (x402's `scheme_exact_aptos.md`), which `@x402/aptos` implements: the network and chain id, the sender's signature, the fee payer where it sponsors, the transfer's asset, payee and amount, the expiry, the balance, and a simulation. 5. The resource server takes the payment only after the agreement for this H is recorded, and an agreement whose signer is the option's payee is no agreement. **The reference** 6. `reference` gives the network, the sender, the signed sequence number, the signed expiry, a digest of the signed transfer (SHA-256 over the RFC 8785 form of the sender, the sequence number, the function, its type arguments and its arguments), the signed `max_gas_amount` and `gas_unit_price`, and the option's payee, the `payTo` of the option it is given, the key of the two party tests and no search key. It refuses a payment whose `accepted` is not that option, compared by RFC 8785 form (`x402/accepted-not-option`). A transaction hash a settler names is a hint, since a fee payer's signature changes it. **The read** `status` reads through an Aptos node's REST API the caller supplies. It compares no amount, asset or time with the option. 7. **Found by.** The payment is the sender's committed transaction at the signed sequence number, `GET /v1/accounts/{sender}/transactions?start=n&limit=1`, a named hash read first as a hint. It is the act asked about where it succeeded, its sender is not the option's payee, it is no act the caller gave (by its reference's sender and sequence number, or by its hash), and it names the payee's account, whatever it moved. Whether it is the payment presented is `presented` on `settled`, which decides no answer: `yes` where every signed member the reference holds equals the REST answer's (the transfer's digest, the expiry, and the gas members), `no` where one differs, `unshown` where the answer does not show one. Neither the fee payer's address nor the chain id is compared: x402's Aptos scheme states that the sender's signature does not cover the fee payer's address (`scheme_exact_aptos.md`), which a run is yet to show, and the REST answer carries no chain id, the read holding the ledger's own (`GET /v1`) to the network instead. A transaction at the number with another payload than an entry function (a script, a multisig) is read for its deposits as rule 8 states, and is not the payment presented. A named hash is passed over where it names no user transaction, and a transaction the node holds uncommitted ends nothing; the lookup by sequence number is still made. 8. **The account an act names.** Each fungible-asset deposit the transaction made, by its `0x1::fungible_asset::Deposit` event, `{store, amount}`: the store's owner, from the transaction's `0x1::object::ObjectCore` change at the store's address, is the account it reached, and its asset is the `metadata` of the `0x1::fungible_asset::FungibleStore` change there. What moved records each deposit with its asset, amount and owner, named by the committed transaction and its place, the index of its `Deposit` event among the transaction's `events`. A payment names the payee's account where one deposit's owner is the option's payee. The reader returns each committed transaction with its `events` and its `changes` whole; an answer without either, or with a deposit whose owner it does not show, is `unreadable`, `unparseable`, and is never read as a transaction that deposited nothing. 9. **The single-use value** is the sender's sequence number. The prologue takes a sequence-number transaction only at the account's current number and the epilogue raises it by one whether it succeeded or aborted (aptos-core `aptos-move/framework/aptos-framework/sources/transaction_validation.move`), so a transaction at the number consumed it. Where the lookup returns nothing at the number, the read takes the account's sequence number, `GET /v1/accounts/{sender}`, with that answer's ledger time (`X-Aptos-Ledger-TimestampUsec`) and history floor (`X-Aptos-Ledger-Oldest-Version`). A number the account has passed, whose transaction the lookup did not return, is `pending`, `search-incomplete`. One it has not passed can still land while the ledger's time in whole seconds is below the signed expiry: `pending`, `instrument-live`; the prologue takes a transaction only while `timestamp::now_seconds() < txn_expiration_time`, so from that second it is `failed`, `instrument-unused`. 10. **History.** A number passed with nothing returned at it, and an expiry passed, are decided only where the history floor of each answer is at or below the position given (the issue position); otherwise, or with no position given, the answer is `unreadable`, `history-gap`, decided before `instrument-unused`, and the caller reads its declared archive endpoint. 11. **Answers.** Committed with `success` false at the number, it consumed the number and moved nothing: the account it names is the destination the payer signed, `arguments[1]` of `0x1::primary_fungible_store::transfer` (another payload names none the read can take), and it is `failed`, `transaction-failed` where that is the option's payee, else `failed`, `instrument-consumed` (`read-status.md` rule 20). Committed and not the act asked about, signed by the payee, given by the caller, or naming no account of the payee's, is `failed`, `instrument-consumed`, naming it with what it moved. A transaction at or before the position given is `failed`, `before-position`. One mark: a committed transaction is final, and the position is its ledger version. Coverage `none` takes no search for H. **What a record proves** 12. That an account signed an agreement transaction carrying H before this payment was taken, which shows neither that the account is the payer nor what the agreement moved; that the payer's signed transaction does not carry H; and that the read found the payment by its sender and sequence number, signed by an account other than the option's payee and depositing to a store the payee owns, what it moved recorded as observed. **The read kit** 13. Declared inapplicable to the read kit: `below-mark`, since a committed transaction is final and there is one mark; `not-found`, since the read reads the account's sequence number; and a lookup beside an item a search could not decode, since the read takes no search. --- # x402-exact-cardano.md Source: https://lcp.integraledger.com/profiles/x402-exact-cardano.md **LCP profile `x402/exact/cardano` and `x402/exact/cardano/lock`: the ATR hash as a CIP-20 message.** Two pairings carry H the same way. `x402/exact/cardano` is x402's address-to-address method: the option's `extra.assetTransferMethod` is absent or `"default"`. `x402/exact/cardano/lock` is x402's two lock methods, `"masumi"` (Masumi's `vested_pay` escrow) and `"script"` (a contract the resource server defines): a deposit into a contract, which is a charge and never an agreement. The member tells the two apart; an option naming another method is neither's. 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. 2. The client fetches L, hashes the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client builds the `exact` payment with a TTL, attaches metadata label 674 = `{"msg": ["lcp:sha256:0x", ]}` with its `auxiliary_data_hash`, signs, does not broadcast, and echoes `extensions` unchanged. This client always writes a TTL. 4. The server refuses a payment whose signed body does not commit to exactly one such message carrying an H it issued for that request and has not seen claimed, before it calls a settler. A settler then applies the published verifier's rules, which are x402's Cardano scheme's (*Facilitator Verification Rules*), and submits. 5. H is on chain in the transaction's metadata, readable by transaction id. 6. A client that does not implement this profile writes no such message, and rule 4 refuses its payment before it is verified or settled. **The option and the payment** 7. The option's `extra.areFeesSponsored`, where present, is `false`: the published scheme sponsors no fee, and an option that says otherwise is refused at the filter. `extra.paymentFlow` is absent or `"authorization"`. The networks are `cardano:mainnet`, `cardano:preprod` and `cardano:preview`, and the three CIP-34 forms are read as the same networks. 8. The payment is `{transaction, nonce}`: the signed, unbroadcast transaction in base64, and the input `nonce` names, `#`, which must be one of the inputs the body spends. That input is the payment's single-use value: once a transaction spends it, this body can never land. 9. The payment's reference names the network, the transaction id (the Blake2b-256 of the body as received), the input, the method, H, the body's TTL slot where it has one, and the option's payee: its `payTo`, or on a Masumi lock the seller its `extra.terms.sellerAddress` names, `payTo` there being the escrow every seller of a deployment shares, which the reference keeps beside the seller. A Masumi seller is the address of a public-key payment credential, as the scheme's verification rules require, and its escrow an address with a payment credential; an option otherwise is `x402/option-malformed`. It refuses a payment whose `accepted` is not the option it is given. On the address method a body with no TTL is admitted, as the published verifier admits it (`@x402/cardano` 2.30.0 checks a TTL only where the body has one), and its reference names none; a lock refuses it, since the scheme requires a TTL of a lock. 10. The payment presented is the body the payer signed, its witnesses apart. A landed transaction is the payment presented exactly where its id is the reference's: a `settled` answer states `presented` `yes` where the act's id is the reference's and `no` where it is another, and never `unshown`, the id being the body's digest. **The agreement (`x402/exact/cardano` only)** 11. A payment of the address method can be the sale's agreement: the same signed transaction, carrying H in label 674, paying the offer's payee directly. Its floor is a rule, the ledger's smallest output to the payee: `(160 + |serialized output|) × coinsPerUtxoByte`, about 1 ADA, the output being `{0: the payee's address, 1: value}` in the post-Alonzo map form, its value the coin alone for a lovelace option, or the coin and one unit of the option's token, and its coin the least that covers its own encoding. The resource server evaluates it when it issues the agreement's offer, from `coinsPerUtxoByte` read from its own Cardano endpoint, and never stores it as a number; where that read fails, the option is left out of that offer. `advertise` on the address method takes `coinsPerUtxoByte` after the offer, before the agreement URL, evaluates the floor as `cardanoFloor` does, and refuses a lovelace offer whose amount is below it (`cardano/amount-below-floor`) and a parameter, `payTo` or asset the rule cannot read (`cardano/floor-input`). An amount below the floor cannot be built. The ADA such an output holds travels to the seller with a token amount. 12. The buyer pays the fee, a field of the body balanced against its own inputs (about 0.17 ADA); the published scheme sponsors none. 13. The agreement succeeded where the transaction whose id is the Blake2b-256 of the signed body is in a block at the mark read with `valid_contract` true, and its label 674 holds H. What its outputs pay is recorded as observed and compared with nothing; an agreement is a proof and is held to no account. A transaction whose payer is the option's payee is no agreement. **The read** 14. `status` reads through an indexer the caller supplies (Blockfrost or Koios), holding the chain from genesis. Marks are counts of confirmations, the blocks after the transaction's own, from 0, the transaction included at the tip, to the ledger's security parameter read from the endpoint's genesis (2160 on mainnet and Preprod, 432 on Preview), which is the final mark. Positions are block heights. The position given is read first: an endpoint that answers no read of the block at it is `unreadable`, `history-gap`; where none is given, the genesis block shows the history. 15. What identifies the act: H in label 674, by this package's decoder; `valid_contract` true; the payer, the payment credential that holds the reference's input, among the payment credentials of the transaction's inputs, and the payee's not among them (one that is, is `payee-signed`); the act's kind, a deposit into a contract (an output to a script credential with an inline datum) being the lock's and no deposit the address method's; and, on a payment, an output whose address has the payee's payment credential, whatever its stake part, or on a Masumi lock a deposit into the reference's escrow whose inline datum, the scheme's `masumi.vested_pay.v2` (Plutus `Constr 0` over 19 fields), names in field 2, `seller`, an address with the payee's payment credential; a datum that does not decode names no account. Only a deposit into that escrow names a seller: any other output, on every method, names its own payment credential, so a datum naming the seller on a deposit into another script, or on an output to a key, names no seller, and an output to the seller's own credential is a transfer to the payee. On a `script` lock an output pays where its address has the payment credential of `payTo`. 16. What moved is each output to another credential than the payer's, its asset (`lovelace`, or `.` in hex) and amount, the payment credential it reached (on a Masumi lock, the beneficiary the datum names, also recorded as its `beneficiary`), and, for an output to a script's address with an inline datum, a deposit into a contract, that address in Bech32 as its `contract`, and the transaction's id with the output's index among the body's outputs as its place, recorded as observed. The read compares no amount, asset or time with the option. 17. The single-use value is the reference's input, read through the indexer: unspent, or spent and by which transaction. An unspent input is read at the latest head only where the indexer that answered held the tip read first; otherwise the read never answers `instrument-live`. The input is consumed at the final mark where the transaction that spent it has the security parameter's confirmations. A transaction consumed it where it is valid and spends it, or is invalid and took it as collateral. A phase-2-invalid transaction that left the input unspent consumed nothing: the answer is `pending`, `instrument-live` until the TTL passes, and then the lapse's. 18. The lapse: the slot of the block the security parameter below the tip is at or past the body's TTL, the transaction absent from a lookup that covers the tip read first, and the input unspent. Below the final mark (the tip's own slot at or past the TTL, that block's not) the answer is `pending`, `below-mark`. A body with no TTL never lapses: it is `pending`, `instrument-live` while its input is unspent. 19. The search for H, before every `failed` but `before-position`: an act of the payer spends an input its payment credential holds, so the search lists that credential's transactions from the block after the position given (or after the position an earlier answer returned) to the tip read first, ordered by height and then by id, and reads each whole; no endpoint finds label 674 by its content, and the payee is never a key. A listed transaction that is the act settles the read, or, above the final mark, answers `pending`, `below-mark`. One that carries H and is not the act is a foreign item. A listed transaction that does not decode is named, and the search reads on: where nothing else decides, the answer is `pending`, `search-incomplete`, naming it, its position the height before it. The search is complete where every page to the tip was read, the endpoint named a height at or past it before each page, every listed transaction was read whole, and the listing is one rule 20 admits. Every page is read to the last; where the endpoint named a height below the tip before a page, the answer is `pending`, `search-incomplete`, with the lowest height it named, through which every listed transaction was read, and where the bound or a listed transaction the endpoint does not hold stopped it, with the height before the first it did not read; the next call takes that height. An item the search could not decode is held no later than that height. One call reads at most 1,000 listed transactions whole. A payer whose address holds no payment credential gives no search, and the read answers `pending`, `search-incomplete` where it would answer `failed`. 20. The search proves absence only through a listing shown to hold every transaction that spends an output of the credential, a page with no more being the last. Koios's `POST /credential_txs` (with `POST /tx_cbor` and `POST /tx_info`) is such a listing by its published document (v1.4.2), not yet shown by a run; Blockfrost's `GET /addresses/{address}/transactions` lists one address of the credential only. Until a run shows a listing whole, the search is never complete: the read answers `pending`, `search-incomplete` where it would answer `failed`, and a search read to the tip gives no position. No reader can state a listing shown whole; that comes with the run. 21. `failed`, `instrument-consumed`: at the final mark, a transaction that is not the act spent the input (an invalid one, one that carries no H, an act the caller gives, or on a payment one that names no payee's account, `other-account`), and the search is complete and found no act. A valid transaction that spent the input and is the act settles the read, the body the payer rebuilt from the same input among them, with `presented` `no`. Where the endpoint cannot name the transaction that spent the input, or does not hold it, the answer is `pending`, `search-incomplete`. `failed`, `transaction-failed`: the transaction the reference names, included with `valid_contract` false at the final mark, took the input as collateral, and the search is complete and found no act. 22. A buyer's wallet that pays again from another payment credential is another payer, whose act is no act of this read. **The read kit.** Every case of `read-status.json` runs through both pairings' reads but those the reads cannot meet, on both pairings, which the forms in `test/read-kit/forms/cardano.ts` skip, each with its reason: *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since every output carries at least the ledger's smallest (the agreement's floor); *an item the search could not decode that gives no position*, since the credential listing names each transaction it lists with its block's height (rule 19); and, while no run has shown a listing whole (rule 20: Koios's listing until its run, Blockfrost's until a run shows the credential whole), each case whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed`. Through the read each of those answers `pending`, `search-incomplete`. The lock pairing's form runs each case on the Masumi lock and, where every act the case holds is of its kind, on the `script` lock as well, whose every act is of its kind (rule 15), each answer held to the case's. **What a record proves.** On the address method: the payer's own signed transaction carrying H landed valid at the mark read, and paid, as observed, the outputs the read names. On a lock: it deposited into a contract, with the beneficiary a Masumi datum names. A transaction with fewer confirmations than the security parameter can be rolled back. --- # x402-exact-casper.md Source: https://lcp.integraledger.com/profiles/x402-exact-casper.md **LCP profile `x402/exact/casper`: the ATR hash as the CEP-3009 nonce.** **Status.** This profile defines the pairing `x402/exact/casper`. Its `confirmed` is `no`: nothing outside lcp has yet shown a payment of this form with H as its nonce, and the stock `@x402/casper` client draws a random nonce, so it cannot pay this pairing. No token on Casper mainnet (`casper:casper`) has yet been shown to execute `transfer_with_authorization`. **The form** 1. The `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L an `https` URL serving them. 2. The client fetches L, hashes the bytes received, and compares with H as 32 bytes. On a mismatch it does not sign. 3. On a match it signs CEP-3009 `TransferWithAuthorization` (`from`, `to`, `value`, `validAfter`, `validBefore`, `nonce`, under the domain `name`, `version`, `chain_name`, `contract_package_hash`) with `to` the option's `payTo`, `value` its `amount`, `validAfter` 0, `validBefore` the client's clock plus the option's `maxTimeoutSeconds` in Unix seconds, `chain_name` the option's `network` (`casper:` and the chainspec name, CAIP-2: `casper:casper` on mainnet, `casper:casper-test` on testnet), `contract_package_hash` its `asset`, and `nonce` = H as 64 hex digits; and it echoes `extensions` unchanged. A presented nonce is read with or without `0x`, and is 32 bytes. 4. **The agreement's own nonce.** Where the payment is offered as an agreement, the signed `nonce` is the agreement's value in place of H: SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` followed by H's 32 bytes (the profile `read-status`, rule 1), 64 hex digits; its vectors are `core-vectors.json`'s `agreementValue` and this pairing's. The token keys a used nonce by `(from, nonce)`, so an agreement and a payment under one H from one account never take one item. `build` writes it for the act `agreement`; `bound`, given the act `agreement` and H, refuses a payment whose nonce is not that value, `casper/nonce-not-bound`, and gives H where it is; `reference`, given the same, names that value as the signed nonce. 5. The server refuses a payment whose nonce is not an H it issued for this request, or that H's agreement value where it offered the option as an agreement, and has not seen claimed. It refuses a payment whose `from` is the option's `payTo`: an act the payee signed is no payment and no agreement. 6. A settler relays the authorization to the token's `transfer_with_authorization` and pays the gas; nothing in the authorization names it. It checks the authorization by x402's Casper scheme before anything is sent, and the server checks H first (rule 5). **What "succeeded" means, and what fails** 7. Succeeded: the transaction executed with no `error_message`, calling a CEP-3009 package's `transfer_with_authorization`, or `receive_with_authorization`, with the authorization's `from` and the signed nonce. The call sets that package's `used_nonces[(from, nonce)]`. Its package, `to` and `value` are what moved, recorded as observed; the package is never a reason to pass a call over (rule 16). 8. Executed with an `error_message`: contract state rolls back and the nonce stays unset. No payment and no agreement, and nothing is consumed: the authorization can still land until `validBefore`. 9. A cancellation: an executed `cancel_authorization` for the nonce is the payer's signature over it. It sets the item with no transfer, so the nonce can never land on this token, and it is no payment and no agreement. **The asset's requirements** 10. The asset's CEP-3009 refuses a nonce that is not 32 bytes; names the amount `value`, as x402's published Casper settler sends it; refuses an authorization at or past `validBefore`; and holds a used nonce in the dictionary `used_nonces` under the item the reader reads for `(from, nonce)`. The dictionary's name and the item key are the token's own; a reader reads an asset only where a run has shown them. On any other asset the payment is not found from what the payer signed. **The read** (the profile `read-status`) 11. The reference names the network, the asset package, `from`, the signed nonce (H, or the agreement's value), the option's `payTo` as the payee, `validBefore` (as `settleBy`, capped at 2^53 − 1), and the authorization as presented. `reference` refuses a presented `accepted` that is not the option it is given, `x402/accepted-not-option`. With nothing given, which means the act `payment`, it refuses a payment that echoes a legal context whose H is not its nonce, `casper/nonce-not-bound`; a payment that echoes none gives its nonce as H, as `bound` does. The caller adds H for `status`, by which the read tells H's other value (the agreement's value on a payment, H on an agreement) from the act's own. The reference's nonce must be the value the act asked about carries, H on a payment and the agreement's value on an agreement, and it must hold the authorization as presented, of the form rule 3 states, whose `validBefore` is the lapse; otherwise `status` answers `unreadable`, `unparseable`, with nothing read. 12. The ledger has one mark, `finalized`: a node serves only executed transactions of final blocks, so the newest block it has executed is both the final mark and the latest head, and one read of the nonce there is its read at both. A position is a block height. 13. The read is of the nonce. It reads `used_nonces[(from, nonce)]` with `state_get_dictionary_item` at the state root of the newest block the node has executed. Unset, in the node's documented form for a missing item: the payment has not landed on this package. Where that block's own timestamp is before `validBefore` the answer is `pending`, `instrument-live`. At or past it, the authorization can no longer land on this package, but an authorization the payer signed under the same nonce on another token package is a payment carrying H that no read of this item shows, so the read of the item is no search for H (the profile `read-status`, rules 24 to 26: each token package keeps its own nonces) and the answer is `pending`, `search-incomplete`, never `failed`; its search position is the height read unset, as it is wherever the caller gave a search position. 14. Set: the read finds the block that set it. Where the caller gave a position and the item is already set at it, the block is found below it, from the lowest height the node serves; otherwise above the position given, or above the lowest height the node serves. It bisects block heights, one read of the item at one block's state root for each probe (at most 64 a call), to the first block where the item is set. A probe the node does not serve is `unreadable`, `history-gap`; an item set at the lowest height served is `unreadable`, `history-gap`; a search position naming a transaction that set the item, which the node no longer knows, is `unreadable`, `history-gap`. The node's `available_block_range` chooses the endpoint and is never the verdict. 15. It reads that block's transactions, in the block's order, a page at a time (at most 8 pages a call, and at most 1024 calls a page, a page that gives more being `unreadable`, `too-large`), for the one transaction that executed with no `error_message` on the asset package, under the nonce, for the reference's `from`. One act sets the item, so exactly one such transaction exists. It reads the whole block, so that every transaction in it that carries H, on whatever package it calls, is named. Where pages remain, the answer carries the search position, the block and the next page, from which the next call resumes. A CEP-3009 call there whose package or 32-byte nonce the node does not show, and a call that carries the nonce or H's other value and whose `from`, or on a transfer `to` or `value`, the node does not show, are calls the node does not give whole: each is an item the search could not decode, which holds the search at its page, and the answer names it (the profile `read-status`, rule 19). 16. The one that set the item, by `transfer_with_authorization` or `receive_with_authorization` on the asset package, is the act asked about, the call on another package setting another package's item: on the act `agreement` it is the act whatever its `to`, an agreement being held to no account; on the act `payment` it is the act where its `to` is the option's `payTo`, whatever its `value`, zero included. A payment whose `to` is another account consumed the nonce and names no payee's account: it is not the act, and since the read of the item is no search for H the answer is `pending`, `search-incomplete`, naming it with what it moved and the reason `other-account`, never `failed`. A `cancel_authorization` is answered the same way, naming it with the reason `other-kind`. 17. The item set and the block read whole with no such transaction found, as where an authorization was executed from session code or through another contract, whose arguments no transaction's own call shows: `pending`, `search-incomplete`, never `not-found` or `failed`. 18. Every other transaction in the block that carries the nonce or H's other value and executed is a foreign item, named with the first reason of the closed list that holds: an authorization the payee signed, `payee-signed`; another account's, `other-signer`; one the caller gave, by its reference or by its transaction in either case of its hex digits, `given`; the payer's act under H's other value, or on a package other than the asset's, its package recorded with what it moved, `other-kind`. One that executed with an `error_message` decides nothing and is no foreign item. A transaction at or before the position given that set the item answers `failed`, `before-position`, naming it. 19. What moved names the one transfer by the transaction that set the item and, as its place, that transaction's own call to the package, by its entry point, from whose arguments it is read: the package, `to` and `value`. `to` alone is compared, with `payTo`, on the act `payment`; the package and `value` are compared with nothing. The signer is the authorization's `from`. 20. `presented`, on `settled`: `yes` where the executed call's package, `from`, `to`, `value`, `validAfter`, `validBefore` and nonce equal the authorization as presented; `no` where one differs; `unshown` where the read does not show every one; a `receive_with_authorization` or a cancellation is another message than the one presented, `no`. It decides no answer. An authorization as presented with a member out of its form (rule 11) is no reference. 21. No transaction hash is needed for any answer: a lost settle answer is decided by the read of the nonce and the search. 22. `failed` is answered only as `before-position`. The read kit's cases this ledger cannot give are declared inapplicable to it: `below-mark`, since the family has one mark; `transaction-failed` and the cases opening *a failed result that consumed the value*, since a failed execution leaves the nonce unset; `instrument-unused` and `instrument-consumed`, since no `failed` but `before-position` is answered (rule 13, rule 16); and `not-found`, since the read always holds the nonce. Declared inapplicable also, by the cases' words: *an act read at the finality asked for, below the final mark*, *a value unconsumed at the final mark and consumed at the latest head* and *a value whose validity passed, unconsumed at the final mark and consumed at the latest head* and *a read that did not read the value at the latest head*, since the one mark is the latest head and the read holds the nonce (rule 12); *a read with no means to read the single-use value*, since the read always holds the nonce; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since the read takes each transaction from a block at its height (rule 15); *each transfer of what moved is named by its transaction and its place*, since the one CEP-3009 call the act makes moves one transfer (rule 19); *a payment act carrying H that moved another asset* and *a second act of the payer that meets every test*, since the act asked about is the one call under the signed nonce on the option's asset package, which one act sets, and no search reaches the payer's acts in another package (rules 13 and 16); and *instrument-live is answered before an item the search could not decode* and *an item the search could not decode holds a failed answer*, since the read reads a block's transactions only once the item is set, so a nonce read unset, lapsed or not, meets no item (rules 13 and 15). **Recovery** 23. `recover` takes `{network, tx, option}`, the option's `asset` naming the package, and returns the `nonce` argument of the transaction's executed authorization call on that package: H from a payment's transaction, and from an agreement's the agreement's value, which a holder of the ATR computes from its own H and compares. **The agreement** 24. The pairing's data holds an `agreement`, so the payment can be an agreement, while its `confirmed` is `no` (*Status*): one authorization the payer signs, paying the payee directly a fixed amount, with no hold, landing whole on one network. The floor is 0 by the token; x402's published Casper settler refuses a zero amount, so a settler that registers it declares no zero, and the agreement is then 1 base unit. The settler pays the fee, always. The transaction must succeed (rule 7). An authorization the payee signed is no agreement. **What a record proves** 25. A settled read shows that the payer's own signed authorization carries H as its nonce (on an agreement, the agreement's value), which the token contract verified with the payer's key when it executed; and that it paid the account `to` names the amount `value`, zero included, which on a payment is the option's `payTo`. It does not show that the amount, the asset or the timing match the ATR's content. --- # x402-exact-ccd.md Source: https://lcp.integraledger.com/profiles/x402-exact-ccd.md **LCP profile `x402/exact/ccd`: the ATR hash as the transfer memo.** **Status.** This profile defines the pairing `x402/exact/ccd`. Its `confirmed` is `no`: nothing outside lcp has yet shown a payment of this form with H as its memo, and the stock `@x402/concordium` client writes no memo, so it cannot pay this pairing. Its `nonce` is `unshown`, and its data holds no `agreement` until a run shows single use (rule 7). 1. The `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L an `https` URL serving them. 2. The client fetches L, hashes the bytes received, and compares with H as 32 bytes. On a mismatch it does not sign. 3. On a match its one transfer carries a memo: for CCD (the option's `asset` read without regard to case, as the stock facilitator reads it), `SimpleTransferWithMemo` whose memo is the CBOR text string `lcp:sha256:` + H; for a PLT, a `transfer` operation whose `memo` is CBOR tag 24 around those bytes. The transaction is the sponsored form, version 1: the header the sender signs names the sender, its sequence number, the `expiry` and the sponsor, the option's `extra.feePayer`. The client sets the expiry as the stock client does, the time it signs plus `maxTimeoutSeconds` less 5 seconds. The option's `network` is `ccd:` and the first 32 lowercase hex digits of the genesis block hash (CAIP-2). Its `amount` may be `"0"`: the scheme asks strict equality and sets no floor. 4. The server refuses a payment whose memo does not carry an H it issued for this request and has not seen claimed. 5. The memo is in the finalized `AccountTransfer` or `TokenTransfer` event of the settlement transaction. **The settler and the agreement** 6. The settler, as sponsor, adds its signature and submits what the sender signed, and pays the fee, always. The stock facilitator checks the sponsor against `extra.feePayer`, the receiver against `payTo`, the amount by equality, the expiry against `maxTimeoutSeconds`, the sender's signature and that the signed sequence number is the account's next one; it reads no memo, so the check of rule 4 is the server's, made before it calls the settler. The transaction it names is a hint: the read of rule 9 decides. 7. The pairing's payment can itself be an agreement once its single use is shown: its floor is zero; the fee is the sponsor's; the item must be finalized with a successful outcome; and an act whose sender is the option's payee, compared as an account, is no agreement and no payment. A `rejected` outcome is included, charged its fee, and consumes the sender's sequence number: it is no agreement. Until a run shows a landed payment refused when sent again, the pairing's `nonce` is `unshown` and its data holds no `agreement`: the agreement option waits on that run. **The read** (the profile `read-status`) 8. `reference` gives the network, H, the header's sender (its base58check text), the signed sequence number (a decimal string), the signed `expiry` in seconds (the payment's deadline), the option's `payTo` for the two party tests, and the digest of what the sender signed (rule 14). It refuses a header whose sequence number, `numSignatures` or sponsor's `numSignatures` is not a positive integer, whose `executionEnergyAmount` is not a non-negative one, that names no sponsor, or whose sponsor is not an account address, `ccd/transaction-malformed` or `ccd/address-malformed`, and a payment whose `accepted` is not the option it is given, compared as RFC 8785 JSON, `x402/accepted-not-option`. It names no asset: nothing the transfer moved is compared with the option but its receiver. The caller may add `transaction`, a hash a settler named, which the read takes as a hint. 9. **Accounts.** An account is its address's first 29 bytes; the last three name an alias of the same account. The read compares accounts so: the item's sender with the reference's, the sender with the payee, and on a charge the receiver with `payTo`. 10. **The mark** is one, `finalized`. The position is a finalized block height. The single-use value is the sender's sequence number. The read takes the account's next sequence number (`GetAccountInfo`) at the last finalized height, at the latest head (`best`) and at the position given; an account absent at a block the node holds has used no number there, and a block the node does not hold, told by `GetBlockInfo`, is `unreadable`, `history-gap`. The latest head is no mark: an item a hint names that the node answers `committed`, not yet finalized, is read at `committed`, below the mark, and answers `pending`, `below-mark` where it is the act asked about or would answer `failed`. One the node answers `finalized` under another account's signature, which no number of the sender's reaches, is read at the mark: a foreign item where it carries H. The read takes a hint only where the reader gives the height of the block that holds it and its outcome names no kind the reader does not know. 11. **Found by.** Where the next number at the last finalized height has passed the signed one, the read bisects the finalized heights from the position given to find the block at which it passed, and reads that block's items, `GetBlockItems`, each payload decoded from its binary form (`transferWithMemo`, tag 22: the receiver's 32 bytes, the memo with a 2-byte length, the amount as 8 bytes; `tokenUpdate`, tag 27: the token id with a 1-byte length and the operations with a 4-byte length, in CBOR), for the item whose header names the sender, as an account, and the signed number. Its outcome is read by its hash, `GetBlockItemStatus`. That item is the act asked about where its payload is one transfer whose memo is H, its outcome a success, its sender not the payee, and on the act `payment` its receiver `payTo`; what it moved is recorded as observed, each transfer named by the item's hash and its index among the transfers its outcome lists, whatever token or amount, zero included, with the decimals of its amount: six for CCD, whose amounts are in microCCD (concordium-grpc-api `v2/concordium/types.proto`, `Amount`), and for a PLT the `decimals` of the event's `TokenAmount` (`v2/concordium/protocol-level-tokens.proto`), which the reader gives with each PLT transfer, an outcome whose PLT transfer gives none being unparseable. For a failed result the account it names is the receiver its signed payload names, and what moved is empty. Any other item at that number consumed it: `instrument-consumed`; this payment's own `rejected` item: `transaction-failed`. The item at the number, its payload type, or an effect or event kind of its outcome, that the reader cannot decode is `unreadable`, `unparseable`. 12. **The lapse.** The number not passed at the final mark and at the latest head, while the last finalized block's own time (`slot_time`, in milliseconds) is not past the signed `expiry` (in seconds), is `pending`, `instrument-live`; not passed at the final mark and passed at the latest head, `pending`, `search-incomplete`. Not passed with a finalized block past the expiry: `instrument-unused`. Already passed at the position given: `failed`, `before-position`, naming the item at the number, which the read locates from the chain's first block; a node that does not hold the account's state or blocks below the position given answers that case `unreadable`, `history-gap`, and an item there it cannot decode `unreadable`, `unparseable`. Passed and its item not located: `pending`, `search-incomplete`. 13. **The search for H.** Every `failed` but `before-position` needs the search for H read whole and finding no act asked about. It reads every act of the sender's account after the position given: the items at the numbers from the account's next number at that position (1 where the account was absent there) to the one before its next number at the latest head; where the two are equal it is complete with no further call. Each number is located by the bisection of rule 11 and its item read and decoded as there. The first item whose payload is one transfer whose memo is H, whose outcome is a success, whose sender is not the payee and, on a charge, whose receiver is `payTo`, is the act asked about: `settled`. An item carrying H whose sender is the payee, or on a charge whose receiver is another account, is a foreign item, and so is an encrypted or scheduled transfer (tags 23 and 24) whose memo is H, another kind; a rejected one is none; an act the caller gives under the same H, by its sender and number or its hash, is never settled on. Its position is the next number to locate, `{next}`; at most 16 numbers (`CCD_SEARCH_NUMBERS`) are located in one call. A number not passed at the last finalized height, or located with no item of the account, leaves it incomplete there; an item it cannot decode, its payload type or an effect or event kind of its outcome, is named, the rest of the range is read, and the search is held at that item's number. The search reads every transaction of the sender since the position given, so a busy sender lengthens it over several calls. 14. **The payment presented.** A `settled` answer states `presented`: `yes` where the item's signed members equal those the presented payment holds, `no` where any differs. The members are compared by one digest, SHA-256 over the sender's 32 bytes, the sequence number, the expiry and the energy as 8-byte big-endian integers (the energy the header the sender signed holds, which the wire form does not: 100 for each signature, the sender's `numSignatures` and the sponsor's, plus the 94-byte sponsored header and the payload's bytes, plus `executionEnergyAmount`, as `@concordium/web-sdk` 12.0.2 computes it at signing, and as a node gives the header's `energy_amount`), a byte 1 and the sponsor's 32 bytes (a byte 0 where the header names none), and the payload in the protocol's binary form; `reference` computes it from the presented transaction, the read from the item's header and `raw_payload`. An item a hint names, read from its outcome alone below the final mark, shows neither, and is `unshown`. 15. **Not yet shown.** That every included item of an account takes its next number, none skipped; that `GetAccountInfo` answers for an account named by any of its aliases; what a node answers for an account absent at a finalized height; and the search itself, are not yet shown by a run. Until a run shows them, a search read whole proves no absence: where the read would answer `failed` for any reason but `before-position`, it answers `pending`, `search-incomplete`. 16. **The read kit.** These cases of `read-status.json` cannot arise on this read, and the read kit skips them. By their reason: `not-found`, since the read holds the sender's sequence number and answers one not passed `pending`, `instrument-live`, and one passed whose item is not located `pending`, `search-incomplete`. By the case's words: *an act read at the finality asked for, below the final mark*, since a seller names `finalized` alone, the search's latest head above it being no mark; *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since the read holds the sequence number and reads the next number at the latest head; *a value read consumed whose transaction the search has not found*, since the search locates the item behind every number the account consumed after the position given, so one not located leaves the search with range left, held at that number, and a search read whole has found the transaction; *the validity passed with the value unconsumed, read below the final mark*, since the `expiry` is compared with a finalized block's own timestamp alone; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every item is located at a block's height. And, while the search proves no absence (rule 15), the cases its gate holds: each case at coverage `full` whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete`, as the pairing's vectors hold. While the pairing's data holds no `agreement` (rule 7), the read kit runs no case on the act `agreement`: the read's agreement path is held by the vectors alone. 17. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/ccd`: The payer signed a Concordium transaction one of whose transfers carries this ATR's hash, in LCP string form, as its memo. The chain accepted the transaction only with the sender's valid signature, and the memo is on chain in the finalized transfer event. Where the transfer moved an amount, zero included, the payer paid it to the account the transfer names. It does not show that amount, token or timing match the ATR's content. --- # x402-exact-eip155-eip3009.md Source: https://lcp.integraledger.com/profiles/x402-exact-eip155-eip3009.md **LCP profile `x402/exact/eip155/eip3009`: the ATR hash as the EIP-3009 nonce.** This pairing serves x402's `exact` scheme on an EVM chain through an EIP-3009 token, as lcp's client writes it. H is the nonce of the `TransferWithAuthorization` the payer signs, all of H, so the pairing is at coverage `full`, and its read finds the payment by H. The stock client (`@x402/evm`) draws the nonce at random and writes no H. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs `TransferWithAuthorization` for an `exact` option with `nonce` = H, `validAfter` 0 and `validBefore` the signing time plus the option's `maxTimeoutSeconds`, under the token's EIP-712 domain (`extra.name`, `extra.version`, the chain id, the asset as verifying contract), and echoes `extensions` unchanged. 4. The option filter takes an `exact` option on an `eip155` network with the token's `extra.name` and `extra.version`. It refuses an option whose `extra.name` is `GatewayWalletBatched` or whose `extra.verifyingContract` is present and not the asset, which is Circle's batched payment, signed under the Gateway Wallet's domain and not the token's (`x402/batched-not-eip3009`), and an option whose `extra.splits` is present and not empty, since `exact` pays one payee (`x402/splits-not-carried`). It takes an amount of `"0"`: the token sets no floor, and x402's facilitator compares the authorization's value with the amount by equality. 5. The server refuses a payment whose `nonce` is not an H it issued for that request and has not seen claimed. 6. H is on chain as `topics[2]` of `AuthorizationUsed(authorizer, nonce)`, emitted by the token that consumed the authorization in the settlement transaction. A search by that topic can also return other authorizers' uses of the same value. 7. x402 calls the nonce a *"32-byte random nonce to prevent replay attacks"*. H is unpredictable before issue and unique per ATR, because each ATR carries a random UUID, so the nonce keeps its replay role. A client that does not implement this profile draws a random nonce, and rule 5 refuses its payment. **The agreement** 8. This pairing's payment can be the agreement itself, an act of its own under the same H. The agreement's nonce is the agreement's own value: SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` (hex `6c63702d61677265656d656e742d7631`) followed by H's 32 bytes, 48 bytes in all, written as H is (`read-status.md`, rule 1). So a payment and an agreement under one H never share a nonce, and neither consumes the other's. For H = SHA-256("abc") the value is `0x424524a7e791dcf7c2e6980bc94582ae2b436d6184873563d03539e97d36a434` (`x402-exact-eip155-eip3009.json`, `AG`, computed with GNU coreutils `sha256sum` and `openssl dgst -sha256`). 9. `build(choice, H, "agreement")` signs that value as the nonce. `bound` of a payment returns its nonce; given the act `agreement` and H, it returns H where the nonce is H's agreement value and refuses any other nonce (`x402/nonce-not-agreement`), and `reference` holds the same. On the act `agreement`, `status` reads the agreement's value where this profile reads H, and `AuthorizationUsed`'s nonce topic is that value. A reference is keyed on H and serves both acts, `status` taking the act's value from H, so the payment's reference asked about the agreement reads the payment as an act of another kind. An agreement's own payment is given to `bound` and `reference` with the act and H: given neither, they take its nonce, the agreement's value, as H, and `status` reads the reference as a payment under that value, whose agreement is no act anyone signed. `recover` returns the nonce the transaction used, which a holder of the ATR compares with H's agreement value. 10. The agreement's floor is 0, where the network's settler takes a zero amount; the party that submits pays the fee, and the buyer needs a key and no funds at zero. It succeeded where the receipt's `status` is 1 and the token it called emitted `AuthorizationUsed` with the buyer as authorizer and the agreement's value as nonce, paired with its `Transfer` as rule 14 pairs them. **The reference** 11. `reference` gives the network, the asset, the payer (the authorization's `from`), the signed `validBefore`, H, the members of the payment presented (the token, `from`, `to`, `value` and `nonce`, lowercase), the option's payee (the `payTo` of the option it is given, the key of both party tests), and the transaction a settler names, a hint. It refuses a payment whose `accepted` is not that option, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** `status` reads through a JSON-RPC endpoint the caller supplies: receipts, transactions, `eth_call`, blocks by mark with their timestamps, and `eth_getLogs`. It compares no amount, asset or time with the option. 12. **The single-use value** is the nonce (on an agreement, its value, rule 8), which the token keeps for each authorizer. The read takes `authorizationState(payer, nonce)` on the asset at the `finalized` block and at the latest block. 13. **Found by.** The search reads the logs of every contract with topics `[AuthorizationUsed, payer, nonce]`, by a filter that names no address, and the other act's nonce the same way, and the asset's `[AuthorizationCanceled, null, nonce]`, from the block after the position the caller gives (or the search position an earlier answer returned) to the latest head. It reads pages of at most 10,000 blocks, halving a page whose range the endpoint refuses; a range refused at one block is `unreadable`, `transport`, never absence. One call reads at most eight pages; a search with range left answers `pending`, `search-incomplete`, with the position the next call resumes from. A use on a contract other than the asset counts only where the read verifies the payer's signature over the authorization its transaction carries, as a token verifies it (Circle's FiatTokenV2_2, `SignatureChecker`): by ecrecover to `from` in that contract's EIP-712 domain, the four-member one (its `name()` and `version()`, the chain id and the contract as verifying contract) or the one the contract states by EIP-5267's `eip712Domain()` where that names the contract and the chain, a `salt` included; or by `from`'s ERC-1271 `isValidSignature(digest, signature)` answering the magic value `0x1626ba7e` over either digest, the payer being a contract account. Each is read in the state after the use's block. A use counts for nothing only where it is shown not to be the payer's: the contract's domain is known (stated by `eip712Domain()`, or its `DOMAIN_SEPARATOR()` equal to the four-member one), the 65-byte signature, with a low `s`, recovers to another account in it, and `from` accepts it by no ERC-1271 answer (an account with no code answers none). One the read cannot decode, or cannot verify or show not to be the payer's, holds the search at that transaction (`read-status.md`, rule 19), since the payer's act on another token is the act asked about whatever asset it moved (rule 10), and absence is never inferred from it. A transaction the settler names is read along with the search. 14. **Pairing a use with its transfer.** Where the transaction holds exactly one `AuthorizationUsed` of that authorizer emitted by that contract and at most one `Transfer` from that authorizer emitted by it, the two pair, in whatever order the token logs them, whoever submitted the call and through whatever contract: EIP-3009's reference implementation and Circle's FiatToken emit `AuthorizationUsed` and then the transfer, and EIP-3009 states no order. Otherwise the read decodes the transaction's input: the contract's `transferWithAuthorization` or `receiveWithAuthorization`, in its `v, r, s` or its `bytes` signature form (selectors `0xe3ee160e`, `0xcf092995`, `0xef55bec6`, `0x88b7ab63`), found at any byte offset, whose `from` is the authorizer and whose `nonce` is the use's. Exactly one such call must be there, and the use's transfer is the contract's `Transfer` from `from` to the call's `to` of the call's `value`, not already paired with another use. Where the reader gives no transaction, or the call or the transfer is not there, the transaction holds the search (`x402-exact-eip155-eip3009.json`, `V6.pairing`). The cost: authorizations a contract holds and submits in another encoding are not split, and such a transaction holds its search. 15. **The account an act names, and what moved.** The paired `Transfer`'s `to`, compared with the option's payee; what moved is that transfer's token, `value` and `to`, named by the transaction and its place, the index of its log among the receipt's logs. On Arc each USDC transfer also emits a `Transfer` from the system emitter `0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE` in 18 decimals (Arc's documentation, *USDC system events*): the read takes only the asset contract's own `Transfer`, and the system log is never paired, recorded or counted. 16. **Who signed.** The authorization's `from`, the authorizer, is the signer of H, never the transaction's sender, which is a settler. An act whose authorizer is the option's payee, or another account, is a foreign item and settles nothing. A cancellation, the asset's `AuthorizationCanceled(authorizer, nonce)`, is the authorizer's act of another kind that names no account, and consumes the nonce where the authorizer is the payer. 17. **A reverted transaction** consumed no nonce: the read decodes its call carrying the nonce and answers a failed result naming the account the call's `to` names. 18. **The payment presented** is what the payer signed, its signature apart: the token, `from`, `to`, `value` and `nonce`, read from the two logs rule 14 pairs, the token being the contract that emitted both. `presented` on `settled` is `yes` where the five equal the presented authorization's, `no` where one differs, and `unshown` where the read does not show one; the validity window is no member. So a call any holder of the signature wraps in a contract of its own reads `yes`. 19. **Lapse.** The token takes an authorization only while the block's time is below `validBefore` (EIP-3009, `require(now < validBefore)`). The nonce unconsumed at a `finalized` block whose timestamp is at or past `validBefore`, and at the latest block, with the search read whole, is `failed`, `instrument-unused`; before that it is `pending`, `instrument-live`. **Below the position given.** Where the nonce reads consumed and the search has found no transaction that consumed it, the read reads the nonce at the position given. Consumed there, it was consumed at or before that position: the read finds the first block at which it reads consumed, halving the range from the network's first block, reads in that block the asset's `[AuthorizationUsed, payer, nonce]` and `[AuthorizationCanceled, payer, nonce]` logs, and classifies their transactions as rules 14 to 17 do. One that consumed the nonce answers `failed`, `before-position`, naming it; none found answers `pending`, `search-incomplete`, since no search after the position given that met none shows a transaction at or before it. The cost: one read of the nonce at the position given and one for each halving, each needing an endpoint that holds that block's state (one that does not is `unreadable`, `history-gap`), and one block's logs. 20. **Marks.** `latest`, `safe` and `finalized`; the final mark is `finalized`, a state the endpoint reports and not a confirmation count. A network whose endpoints refuse a mark does not take it. The answers follow `read-status.md`: an act found and settled at the mark asked for is `settled`, and `failed` other than `before-position` comes only once the search is read whole (rule 24). The reader holds the history from the position given through its log query; a reader with no log query holds the search open and answers no `failed` that rests on it. **What a record proves** 21. That the payer signed an EIP-3009 transfer authorization whose nonce is this ATR's hash (or, for an agreement, the agreement's value of it), that the token contract verified that signature when it executed the transfer, and that the hash is on chain as the nonce topic of its `AuthorizationUsed` event in the settlement transaction; not that the amount, payee, asset or timing match the ATR's content. **The read kit** 22. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no authorization nonce. - `not-found`: the read holds its single-use value. - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *A read with no means to read the single-use value* and *a read that did not read the value at the latest head*: the read reads the value at a `finalized` block and at the latest block. - *Each transfer of what moved is named by its transaction and its place*: a use moves one transfer. A transaction that consumed the payer's nonce carries an authorization the payer signed, so the read kit's case of one another account signed is made as the payer's. --- # x402-exact-eip155-erc7710-salt.md Source: https://lcp.integraledger.com/profiles/x402-exact-eip155-erc7710-salt.md **LCP profile `x402/exact/eip155/erc7710-salt`: the ATR hash as the leaf delegation's salt.** This pairing serves x402's `exact` scheme with `assetTransferMethod` `erc7710`, through MetaMask's reference DelegationManager (`0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3`, v1.3.0) on a chain where it is deployed, with H as the signed salt of the leaf delegation, so it is at coverage `full`. Every other `erc7710` payment is `x402/exact/eip155/erc7710`, which signs no H. A redemption is reusable: it consumes no single-use value and is never an agreement. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client's delegation tooling creates the delegation it gives the facilitator for this payment, the leaf of `permissionContext`, with `salt` = H as a uint256, and echoes `extensions` unchanged. 4. The server refuses a payment whose leaf salt is not an H it issued for that request and has not seen claimed. A payment through any other delegation manager is served at the unsigned level, and its record says so. 5. H is on chain as data word 5 of the leaf's `RedeemedDelegation` event from the manager in the settlement transaction. 6. ERC-7710 defines no salt; the salt is the reference implementation's signed field, and H, unique per ATR, keeps each per-payment delegation's hash unique. 7. **Which level a payment is.** `pairingOfPayment` names this level only where the payment's `delegationManager` is the reference manager, the option's chain is one of its deployments, and the leaf delegation of the permission context carries as its salt the H the payment's echoed `extensions.legalContext.info` names. A stock client's delegation through the reference manager, whose leaf salt is drawn at random, and one whose context or extension does not decode, is the unsigned level (`x402-exact-eip155-erc7710-salt.json`, `EV8.stockSalt`). This level's `bound` refuses a payment through another manager or on another chain (`x402/manager-not-reference`), a context that does not decode (`x402/permission-context-malformed`) and an empty one (`x402/delegation-empty`). **The reference** 8. `reference` gives the network, the token, H, the payer (the root delegator, the last delegation's delegator, whose account the manager executes the transfer from), the leaf delegation presented, as its EIP-712 hash (rule 13), the option's payee and the transaction a settler names, a hint. It refuses a payment whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** `status` reads through a JSON-RPC endpoint the caller supplies: receipts, blocks by mark, and `eth_getLogs`. 9. **No single-use value.** A delegation signs no bound and holds no single-use value, so the read answers no `instrument-live` and no `instrument-unused`, and is never `failed` for lapse: the search runs for as long as the caller asks, and is never read whole. 10. **Found by.** The manager's `RedeemedDelegation(rootDelegator, redeemer, delegation)` logs with the payer as root delegator (topic 1), from the block after the position given to the latest head, in pages as `x402/exact/eip155/eip3009` reads them. Each redemption whose delegation carries H as its salt is an act carrying H: of this kind where it is the leaf, its delegate the redeemer or the reference implementation's wildcard `0x0000000000000000000000000000000000000a11`, and of another kind where it is a delegation above the leaf. A `RedeemedDelegation` of that root delegator the read cannot decode holds the search. A reverted transaction holds no act. 11. **Who signed.** Every delegator of that root's redemptions in the transaction is tested as a signer of H: an act where the root delegator or any of them is the option's payee is the payee's, and settles nothing; one whose root delegator is not the payer is another account's. 12. **The account an act names, and what moved.** The token's `Transfer` from the root delegator to the option's payee names the payee's account; what moved is each `Transfer` from the root delegator in the transaction, named by the transaction and its log's place among the receipt's logs. 13. **The payment presented** is the leaf delegation whole, compared by its EIP-712 hash as the DelegationManager's `getDelegationHash` computes it (delegation-framework v1.3.0, `EncoderLib`; the types `Delegation(address delegate,address delegator,bytes32 authority,Caveat[] caveats,uint256 salt)` and `Caveat(address enforcer,bytes terms)`, `src/utils/Constants.sol`): its delegate, delegator, authority, salt and each caveat's enforcer and terms, a caveat's `args` being the redeemer's and its signature apart. A delegation's `authority` is its parent's hash, so the leaf's hash covers the chain above it. The read decodes the delegation each leaf's `RedeemedDelegation` carries whole, its data `abi.encode(Delegation)` under the bounds a permission context is decoded under, and `presented` is `yes` where its hash is the presented leaf's, `no` where it is another (a leaf with other caveats among them), and `unshown` where the read cannot decode it whole. Every redemption of one chain of delegations is that payment. 14. **Marks.** `latest`, `safe` and `finalized`; final `finalized`. The answers follow `read-status.md`. **What a record proves** 15. That the leaf delegation of the permission context redeemed for this payment, made through MetaMask's DelegationManager, carries this ATR's hash as its signed salt; that the manager verified every delegation's signature when it redeemed them; and that the leaf, with its salt, is in a `RedeemedDelegation` event in the settlement transaction. The leaf's signer is its delegator, which may be an account the paying account authorised rather than the paying account itself. This does not show that the amount, payee, asset or timing match the ATR's content. **The read kit** 16. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes nothing, and a redemption holds no single-use value. - `not-found`: the read searches for as long as the caller asks, and never reads its search whole. - `instrument-unused` and `instrument-consumed`: a delegation signs no bound and holds no single-use value. - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *Before-position is decided before any other reason* and *a transaction at the position given counts as before it*: their act carrying H lies at or below the position given, and the read cannot meet it. Its search for H starts at that position, it holds no value whose read there would show an act below it, and a leaf delegation carries H, so it is signed only after the ATR exists, and the position the caller gives is the one read before then. The cost, on a test network that restarts: a redemption landed on the restarted ledger below that position is not met, and the search runs for as long as the caller asks. - *An act carrying H under another account's signature*: the search reads the redemptions whose root delegator, `RedeemedDelegation`'s topic 1, is the payer (rule 10), and a redemption under another root carries H only in its leaf delegation's `salt`, a member the event does not index, so the search would meet one only by reading and decoding every redemption the manager records on the network, which it does not. The cost: a redemption carrying H under another account's root is named in no answer, and, being a foreign item, it would decide nothing. - Every other case whose facts give a single-use value, since the level holds none, but these ten, which the read meets all the same: *a read that did not read the value at the latest head*, *a search narrowed to one asset, payee or token*, *a value read consumed whose transaction the search has not found*, *a value unconsumed at the final mark and consumed at the latest head*, *a value whose validity passed, unconsumed at the final mark and consumed*, *an item the caller gave that the read cannot decode, beside one*, *an item the search could not decode holds a failed answer*, *at coverage full, instrument-consumed waits for the search for H*, *below-mark is answered before instrument-live* and *the validity passed with the value unconsumed and the search for H not read whole*. --- # x402-exact-eip155-erc7710.md Source: https://lcp.integraledger.com/profiles/x402-exact-eip155-erc7710.md **LCP profile `x402/exact/eip155/erc7710`: an ERC-7710 payment that signs no H, taken after its agreement.** This pairing serves x402's `exact` scheme with `assetTransferMethod` `erc7710` for every delegation that is not `x402/exact/eip155/erc7710-salt`: one through another delegation manager, one through the reference manager on a chain outside its deployments, and one through the reference manager whose leaf salt is not H, as a stock client draws it. Nothing the delegator signed holds H, so the pairing is at coverage `none` (`link` `none`): the payment is taken only after an agreement carrying H is recorded, by any agreement option the resource server declares (`agreementOn` `any`), and the read finds the payment only by the transaction a settler names. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, as in the profile `x402/exact/eip155/eip3009`, and the `erc7710` option, the same option the salt level serves. 2. The client gives the facilitator a delegation chain whose execution moves the option's amount of the option's asset from the delegator to `payTo`, encoded as x402's ERC-7710 payload (`delegationManager`, `permissionContext`, `delegator`), and echoes `extensions` unchanged. `bound` returns the echoed H (`x402/no-legal-context` where it does not decode), which only locates the sale and is no proof. `pairingOfPayment` names this level as `x402/exact/eip155/erc7710-salt`'s rule 7 states. 3. The settler simulates the redemption and calls `redeemDelegations` on the delegation manager the payload names; x402 leaves the `permissionContext` opaque, and no published facilitator settles it. 4. The resource server takes the payment only after the agreement for this H is recorded, and an agreement whose signer is the option's payee is no agreement. **The reference** 5. `reference` gives the network, the token, H as the echoed extension gives it, the payer (the payload's `delegator`), the leaf delegation presented, as its EIP-712 hash where the permission context decodes as the reference DelegationManager's (rule 8), the option's payee and the transaction a settler names. It refuses a payment whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** `status` reads through a JSON-RPC endpoint the caller supplies: a receipt, a transaction, and blocks by mark. 6. **No search.** Nothing the delegator signed names the sale, so the read is the lookup of the transaction the reference names, read whole where one is named. The read holds no single-use value: it answers no `instrument-live`, and no `failed` but `before-position`. A read of the chain alone, with no named transaction, never settles the payment. 7. **The act.** The named transaction is the payment where it succeeded and holds a `Transfer` from the payment's `delegator` to the option's `payTo`, whatever its amount; what moved is each `Transfer` from the delegator in it, named by the transaction and its log's place among the receipt's logs. The read is given the position the agreement's settlement recorded, and a transaction at or before it is `failed`, `before-position`. A `Transfer` from the delegator whose value the read cannot decode holds the read. 8. **Answers.** A named transaction that reverted is `pending`, `search-incomplete`, the delegation left usable; one that holds no transfer to the payee's account, or that the caller gives as another act under the same H (the agreement's own transaction among them), is `pending`, `not-found`, the lookup read whole having found no act of this payment. An other act the caller gives by a reference that names its transaction is that transaction's act. On `settled`, `presented` compares the leaf delegation whole, by its EIP-712 hash as `x402/exact/eip155/erc7710-salt` computes it (that profile, rule 13), with the one leaf the reference DelegationManager redeemed in the named transaction under the payment's `delegator` as root delegator, decoded whole from its `RedeemedDelegation`: `yes` where the hashes are equal, `no` where they differ, and `unshown` where the transaction holds no such redemption (another manager's), several, or one the read cannot decode, or where the reference holds no leaf. Nothing the delegator signed carries H, so the signer the answer names is the payment's `delegator`, whose `Transfer` is the act, and the party tests read that account. 9. **Marks.** `latest`, `safe` and `finalized`; final `finalized`. **What a record proves** 10. That an account signed an agreement transaction carrying this ATR's hash before this payment was taken, which shows neither that the account is the payer nor what the agreement moved; that the ATR was assembled and delivered before the payment, and that the payment echoed its hash in the legal-context extension; and that the named settlement transaction holds a transfer from the delegator to the payee. The delegation does not sign the hash, and the settlement transaction does not carry it. **The read kit** 11. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes nothing, and the level holds no single-use value. - `instrument-unused` and `instrument-consumed`: the level signs no bound and holds no single-use value. - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every receipt the read meets names its block. - Every case whose facts give a single-use value: the level holds none. --- # x402-exact-eip155-gateway-batched.md Source: https://lcp.integraledger.com/profiles/x402-exact-eip155-gateway-batched.md **LCP profile `x402/exact/eip155/gateway-batched`: Circle Gateway's batched payment, its nonce the ATR hash, taken after its agreement.** This pairing serves x402's `exact` scheme in Circle Gateway's `GatewayWalletBatched` domain, as lcp's client writes it. The payer signs an EIP-3009 `TransferWithAuthorization` under the Gateway Wallet's EIP-712 domain, with H as its nonce, and the resource server hands it to Circle Gateway, which settles it in batches from the payer's Gateway balance. No public ledger shows the authorization, so H in its nonce is a link and no proof: the pairing is at coverage `none` (`link` `h`), each payment is its own sale, and it is taken only after an agreement carrying H is recorded on the payment's own network (`agreementOn` `same-network`). Circle's client, `@circle-fin/x402-batching` 4.0.0, draws the nonce at random (`src/nonce.ts:6-12`, called at `src/client/BatchEvmScheme.ts:233`) and writes no H. **The agreement first** 1. Each payment is its own sale. Before the resource server offers this option, the buyer makes the sale's agreement on the payment's own network: an agreement option the resource server declares there, such as `x402/exact/eip155/eip3009` at its floor, paying the option's payee. 2. The resource server offers the batched option only once that agreement's transaction has been read and recorded for this H, and an agreement whose signer is the option's payee is no agreement. This pairing's payment is never itself an agreement: it is no public act. **The option** 3. The option filter takes an `exact` option on an `eip155` network whose `extra.name` is `GatewayWalletBatched`, whose `extra.assetTransferMethod` is absent or `eip3009`, and which names an asset, a `payTo`, an `amount` that is the canonical decimal string of a positive integer below 2^256 and a `maxTimeoutSeconds` that is a positive safe integer. It refuses an option whose `extra.splits` is present and not empty, since `exact` pays one payee (`x402/splits-not-carried`). 4. **The domain's version.** Circle signs under two domains, chosen by `extra.version` (`src/client/BatchEvmScheme.ts:330-338`; `src/constants.ts:12-27`): `"1"`, whose members are `name` (`GatewayWalletBatched`), `version`, `chainId` and `verifyingContract`; and `"2"`, those four and `salt`, the asset's address left-padded to 32 bytes. An option with no `extra.version` is version `"1"`, as Circle's client reads it (`src/detection.ts:46`, `:98-102`). An option of any other version is refused (`x402/option-malformed`). A version `"1"` authorization names no token, its domain having no `salt`, and Circle's client signs version `"1"` only where the option's asset is the USDC of the option's network (`isVersionAllowed`, `src/detection.ts:104-115`, called at `src/client/BatchEvmScheme.ts:222-227`; `isUsdc`, `src/config.ts:362-368`). So the filter refuses an option of version `"1"`, or with no `extra.version`, whose asset is not that network's USDC, compared without regard to case (`x402/option-malformed`): USDC is `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` on Ethereum (1), `0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85` on OP (10), `0x078D782b760474a361dDA0AF3839290b0EF57AD6` on Unichain (130), `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` on Polygon (137), `0x29219dd400f2Bf60E5a23d13Be72B486D4038894` on Sonic (146), `0x79A02482A880bCE3F13e09Da970dC34db4CD24d1` on World Chain (480), `0xb88339CB7199b77E23DB6E890353E22632Ba630f` on HyperEVM (999), `0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392` on Sei (1329), `0x3600000000000000000000000000000000000000` on Arc (5042), `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` on Base (8453), `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` on Arbitrum (42161), `0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E` on Avalanche (43114), `0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238` on Sepolia (11155111), `0x5fd84259d66Cd46123540766Be93DFE6D43130D7` on OP Sepolia (11155420), `0x31d0220469e10c4E71834a79b1f276d740d3768F` on Unichain Sepolia (1301), `0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582` on Polygon Amoy (80002), `0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51` on Sonic Testnet (14601), `0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88` on World Chain Sepolia (4801), `0x2B3370eE501B4a559b57D449569354196457D8Ab` on HyperEVM Testnet (998), `0x4fCF1784B31630811181f670Aea7A7bEF803eaED` on Sei Atlantic (1328), `0x3600000000000000000000000000000000000000` on Arc Testnet (5042002), `0x036CbD53842c5426634e7929541eC2318f3dCF7e` on Base Sepolia (84532), `0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d` on Arbitrum Sepolia (421614) and `0x5425890298aed601595a70AB815c96711a31Bc65` on Avalanche Fuji (43113), as `@circle-fin/x402-batching` 4.0.0 configures each network (`src/config.ts:121-360`). Version `"2"`, whose `salt` names the asset, is taken for any asset. 5. **The verifying contract.** `extra.verifyingContract` is the Gateway Wallet on the option's network, compared without regard to case: `0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE` on Ethereum (1), OP (10), Unichain (130), Polygon (137), Sonic (146), World Chain (480), HyperEVM (999), Sei (1329), Arc (5042), Base (8453), Arbitrum (42161) and Avalanche (43114); and `0x0077777d7EBA4688BDeF3E311b846F25870A19B9` on Sepolia (11155111), OP Sepolia (11155420), Unichain Sepolia (1301), Polygon Amoy (80002), Sonic Testnet (14601), World Chain Sepolia (4801), HyperEVM Testnet (998), Sei Atlantic (1328), Arc Testnet (5042002), Base Sepolia (84532), Arbitrum Sepolia (421614) and Avalanche Fuji (43113), as `@circle-fin/x402-batching` 4.0.0 configures each network (`src/config.ts:110-116`, `:121-360`). An option whose `extra.verifyingContract` is not the Gateway Wallet on its network, or that names a network with none, is refused (`x402/option-malformed`). 6. The filter of `x402/exact/eip155/eip3009` refuses this option, and any `exact` option whose `extra.verifyingContract` is present and not its asset (`x402/batched-not-eip3009`): signed under the token's domain it would be valid nowhere. So no `exact` option on an `eip155` network is served by both pairings. **What the payer signs** 7. The client fetches the ATR's link, computes SHA-256 over the bytes received, and compares the result with H; on a mismatch it does not sign. On a match it signs `TransferWithAuthorization{from, to, value, validAfter, validBefore, nonce}` (`from` `address`, `to` `address`, `value` `uint256`, `validAfter` `uint256`, `validBefore` `uint256`, `nonce` `bytes32`, in that order; `src/client/BatchEvmScheme.ts:31-40`) under the domain of rule 4, with `to` the option's `payTo`, `value` its `amount`, and `nonce` = H, all of H. It echoes `extensions` unchanged. 8. **The validity.** `validAfter` is the signing time less 600 seconds. `validBefore` is the signing time plus the greater of the option's `maxTimeoutSeconds` and the served minimum plus 100 seconds, where the served minimum is the `minValiditySeconds` that Circle Gateway's `/supported` serves for the network and 100 seconds is Circle's own margin for clock differences and latency (`src/constants.ts:34-49`). Circle's client signs the same window from its own constants, 604,800 seconds and the same margin (`src/client/BatchEvmScheme.ts:234-247`), and Circle's seller offers `maxTimeoutSeconds` 604,900 (`src/server/gatewayMiddleware.ts:121`). lcp calls no network, so the caller reads the served minimum and gives it to `build`, which refuses a choice that gives none, or one that is not a positive safe integer (`x402/option-malformed`). Circle refuses an authorization whose validity is shorter than it serves (`authorization_validity_too_short`). 9. **The payer** is an externally owned account: by Circle's Gateway documentation, Circle takes a batched payment's signature from no contract account. The signature is 65 bytes, `r ‖ s ‖ v`. **The payment presented** 10. The payment is x402's `PaymentPayload`: the option as `accepted`, and `payload` `{signature, authorization}`, the authorization's members strings, as Circle's client writes them (`src/client/BatchEvmScheme.ts:240-262`). 11. **`bound`** returns the authorization's nonce as H. Where the payment echoes an `extensions.legalContext` that decodes, its H must be the nonce, else `x402/signed-not-bound`. `bound` verifies no signature; Circle verifies it when it takes the authorization. 12. **`authorizer`** gives the account whose signature authorises the payment: the address recovered, by secp256k1 public-key recovery, from the 65-byte signature over the EIP-712 digest of the presented authorization in the domain the presented option names (rule 4). It gives that account whether or not it is the authorization's `from`. A signature that is not 65 bytes with a low `s` and a `v` of 27, 28, 0 or 1 recovers no account and is `x402/signature-malformed`; `authorizer` refuses no signature for the account it recovers. Its holder compares that account with the authorization's `from` and with the agreement's signer: the signature is the payer's only where the account is the `from`, and the payer and the agreement's signer are one account only where it is the `from` and the agreement's signer both. 13. **`broadcaster`** answers `payee`: the resource server, or a facilitator acting for it, hands the authorization to Circle Gateway, and the payer sends nothing. **What the resource server checks, before it calls Circle** 14. The agreement for this H is recorded on the payment's network (rule 2); `bound`'s H is an H it issued for this request and has not seen used; and `authorizer`'s account is recorded beside the authorization's `from` and the agreement's signer (rule 12). **What a settler checks** 15. Circle Gateway settles: the resource server calls its `/v1/x402/verify` and `/v1/x402/settle`, as `@circle-fin/x402-batching` 4.0.0's `BatchFacilitatorClient` does. Circle's answer of success to `settle` names a transfer it has accepted, which can still end `failed`; its transfers move through `received`, `batched`, `confirmed`, `completed` and `failed`. The resource server takes the payment as paid only once Circle's transfers API reads the transfer `completed`. Where Circle answers a settle `nonce_already_used`, a retry after a lost answer or another holder's submission, the resource server looks the nonce up (`GET /v1/x402/transfers?nonce=`) and takes the transfer whose payer, payee and amount are those of the payment it holds, as paid once it reads `completed`, and otherwise as refused. A run on Base Sepolia showed two members of Circle's API that x402 does not fix. Circle's `/v1/x402/verify` refuses a payment whose `resource` lacks `description` or `mimeType` (`Invalid request: paymentPayload.resource.description: Required, paymentPayload.resource.mimeType: Required`), which x402 2.31.0's `ResourceInfo` makes optional; the payment carries the challenge's `resource` unchanged, so the resource server states both. The transfers API names a transfer's payer `fromAddress` and its payee `toAddress`, in lowercase, beside `amount`, `nonce`, `status` and the batch's `txHash`. **The single-use value and the instrument** 16. The single-use value is the nonce, H, which Circle Gateway keeps for each payer. The instrument is the network, the payer and the nonce. Whether one authorization can be taken more than once is not shown by any vector or run, so the pairing's `nonce` is `unshown`. **H is a link, never proof** 17. No chain shows the authorization: Circle settles in batches from the payer's Gateway balance, and a batch's transaction carries each depositor's net change and no payment's nonce (`src/modules/wallet/Batches.sol:119-152` at `circlefin/evm-gateway-contracts@c21d2d2e`). Circle's transfers API shows each payment by its nonce, with no key (`GET /v1/x402/transfers?nonce=`), so every H used this way is listed there in public beside the payer's and the payee's addresses and the amount: Circle's statement, which is no ledger's and no proof. The deposit into the payer's Gateway balance names no payee, carries no H, and is no part of the sale's proof. 18. **No read.** Nothing public shows the payment, so the pairing has no `reference`, no `status` and no `recover`, and the agreement's transaction never stands for the payment. The payment is settled by the resource server's own report of Circle's transfer. **What a record proves** 19. That an account signed an agreement transaction carrying this ATR's hash on the payment's network before this payment was reported, which shows neither that the account is the payer nor when the payment was taken; that the payment presented was a Circle Gateway batched authorization whose nonce is this ATR's hash, under the Gateway Wallet's domain; and that the resource server reported it paid. No public ledger records the payment. Not that the amount, payee, asset or timing match the ATR's content. **The agreement** 20. This pairing is no agreement option: no public ledger shows its payment, so it can never stand for the sale's agreement, which is a separate payment of an agreement option on the same network (rules 1 and 2), with that option's floor, fee and test of success. **The read kit** 21. The pairing has no read, so it has no read-kit form and declares no case. **Vectors** 22. `x402-exact-eip155-gateway-batched.json`, whose oracle is Circle's own client, `@circle-fin/x402-batching` 4.0.0, with viem 2.57.4's `hashTypedData` as the independent EIP-712 check. `S`: the typed data, the domain and the signature Circle's signing step (`src/client/BatchEvmScheme.ts:317-355`) gives an authorization with nonce H, under version `"1"` and version `"2"` on Base Sepolia and version `"2"` on Base, signed with the published Anvil development key #0; `build` gives the same typed data, its `complete` the same payment, `bound` H and `authorizer` the payer. `W`: the window Circle's `createPaymentPayload` signs with its clock fixed, for a `maxTimeoutSeconds` below, at and above 604,900, which `build` signs given the served minimum 604,800. `wallets`: Circle's client's network table, each network's Gateway Wallet and USDC, against rules 4 and 5, with each network's version `"1"` option signed by Circle's `createPaymentPayload` for its USDC and refused for another asset, which the filter refuses too. `signer`: the account `authorizer` gives where it is the authorization's `from` and the agreement's signer, the `from` with another account as the agreement's signer, and not the `from`, the other account's signature made by Circle's signing step with the published Anvil development key #1; viem's `recoverTypedDataAddress` gives the account each `authorizer` row whose authorization or signature was changed after signing recovers (`check`). The refusal rows, each a good input with one member changed and its code: `filter` (with Circle's `supportsBatching` beside each), `eip3009Filter`, `build`, `bound`, `authorizer` and `boundAccepted`. No outside oracle states lcp's codes, and each refusal row starts from the outputs above. **Costs** 23. The signed authorization stays payable through Circle for its whole validity, and nothing cancels it: no module of the Gateway Wallet has a call that cancels an authorization (`src/modules/wallet/` at `circlefin/evm-gateway-contracts@c21d2d2e`), so the payer cannot make it lapse sooner. 24. Every H paid this way is listed in public by Circle's transfers API beside the payer's and the payee's addresses and the amount. 25. A payment Circle refuses, or fails after its answer of success, is not paid, and only Circle's transfers API shows which: the resource server reports what Circle's transfer shows, and no ledger corrects a report made before the transfer reads `completed`. 26. A payee paid this way holds a balance in the Gateway Wallet under its address, not tokens in its account. It takes them out through Circle by a burn intent signed for that balance, whose fee covers the burn's gas and Circle's transfer fee, or without Circle by the wallet's own `initiateWithdrawal` and, `withdrawalDelay` blocks later, `withdraw`, each sent from the payee's address (`src/modules/wallet/Withdrawals.sol:76-117` at `circlefin/evm-gateway-contracts@c21d2d2e`), so the payee is an account that can sign or send them. A batch moves no token, changing balances inside the Gateway Wallet (`src/modules/wallet/Batches.sol:119-152`, `:192-241`), so a token's blocklist does not screen a batched payment, which Circle's service alone screens. 27. The filter takes the Gateway Wallet and USDC of each network Circle's client 4.0.0 configures (rules 4 and 5), and refuses an option on any other network, and a version `"1"` option for any other asset, until the table names it. --- # x402-exact-eip155-permit2.md Source: https://lcp.integraledger.com/profiles/x402-exact-eip155-permit2.md **LCP profile `x402/exact/eip155/permit2`: the ATR hash as the Permit2 nonce.** This pairing serves x402's `exact` scheme on an EVM chain through Permit2 and x402's exact Permit2 proxy, as lcp's client writes it. H is the Permit2 nonce the payer signs, all of H, so the pairing is at coverage `full`. The stock client draws the nonce at random and writes no H. Its option is an `exact` option on an `eip155` network whose `extra.assetTransferMethod` is `permit2`, as x402's exact scheme names the Permit2 method. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs the scheme's `PermitWitnessTransferFrom` with `nonce` = H as a uint256, `spender` x402's exact Permit2 proxy (`0x402085c248EeA27D92E8b30b2C58ed07f9E20001`), `deadline` the signing time plus the option's `maxTimeoutSeconds`, and the witness `{to: payTo, validAfter: 0}`, and echoes `extensions` unchanged. The option filter refuses an option whose `extra.splits` is present and not empty, since `exact` pays one payee (`x402/splits-not-carried`). `bound` reads the nonce in decimal or as `0x` and 64 hex digits, and refuses another spender (`x402/spender-not-proxy`) and a nonce in neither form (`x402/nonce-malformed`). 4. The server refuses a payment whose nonce is not an H it issued for that request and has not seen claimed. 5. H is in the settlement transaction's calldata; Permit2 records its use as bit `H & 0xff` of `nonceBitmap(owner, H >> 8)`, one bitmap per owner for every token, and no event carries it: x402's Permit2 proxies emit `Settled()` and `SettledWithPermit()`, which carry nothing, and Permit2's signature transfer emits no event of its own. 6. x402 states no Permit2 nonce derivation. H is unpredictable before issue and unique per ATR, so Permit2's single use of (owner, nonce) holds. A client that draws a random nonce is refused by rule 4. **The agreement** 7. The agreement's nonce is the agreement's own value as a uint256: SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` (hex `6c63702d61677265656d656e742d7631`) followed by H's 32 bytes (`read-status.md`, rule 1). For H = SHA-256("abc") the value is `0x424524a7e791dcf7c2e6980bc94582ae2b436d6184873563d03539e97d36a434`, the nonce `29974813443532012023066257594749077332739347346832184257714923838385434305588` (`x402-exact-eip155-permit2.json`, `AG`, computed with GNU coreutils `sha256sum` and `openssl dgst -sha256`). `build(choice, H, "agreement")` signs it; `bound` given the act `agreement` and H returns H for that nonce and refuses any other (`x402/nonce-not-agreement`), and `reference` holds the same; on the act `agreement`, `status` reads that value where this profile reads H. A reference is keyed on H and serves both acts, `status` taking the act's value from H; an agreement's own payment is given to `bound` and `reference` with the act and H, since given neither they take its nonce, the agreement's value, as H. 8. The agreement's floor is 1 base unit: no run has yet shown x402's exact Permit2 proxy taking or refusing a zero amount, so no zero is offered. The party that submits pays the fee; the buyer's one-time approval of Permit2 is the buyer's unless x402's gas-sponsoring extension covers it. It succeeded where the receipt's `status` is 1 and the transaction holds the payer's `Transfer` paired with the proxy call carrying the agreement's value, as rule 11 counts it. **The reference** 9. `reference` gives the network, the asset, the payer (the permit's owner), the signed `deadline`, H, the members of the payment presented (the permit's `token`, `amount`, `nonce` and `deadline`, its `spender`, the owner, and the witness's `to` and `validAfter`), the option's payee, and the transaction a settler names, a hint. It refuses a payment whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** `status` reads through a JSON-RPC endpoint the caller supplies: receipts, transactions, `eth_call` at a block, blocks by mark with their timestamps, and `eth_getLogs`; where the node no longer holds the Permit2 state of a block the read needs, an archive endpoint, and without one the answer is `unreadable`, `history-gap`. It compares no amount, asset or time with the option. 10. **The single-use value** is the payer's Permit2 bit for the nonce (on an agreement, its value), read by `nonceBitmap(payer, nonce >> 8)` at the `finalized` block and at the latest block. The nonce is H, and Permit2 keeps one bitmap per owner for every token, so the bit is H's own carrier: its two reads are the search for H, read whole (`read-status.md`, rule 26). Where both read it unset, the search is whole with no log read. 11. **Found by.** Where the bit is read set, the read finds the act that set it: every contract's `Transfer` from the payer, and Permit2's `UnorderedNonceInvalidation` with the payer as owner, from the block after the position given to the latest head, in pages as `x402/exact/eip155/eip3009` reads them. A hit counts only where its transaction's input carries the nonce in a call of an x402 Permit2 proxy, found at any byte offset (`settle`, `0x13cd3b53`, and `settleWithPermit`, `0xfa340378`, on the exact proxy; `0xff11e7b4` and `0x016c1748` on the `upto` proxy), whose words name the permit's token, amount, nonce and deadline, the owner, and the witness; where the receipt holds a `Transfer` of that token from the owner to the witness's `to` of the amount the proxy moves, the permit's whole `amount`; and where the owner's bit for the nonce is set at the receipt's block and unset at the block before, since the bitmap shows only that the nonce was used in a block. Each call is tied to its own transfer, one each. One call is taken by owner and nonce: a copy of a call in the same input is that call, and a transaction holding two calls of one owner over one nonce that differ is not read as the act, the search holding on it, as `recover` refuses it (`evm/ambiguous`). An invalidation consumes the nonce where its word and mask cover it and its owner is the payer, an act of another kind that names no account. A reverted transaction's call is a failed result that consumed nothing. A call through the `upto` proxy is an act of another kind. Another owner's proxy call or nonce invalidation over H, and the payer's over the other act's value, in a transaction the search finds, is an act carrying H that consumed nothing, named as a foreign item. 12. **The account an act names, and what moved.** The paired `Transfer`'s `to`, compared with the option's payee; what moved is that transfer, named by the transaction and its log's place among the receipt's logs. The signer of H is the permit's owner, never the transaction's sender. 13. **The payment presented** is what the payer signed, its signature apart: the permit's `token`, `amount`, `nonce` and `deadline`, its spender (the proxy the call's selector names), the owner, and the witness's `to` and `validAfter`. Where the proxy call is the transaction's own (its `to` the proxy, the call at the input's start), its decoded arguments are compared as they stand. Where it is wrapped in another call, the logs and the payer's bit show the token, the owner, `to`, `amount` and the nonce, since the exact proxy moves the permit's whole amount to the witness's `to`; so where the transaction holds exactly one `Transfer` from the payer on the token and exactly one proxy call of the payer's, a wrapped call reads `yes` where those five equal the presented permit's and `no` where one differs, and otherwise `unshown`. 14. **Lapse.** Permit2 refuses a permit once the block's time is past its `deadline` (`SignatureTransfer.sol`, `if (block.timestamp > permit.deadline) revert SignatureExpired`). The bit unset at a `finalized` block whose timestamp is past `deadline`, and at the latest block, is `failed`, `instrument-unused`; before that `pending`, `instrument-live`. **Below the position given.** Where the bit reads set and the search has found no transaction that set it, the read reads the bit at the position given. Set there, it was set at or before that position: the read finds the first block at which it reads set, halving the range from the network's first block, reads in that block every contract's `Transfer` logs from the payer and Permit2's `UnorderedNonceInvalidation` logs of the payer, and counts each hit as rule 11 does. One that set the bit answers `failed`, `before-position`, naming it; none found answers `pending`, `search-incomplete`, since no search after the position given that met none shows a transaction at or before it. The cost: one read of the bit at the position given and one for each halving, each needing an endpoint that holds that block's state (one that does not is `unreadable`, `history-gap`), and one block's logs. 15. **Marks.** `latest`, `safe` and `finalized`; final `finalized`. The answers follow `read-status.md`. **What a record proves** 16. That the payer signed a Permit2 witness transfer whose nonce is this ATR's hash (or, for an agreement, the agreement's value of it), with x402's exact proxy as spender and the payee in the witness; that Permit2 verified the signature when the proxy executed the transfer; and that the hash is in the settlement transaction's calldata as the Permit2 nonce, no event carrying it; not that the amount, payee, asset or timing match the ATR's content. **The read kit** 17. Declared inapplicable to the read kit, each with its reason: - `transaction-failed`, and the cases opening *a failed result that consumed the value*: a reverted transaction consumes no Permit2 bit. - `not-found`: the read holds its single-use value. - *An act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*: every log and receipt the read meets names its block. - *A read with no means to read the single-use value*, *search-incomplete is answered before not-found* and *a read that did not read the value at the latest head*: the read reads the value at a `finalized` block and at the latest block, and those reads are the search, read whole. - *Each transfer of what moved is named by its transaction and its place*: the proxy moves one transfer. - *A search narrowed to one asset, payee or token*, *the validity passed with the value unconsumed and the search for H not read whole*, *instrument-live is answered before search-incomplete*, *a search that met an item it cannot decode*, *the answer names every item the search could not decode*, *an item the search could not decode holds a failed answer*, *the search's range left to read and an item it could not decode*, *an item the caller gave by its transaction holds no search*, *an item the caller gave that the read cannot decode, beside one* and *instrument-live is answered before an item the search could not decode*: the bit is H's own carrier, so its reads at a `finalized` block and at the latest block are the search, read whole, and meet no item the read cannot decode (rule 10). --- # x402-exact-hedera.md Source: https://lcp.integraledger.com/profiles/x402-exact-hedera.md **LCP profile `x402/exact/hedera`: the ATR hash as the transaction memo.** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H being the SHA-256 of the ATR's exact bytes as `0x` lowercase hex, and L an `https` URL serving those bytes. The option's `network` is `hedera:mainnet`, `hedera:testnet`, `hedera:previewnet` or `hedera:devnet`. 2. The client fetches L, hashes the bytes received, and compares with H as 32 decoded bytes; on a mismatch it does not sign. 3. On a match, the client signs one `TransactionBody` whose `memo` is H's LCP string, `lcp:sha256:0x` and the 64 lowercase hex digits of H, 77 bytes of the 100 a memo holds, and echoes `extensions` unchanged. The body's `transactionID` names the option's `extra.feePayer` and a valid start the buyer chooses; its `cryptoTransfer` debits the buyer and credits the option's `payTo` by the option's `amount`, in HBAR where the option's `asset` is `0.0.0` and otherwise in the token the `asset` names. The stock x402 client writes no memo, and its payment is refused by rule 4. 4. The server refuses, before anything is sent, a payment whose memo is not byte for byte H's LCP string: an empty memo `hedera/no-memo`, and any other, one with an uppercase hex digit among them, `hedera/memo-not-lcp`, since the read of rule 11 settles only on that exact string; and an H it issued for that request and has not seen claimed. It refuses also a body whose valid start is later than the time of the check, `hedera/valid-start-future` (rule 7). 5. H is public in the transaction record's memo, readable by transaction id from any Mirror Node. 6. A `TransactionList`, the bodies the SDK freezes for several nodes, is taken only where every body equals the first in every field but `nodeAccountID`; otherwise it is refused `hedera/list-inconsistent`. Every body of a list taken is the same payment, and a settler submits any one of them to the node it names. 7. **Life.** The chain holds a body's `transactionValidDuration` to its `transaction.maxValidDuration`, 180 seconds, and takes no valid start later than its consensus time. A body whose valid duration is above 180 seconds is refused `hedera/valid-duration`, and one whose valid start is later than the time of the check `hedera/valid-start-future`: by the client's `build` at the time of the call, and by the server's `bound` and `reference` at the time each runs. A signed payment stays payable for its valid duration, counted from its valid start. 8. **Who pays the fee, and who is the buyer.** The account the transaction id names, the option's `extra.feePayer`, is the fee payer: the seller's settler, which adds its signature and submits the buyer's bytes unchanged. The buyer is the one account the signed body debits, and never the fee payer: a body that debits the fee payer is refused `hedera/payer-not-buyer`, and one that is no crypto transfer, or debits no account or more than one, `hedera/tx-malformed`. The body lists the buyer's debit and the payee's credit alone, so the form has no split. A transaction id is written `shard.realm.num@seconds.nanos`, as the SDK spells it, and `shard.realm.num-seconds-nanos`, the nanoseconds in nine digits, as the Mirror Node spells it, in whose spelling every read key is. 9. **The reference** a read takes holds, from the body presented: the network; the transaction id, the payment's single-use value, since the chain takes one transaction under an id and only the fee payer's key can land another body under it; the valid start, to the nanosecond, and the valid duration; the memo; the debited account, the payer, which is the signer the read names and the search's key; and the node of each body the list holds, the maximum fee and the transfer rows, the rest of the payment presented (rule 12). From the option the payment answers it takes the `payTo`, the payee, the key of the read's two party tests. A payment whose `accepted` is not the option the reference is given, compared by its RFC 8785 form, is refused `x402/accepted-not-option`. The reference holds no member for comparing an amount or an asset with the option. 10. **Succeeded** means that the Mirror Node's entry for the transaction id with `nonce` 0 and `scheduled` false has `result` `SUCCESS`; its `memo_base64` decodes to exactly H's LCP string; and its `transfers` or `token_transfers` debit the buyer with `is_approval` false, what they credit recorded as observed. HBAR rows are read with each account's `staking_reward_transfers` row taken out and `charged_tx_fee` added back to the account the transaction id names, since `transfers` holds each account's total change, fee and reward included. 11. **The read** (`status`, under the profile `read-status`) goes through the Mirror Node's REST interface. Its one mark is `consensus`, a consensus result, which is final; positions are consensus timestamps. It reads the mirror's latest consensus timestamp first, the end of its newest block, and then the entries under the transaction id, so that an entry the mirror ingests between the two reads is seen. An entry under the id decides unless it is a `DUPLICATE_TRANSACTION`, a copy sent through another node, or an `INVALID_NODE_ACCOUNT` or `INVALID_PAYER_SIGNATURE`, a node's failure after which a valid transaction under the id is still handled. A deciding entry consumed the id: where it succeeded, carries H and is the buyer's own act (rule 14), it is the act asked about, for the act `payment` only where it also credits the payee; any other result under the id is the act's own failed result, which moved nothing and names the account the body presented credits, by this rule and not by a read, since its rows show the fee alone and the id names the fee payer, whose key could land another body under it, `transaction-failed` where that account is the payee; and a `SUCCESS` that is not the act is `instrument-consumed`, with its reason where it carries H. With no deciding entry, and the mirror holding records back to the valid start, the id is unconsumed: `pending`, `instrument-live`, until the valid start plus the valid duration is strictly before the timestamp read first, and `instrument-unused` after it. A precheck refusal reaches no record and consumes nothing. Every `failed` but `before-position` waits for the search of rule 13, read whole. Records that begin after the valid start, or after the position the search starts from, answer `unreadable`, `history-gap`. 12. **The payment presented.** A `settled` answer states `presented`: `yes` where every member the mirror shows of the body that landed equals the body presented, `no` where one differs, `unshown` where the mirror does not show one. The mirror's `bytes`, which would carry the signed transaction whole, is nullable, so the members are compared one by one: the transaction id with its account and valid start (`transaction_id`, `valid_start_timestamp`); the memo (`memo_base64`); the valid duration (`valid_duration_seconds`); the maximum fee (`max_fee`); the node (`node`), any the presented list names; and the transfer rows, each the body lists equal to a row of the entry and no other row left: the HBAR rows read as rule 10 reads them, then the rows of the node the landed entry names, of the network's fee account `0.0.98`, of the staking and node reward accounts `0.0.800` and `0.0.801` and of the fee collection account `0.0.802`, whatever their sign, and every row that then nets to zero, set aside, since the charged fee is spread over those accounts; and the token rows. What the mirror does not show of a body is not compared, so a landed body that differs from the presented one only there reads `yes`; a body that itself lists the node or one of those accounts, or a token transfer that assessed a custom fee (`assessed_custom_fees`), reads `unshown`. An act settled under another transaction id reads `no`. The comparison decides no answer. 13. **The search for H.** A buyer that signs again under another transaction id can land a body that carries H while the presented one lapses or fails, so every `failed` but `before-position` comes only once a search for H is read whole and finds no act asked about. It is made once the validity has passed with the id unconsumed, or once a deciding entry under the id has consumed it, and reads the Mirror Node's list of the payer's transactions, `GET /api/v1/transactions` with `account.id` the debited account the reference names, `timestamp` `gt:` the position the transaction must come after, or the search position an earlier answer returned, and `lte:` the timestamp read first, `order` `asc` and `limit` 100, page by page, at most 8 pages a read, each next page asked `gt:` the consensus timestamp of the last entry read, which is the page the answer's `links.next` names, no two transactions sharing a consensus timestamp. No query selects by memo, so every entry is read and its `memo_base64` compared with H's string byte for byte. An entry that decides as an entry under the id does and is the act asked about is answered `settled`, under whatever transaction id; any other entry that carries H decides nothing and stops no search. The search is read whole where every page up to that timestamp was read, the last naming no `links.next`, and the mirror holds records back to its start. A page left when the read's bound ends, or a page the mirror refuses, leaves it not whole: `pending`, `search-incomplete`, with the search's position, the consensus timestamp of the last entry read, from which the next read resumes. An entry the read cannot decode is named by its transaction id and holds the search one nanosecond before its consensus timestamp, the read going on through the rest of its range. Three facts the search rests on are not yet shown by a run: that `account.id` selects a transaction in which the account appears only in `token_transfers`, as the buyer does in an HTS transfer whose fee the settler paid; that a mirror balanced over several replicas answers every page of one search from one view; and that a mirror holding a block holds every transaction in it. Until a run shows the three, the search proves no absence, read to its last page or not: no reader and no caller states them shown, and the read answers `pending`, `search-incomplete`, at the search's position, where it would answer `failed`; the pairing's vectors hold that answer. 14. **The parties, and what moved.** An entry's signer is the one account its rows debit, rule 10's adjustments made, or, where they debit none, the account its transaction id names. It is the buyer's own act where that one account is the debited account the reference names and its debit spends no allowance (`is_approval` false); an act whose debited accounts include the option's payee is the payee's own signature and no act of the payer's, a foreign item `payee-signed` on either act. It names the payee's account where its rows credit the payee, in any asset and any amount; it names another account where they credit another, and none where they credit only the node and the fee accounts. An entry of another transaction type than `CRYPTOTRANSFER` that carries H is an act of another kind. What moved names each credit by the transaction id and its place, `/`, the asset, `0.0.0` or the token id, and the credited account, since the mirror holds each account's total change in an asset as one row, the node's and the fee accounts' rows apart; the asset and the amount are recorded and compared with nothing. An entry that carries H, succeeded and is not the act asked about is a foreign item, with the first reason of `read-status`'s list that holds; an entry that carries H and failed is none. 15. **The transfer-executor**, `x402/exact/hedera/transfer-executor`, is at coverage `none`: nothing the payer signs carries H, which reaches the payer only in the option's extension. Its read takes the transaction the facilitator names as the act, in its merged consensus record, the user entry and its child entries, read as rule 10 reads them, and makes no search. Its signer is the one account the record debits: the payer where its digest is the one `reference` recorded, the payee where it is the option's payee. It pays where it credits the payee. Its `reference` refuses a payment whose `accepted` is not the option it is given, `x402/accepted-not-option`, as rule 9 states. The named transaction id is single-use: a deciding entry under it consumed it, a failed result, the act's own, answering `transaction-failed` and naming the payee by this rule and not by a read, since the read does not decode the authorization the payer signed, and a success that is not the payer's payment to the payee `instrument-consumed`; with none, it is `instrument-live` until its valid start plus the chain's `transaction.maxValidDuration`, 180 seconds, is strictly before the mirror's latest consensus timestamp, and `instrument-unused` after it, the mirror holding records back to that valid start. A `settled` answer states `presented` `unshown`: the read decodes no authorization the payer signed, so it shows no member of the payment presented. The form waits on an executor contract a payer uses with published source and a client that builds the form, and is not offered until then. 16. **The agreement.** A payment of this pairing can itself be the agreement, held by its binding alone: its smallest amount is 1 tinybar, or 1 unit of an HTS token, since a transfer of zero debits no account and needs no signature of the buyer's; its fee is paid by the seller's settler, the account the transaction id names; it must succeed, as rule 10 states, and no failed result of rule 11 is an agreement; and a body the payee's own account signed is no agreement, whatever it moved. An agreement is held to no account. 17. **The read kit.** The cases of `read-status.json` run through this pairing's read and the transfer-executor's; a case is skipped only where this profile states that it cannot arise, and these are its statements. On both: every case that answers `below-mark`, since every record the mirror serves is final. On this pairing: every case that answers `not-found`, since the read holds the single-use value, the transaction id, and reads the entries under it, an id with no entry that decides being `pending`, `instrument-live`, until the lapse; *an act read at the finality asked for, below the final mark*, *a value unconsumed at the final mark and consumed at the latest head*, *a value whose validity passed, unconsumed at the final mark and consumed at the latest head* and *a read that did not read the value at the latest head*, since the mirror's one mark is its latest consensus timestamp, read first, at which the id is read; *a value read consumed whose transaction the search has not found*, since the id is read consumed only by an entry under it, which names the transaction; *a read with no means to read the single-use value*, since the read holds the id; *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since a transfer of zero debits no account and the buyer is the account the body debits; *the settled act's answer names every foreign item*, *instrument-live is answered before search-incomplete* and *instrument-live is answered before an item the search could not decode*, since the search is made only before a `failed`; *an act the read cannot place against the position given*, its three cases, and *an item the search could not decode that gives no position*, since every entry carries its consensus timestamp; and, while the search proves no absence (rule 13), every case at coverage `full` that answers `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the search's gate holds, the vectors holding the read's answer, `search-incomplete`. A second act of the payer is run, made under its own transaction id. On the transfer-executor, whose read takes the transaction the settler names by its id and makes no search: every case that answers `not-found`, and *at coverage none, a lookup read whole beside an item the search could not decode*. 18. **The payee's preconditions,** which no validation reads: the account exists; for an HTS asset it is associated with the token or holds a free automatic association; it does not require a receiver's signature, since a credited account with `receiverSigRequired` set must sign the transaction; and for an HTS token it is granted KYC where the token has a KYC key, and is not frozen for the token. A payment that fails for want of one consumed its transaction id and is answered `transaction-failed`. 19. **What a record proves**, as each pairing's `data.proves` states it; a record fills in the values set in angle brackets: - `x402/exact/hedera`: The payer's own signed act carries this ATR's hash: a Hedera crypto transfer whose memo is the hash's LCP string reached consensus with SUCCESS, debiting the payer, the one account its rows debit, and paid the account it credits, recorded with the asset and amount it moved. The memo is in the public transaction record, readable by transaction id. It compares no amount, asset or time with the ATR's terms. - `x402/exact/hedera/transfer-executor`: Before this payment was taken, an account signed an agreement carrying this ATR's hash on ``, recorded in ``; this does not show that the account is the payer. The payment is an x402 transferExecutor payment on Hedera: the payer's executor contract moved the funds under an authorization the seller did not read, and the facilitator submitted the transaction. The hash reached the payer only in the challenge's extension, and nothing the payer signed carries it. The read of the named transaction's merged consensus record found that its one debited account is the payer recorded when the payment was presented, and that it credited the payee. It compares no amount, asset or time with the ATR's terms. --- # x402-exact-lnbtc-payment-hash.md Source: https://lcp.integraledger.com/profiles/x402-exact-lnbtc-payment-hash.md **LCP profile `x402/exact/lnbtc/payment-hash`: an invoice for a payment hash the ATR commits, issued after the agreement.** This pairing is x402's `exact` scheme on Bitcoin Lightning (`lnbtc`), with the `bolt11` asset transfer method and the `upfront` payment flow, as x402 specifies it (`specs/schemes/exact/scheme_exact_lnbtc.md` in `x402-foundation/x402` at `88b66dd4`, cited below as *the scheme*), on `lnbtc:000000000019d6689c085ae165831e93` (mainnet) and `lnbtc:000000000933ea01ad0ee984209779ba` (testnet). The buyer signs nothing: its node pays an invoice the seller's node signed, and no public ledger shows the payment. So the pairing is at coverage `none`, with no link (`link` `none`): the ATR commits the invoice's payment hash, and the buyer makes the sale's agreement on another network first, by an agreement option the resource server offers. The ids `x402/exact/lnbtc` and `x402/exact/lnbtc/invoice-named` are retired and never reused. **The offer, and what the ATR commits** 1. **The secret.** For each sale the seller's own software draws a 32-byte secret with cryptographically secure randomness, once, so that issuing the same sale again finds the same hash, and keeps it. The payment hash is SHA-256 of the secret. The software never logs the secret and never puts it in the ATR, a response or anything it sends to another party; it gives it to its own node only when the invoice is issued. 2. **The offer at issue** is an x402 v2 option with the scheme's members (`scheme` `exact`, the network, `amount` in millisatoshis, `asset` `BTC`, `payTo` the seller node's compressed secp256k1 key as 66 lowercase hex digits, `maxTimeoutSeconds`, and in `extra` `paymentFlow` `upfront`, `assetTransferMethod` absent or `bolt11`, `requestHash`, `requestBindingProfile` and `requestBindingParams`) and one more `extra` member, `paymentHash`: the payment hash as 64 lowercase hex digits. It carries no `extra.invoice`. `advertiseBeforeCarrier` checks it and places the legal context: it refuses an offer that carries `extra.invoice` (`ln/invoice-in-offer`) or lacks a `paymentHash` of that form (`ln/payment-hash-required`), and makes rule 6's checks of the option's own members. 3. **What H commits.** The ATR's `x402` slot holds the option as `unplaced` gives it, without `extra.invoice`, so H commits `extra.paymentHash`, and with it the one invoice whose `p` field is that hash. `paymentHash` is a member the resource server declares, so the scheme's own rule holds it equal between the option a payment accepted and the requirements the resource server checks it against (the scheme, Facilitator Validation, check 3). 4. **The first response** carries H, the ATR's link, the agreement's URL and the sale's return value (`legal-context-return.md`, rule 5), and no option of this pairing: a stock client finds nothing to pay. **The invoice, after the agreement** 5. **One invoice, sent to the sale's own client.** Only once the sale's agreement is recorded does the seller's node issue one invoice for the committed hash, from the kept secret: its `p` the payment hash, its `h` the request hash, no `d`, its amount the option's `amount`, its expiry the option's `maxTimeoutSeconds`, signed by the key in `payTo`. The resource server sends the option with that invoice in `extra.invoice` only in answer to a return whose `Legal-Context` header names the sale's H and carries the sale's return value, and to such a return again the same invoice; it sends the invoice to no other request. `advertise` checks the option with its invoice by rule 6 and places the legal context. Every node on the payment's route learns the preimage, and H is public once the agreement lands; the return value, which no route node holds, is what keeps a route node from obtaining the sale's invoice. 6. **The checks of the option and its invoice** that the option filter makes, and so `read`, `advertise`, `build`, `bound` and `reference`, in this order: a. the option's own members: `scheme` `exact` on one of the two networks, `asset` `BTC`, `amount` a positive integer in canonical decimal of at most 78 digits, `maxTimeoutSeconds` a positive safe integer, `payTo` a valid compressed secp256k1 public key as 66 lowercase hex digits, `extra.paymentFlow` `upfront`, `extra.assetTransferMethod` absent or `bolt11`, else `x402/option-malformed`; b. `extra.paymentHash` 64 lowercase hex digits, else `ln/payment-hash-required`; c. `extra.requestHash` 64 lowercase hex digits, else `ln/request-hash-mismatch`; `extra.requestBindingProfile` `http:1` or `mcp:1` and `extra.requestBindingParams` exactly the parameters the scheme's Request Binding gives that profile, in their stated form, else `ln/request-binding-malformed`; d. `extra.invoice` a string that decodes strictly by BOLT 11 (`11-payment-encoding.md` at `19146282`): a valid checksum, a prefix the decoder knows, an integral millisatoshi amount, exactly one `p` and exactly one `s`, each 52 words, an `n` where present of 53 words, and a signature that verifies, by the `n` key where the invoice has one, a low `s` required, and otherwise by public-key recovery, either `s` accepted; else `ln/invoice-malformed` (`ln/invoice-too-large` past 8,192 characters or 64 tagged fields); e. exactly one `h` field and no `d` field: `ln/no-description-hash`, `ln/field-repeated` for a second `h`, `ln/description-inline` for a `d`; f. the `h` field equal to `extra.requestHash`, else `ln/request-hash-mismatch`; g. the invoice's signing key equal to `payTo`, else `ln/signer-not-payee`; h. the invoice's currency the network's (`bc` on mainnet, `tb` on testnet), else `ln/currency-network`; i. the invoice's amount equal to `amount`, else `ln/amount-mismatch`; j. the invoice's expiry equal to `maxTimeoutSeconds`, else `ln/expiry-mismatch`; k. added by this form: the invoice's `p` equal to `extra.paymentHash`, else `ln/payment-hash-mismatch`. These checks read no clock and no request. An option on an `lnbtc` network that fails one is refused with its code, so the pairing offers no option whose invoice it would not pay. The scheme's two checks of the invoice's time, its creation time no later than the validation time plus the clock-skew allowance and the invoice unexpired, are the resource server's with its own clock before it sends the option. 7. **The client's checks, before it pays** (`build`), are the scheme's (Client Payment Construction, checks 1 to 9) in the scheme's order, with check k added: rule 6's checks; then, from the buyer's own intended request, which `build` is given, the request hash computed by the scheme's Request Binding for the option's profile (the profile must be the request's own transport, and on `http:1` the document's `resource.url` the request's URL, on `mcp:1` the option's `server` the server the buyer means to call), which must equal `extra.requestHash` and the invoice's `h` (`ln/request-hash-mismatch`; `ln/request-binding-malformed` for a request the profile cannot bind); then, at the validation time `build` is given, the invoice's creation time no later than that time plus 60 s (`ln/created-in-future`) and the invoice unexpired at that time, its creation time plus its expiry later than it (`ln/invoice-expired`). Only then does `build` return the invoice to pay. After the payment, `complete` takes the preimage the buyer's node returned and refuses one that is not 64 lowercase hex digits (`ln/preimage-malformed`) or whose SHA-256 is not the invoice's `p` (`ln/preimage-mismatch`), as the scheme asks of a paid result; it builds `{x402Version: 2, resource, accepted, payload: {preimage}, extensions}`, `accepted` being the option with the invoice paid. 8. **One invoice for a sale.** A sale has one hash and one invoice. An invoice that expires unpaid, where the seller's node will issue no second invoice for the hash, leaves the sale to a new ATR and a new agreement. `maxTimeoutSeconds`, which the ATR commits before the invoice exists, is the invoice's expiry, so the resource server sets it to at least the sale's lifetime. **The payment presented, and what the resource server checks before anything is taken** 9. **`bound`** takes the payment presented: an x402 v2 payment whose `accepted` passes rule 6 (so the invoice's `p` is the echoed `extra.paymentHash`), whose `payload.preimage` is 64 lowercase hex digits (`ln/preimage-malformed`) and hashes by SHA-256 to the invoice's `p` (`ln/preimage-mismatch`), and whose echoed `extensions.legalContext` names an H; it returns that H. The echoed H only locates the sale. The resource server holds the echoed option, without its invoice, to the option the ATR's slot holds for that H, which ties the echoed payment hash to the ATR. `reference` gives the network, the payment hash and the time by which the payment can be proven (the invoice's creation time plus its expiry plus the scheme's 60 s), and refuses a payment whose `accepted`, without its invoice, is not the option it is given without its invoice (`x402/accepted-not-option`). 10. **Before anything is taken,** the resource server, in this order: answers no request of the sale that lacks the sale's return value; holds the presented `accepted.extra.invoice` byte-equal to the invoice its node issued for the sale; builds the requirements from its own record of the sale (the option the ATR's slot holds, the invoice issued, and the request hash it computes from the request that will execute, by `requestHash`, the computation rule 7's check k makes of the buyer's intended request), never from `accepted`; and runs `validateExactLnbtc` over the payment and those requirements, which moves nothing. Only then does it send the payment to a settler's `/settle`, never `/verify`, which the scheme's protocol sequence forbids for this flow, or make its own record that the payment hash is used, and serve. So a presentation with an invoice another node signed, or past the scheme's window, is refused before anything another party can take, with the scheme's reason. 11. **`validateExactLnbtc`** is the scheme's Facilitator Validation, checks 1 to 7 and the Paid-but-expired Policy, in the scheme's order, each failure answered with the scheme's `errorReason`, with this form's one check added at the end of check 5: the accepted invoice's `p` equal to `requirements.extra.paymentHash`, else `invalid_exact_lnbtc_invoice_payment_hash_mismatch`. It takes the validation time and the clock-skew allowance, 60 s by default, and answers the network and the payment hash, from which a settler forms the scheme's consumption key, `network + ":" + payment_hash`. A settler's `/settle` for this form runs the same export, then records that key once. 12. **`checkPreimage(preimage, paymentHash)`** is the preimage check alone: `true` where the preimage is 64 lowercase hex digits whose SHA-256 is the payment hash, given as 64 lowercase hex digits; `ln/preimage-malformed`, `ln/payment-hash-required` or `ln/preimage-mismatch` otherwise. **What a preimage shows, and what a record proves** 13. The preimage is a bearer value. Every node on the payment's route learns it (BOLT 2 at `19146282`, `02-peer-protocol.md`, `update_fulfill_htlc`), and the seller's software holds the secret from the sale's issue. So a preimage that hashes to the committed hash shows that the secret left the seller's custody, as its node releases it when the invoice is paid, and never who paid; to anyone but the seller's node it does not show that the invoice was paid. The invoice's signer is held to `payTo`; no payer is named; the amount is the invoice's, as the seller reports it. 14. A record of a payment through this pairing proves: that an account signed an agreement transaction carrying the ATR's hash, on its own network, before this payment was taken or reported, which shows neither that the account is the payer nor when the payment was taken, which nothing reads; that the ATR commits the payment hash of the invoice paid; and that settlement is the seller's report. **Where this form departs from the scheme's text** 15. One invoice for each sale, repeated to the sale's own client, where the scheme asks for a fresh invoice for each challenge and forbids reuse across challenges (the scheme, `PaymentRequirements`); the form keeps the rule against reuse across clients. 16. A proof accepted only under its own sale's option, where the scheme accepts an unused proof for another challenge with the same request and terms (the scheme, Request Binding): another sale's option names another `extra.paymentHash`, which `validateExactLnbtc` refuses `invalid_exact_lnbtc_extra_mismatch`. 17. One reason outside the scheme's closed list (the scheme, Error Vocabulary): `invalid_exact_lnbtc_invoice_payment_hash_mismatch`, for an invoice whose `p` is not `requirements.extra.paymentHash`. 18. **The record a resource server keeps of a sale** that offered this pairing outlives the sale: an invoice issued late in the sale's life ends `maxTimeoutSeconds` after its issue, and the scheme accepts its proof until 60 s after that end, so the record is kept until the sale's expiry plus `maxTimeoutSeconds` plus 60 s, and a proof the scheme still accepts finds its sale. **The registry entry** 19. Coverage `none`, `link` `none`, `nonce` `single-use` (the payment hash), `broadcasts` `payer`, `agreementOn` `any`, no `agreement` (no Lightning act is signed by the buyer, so this pairing is never an agreement), no `read`. `confirmed` is `yes`: a recorded run on Bitcoin testnet3 showed a payment of this form. **The read** 20. None. No public ledger shows a Lightning payment and no node is read, so the pairing has no `status` and no `recover`, and no read kit form runs through it: every case of the read kit reads a ledger. A sale paid through it is settled by the seller's report. **The vectors** 21. `x402-exact-lnbtc.json`, whose `about` names each oracle: the scheme's own example option, invoice, payment, preimage, payment hash, request binding digests, validation time and reasons; invoices written and signed by `bolt11` 1.4.1 and read back by `light-bolt11-decoder` 3.2.0, one for each field rule a refused invoice breaks (a `d` field, two `h` fields, a `p` that is not the committed hash, a signer that is not `payTo`, no `s` field) and for the `n` field, an amount and an expiry the census tests use; and BOLT 11's published examples for the decoder. Its refusal rows each change one member of a good input: the offer (`offers`), the client's checks and `complete` (`build`), `bound`, `reference`, the scheme's validation (`validate`), the preimage check (`checkPreimage`) and the option filter (`boundAccepted`, each row an option the pairing's `read` does not offer, refused by `bound` and `advertise` with its code). --- # x402-exact-near-memo.md Source: https://lcp.integraledger.com/profiles/x402-exact-near-memo.md **LCP profile `x402/exact/near/memo`: the ATR hash as the NEP-141 transfer memo.** This profile defines the pairing `x402/exact/near`. 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs the delegate action x402's NEAR scheme defines, with `ft_transfer` args `{"receiver_id":…,"amount":…,"memo":"lcp:sha256:"+H}` ([LCP §8.1](https://github.com/legal-context-protocol/legal-context-protocol/blob/main/spec/legal-context-protocol-v1.md#81-naming-conventions)), and echoes `extensions` unchanged. `build`'s `near-delegate` request carries, beside `hash`, `delegateAction`: the borsh bytes of the delegate action whose NEP-461-prefixed SHA-256 is `hash`, which `nearRequest` reads back to that hash and to every member the key signs. 4. The server refuses a payment whose `memo` does not decode to an H that it issued for that request and has not seen claimed. 5. H is on chain in the delegated `ft_transfer` arguments, and in the token's `ft_transfer` event where the token follows NEP-141's events. A read finds the payer's act by the payer's access key, the delegate action's sender and public key: the change of that key that carried its nonce to or past the delegate's nonce, read from the block after the position the caller gives (the final block height when the option was issued) up to the delegate's `max_block_height`, and, where the nonce is read at or past the signed one, up to the block it was read so at, since a delegate action the payer signs again over the same nonce carries a later `max_block_height`. The transaction that carried the change is read with the RPC's `EXPERIMENTAL_tx_status`. A transaction hash a settler names is a hint: it shortens the search and proves nothing. Positions are block heights; a search position is the height below which the search read every change, given where it stopped below the latest head. The marks are optimistic, the latest head, and `FINAL`, the final mark, at which alone a read answers `failed`. The key's nonce is read at both: a nonce below the signed one at both is `instrument-live` until rule 8's lapse. 6. x402's NEAR scheme leaves `memo` to the client. A client that does not implement this profile writes none, and rule 4 refuses its payment. 7. **Succeeded** means: the payer's account ran the delegate action, its receipt's outcome a success, and the receipt the token contract executed for the delegate's one action has outcome success, its memo H; the relayer's transaction is `FINAL` at the final mark, or executed at the optimistic one. The token and the `receiver_id` are recorded as read. On a payment the `receiver_id` is compared with the option's `payTo`, and a delegate action paying another account pays nothing; the amount and the token are compared with nothing. A delegate action the payer's account ran whose token receipt failed consumed the key's nonce. One refused for its signature or its expiry consumed nothing, and can still land until `max_block_height`. One refused for its nonce shows the nonce already taken, and the search decides: the act is the delegate action that took it where it is this one under another transaction. A transaction whose token receipt has not yet run is below the mark. What moved names the one transfer by the relayer's transaction and, as its place, the id of the receipt the token contract executed for the delegate's one action. The signer an answer names, for the act and for a foreign item alike, is the delegate action's sender, and its authority the public key the sender signed with. 8. **The lapse.** The delegate action can no longer land where the key's nonce is still below the signed nonce at a final block past `max_block_height`. The read answers it `instrument-unused` only where the search for H, the changes of every access key of the payer's account from the issue position to the latest head at the read, each read through the transaction that carried it, is read whole and finds no delegate action of the payer's that carries H and is the act asked about: a delegate action the payer signs with another of its keys is the payer's act. A nonce at or past the signed one whose change is not found, and a key absent at either read, as one the payer deleted is, whose nonce is then unread, are `search-incomplete`, never a lapse and never `not-found`, whatever the search shows; a nonce past the signed one is never a lapse by itself. Every `failed` but `before-position` waits for that search read whole; until rule 9's run, no search is read whole, so the read answers those `pending`, `search-incomplete`. A change whose transaction the reader cannot name stops the search at the block before it, from which the next read resumes. A transaction the reader cannot read is named as an item the search could not decode, the search held at the block before it and reading on (`read-status`, rule 19); one the caller gave as another act is named `given`. 9. **Shown, and not yet shown, by a run.** A run on `near:testnet` showed, on a payer's account with one access key, that the access-key changes show a relayed delegate action's nonce change from the issue position, and that a reader names the relayer's transaction from that change, whose cause is the delegate action's receipt (transaction `Lbk2JQucgSdTxjtnMrZa4d7roVx8H4vKHyyUeEVviYC`, found by the search with no transaction named). Not yet shown by a run: that the changes of every key of the account show every delegate action of the account. Until a run shows it, a search read whole proves no absence (`read-status`, rule 25). A run showed that NEAR's RPC does not read a transaction by its hash alone: its transaction status method takes the hash with the signer's account, or the signed transaction, and refuses a hash without an account (nearcore 2.14.1 on testnet), so a reader that `recover` is given resolves the signer itself, as a seller's reader can from the accounts that relayed its payments, and a party holding only the hash has no read. 10. **The payment presented** is the NEP-366 delegate action the payer signed, whole, its signature apart: its sender, its receiver, its one function call with its method, arguments, gas and deposit, its nonce, its `max_block_height` and its public key. A `settled` answer states `presented` `yes` where the delegate action it settled on equals that one in every member, and `no` where one differs. The comparison judges no term and decides no answer. `reference` keeps those members, the arguments by their SHA-256, with the option's `payTo` as the payee, and refuses a presented `accepted` that is not the option it is given, compared as RFC 8785 JSON, with `x402/accepted-not-option`. 11. **The agreement.** A payment of this form can itself be the agreement. Its floor is 1 atomic unit of the token: the standard token refuses a zero `ft_transfer` (inferred, not yet shown). The relayer pays the fee, always: it submits the delegate action, pays the gas and prepays the 1 yoctoNEAR deposit; the delegate action names no relayer, so nothing about the fee is fixed in what the payer signs. The transaction must succeed as rule 7 states; one included with a failed result is no agreement. The payee's own signature is no agreement: a delegate action whose sender is the option's payee is never the act, on either act. An agreement is held to no account. 12. Cases of the read kit this read cannot meet, which the form `test/read-kit/forms/near.ts` skips, each with its reason: on `x402/exact/near`, `not-found`, since the read holds the single-use value, the access key's nonce, where the key is present at both reads, and a key absent at either read, as one the payer deleted is, leaves the value unread and is answered `pending`, `search-incomplete`, never `not-found`, whatever the search shows, a search read whole included: the value may have been taken before the key went, and no state in which it may have been taken is answered `not-found`; by the cases' words, *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since the standard token refuses a zero `ft_transfer` (rule 11, inferred); *each transfer of what moved is named by its transaction and its place in it*, since a delegate holds one action, an `ft_transfer`, which moves one transfer (rule 7); *a read that did not read the value at the latest head*, since the read reads the access key's nonce and its changes to the latest head; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since the search reads changes by block; and, while no run has shown the search whole (rule 9), each case whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed`. Through the read each of those answers `pending`, `search-incomplete`, as the vectors' read rows hold. 13. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/near`: Paid: the payer's account signed a NEP-366 delegate action whose one ft_transfer carries this ATR's hash in its memo, in LCP string form, so the payer's own signed act carries the hash. The runtime verified that signature and ran the delegate, and the transfer succeeded on the token contract the delegate names, reaching the account its receiver_id names, both as read. The signer is the delegate's sender, named apart from any other act's. This states nothing of the amount, nor that the token, the account reached or the time meet a term of the ATR. --- # x402-exact-polkadot-lcp-assets-remark.md Source: https://lcp.integraledger.com/profiles/x402-exact-polkadot-lcp-assets-remark.md **LCP profile `x402/exact/polkadot/lcp-assets-remark`: the ATR hash in a payer-signed remark, batched with the transfer.** *Scope.* x402 v2, `scheme` `"exact"`, `network` `polkadot:68d56f15f85d3136970ec16946040bc1` (Polkadot Asset Hub) or `polkadot:67f9723393ef76214df0118c34bbbd3d` (Westend Asset Hub), `extra.assetTransferMethod` `"lcp-assets-remark"` (required). It defines this transfer method until x402 or MPP defines Polkadot. The default flow is `authorization`, and `upfront` is allowed. 1. The option gives `amount` in the asset's atomic units as the canonical decimal of a positive integer (digits only, the first not `0`), `asset` as the `pallet-assets` asset id in decimal, `payTo` in SS58, and `maxTimeoutSeconds` as an integer from 1 to 3,600. `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, where H is the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L is an `https` URL that serves them. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs one v4 extrinsic, with a mortal era, whose call is exactly `utility.batch_all([assets.transfer_keep_alive(asset, Id(payTo), amount), system.remark_with_event(R)])`, where R is the 77 ASCII bytes `lcp:sha256:` followed by H. It sends `payload.extrinsic` (the signed extrinsic) and `payload.call` (its call), both in lowercase hex, and echoes `extensions` unchanged. 4. The payer pays every fee, in DOT or in an asset its wallet selects. Nothing in this profile sponsors them. 5. A facilitator's `/verify` decodes the extrinsic with the network's runtime metadata; requires rule 3's call, equal byte for byte to `payload.call`, for `asset`, `payTo` and `amount` exactly; requires a mortal era; and requires `TaggedTransactionQueue_validate_transaction` at the best block to return `Ok`. Its `/settle` repeats `/verify`; submits the extrinsic; deduplicates settlements by the extrinsic's BLAKE2b-256 hash, atomically, until its era ends; and answers `success: true`, with `transaction` = `-` and `payer` = the signer in SS58, only when the extrinsic is in a block and its events include `System.ExtrinsicSuccess`, `System.Remarked` for R and `Assets.Transferred` for `asset`. Broadcast but not yet in a block, it answers `settlement_pending` with `transaction` = the extrinsic's BLAKE2b-256 hash. Its answer's `transaction` is a hint to a reader of the payment, never the read's key (rule 8). 6. The resource server refuses a payment whose remark does not decode to an H that it issued for that request and has not seen claimed. 7. Declarations for x402's facilitator-submitted family: fee payer: the payer, self-funded. Replay primitive: the payer's account nonce, shared with the payer's account state, so a payer has one pending payment per nonce, and any other extrinsic the payer lands with that nonce invalidates this payment, even after the resource handler has run. Validity window: the mortal era, at most `BlockHashCount` (4096) blocks. Duplicate submission: the same bytes have the same hash, and once included their nonce is spent; settlements are still deduplicated as rule 5 requires. 8. H is on chain as the remark inside the extrinsic the payer signed, and `System.Remarked` carries its BLAKE2b-256. No index searches remarks. The payment is read by the signer's account nonce, never by the extrinsic's hash, since any re-signing at the same nonce has another hash; a timepoint a facilitator names is a hint. The read is the profile `read-status`'s, with these facts: - **The marks** are `head`, the latest block the endpoint serves, and `finalized`, the final mark; a position is a block height, and a transaction is named by its timepoint. - **The instrument** is the signer's account nonce. The reference names the signer, the signed nonce and the signed era, read from the bytes that follow the signature (the era, then the compact nonce, the first explicit bytes of the extensions), the presented extrinsic, and the option's payee. - **The search** reads every block after the position the caller gives up to the latest head, at most `POLKADOT_BOUNDS.searchBlocks` blocks a call, the next call taking the search's position. It decodes each item's preamble: a bare item, and another signer's item, is passed whatever its size; the signer's own items are held to the size bound; an item it cannot decode, which could be the signer's, leaves the search not read whole. A signed item is a signed v4 extrinsic, or, on Polkadot Asset Hub, a version 5 general transaction that `VerifyMultiSignature` signs: `0x45`, the extension version `0x01`, the variant `Signed` with its `MultiSignature` and the signer's 32-byte account, `AsPgas` and `AsDotnsGateway` each `None` and `RestrictOrigins`, then the era and the compact nonce, as the runtime's metadata (v16, spec 2005003) lists extension version 1's extensions. A payer can land such a transaction at its account nonce, which it consumes as a v4 extrinsic does; the search reads its signer, era and nonce, and reads it as it reads a v4 extrinsic. Any other general transaction is an item the search cannot decode, every one on Westend Asset Hub among them, whose runtime lists extension version 0 alone, which carries no signature. The signer's extrinsic at the signed nonce is the instrument's, and every extrinsic whose bytes hold R is read for the search for H. - **Succeeded** means the extrinsic dispatched (`System.ExtrinsicSuccess`, the endpoint's `success`) with `System.Remarked` for R, wherever R sits in its call. What it moved is recorded as observed: every `Balances.Transfer` and every `Transferred` of the assets pallet's instances (`assets`, `foreignAssets`, `poolAssets`) whose `from` is the payer, with its asset, amount and recipient, no sender recorded, and, for each `assets.transfer` or `transfer_keep_alive` call of zero in the signed call that runs as the payer and ran, which emits no event, a transfer of zero to its `dest`. Such a call ran where every call on its path from the extrinsic's own call ran, as the pallets dispatch (polkadot-sdk at 23b84ba4, `substrate/frame/utility/src/lib.rs:188-192`, `:214-235`, `:323-350`, `:404-440`): under a `utility.batch` where the batch was not interrupted or the call comes before the one whose index `Utility.BatchInterrupted` names, the batch dispatching its calls in order and stopping at the first that fails; under a `utility.force_batch` where the batch reports no `Utility.ItemFailed` for it; under a `utility.batch_all` where the batch ran; under a `proxy.proxy` where its `Proxy.ProxyExecuted` carries no error; a failed call's own events being undone with it. The events are read in the order the pallets emit them, and a call of zero ran only where every reading of the dispatch that places all of them shows it ran. Each transfer is named by the extrinsic's timepoint and its place: the index of its event among the extrinsic's events as the endpoint lists them, or, for a transfer of zero, `call` and the index of each call on the path from the extrinsic's own call down to it, `0` for the one call of a `proxy.proxy` or a `multisig.as_multi_threshold_1`, and for a `utility.batch`, `batch_all` or `force_batch` the index among the batch's calls of the call the path goes through: `call 0` for rule 3's own, `call 0 0` under one `proxy.proxy`, and `call 0 1 0` the first call of a batch that is the second call of a batch under one wrapper, so that two such calls in one extrinsic are told apart. On the act `payment` the extrinsic names the payee's account where one of these reaches `payTo`'s 32-byte account, whatever asset or amount; one that names no such account is not the payment. An agreement is held to no account. - **The answer for the instrument.** The signer's extrinsic at the signed nonce settles where it succeeded and is the act asked about; where it holds R and did not succeed (`System.ExtrinsicFailed`, or a wrapper whose failed inner call took the remark with it) and, on the act `payment`, its signed call names `payTo`'s account (a failed extrinsic's transfers being rolled back with it, the account it names is its signed call's), it is `failed`, `transaction-failed`; in every other case, one that holds no R, whatever its result, or, on the act `payment`, names no payee's account, it is `failed`, `instrument-consumed`. Each `failed` but `before-position` is answered only once the search is read whole to the latest head and found no extrinsic of the signer that is the act asked about: one it finds settles, at `head` it is `pending`, `below-mark`. - **The lapse.** An era signs a period and a phase and no birth block, so its end is proven only where the chain's validation of the presented extrinsic (`TaggedTransactionQueue_validate_transaction`, through the declared `json-rpc` endpoint) answered valid at a head; the last block that can include it is then the era's last for that head, and no later than `BlockHashCount` + 1 blocks after its birth. A `pending` answer keeps that head in its search position, as `validated`, and the next call takes it back. The era's end is compared with finalized alone: ended at the head and not at finalized, the extrinsic can still land, and the read is `instrument-live`. `instrument-unused` is answered once the finalized height is past that last block, the account nonce at finalized is not past the signed one, and the search is read whole. With no validation answered valid, and for an immortal era, the lapse is never answered: the read is `pending`. - **The payment presented.** On `settled`, `presented` is `yes` where the landed extrinsic's signed body, its signature apart, is the presented extrinsic's, and `no` otherwise. - **Foreign items.** An extrinsic of the range that holds R, succeeded and is not the act asked about is named with its reason: under another signer `other-signer`, signed by the payee `payee-signed`, one the caller gave `given`, and on the act `payment` one of the signer's that names no payee's account `other-account`. One that did not succeed is no foreign item. - **Read-only forms.** A `proxy.proxy` or `multisig.as_multi_threshold_1` wrapper and an immortal era are read and described where a payer lands one; a facilitator submits none of them (rule 5). A call runs as the signer, as a `proxy.proxy`'s `real`, or as the multisig account of an `as_multi_threshold_1`'s other signatories and its sender at threshold 1; an extrinsic whose call runs as the reference's signer, the payer, is the payer's act, save one the option's payee signed. An answer names the extrinsic's signer, and, where it acted for the payer through a wrapper, that wrapper as the authority it acted under, `proxy.proxy` or `multisig.as_multi_threshold_1`; none where it signed as the payer. - **Cases that cannot arise.** The read kit's cases that cannot arise on this ledger, each named by its reason or the opening words of its text: `not-found`, since the read holds the single-use value, the account nonce, which it reads at finalized; *an act of another pairing or kind carrying H*, since the network has one pairing and every extrinsic of the signer that carries R is its act wherever R sits, an agreement and a charge alike; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every extrinsic is read at its block's height; *the validity passed with the value unconsumed, read below the final mark*, since the era's end is compared with finalized alone; and *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since the read holds the account nonce and reads it at finalized and at the latest head. 9. **The agreement.** The payment form is also offered as an agreement, at the floor: 1 base unit, since the assets pallet returns early on a transfer of zero and emits no `Transferred` event, which rule 5 requires. The signer pays every fee (rule 4); no other party can pay on Polkadot Asset Hub. The extrinsic must succeed (rule 8); an extrinsic the option's payee signed is no agreement and no payment, on either act. The payee must already hold the asset, since a transfer of one unit cannot open an asset account below the asset's minimum balance; no validation reads it. 10. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/polkadot/lcp-assets-remark`: The payer signed one Polkadot Asset Hub extrinsic whose bytes hold this ATR's hash in LCP string form as a remark, at the account nonce its reference holds, or an account acting for the payer through a `proxy.proxy` or `multisig.as_multi_threshold_1` wrapper signed one. The chain verified the signature and dispatched the extrinsic with a Remarked event for that remark, at the finality recorded. Where the record shows a transfer event from the payer, or the call is a transfer of zero that runs as the payer, it states that the extrinsic paid, with each recipient and what moved; where it shows neither, it states that the payer signed. The signer is named, with the wrapper as its authority where it acted for the payer. This does not show that amount, asset or timing match the ATR's content. --- # x402-exact-solana.md Source: https://lcp.integraledger.com/profiles/x402-exact-solana.md **LCP profile `x402/exact/solana`: the ATR hash as the Memo instruction of the transaction the buyer signs.** x402's `exact` scheme on Solana (`scheme_exact_svm.md` at `x402-foundation/x402` `88b66dd4`). 1. The option's `network` is `solana:` and the first 32 characters of the cluster's base58 genesis hash (CAIP-2). Its `extra.memo` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes, which the stock client writes as one Memo Program instruction of the transaction the buyer and the fee payer sign (`@x402/svm` 2.30.0, `src/exact/client/scheme.ts:115-118`). The stock client fixes its compute unit limit at 20,000 (`@x402/svm` 2.31.0, `dist/esm/chunk-DAIKIZVB.mjs:15`, `dist/esm/chunk-PQ2KWLVO.mjs:116-119`), which the Memo program's 28,899 units for this 77-byte memo exceed on Solana devnet, so a stock client's payment of this form fails before it lands and a facilitator's verify refuses it; lcp's client builds with a limit of 40,000 where its caller names none (the `build` vectors), and a buyer pays this form with a client that sets such a limit. `bound` holds the presented `accepted` to the option filter and refuses a transaction unless exactly one of its top-level Memo instructions holds an LCP string and it is H's, the only Memo instruction: no LCP-form memo is `svm/no-carrier`, more than one `svm/memo-count`, one spelled otherwise `svm/carrier-not-canonical`, one other than `extra.memo` `svm/carrier-mismatch`; a durable nonce account loaded from an address table is `svm/nonce-account-not-static`. `reference` names the message's digest, the buyer, the fee payer, H, the option's payee and the blockhash or durable nonce, and refuses a payment whose `accepted` is not the option it is given, `x402/accepted-not-option`. 2. The fee payer is the option's `extra.feePayer`, the seller's settler, the message's first signer; the settler co-signs and broadcasts. `bound` refuses an instruction the stock facilitator does not admit under any configuration: a Memo v4 instruction, since every verify path it has, the default layout, an allow-listed one and a smart wallet's, requires exactly one Memo instruction of the program `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` equal to `extra.memo` (`dist/esm/chunk-RCDWMK2L.mjs:1018-1023`, `chunk-7TSGYOB2.mjs:314-322`), and this profile's carrier is one memo of either program, and, in a version-1 message, a Compute Budget instruction, its header carrying the budget (`svm/instruction-not-admitted`; `@x402/svm` 2.31.0 `dist/esm/chunk-RCDWMK2L.mjs:145-161`, `:194-198`). What else a facilitator admits is its configuration's, and its own verify's. 3. The client builds the highest message version both `extra.transactionVersions` and lcp admit: version 1 where the list holds 1, version 0 where it holds 0 alone or is absent, as a stock client does (`@x402/svm` at `88b66dd4`, `utils.ts:200-203`); a list that admits neither is refused at the filter (`x402/option-malformed`, as `scheme_exact_svm.md` §1.5 makes it invalid). `bound` and `reference` decode legacy, version 0 and version 1 messages, and refuse one whose version the list does not admit, `svm/version-not-admitted`, `legacy` being admitted where the list holds 0 and the list absent being `[0]`, as `@x402/svm` 2.31.0's facilitator admits it (`isAcceptedTransactionVersion`): a payment the option does not admit is no answer to it. 4. An option carrying `extra.splits` is refused at the filter, `svm/input-malformed`, before the buyer signs: no Solana build writes split legs, and each pays the whole amount to `payTo`. 5. The agreement: its floor is 0, since a zero `TransferChecked` lands and the stock facilitator compares the amount by equality (`dist/esm/chunk-RCDWMK2L.mjs:1010-1011`); the fee is the settler's; it succeeds where `getTransaction` at `finalized` returns the transaction with `meta.err` null, the buyer among its signers and its one LCP-form Memo instruction H's; one that landed with an error, which consumed the signed message, is no agreement. 6. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the owner, as the transaction's token balances name it (`meta.postTokenBalances`), of the token account a transfer from the buyer's token account reaches, top-level or inner; a payment counts where one such transfer reaches the option's payee, zero included, and an agreement is held to no account; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 7. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. 8. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, whose one LCP-form Memo instruction is the hash's LCP string, final at `finalized` with no error. It paid each transfer it made from the buyer's account, recorded with its mint or lamports, amount and recipient, one of zero included, the recipient being the owner the transaction's token balances name; as a payment, one of them reached an account the option's payee owns. The memo is in the transaction's instruction data on chain. It compares no amount, mint or time with the ATR's terms. 9. A transfer hook. A Token-2022 mint whose `TransferHook` extension names a program runs that program in each transfer, which Token-2022 invokes with the accounts the program's validation account lists for `Execute`, and fails without them. The spl-transfer-hook interface states how a client resolves those accounts from what it reads (`add_extra_account_metas_for_execute`, solana-program/transfer-hook at `155d8212`, `interface/src/offchain.rs:48-112`; `ExtraAccountMeta` and `Seed`, solana-program/libraries at `07b9b49e`, `tlv-account-resolution/src/{account,seeds,pubkey_data}.rs`), and a facilitator admits the transfer that carries them, its top-level instruction still the one `TransferChecked` rule 2 admits: `build`, given a reader of the option's network (its `account`), reads the mint at `confirmed`, and where the hook names a program appends to `TransferChecked`, after its four accounts, the extra accounts the list resolves to, in its order, each with no role an account before it lacks, then the program and its validation account, the program's PDA of `extra-account-metas` and the mint. Where its caller names no compute unit limit it writes 400,000, `@x402/svm` 2.31.0's default maximum (`dist/esm/chunk-DAIKIZVB.mjs:16`), since the hook's cost is its program's and no rule states it. A validation account that does not exist or lists no accounts for `Execute`, a list that does not resolve, or an account resolved that signs, a signature x402 takes from no third party (`scheme_exact_svm.md` §2.1.4), is `svm/transfer-hook-unresolved`; a reader that fails is `svm/unreadable`, and one of another network `svm/wrong-reader`. Without a reader `build` reads no account and writes `TransferChecked` with its four accounts, which such a mint does not take; the stock client writes the same four (`@x402/svm` 2.31.0, `dist/esm/chunk-2P7IHAQJ.mjs:83-93`) and pays no such mint. `bound`, `reference` and the read take the transfer by its first four accounts, and read the transfer that carries the hook's accounts as they read any other. --- # x402-exact-starknet.md Source: https://lcp.integraledger.com/profiles/x402-exact-starknet.md **LCP profile `x402/exact/starknet`: the ATR hash's low 250 bits as the SNIP-9 nonce.** **The form** 1. The `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L an `https` URL serving them. 2. The client fetches L, hashes the bytes received, and compares with H as 32 bytes. On a mismatch it does not sign. 3. On a match it signs SNIP-12 revision 1 typed data for x402's `OutsideExecution` (SNIP-9 version 2), under the domain `name` `Account.execute_from_outside`, `version` 2, `revision` 1 and `chainId` the network's reference as a short string, the option's `network` being `starknet:SN_MAIN` or `starknet:SN_SEPOLIA`: `Caller` the option's `extra.feePayer`; `Nonce` = H AND (2^250 − 1), the low 250 bits of H, as a felt; `Execute After` 1; `Execute Before` the client's clock plus the option's `maxTimeoutSeconds`, in Unix seconds; and `Calls` exactly one call, `To` the option's `asset`, `Selector` sn_keccak(`transfer`), `Calldata` `[payTo, the amount's low 128 bits, its high 128 bits]`. It presents the payer's account as `from`, the typed data and the signature as 1 to 32 felts, and echoes `extensions` unchanged. A felt is `0x` and 1 to 64 hex digits below the STARK prime 2^251 + 17·2^192 + 1, compared as a number. The 250 bits are lcp's choice within the 251 a felt holds whole. 4. **The agreement's own nonce.** Where the payment is offered as an agreement, the signed `Nonce` is the low 250 bits of the agreement's value in place of H's: SHA-256 over the 16 ASCII bytes `lcp-agreement-v1` followed by H's 32 bytes (the profile `read-status`, rule 1), AND (2^250 − 1); its vectors are `core-vectors.json`'s `agreementValue` and this pairing's. The payer's account keys a used nonce by its value alone, so an agreement and a payment under one H from one account never take one nonce. `build` writes it for the act `agreement`; `bound`, given the act and H, refuses a payment whose `Nonce` is not the value that act carries, `starknet/nonce-not-bound`, and gives H where it is; `reference`, given the same, names that value as the signed nonce. With nothing given, `bound` takes H from the echoed legal context and gives it where its low 250 bits are the `Nonce`, as a payment carries it. 5. The server refuses a payment whose `Nonce` is not the low 250 bits of an H it issued for this request, or of that H's agreement value where it offered the option as an agreement, and has not seen claimed. It refuses a payment whose `from` is the option's `payTo`: an outside execution the payee's account signed is no payment and no agreement. `bound` refuses a signed message whose `Caller` is not the option's `extra.feePayer`, `starknet/caller-not-fee-payer`, and one with a call whose `Selector` is not sn_keccak(`transfer`), `starknet/selector-not-transfer`: who may execute it and the form that carries H, never what it pays. 6. A settler executes the outside execution as the named `Caller` and pays the fee, through that account or the relayer behind it where the `Caller` is a forwarder; nothing else in the signed message names it. It checks the payment by x402's Starknet scheme before anything is sent (rule 25), and the server checks H first (rule 5). **What "succeeded" means, and what fails** 7. Succeeded: the receipt's execution status is `SUCCEEDED`, and the transaction's trace (`starknet_traceTransaction`) holds, at any depth, below a forwarder as below the executor, an `execute_from_outside_v2` invocation on the payer's account whose calldata carries the signed nonce, no invocation on the path to it reverted. It consumed the nonce. Each `Transfer` the receipt holds from the payer, on any token, is what moved, with its token, recipient and amount; and a `transfer` call of zero under that invocation for which its token emitted no `Transfer` is a transfer of zero to the account its calldata names. None is counted, and no token or amount is compared. 8. `REVERTED`: the transaction is included, and the signature check and the nonce's use inside `execute_from_outside_v2` roll back with it (x402's scheme, `scheme_exact_starknet.md`). No payment and no agreement, and the nonce is not consumed: the outside execution can still land until `Execute Before`. 9. `SUCCEEDED` with the `execute_from_outside_v2` invocation reverted beneath a forwarder: the same outcome. A reverted invocation's subtree is rolled back with it, its calls keeping `is_reverted: false`, and the nonce is not consumed. 10. A `Transfer` is an event whose first key is sn_keccak(`Transfer`), keyed (keys `[selector, from, to]`, data `[low, high]`) or unkeyed (keys `[selector]`, data `[from, to, low, high]`), each amount limb below 2^128; its token is the contract that emitted it. Any other event with that first key is of neither layout. **The read** (the profile `read-status`) 11. The reference names the network, the payer's account `from`, the asset, which is the event search's key, the signed nonce (H's low 250 bits, or the agreement value's), the option's `payTo` as the payee, `Execute Before` as `settleBy`, and the outside execution as presented: `caller`, `nonce`, `executeAfter`, `executeBefore` and `calls`, each call's `to`, `selector` and `calldata`, every member a felt in its shortest lowercase spelling. `reference` refuses a presented `accepted` that is not the option it is given, `x402/accepted-not-option`. The caller adds H for `status`, by which the read tells H's other value (the agreement value's low bits on a payment, H's on an agreement) from the act's own, and may add the transaction a settler named. The reference's nonce must be the low 250 bits of the value the act asked about carries, H's on a payment and the agreement value's on an agreement, and it must hold the outside execution as presented, each member a felt; otherwise `status` answers `unreadable`, `unparseable`, with nothing read. 12. The marks are `ACCEPTED_ON_L2`, the newest block (`latest`), and `ACCEPTED_ON_L1`, the final mark. A `PRE_CONFIRMED` receipt, or one that names no block, is below every mark: no act is found in it, and the read of the nonce decides. A position is a block number. 13. Where the reference names a transaction, it is read first, its receipt and its trace, and classified as rules 16 to 18 classify a transaction the search finds. One that did not succeed, one that carries no outside execution under either of H's values, and one the node does not know decide nothing, and the read goes on. A receipt or trace of it the read cannot decode is `unreadable`, `unparseable`; one beyond lcp's bounds, `unreadable`, `too-large`; a receipt with no trace, `unreadable`, `history-gap`. Each other act the caller gives by its transaction (the profile `read-status`, rule 6), at most 16 a call, is read the same way and holds no search: one the read can decode is classified as rule 18 classifies it; one whose receipt or trace it cannot decode, that exceeds lcp's bounds, or that has no trace is named among the foreign items, `given`, by its transaction alone (rule 19 of `read-status`); one the node does not know decides nothing. A query that gives more than 16 is `unreadable`, `too-large`, with nothing read. 14. The read is of the nonce, as state: `is_valid_outside_execution_nonce(nonce)` on the payer's account at the newest `ACCEPTED_ON_L1` block and at the newest block, each read with its number and its own timestamp. Valid at both: no outside execution under the nonce has landed on the payer's account, whatever token it moved; the account keeps one nonce space for every token and the nonce derives from H alone, so these two reads are the search for H, read whole (the profile `read-status`, rule 26). Where the final block's own timestamp is before `Execute Before`, the answer is `pending`, `instrument-live`, save where the newest block's own timestamp is at or past it: the validity has passed as read below the final mark, and the answer is `pending`, `below-mark` (the profile `read-status`, rule 17), until a final block shows it. Where the final block's own timestamp is at or past `Execute Before`, the answer is `failed`, `instrument-unused`. Where the caller gave a search position, a `pending` answer returns one that starts after the newest block read. A block whose state the node does not serve is `unreadable`, `history-gap`. Where the node answers the call with `starknet_call`'s documented `CONTRACT_NOT_FOUND` (20), an account not deployed at that block, or `ENTRYPOINT_NOT_FOUND` (21), an account with no SNIP-9 entry point, which the pairing requires of the payer, the account runs no outside execution at that block, so the nonce reads valid there: before `Execute Before` the answer is `pending`, `instrument-live`, since the account can still be deployed or given a SNIP-9 class and run it, and after it, read so at the final block and at the newest, `failed`, `instrument-unused`. The cost, stated: an account that ran the payment and then replaced its class with one that has no such entry point reads as one that never ran it. Any other error is `unreadable`, `transport`: an error is never absence, and the read establishes nothing. 15. Consumed at either block: the search finds the transaction that consumed it. It reads `starknet_getEvents` on the asset for events whose first key is sn_keccak(`Transfer`), a page at a time by the node's continuation (at most 8 pages and 16 candidate transactions a call), from the position the caller gave, or block 0 where it gave none, to the block at which the nonce was read consumed: the final block where it was consumed there, else the newest. Each `Transfer` from the payer names a candidate transaction, whose receipt and trace it reads; a candidate is taken only where its trace carries an outside execution under either of H's values. Where range is left, the answer carries the search's position, from which the next call resumes. A range the node does not hold is `unreadable`, `history-gap`. A candidate whose receipt or trace the read cannot decode, or that exceeds lcp's bounds, and an event of the asset with the `Transfer` key of neither layout, is an item the search could not decode: it holds the search at its page, and the answer names it (the profile `read-status`, rule 19). The account keys the nonce alone, so a copy the payer signs with a later `Execute Before` consumes it too: `Execute Before` bounds the lapse and not the search. 16. The payer's outside execution under the act's own nonce consumed it, and it is the one transaction that did, so once it is found the search is whole: no candidate after it is read, and no bound of rule 15 cuts the search short. On the act `agreement` it is the act whatever it moved, an agreement being held to no account. On the act `payment` it is the act where one of its `Transfer`s from the payer, or a transfer of zero (rule 7), reaches `payTo`, whatever its token or amount, zero included. A payment execution that names no payee's account, its transfers reaching other accounts or it holding none, consumed the nonce and is not the act: at the final mark it is `failed`, `instrument-consumed`, named with what it moved and the reason `other-account`; below it, `pending`, `below-mark`. Where its receipt holds an event with the `Transfer` key of neither layout, it is not shown to name no payee's account, and it is an item the read could not decode (rule 15), or on a named transaction `unreadable`, `unparseable`. 17. Consumed, and the search read to its end with no such transaction found: `pending`, `search-incomplete`, never `not-found` or `failed`. The search reads the asset's events alone, so an execution under the nonce that moved another token, or emitted no `Transfer`, is found only where the reference names its transaction: no index leads from a nonce to the execution that used it. 18. Every other outside execution under either of H's values that succeeded in a transaction the read met is a foreign item, named with the first reason of the closed list that holds: the payee's account signed it, `payee-signed`; another account, `other-signer`; one the caller gave, by its reference or its transaction, `given`; the payer's under H's other value, `other-kind`. The search is keyed on the payer's `Transfer`s, so another account's execution is met only in a named transaction. A transaction that did not succeed decides nothing and is no foreign item. A transaction at or before the position given that is the act or consumed the nonce answers `failed`, `before-position`, naming it. 19. What moved names each `Transfer` by the transaction and the event's index among its receipt's `events` (`event`), and a transfer of zero read from the trace by the transaction and the indexes of the calls that lead to it from the trace's root (`call`); each with its token, recipient and amount. The recipient alone is compared, with `payTo`, on the act `payment`. The signer is the account whose `execute_from_outside_v2` executed. 20. `presented`, on `settled`: `yes` where the executed outside execution's `Caller`, `Nonce`, `Execute After`, `Execute Before` and `Calls`, read from the `execute_from_outside_v2` calldata, signature apart, equal the outside execution as presented; `no` where one differs; `unshown` where the calldata does not show them whole. It decides no answer. 21. A lost settle answer is decided by the read of the nonce and the search, with no transaction hash, save where rule 17 holds. 22. `transaction-failed` and `not-found` are never answered. The read kit's cases this ledger cannot give are declared inapplicable to it: `transaction-failed` and the cases opening *a failed result that consumed the value*, since neither failed outcome consumes the nonce (rules 8 and 9); and `not-found`, since the read always holds the nonce (rule 14). Declared inapplicable also, by the cases' words: *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since the read holds the nonce and reads it at a final block and at the latest block (rule 14); *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every event the search reads names its block (rule 15); *an act found above the final head*, *a search narrowed to one asset, payee or token*, *the validity passed with the value unconsumed and the search for H not read whole*, *instrument-live is answered before search-incomplete*, *an item the search could not decode holds a failed answer*, *instrument-live is answered before an item the search could not decode* and *a second act of the payer that meets every test*, since the nonce is H's low bits, or the agreement value's, keyed by the account alone, so its read at the final mark and at the latest head is the search for H, read whole, which no item changes, a nonce read unconsumed is read with no other search and so meets no item, and every act of the payer that carries H runs under that nonce, which one act consumes, the `Transfer` search that looks for the transaction that consumed a nonce read consumed being no search for H, which can be left with range to read and then answers `pending`, `search-incomplete` at its position (rules 14 to 17); and, on the act `payment`, *an act carrying H that names no account and consumed nothing* and *at coverage full, instrument-consumed waits for the search for H*, since every act of the payer that carries H runs under that nonce and so consumes it, and that read is the search (rules 14 and 15). The case of a validity passed read below the final mark arises (rule 14), and so does a given transaction the read cannot decode, named `given` (rule 13), and so do *transactions carrying H with a failed result*, the payer's own and one the payee signed, since a `REVERTED` transaction is included in its block (rule 8) and any account can sign an outside execution that carries H: with the nonce valid, the read meets them where they are named or given by their transaction, and neither decides anything (rules 13 and 18). *search-incomplete is answered before not-found* arises and is not declared: the read holds the nonce, so the case, whose facts give no value, is the nonce read consumed with no transaction found and the `Transfer` search left with range to read (rule 15), which the profile `read-status`'s order of the `pending` reasons answers alike, `search-incomplete` at the search's position. **Recovery** 23. `recover` takes `{network, tx, option}`, the option's `asset` naming the token, and returns the nonce of the transaction's executed outside execution whose calls reach a `transfer` on that token, as `0x` and 64 hex digits: H's low 250 bits from a payment's transaction, and from an agreement's the agreement value's, which a holder of the ATR computes from its own H and compares. The ledger holds 250 of H's bits, so nothing recovers H itself. Its refusals: a reader for another network, or a `tx` or `asset` that is not a felt, `starknet/wrong-reader`; a failed or malformed read, or a trace beyond lcp's bounds, which it reads no further, `starknet/unreadable`; no receipt, `starknet/not-found`; at `ACCEPTED_ON_L2` or `ACCEPTED_ON_L1`, a reverted transaction `starknet/reverted`, no such execution `starknet/no-transfer`, and executions under two nonces `starknet/ambiguous`, each of which a `PRE_CONFIRMED` receipt, or one that names no block, gives as `starknet/not-final`. **The agreement** 24. The payment can be an agreement: one outside execution the payer signs, paying the payee directly a fixed amount, with no hold, landing whole on one network. The floor is 0 on a token a run has shown to emit a `Transfer` for a transfer of zero on the option's network, since the search finds a payment by its `Transfer` alone, and 1 base unit on any other: on Starknet Sepolia, STRK (`0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d`) and USDC (`0x53b40a647cedfca6ca84f542a0fe36736031905a9639a7f19a3c1e66bfd5080`), each of whose `transfer(to, 0)` emits a `Transfer` of 0 (`starknet_simulateTransactions`, `test/fixtures/starknet-zero-transfer-sepolia.json`); no run has shown one on Starknet mainnet. The option filter takes an amount of `"0"` on a token whose floor is 0 and refuses it on any other. `starknetFloor` evaluates the rule for a token and a network, answering 1 where no network is given, and refuses an asset that is not a felt (`starknet/felt-malformed`) and a network that is not Starknet's (`starknet/network-malformed`). The settler pays the fee, always, through the `Caller` fixed in what the payer signs. The transaction must succeed (rule 7). An outside execution the payee's account signed is no agreement. **What a settler checks** 25. x402's Starknet scheme (`scheme_exact_starknet.md`) states a settler's checks: the typed data and its `Caller`, the token and the recipient against the option, the signature's validity and the nonce's state through the payer's account, a simulation, and, after the transaction, the one `Transfer` of the option's asset to `payTo` for the amount. The server's check of H (rule 5) comes before every one of them, and before anything moves. **What a record proves** 26. A settled read shows that the payer's own signed SNIP-9 outside execution carries H's low 250 bits as its nonce (on an agreement, the agreement value's), which the payer's account verified with its signature when it executed it; and that it paid the account each `Transfer`, or a transfer of zero, names the amount it states, zero included: on a payment, `payTo` among them; where the read observed no transfer, that the payer signed it. A holder of the ATR confirms H's low 250 bits from the nonce; the ledger holds no more of H. It does not show that the amount, the asset or the timing match the ATR's content. --- # x402-exact-stellar-precondition.md Source: https://lcp.integraledger.com/profiles/x402-exact-stellar-precondition.md **LCP profile `x402/exact/stellar/precondition`: the agreement on Stellar under x402, the ATR hash in a signed-payload precondition.** The form is an agreement and never a charge: a buyer's own act over H that a public ledger shows, made before the sale's charge is paid. It is offered as an x402 `exact` option on a Stellar network and is told from every other Stellar option by `extra.assetTransferMethod`. **The option** 1. The option is `scheme` `exact`, `network` `stellar:pubnet` or `stellar:testnet`, `asset` the contract strkey (`C…`) of a Stellar Asset Contract, `payTo` the payee's account strkey (`G…`), `maxTimeoutSeconds` a positive integer whose fifth, rounded up, is at most 2^32 − 1, and `extra` an object holding `assetTransferMethod` `"lcp-precondition"` and `areFeesSponsored` `true`. `amount` is a decimal integer below 2^127 with no sign and no leading zero: `"0"` where the settler declares that it takes zero, and otherwise the token's smallest unit, which the resource server sets and nothing checks. An option whose `extra.assetTransferMethod` is absent or another value is not this form's. An option of this form that fails another member is refused `x402/option-malformed`, and one whose `payTo` is a muxed account (`M…`) `stellar/option-malformed`. 2. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H being the SHA-256 of the ATR's exact bytes as `0x` and lowercase hex and L an `https` URL that serves those bytes. The client fetches L, computes SHA-256 over the bytes received and signs nothing unless it equals H. **Where H rides, and what the buyer signs** 3. The payment is one Stellar transaction whose one operation is `invokeHostFunction` calling `transfer(buyer, payTo, amount)` on `asset`, authorised by the buyer's Soroban authorization entry with address credentials (`SOROBAN_CREDENTIALS_ADDRESS` or `SOROBAN_CREDENTIALS_ADDRESS_V2`), whose root invocation is that same call with no sub-invocations. The buyer is an account (`G…`); any other credential arm, and a contract buyer, is refused before anything is signed. 4. The transaction's preconditions are `PRECOND_V2` holding exactly one signer of type `SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD` (CAP-40) in `extraSigners`: the buyer's Ed25519 key, with the **payload** of exactly 40 bytes: H's 32 bytes, then the authorization entry's `nonce` as its XDR `int64`, 8 bytes big-endian two's complement. H rides whole in what the buyer signs; the payload is never 32 bytes, and binds the buyer's own single-use value beside H. `PRECOND_V2` keeps the time and ledger bounds the transaction already carried. 5. The buyer's key signs two things: SHA-256 of the entry's `HashIDPreimage` (`ENVELOPE_TYPE_SOROBAN_AUTHORIZATION`, or its V2 form with the address) for the network's id, the entry's nonce, its expiration ledger and its invocation; and the 40-byte payload itself, which the signed-payload signer verifies (CAP-40). The entry's signature is written as a Stellar account's is, a vector of one map `{public_key, signature}`; the payload's rides in the presented envelope's `signatures` as a decorated signature whose hint is the key's last 4 bytes XOR the payload's last 4 bytes. The entry's expiration ledger is the current ledger plus `ceil(maxTimeoutSeconds / 5)`. 6. The client builds from the transaction the buyer's wallet simulated, writes the entry's expiration and the precondition, and hands both requests to the buyer's own signer; it signs nothing and calls no network. The payment is x402's `PaymentPayload` with `payload` `{"transaction": }` and `extensions` echoed unchanged. **What the client and the resource server refuse, before anything moves** 7. The envelope is the strict base64 of a `TransactionEnvelope` v1, or a fee bump of one, of at most 8,192 characters (`stellar/tx-too-large`), read whole with no trailing byte (`stellar/tx-malformed`); its operation and the buyer's entry nest ScVal vectors and maps, and authorized invocations, at most 64 levels (`stellar/tx-malformed`). An envelope whose operation is not exactly the call the buyer's entry signs, or is not one `transfer`, is `stellar/not-one-transfer`; one in which the buyer's entry cannot be identified, or is not an address entry of an account, `stellar/no-address-auth`. 8. The client refuses, before the buyer signs: a simulated transfer whose contract is not the option's `asset` (`stellar/asset-mismatch`), whose amount is not the option's `amount` (`stellar/amount-mismatch`), whose `from` is not the buyer the caller names (`stellar/payer-mismatch`), whose `to` is not the option's plain `payTo`, or whose `from` is the option's `payTo` (`stellar/payee-mismatch`); and a simulated transaction that is a fee bump, already holds an extra signer, or whose current ledger or expiration is not a ledger sequence (`stellar/tx-malformed`). 9. The resource server's check of a presented payment (`bound`) refuses: preconditions holding no signed-payload signer, or more than one (`stellar/no-carrier`); a payload that is not exactly 40 bytes, whose last 8 bytes are not the buyer's entry's nonce, or whose key is not a key whose signature the buyer's entry carries (`stellar/carrier-mismatch`); and a transfer whose `from` is the option's `payTo` (`stellar/payee-mismatch`). It gives H, the payload's first 32 bytes, which the resource server compares with the H it issued. It checks how the payment carries H, never what it pays. 10. The read keys (`reference`) refuse a presented payment whose `accepted` is not the option given, compared as RFC 8785 JSON (`x402/accepted-not-option`). **What a settler checks and does** 11. A settler builds the transaction it submits around the buyer's operation and entry, as its source, paying the fee, with the buyer's precondition unchanged, and carries the buyer's payload signature into the envelope's signatures beside its own. It holds the transfer's `to` to the option's `payTo`. A transaction submitted without the payload signature, or with a wrong one, is refused at submission (`txBAD_AUTH`); the signed-payload check reads no ledger state. **The single-use value, the instrument and the lapse** 12. The single-use value is the buyer's entry's nonce, which only a successful landing of the entry consumes. A transaction included with a failed result consumes no nonce and emits no event; the entry can then land again, with the precondition or without. The entry lapses after its expiration ledger: a ledger above it closed with the nonce unconsumed. **The agreement's rules** 13. Floor: zero. The Stellar Asset Contract refuses only a negative amount, still requires the buyer's authorization, and emits its event at zero. The fee is the settler's, as the transaction's source; the buyer needs a key, and no funds where the amount is zero. The agreement holds only where the transaction succeeded (`getTransaction` answers `SUCCESS`, or the inner success under a fee bump, with `INVOKE_HOST_FUNCTION_SUCCESS`) and the five checks below hold. A transaction the option's payee signed is no agreement. An entry can land in an envelope with no precondition, since its signature covers the network, the nonce, the expiration ledger and the invocation, never the envelope: such a landing carries no H and consumes the entry. At zero it moves nothing; at the smallest unit it moves that one unit with no H, a cost stated to sellers. **The read** 14. The five checks, made on the landed transaction, all required: (1) it succeeded; (2) its preconditions hold exactly one signed-payload signer, whose payload is exactly 40 bytes, H then the nonce of the authorization entry the transaction consumed; (3) the payload's key is a key whose signature that entry carries; (4) the transfer's `from` is not the option's `payTo`; (5) the buyer is an account whose entry's credentials are `ADDRESS` or `ADDRESS_V2`. A transaction that passes them for H and the buyer is the agreement, whatever amount or asset it moved and whichever of the buyer's entries it consumed; an agreement is held to no account. 15. The read goes through a Stellar RPC that holds history back to the ledger the search starts from: `getNetwork`, `getLatestLedger`, `getEvents` and `getTransaction`. It finds the buyer's acts with `getEvents` on every contract, by a filter that names none: `transfer` events whose `from` topic is the buyer and `burn` events whose `from` topic is the buyer, from the ledger the caller gives as the search's start to the latest closed ledger at the read. No filter names the payee or the asset. Each candidate's transaction is read whole by `getTransaction`. A stranger can emit events naming the buyer, so at most 50 candidates are read in one call; past them the answer is `pending`, `search-incomplete`, and the next call resumes at the position returned. A throttled or failed page is never read as absence. 16. The mark is one, `finalized`: a transaction in a closed ledger, which is final; the latest closed ledger is the latest head. Positions are written as the position P of the transaction (below); the position the caller gives as the one the transaction must come after is a ledger sequence, and a transaction in that ledger or below answers `failed`, `before-position`. 17. A transaction found that consumed the entry's nonce and is not the agreement, one that carries no H among them, is the transaction of `failed`, `instrument-consumed`. With the search read through to the latest closed ledger and the nonce unconsumed, the answer is `pending`, `instrument-live` before the expiration ledger has passed, and `failed`, `instrument-unused` after it. A search left with range to read, or that met an item it cannot decode, given by the caller or not, reads the nonce neither consumed nor unconsumed: `pending`, `search-incomplete`. Until a run shows that the event search with no contract named holds every act of the buyer, the read proves no absence, and every answer the search decides, each `failed` reason but `before-position`, is `pending`, `search-incomplete`. 18. On `settled` the answer states `presented`: `yes` where the landed entry's `HashIDPreimage` digest and the landed payload are those presented, `no` where either differs. Each transfer is named by its transaction and by the event's id as the RPC gives it; what moved is the event's contract, `to` (its base account, with `to_muxed_id` where the event carries one) and `amount`, recorded as observed. 19. The position P of a transaction is `ledger` × 2^32 + `order` × 2^12, an unsigned 64-bit integer whose low 12 bits are zero: `ledger` the sequence of the closed ledger that holds it, `order` its application order in that ledger, counted from 1, at most 1,048,575; written as a decimal string with no leading zero. A reader given P refuses nonzero low bits and an order of 0 (`stellar/position-malformed`). **What a record proves** 20. "Signed: the buyer's account signed a Soroban authorization of a transfer and the 40-byte payload of this ATR's hash and that authorization's nonce, carried as a signed-payload precondition of the transaction that consumed it, so the buyer's own signed act carries the hash. The transaction succeeded on the asset contract its event names." Where the transfer moved a nonzero amount, "paid" in place of "signed", with the account the value reached. It states nothing of the amount, nor that the asset, the account reached or the time meet a term of the ATR. **The read kit** 21. The read runs the cases of `read-status.json` on the act `agreement` alone, the form being offered as an agreement only. These cases cannot arise on this form, and its vectors skip them: every case answering `below-mark`, and the cases opening *an act read at the finality asked for, below the final mark*, *a value unconsumed at the final mark and consumed at the latest head*, *a value whose validity passed, unconsumed at the final mark and consumed at the latest head* and *a read that did not read the value at the latest head*, since the one mark, `finalized`, is the latest closed ledger, the latest head, at which the nonce is read (rule 16); every case answering `transaction-failed`, and those opening *a failed result that consumed the value*, since a `FAILED` result consumes no nonce (rule 12); every case answering `not-found`, and those opening *a read with no means to read the single-use value*, since every read holds the nonce (rule 17); those opening *an act the read cannot place against the position given* and *an item the search could not decode that gives no position*, since every transaction the read meets is in a closed ledger, at its position P (rule 19); those opening *a value read consumed whose transaction the search has not found*, *instrument-live is answered before search-incomplete*, *instrument-live is answered before an item the search could not decode* and *an item the caller gave by its transaction holds no search though the read cannot decode it*, since the nonce is read only by the search read through (rule 17); and, until a run shows that the event search with no contract named holds every act of the buyer, each case whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which this read answers `pending`, `search-incomplete` (rule 17). These arise and run: an act that transferred zero, since the Stellar Asset Contract transfers zero and emits its event; *the settled act's answer names every foreign item*, since every read makes its search; and *search-incomplete is answered before not-found*. **Vectors** 22. `x402-exact-stellar-precondition.json` holds the payload, the signed-payload signer, the build of the transaction the buyer signs byte for byte, bound, reference, and one refusal vector for each refusal of rules 1, 8, 9 and 10, each a good input with one member changed; `stellar-position.json` holds the position's compositions, Horizon's `paging_token` examples parsed to their ledgers, its refusals and `M(payee, P)`. Their oracle is stellar-sdk 13.0.0 for Python, run outside this package, and each file's `about` names the command; the refusal codes are this profile's. --- # x402-exact-sui.md Source: https://lcp.integraledger.com/profiles/x402-exact-sui.md **LCP profile `x402/exact/sui`: the ATR hash as the one unused Pure input.** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, as in the profile `x402/exact/eip155/eip3009`. The option's `network` is `sui:mainnet`, `sui:testnet` or `sui:devnet`. 2. The client fetches L, computes SHA-256 over the bytes received, and compares it with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client builds the `exact` payment, adds H's 32 bytes as one `Pure` input that no command uses, signs, and echoes `extensions` unchanged. 4. The server refuses a payment whose transaction does not carry exactly one unused `Pure` input equal to an H it issued for that request and has not seen claimed. 5. H is on chain in the executed transaction's input list; whoever holds the digest can read it back while a node retains the transaction. 6. A client that does not implement this profile adds no unused input, and rule 4 refuses its payment before it is verified or settled. **The gas paths.** The buyer signs the gas data, so the path is fixed in the option before the buyer signs, and the seller chooses it. 7. Three paths. **Sponsored**: the option carries `extra.gasStation`, an endpoint of the sponsor, as x402's Sui scheme defines it; the client sends the transaction without gas data there, the sponsor fills the gas data (owner, payment, price, budget) and returns the whole transaction, and the client signs it only where it equals the one it sent in everything but the gas data: its `complete` takes the transaction sent and refuses a signed one that differs from it in the sender, the kind (the inputs and commands) or the expiration, and one given with no transaction sent, `sui/not-as-sent`. The sponsor fills and co-signs only a transaction none of whose commands names `GasCoin` and that withdraws nothing from the sponsor, since Sui lets a sponsored transaction's commands spend the gas coin beyond the budget, and co-signs only gas data its own gas station filled; it keeps a gas coin it filled out of other use until the payment can no longer land. **Gasless**: the option carries `extra.gasless: true`, which the scheme does not define; the gas data holds an empty payment, price 0 and budget 0, and Sui admits the transaction only where it moves a coin type on the network's gasless list, at least that coin type's smallest transfer, with at most one unused `Pure` input and no `Pure` input over 32 bytes, which H's 32 raw bytes meet, and with `MoveCall`, `MergeCoins` and `SplitCoins` commands alone, so the transfer is `0x2::coin::send_funds` to the payee's address balance and never `TransferObjects`. **The buyer pays**: neither member; the buyer owns the gas data. An option carrying both members, or either in another form, is not this pairing's. 8. A settler checks, by x402's Sui scheme, the network, the signature, a simulation showing the transaction would succeed and has not executed, and the payee's balance change; with this profile it also checks the one unused `Pure` input equal to an H the resource server issued, on the sponsored path rule 7's checks, and at `"0"` that the signed transfer names the option's payee. A transaction the buyer already executed, which it can do on the buyer-pays and gasless paths, is judged by its effects (status success, the unused input, the payee's credit) in place of the simulation, and is not refused for having executed. **The read.** `status` reads through a GraphQL endpoint the caller supplies, and states what the transaction shows; it compares no amount, coin type or time with the option. 9. **What moved, and the account a payment names.** What moved is the effects' balance changes, each one owner's net change in one coin type, a coin type being any struct type, with type parameters where it has them, of at most 4096 characters: each positive change is recorded with its coin type, its amount and its owner, the account it reached, named by the digest and its place, `:`. A transfer a signed command names whose recipient no positive change in its coin type shows, a transfer of zero or a SUI transfer the recipient's own gas outweighs where the recipient owns the gas data, is recorded with its recipient, the recipient's net change in that coin type where it has one and zero otherwise, named by the digest and its place, the index of the command: a `TransferObjects` whose address is a `Pure` input of 32 bytes, or a call of `0x2::coin::send_funds(coin, recipient)` whose recipient is one; its coin type is `T`, or SUI where every object transferred is split from the gas coin, and where the bytes show none it is recorded with no coin type. A transfer to the sender, such as the remainder a balance intent sends back, is the sender's own and is not recorded. A payment names the payee's account where one of these entries reaches the option's payee, in any coin, zero included; an agreement is held to no account. 10. **The transaction the digest names.** The digest is Blake2b-256 over `TransactionData::` and the signed bytes, the single-use value: it is fixed before any money moves and executes once. The transaction the endpoint returns for it must hash to it, decode, and carry the H asked about as its one unused `Pure` input; otherwise the answer is `unreadable`, `unparseable`, and it releases nothing. Its signer is the sender. It succeeded where its effects' status is success; with status failure it was included with a failed result, gas charged, and it consumed the digest: it is no agreement, it moved nothing, and the account it names is the recipient a signed transfer names (rule 9), the one `read-status.md` rule 20 compares with the option's payee. 11. **Marks.** One mark a query can ask for, `final`: certified effects in a checkpoint, every checkpoint being final. A transaction the endpoint returns with no checkpoint, executed and not yet in one, is in the state `executed`, below that mark, after every checkpoint and so after the position given: `pending`, `below-mark`, naming it, never `settled`. The position is the checkpoint's sequence number. 12. **The lapse.** The transaction can no longer land once the epoch is past the last epoch its expiration names (`Epoch`, or the `maxEpoch` of `ValidDuring` or `Validity`); one with no epoch has no readable bound and is never `failed`. The epoch is read at the search's head (rule 13), or at the endpoint's latest checkpoint where it states no range for the sender filter. An absent digest while the endpoint holds transactions from the position given and the epoch is not past the bound can still land: `pending`, `instrument-live`, and sending the same bytes again gives the same digest. 13. **The search for H.** The digest is over the whole signed data, not over H alone, so its read is no search for H: every `failed` but `before-position` (a lapse, a transaction found by the digest that is not the act asked about, one included with a failed result) waits for the search. It reads the sender's transactions, the sender the reference names, through `transactions` filtered by `sentAddress`, `afterCheckpoint` (the position given, or the search position an earlier answer returned) and `beforeCheckpoint` (one past the search's head), page by page forward until `hasNextPage` is false, at most 8 pages a call. Its head is the last checkpoint of the range the endpoint states it holds for that filter, `serviceConfig.availableRange(type: "Query", field: "transactions", filters: ["sentAddress"])`. Each transaction is read as rule 10 reads the digest's, and is an act of this pairing where its one unused `Pure` input is H: one that succeeded and meets read-status rules 7 to 9 is the act asked about, answered `settled` on it whatever it moved; one signed by the option's payee, one that names no account of the payee's on a payment, and one the caller gave are foreign items; one with a failed result settles nothing; none stops the search. A transaction the endpoint names by its digest and checkpoint that does not hash to that digest, does not decode, or whose other members are out of the reader's form, is named among the items the search could not decode, holds the search's position at the checkpoint before it, and fails nothing else of its page (read-status rule 19); a page whose items cannot be named by a digest and a checkpoint in the range, in checkpoint order, is `unreadable`, `unparseable`. The search's position is the last checkpoint all of whose transactions of the sender were read; the next call takes it. 14. **History.** An absence counts only where the endpoint states that it holds transactions from a checkpoint at or before the position given (`availableRange(type: "Query", field: "transaction")`); otherwise the answer is `unreadable`, `history-gap`. The search is complete only where the range it states for the sender filter begins at or before the position it reads from; a range that is not stated, or begins later, is `unreadable`, `history-gap`. 15. **Not yet shown.** That a GraphQL endpoint serves `sentAddress` with both checkpoint bounds, states the range it holds for that filter, returns the sender's transactions in checkpoint order with their bytes, and answers the range and every page of one search from one view, has not been shown by a run. Until a run shows it, a search read whole proves no absence (read-status rule 25): where the read would answer `failed` for any reason but `before-position`, it answers `pending`, `search-incomplete`, the search's position at its head. **The agreement.** A payment of this pairing can itself be an agreement. 16. The floor is a rule by gas path: zero where the buyer or a sponsor pays gas, until a run shows it; on the gasless path the coin type's smallest transfer on the network, a parameter of the ledger: the minimum Sui's protocol configuration lists for the coin type among the tokens a gasless transaction may move (`gasless_allowed_token_types`), which the resource server reads for the option's network when it issues the offer. On the gasless path the floor is the larger of that parameter and 1, so it is never an amount the option filter refuses. `suiFloor` evaluates the rule from the gas path and that parameter, and refuses a gas path or a parameter it cannot read (`sui/floor-input`). The option filter admits an amount of `"0"` where a sponsor or the buyer pays gas, and not on the gasless path. Who pays the fee is rule 7's path. The transaction must succeed (rule 10). A transaction whose sender is the option's payee is no agreement, on either act: the read names it a foreign item and never answers `settled` on it. **The reference.** 17. `reference` gives the network, the digest, the last epoch the expiration names or none, the sender, and the option's payee, the `payTo` of the option it is given, which is the key of the two party tests and no search key. It refuses a payment whose `accepted` is not that option, compared by RFC 8785 form (`x402/accepted-not-option`). A `settled` answer states `presented`: `yes` where its transaction has the reference's digest, which is over the whole transaction data the buyer signed, its signatures apart, and `no` where it is another the search found. **The read kit.** 18. Declared inapplicable to the read kit: `not-found`, since the read reads the digest, which is the single-use value itself; a value read consumed whose transaction is not found, since the value is the transaction (its cases: *a value read consumed whose transaction the search has not found*, *a value unconsumed at the final mark and consumed at the latest head* and *a value whose validity passed, unconsumed at the final mark and consumed at the latest head*); *an act read at the finality asked for, below the final mark*, since a seller names the one mark; *an act found above the final head*, *a transaction that consumed the value, read below the final mark* and *below-mark is answered before instrument-live*, which give a transaction below the final mark a position, where such a transaction is in no checkpoint, the vectors holding the read's `below-mark` for one (rule 11); *the validity passed with the value unconsumed, read below the final mark*, since the epoch is read at a final checkpoint (rule 12); *an act of another pairing or kind carrying H*, since every transaction whose one unused `Pure` input is H is an act of this one pairing, an agreement and a charge alike (rule 13); *each transfer of what moved is named by its transaction and its place in it*, since the effects carry one net balance change per owner and coin type, so two transfers of one asset to one account in one transaction are one entry of what moved (rule 9); *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since every transaction the read meets is in a checkpoint or after all of them; *a read with no means to read the single-use value* and *a read that did not read the value at the latest head*, since the read reads the digest at the latest checkpoint; *the settled act's answer names every foreign item*, *instrument-live is answered before search-incomplete* and *instrument-live is answered before an item the search could not decode*, since the search is made only before a `failed` (rule 13); and, while the search proves no absence (rule 15), each case at coverage `full` whose answer on an act is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the search's gate holds: the vectors hold the read's answer to such a case, `pending`, `search-incomplete`. A case is named by its reason, or by the opening words of its text in `read-status.json`. 19. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/sui`: The payer, the sender, signed a Sui transaction whose one unused Pure input is this ATR's hash, and the network executed it successfully in a checkpoint after the position the read was given; the hash is on chain in its input list, readable by its digest while a node retains it. The sender is not the option's payee. Where the transaction moved value it paid each account a positive balance change names; where it moved nothing it was signed, naming the recipient its signed transfer names. What it moved is recorded as observed: this does not show that amount, coin type or timing match the ATR's content. --- # x402-exact-tron-lcp-trc20-memo.md Source: https://lcp.integraledger.com/profiles/x402-exact-tron-lcp-trc20-memo.md **LCP profile `x402/exact/tron/lcp-trc20-memo`: the ATR hash in a payer-signed TRC-20 transfer's memo.** *Scope.* x402 v2, `scheme` `"exact"`, `network` `tron:` (CAIP-2), `extra.assetTransferMethod` `"lcp-trc20-memo"` (required). It defines this transfer method until x402 or MPP defines Tron. The default flow is `authorization`, and `upfront` is allowed. 1. The resource server's option gives `amount` in the token's atomic units as the canonical decimal of a positive integer (digits only, the first not `0`), or `"0"` for a contract on the list of contracts a run has shown to succeed and log `Transfer` on a `transfer(to, 0)`, by network and address, which is empty until a run shows one, `asset` (the TRC-20 contract) and `payTo` in base58check, and `maxTimeoutSeconds` as an integer from 1 to 86,340. `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, where H is the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L is an `https` URL that serves them. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs one transaction and sends it as `payload.transaction`, the serialized `Transaction` in lowercase hex. It echoes `extensions` unchanged. The transaction's `raw_data` holds: - exactly one `TriggerSmartContract`, from the payer to `asset`, calling `transfer(payTo, amount)` with no call value; - `data` = the 77 ASCII bytes `lcp:sha256:` followed by H; - `timestamp` = now and `expiration` = now + `maxTimeoutSeconds` × 1000, in milliseconds; - a recent reference block, and the client's own `fee_limit`. The signature is the payer's secp256k1 signature over SHA-256 of the serialized `raw_data`. `build`'s `tron-txid` request carries, beside `txid`, `rawBytes`: the serialized `raw_data` whose SHA-256 is `txid`, which `tronRequest` reads back to that id and to every field the payer signs. 4. The payer pays every fee: energy, bandwidth and the network's memo fee. Nothing in this profile sponsors them. 5. A facilitator's `/verify`: - decodes the transaction, and requires rule 3's shape on `asset`, for `transfer(payTo, amount)` exactly; - requires `data` to be an LCP `sha256` string; - requires signatures that the owner's permission accepts; - requires `expiration` to be in the future and no later than now + `maxTimeoutSeconds`. It should also simulate with `/wallet/triggerconstantcontract`, a recommendation and not a requirement. Its `/settle`: - repeats `/verify`; - broadcasts with `/wallet/broadcasthex`; - deduplicates settlements by transaction id, atomically, until `expiration` passes; - answers `success: true`, with `transaction` = the id in hex and `payer` = the owner, only when a node reports the transaction in a block with receipt result `SUCCESS` and H in `raw_data.data`, the owner being the payer. The `Transfer` logs the receipt holds whose sender is the owner are what the transaction moved, recorded as observed; a transaction whose receipt holds no `Transfer` log moved nothing, save a signed `transfer(to, 0)` of a token that logs nothing for zero, a transfer of zero to its `to`. A transaction is the payment only where one of those names `payTo`; one that names no account pays no one. 6. The resource server refuses a payment whose `data` does not decode to an H that it issued for that request and has not seen claimed. 7. Declarations for x402's facilitator-submitted family: - fee payer: the payer, self-funded; - replay primitive: the transaction id, exclusive to this payment; - validity window: bounded by `expiration`, at most 24 hours by the node; - duplicate submission: a node rejects a duplicate, and settlements are still deduplicated as rule 5 requires. 8. H is on chain as `raw_data.data`, inside the bytes whose SHA-256 is the transaction id the payer signed. The payment is read by the transaction id, the single-use value, which the chain derives from the signed `raw_data` alone, through a FullNode's `/walletsolidity` API for solidified data (the final mark), then its `/wallet` API at the head; H is read back by the same id through its `/walletsolidity` API. No index searches memos. The read is the profile `read-status`'s, with these facts: - **The marks** are `head` and `solidified`, the final mark; a position is a block number. The reference holds the `raw_data` the owner signed, the payment presented, its id, its owner as the payer, and the option's payee. - **Succeeded** means the receipt's result is `SUCCESS`, with H in `raw_data.data` and the reference's payer, the owner read from the signed bytes, as the owner. A result other than `SUCCESS` (`REVERT`, `OUT_OF_ENERGY`) is included with a failed result, which consumed the id: it moved nothing, and the account it names is its signed call's `to`. - **What moved** is each `Transfer` log of the receipt whose sender, the address its second topic names (`0x41` and the topic's last 20 bytes, TRC-20's `Transfer(address indexed _from, address indexed _to, uint256 _value)`), is the transaction's owner: its emitter, the recipient its third topic names and the amount in its data, recorded as observed and compared with no term, no sender recorded, named by the transaction id and the log's place among the receipt's logs. A receipt that holds no `Transfer` log, whose signed call is a `transfer(to, 0)`, names that call's `to`, recorded as a transfer of zero to it, named by the place `call`. On the act `payment` the transaction is the payment only where one of those names `payTo`, whatever contract emitted it; one that reaches only other accounts, and one that holds neither, names no payee's account. An agreement is held to no account. A transaction whose owner is the option's payee is never the act asked about, on either act. - **Who signed.** An answer that names a transaction names its owner, in base58check, as the signer, and its contract's `Permission_id`, field 5 of `Transaction.Contract` in `Tron.proto`, as the authority it acted under: `Permission_id 0`, the owner's permission, where the transaction names none, as a transaction of this form does (rule 5). - **The payment presented.** On `settled`, `presented` is `yes` where the settled transaction's id is the presented one's, the id being the SHA-256 of the `raw_data` the owner signed, and `no` otherwise. - **Absence and the history.** The id's validity has passed once the solidified head, read first, is two slots (6,000 ms) or more past `expiration` and neither lookup finds the transaction, each naming a latest block at its level at or past that head's time; a lookup whose node lags that head, or names no time, proves no absence: `pending`, `search-incomplete`. Absence also needs the history: the node's answer to `/walletsolidity/getblockbynum` at the position the caller gives; `{}` there from a node whose solidified head is at or past it is `unreadable`, `history-gap`, and from one below it proves no absence. With no position given, absence is `history-gap` unless the caller declares its node archival (`archival` on the reader). Absent, with the history shown, before the lapse: `pending`, `instrument-live`. - **The search for H.** The id is derived from all of `raw_data`, not from H alone, so a transaction the payer signs again over H has another id, and the read by id is no such search. Only a `failed` answer needs the search, which the read makes only then: it reads every block after the position the caller gives, or after the search position an earlier answer returned, up to the solidified head read first by `/walletsolidity/getblockbylimitnext`, and on to the full node's head by the same call under `/wallet`, at most 100 blocks a call and `TRON_BOUNDS.searchBlocks` blocks a read; a block missing from an answer is read alone by `getblockbynum`, and an answer over the reader's byte bound is read again in halves down to one block. Its key is a transaction's `data`, field 10 of its `raw_data_hex`, equal to H's LCP string, its hex digits in either case, as rules 5 and 6 read H there. Each transaction found is read by its id at its block's level: one of the form, its owner the payer and not the payee, that succeeded and, on a payment, names `payTo` is the act asked about, `settled` at `solidified` or, above the solidified head, `pending`, `below-mark`; any other is a foreign item where a reason holds, an act of another contract with H in its `data` being of another kind, and one with a failed result decides nothing. The search is complete when each block's `number` is the one asked, its `parentHash` the `blockID` of the block before it from the block at the position given, and the last block of each part that part's head. Its position is the last block linked, by number and `blockID`, at or below the solidified head; a link that fails starts it again at the position given; a block missing from the node below it, a found transaction whose receipt its lookup does not return, and a block whose transactions are not hex hold it at the last block linked; a transaction that is no protobuf message is an item it could not decode, held there and named by its id; `{}` for a block from a node at or past it is `history-gap`, and one block over the byte bound `too-large`. - **The gate.** The link shows the chain of headers, not that a block's answer lists every transaction of its block. Until a run on a test network shows that, at each level, a complete search proves no absence: a failed receipt, a receipt that names no payee's account, a transaction the payee owns and a lapse each answer `pending`, `search-incomplete`, with the search's position, and no `failed` but `before-position` is answered. - **Cases that cannot arise.** The read kit's cases that cannot arise on this ledger, each named by its reason or the opening words of its text: `not-found`, since the read always holds the value; *a value read consumed whose transaction the search has not found*, *a value unconsumed at the final mark and consumed at the latest head* and *a value whose validity passed, unconsumed at the final mark and consumed at the latest head*, since the value is the transaction id, read consumed only by the lookup that returns its transaction; *a read with no means to read the single-use value*, *search-incomplete is answered before not-found* and *a read that did not read the value at the latest head*, since the read holds the id and looks it up at the solidified level and at the head; *the settled act's answer names every foreign item*, *instrument-live is answered before search-incomplete* and *instrument-live is answered before an item the search could not decode*, since the search is made only before a `failed`; *an act the read cannot place against the position given* (its three cases) and *an item the search could not decode that gives no position*, since the search reads blocks by number; *the validity passed with the value unconsumed, read below the final mark*, since `expiration` is compared with the solidified head alone; and, until the run the gate names, the cases at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`. 9. **The agreement.** The payment form is also offered as an agreement, at the floor: 1 base unit, held per network and contract; rule 1 admits `"0"` only once a run on a network and contract shows that its `transfer(to, 0)` succeeds and logs a `Transfer`, and no contract is so shown yet. The buyer pays every fee (rule 4); another party can only delegate resources to the payer's account in advance, which pays no one sale's fee. The transaction must succeed (rule 8); a transaction the option's payee owns is no agreement and no proof, on either act. A transaction included with a failed result is no agreement; it consumed the id, and the buyer signs again. 10. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/tron/lcp-trc20-memo`: The payer, the transaction's owner, signed a Tron transaction whose memo is this ATR's hash in LCP string form, and whose one contract calls transfer on the token. The network verified the signature, which covers the memo through the transaction id, and the receipt's result is SUCCESS, at the finality recorded. Where the receipt holds Transfer logs from the owner, the transaction paid, with each recipient and what moved; where it holds no Transfer log and the signed call is a transfer of zero, it paid zero to that call's recipient; where it holds neither, the payer signed, and no account is named. The owner is named as the signer, and its Permission_id as the authority. This does not show that amount, token or timing match the ATR's content. --- # x402-exact-tvm.md Source: https://lcp.integraledger.com/profiles/x402-exact-tvm.md **LCP profile `x402/exact/tvm`: the ATR hash as the comment in the forward payload of the Jetton transfer a payer's W5 wallet signs.** *Scope.* x402 v2, `scheme` `"exact"`, `network` `tvm:-239` (mainnet) or `tvm:-3` (testnet), as x402's TON scheme defines it (`specs/schemes/exact/scheme_exact_ton.md` at `x402-foundation/x402@88b66dd4`, "the scheme" below). The option names no `extra.assetTransferMethod`, its `extra.paymentFlow` is absent or `"authorization"`, and its `extra.areFeesSponsored` is `true`. The stock client and settler are `@x402/tvm` 2.30.0, cited by its source files. 1. **Where H rides.** The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, H the SHA-256 of the ATR's exact bytes as `0x` lowercase hex and L an `https` URL that serves them; and the option's `extra.forwardPayload` is the base64 bag of cells of one cell with no references: 32 zero bits, TEP-74's text comment tag, then the 77 UTF-8 bytes `lcp:sha256:` followed by H. A stock client copies `extra.forwardPayload` into the Jetton transfer as a reference (the scheme, lines 71 and 174; `src/codecs/jetton.ts:43-44`), so H is in the bytes the payer signs, whole. A stock server always fills `extra.forwardPayload`, by default with the cell of one zero bit, `te6cckEBAQEAAwAAAUD20kA0` (`src/utils.ts:60-62`; `src/exact/server/scheme.ts:98-99`, `:116`). `advertise` reads that cell, in any bag of cells that decodes to it, as an empty carrier and places H's comment there; an option whose `extra.forwardPayload` holds any other cell but H's own comment is refused `tvm/carrier-occupied`. `unplaced` drops `extra.forwardPayload` whatever it holds, so the option as the stock server offered it and as placed unplace alike. 2. **What the payer signs.** One W5 (v5r1) `internal_signed` request: op `0x73696e74`, the wallet id, `valid_until`, the sequence number, the action list as `Maybe ^Cell` holding exactly one `action_send_msg` behind an empty list, and `has_other_actions` 0, signed by the wallet's Ed25519 key over the request cell's representation hash; the signature is the body's last 512 bits. The one message is internal and bounceable, to the payer's Jetton wallet of `asset`, and its body is a TEP-74 `transfer`: a query id, `amount`, the destination `payTo`, the response destination `extra.responseDestination` or `addr_none`, no custom payload, the forward TON amount `extra.forwardTonAmount` or 0, and the forward payload as a reference to H's comment. `valid_until` is the client's clock plus `maxTimeoutSeconds`. The message carries a value above the forward TON amount and at most 30,000,000 nanotons above it, the stock settler's cap (`src/exact/facilitator/scheme.ts:326-329`; `DEFAULT_JETTON_WALLET_MESSAGE_AMOUNT`, `src/constants.ts:14`): `build` refuses an `attachNanotons` at or below the forward amount `tvm/value-too-low`, and above the cap `tvm/value-too-high`. The payment's payload is `{settlementBoc, asset}`: an internal message to the payer's W5 wallet, value 0, with the wallet's state init where the wallet is not deployed, whose body is the signed request. `build`'s `ton-w5` request carries, beside `hash`, `signedBoc`: the request less its signature as a base64 bag of cells of one root whose representation hash is `hash`, which `tvmRequest` reads back to that hash and to every member the wallet key signs. 3. **What the resource server refuses**, before anything moves: an option whose forward payload is occupied (rule 1); a payment whose Jetton transfer carries no forward payload holding a comment with an ATR hash (`tvm/payload-not-lcp`), or one other than the option's (`tvm/carrier-mismatch`); a body W5 does not run as one `internal_signed` request (`tvm/not-w5-signed`); an action list that is not exactly one `action_send_msg` behind an empty list with `has_other_actions` 0, whose one action's send mode is other than 1 or 3, the two the scheme admits (line 170), or whose message is not bounceable, `tvm/actions`, the error under which the stock settler's codec refuses each (`src/exact/codec.ts:61`, `:66-72`); and a bag of cells over 8 KiB, 512 cells or depth 32 (`tvm/boc-too-large`). A request with any other mode is refused because TON's other modes include those that remove the sending account once its balance reaches zero, and with it the sequence number rule 6's read rests on. 4. **What a settler checks**, by the scheme (lines 150-180): the signature against the wallet's key, the wallet's code on the scheme's list, which holds W5R1's `20834b7b72b112147e1b2fb457b84e74d1a30f04f737d4f62a668e9552d2b72f` (line 166), the amount, destination, response destination, forward TON amount and forward payload against the requirements' effective values, the attached value against the cap of rule 2, `valid_until`, and the sequence number. The settler relays the signed request to the payer's W5 wallet from its own wallet and pays the gas, always: the scheme defines only that flow (lines 16 and 24). 5. **The reference** `reference(presented, option)` gives: the network; the option's payee, its `payTo` as a raw address, for both party tests of rule 6 and no search key; H; the representation hash of the request body, its signature included, by which the read finds the request; `signedHash`, the representation hash of the request with its signature removed, the hash the wallet key signs, which holds the members of the payment presented: the W5 request the payer signed, whole, its signature apart; the representation hash of the Jetton transfer's body; the payer's W5 wallet and its Jetton wallet, raw; `validUntil`; `seqno`, the sequence number the request was signed against, the single-use value; and `codeHash`, the representation hash of the code in the state init, where the payment carries one. It names no asset. It refuses a presented payment whose `accepted`, its forward payload apart, is not `option`, its forward payload apart, as RFC 8785 compares them, `x402/accepted-not-option`: the payment answers another option. 6. **The read.** `status` (profile `read-status`) reads a TON Center v3 index through a reader the caller supplies. A position is a masterchain block's sequence number, and a transaction is at a position by its `mc_block_seqno`. The marks are `confirmed` and `finalized`, TON Center's finality states 1 and 2; the final mark is `finalized`. A run of a request is a transaction of the W5 wallet that did not abort, whose inbound body is a request W5 runs as signed, `internal_signed` or `external_signed`, and whose data hash changed. The act is found by the request's body hash among the W5 wallet's transactions, then the Jetton `transfer` message its run sent, the payer's Jetton wallet's transaction that took it, and that wallet's `internal_transfer` to the Jetton wallet that took it. - **Succeeded** means three transactions, none aborted: the W5 wallet's run sent the Jetton `transfer`, the payer's Jetton wallet sent `internal_transfer`, and the Jetton wallet it reached took it. A run that sent no Jetton `transfer`, a Jetton wallet that sent no `internal_transfer`, and a delivery that aborted are failed results that consumed the sequence number. A failed result moved nothing, so the account it names is the destination of the Jetton `transfer` the payer signed; it is the act's own failed result, `transaction-failed`, only where it carries H and, on the act `payment`, that destination is the option's payee, and any other is the transaction of an `instrument-consumed` answer (profile `read-status`, rule 20). An aborted W5 transaction, and one the wallet refused for its signature, which returns without aborting, sends nothing and leaves the data hash unchanged, consume nothing and are read as a request not seen. - **The two party tests.** On either act the W5 wallet, the signer, is not the option's payee; where it is, the run is a foreign item, `payee-signed`. On the act `payment` the delivering account is the payee's Jetton wallet of the payer's Jetton wallet's master, the master's `get_wallet_address` for `payTo`, read through the index's `runGetMethod`, the master read by `get_wallet_data` on the payer's Jetton wallet; where it is another, the run names another account, `other-account`. An agreement is held to no account. Neither the Jetton nor the amount is compared with anything. - **What moved** is each Jetton `transfer` carrying H the run sent, one for a request of this form: the payer's Jetton wallet's master as the asset, the `internal_transfer` amount, zero included, and the delivering account, named by the W5 transaction and, among its out messages, as its `place`, the Jetton `transfer` message's hash. The signer is the W5 wallet. On `settled`, `presented` is `yes` where the act is the request found by its body hash, or where the run's request, its signature apart, has the reference's `signedHash`, `no` where it has another, and `unshown` where the read cannot hash it: the read hashes the ordinary cells it decodes, and a request holding an exotic cell is `unshown`. A reference without `signedHash` is no reference: `status` answers `unreadable`, `unparseable`, with nothing read. - **The expiry read, which is the search for H.** The read takes the index's statement of the masterchain blocks it holds, from its first block through a finalized block, with that block's time; the wallet's state as the index holds it, its status, code hash, sequence number and last transaction; and the wallet's transactions from that last one back, each by its predecessor, to the first at or before the position the caller gave, or to the wallet's first, at most 256. Each listed transaction gives its inbound body, whether it aborted, its out messages with their bodies, its masterchain block, its predecessor, and the account's status and data hash before and after it, the status being TON Center v3's `orig_status` and `end_status`: a transaction whose account did not exist before it, the wallet's deploy, gives the status `nonexist` before it, though the index's `account_state_before` then states no `account_status`, so the search does not hold there. A wallet is W5 where its code hash, from its state, or from the reference's `codeHash` while it is `uninit` or `nonexist`, is W5R1's. Every listed run whose Jetton `transfer` carries H, at the signed number or another, is followed as the request is, and tested by the two party tests; a listed run whose out message is a plain comment holding H is an act of another kind, `other-kind`. W5 also runs the actions an installed extension sends it, op `extn` (`0x6578746e`), from the extension's own account, with no signature of its key and no sequence number (`wallet_v5.fc`, `recv_internal`, at `ton-blockchain/wallet-contract-v5@ff2a9cdb`): a listed transaction of that op whose Jetton `transfer` carries H is followed as a run is, and is a foreign item signed by the extension's account, `payee-signed` where that account is the option's payee and `other-signer` otherwise; it consumes no sequence number. The single-use value is read consumed where a listed run is at the signed number, where the wallet is `active` with a number above the signed one, or where a listed transaction removed the account or deployed it, whose number then starts anew; it is read at the latest head from the wallet's state, and an active wallet whose state the index gives without its number is not read there, which never answers `instrument-live`; it is read consumed at the final mark only where that run lies at or below the stated finalized block, or where the wallet's last transaction does; it has lapsed where the latest head is more than 60 seconds past `validUntil`, a W5 transaction running at its shard block's time, which a masterchain block references only later, and it is read at the final mark only where the stated finalized block is also past that time. A listed transaction whose inbound body, request or Jetton `transfer` the read cannot decode is an item the search could not decode: it is named, in the order of the masterchain blocks, and holds the search there, and it is never `unreadable`. Of two acts that meet every test, the earlier is answered. A frozen account, its code removed, runs no request until a message restores the state its hash fixes, its number among it, so it reads as `uninit` and `nonexist` do: its number not passed, W5 where the code hash its state or the reference gives is W5R1's. A listed run is matched to an other act the caller gave by its reference by the reference's `signedHash`, or by its `requestBodyHash`, the run's inbound body hash; a listed transaction whose account is not a raw address is out of the reader's form. A wallet that is not W5 gets no expiry read: the read has no means to read its value, the lookup by the request's body hash is its search, read whole where the stated block's time is at or past the latest head, and its history is shown where the stated first block is at or before the position the caller gave, or, where the caller gave none, is the masterchain's first. - **Not yet shown.** No call by which a TON Center v3 index states the blocks it holds is named in its API definition, and that its wallet state holds every transaction of the blocks it states, and that its listed transactions link whole, have not been shown by a run. The search is therefore never read whole, through any reader, and no answer but `before-position` is `failed` until a run shows both (profile `read-status`, rule 25); no caller's statement stands in for that run. A list read to its end gives no search position. - **The search position** names two transactions of the wallet's list, each by its hash and logical time: `top`, the newest the search had listed, and `next`, the one it reads next. The list is a linked list read back from its newest transaction, so a call given a search position lists the transactions above `top`, which landed since, then reads on from `next`, the ones between having been read, and a wallet with more transactions than one call lists is read whole over several. The answer holds the search at the first transaction it must read again: where a run's message is not yet taken, or a transaction lacks a member the read takes, that transaction; where a link does not hold or the list's bound is reached, the transaction it reads next; and where such a transaction is above the given `top`, at the position given. The request found by its body hash alone holds no place in the list. 7. **What a record proves.** At coverage `full`: the payer's W5 wallet signed a request whose one Jetton transfer carries H in its forward payload, and ran it; it paid, through its Jetton wallet, the amount the `internal_transfer` names, zero included, to the Jetton wallet that took it, the recipient; where the read observed no transfer, the W5 wallet signed. The signer is the W5 wallet, named apart from the recipient. Nothing in the record shows that the amount, the Jetton, the payee or the time match the ATR's content. 8. **The agreement.** The payment can itself be the agreement: coverage `full`, single use, one payer-signed act paying a fixed amount with no hold. Its floor is zero: the scheme asks equality with no floor, and the stock settler and the standard Jetton wallet take a zero (lines 155 and 171); so the option filter admits an `amount` of `"0"`, which `build` writes as a Jetton `transfer` of zero. The settler pays the fee, always. The agreement is the request's run that meets "succeeded" (rule 6); a failed one is no agreement. A request the payee's own W5 wallet signed is no agreement and settles no payment, on either act. 9. **The read kit** (profile `read-status`, rule 28). Declared inapplicable to the read kit: while the expiry read releases nothing (rule 6, *Not yet shown*), the cases its gate holds, each case at coverage `full` whose answer on the act is `instrument-unused`, `instrument-consumed` or `transaction-failed`, its search resting on the fact not yet shown; this pairing's vectors and its read give such a case `pending`, `search-incomplete`. The cases of a transaction that carries H under another account's signature, `other-signer`, arise: a W5 wallet runs the actions an extension it has installed sends it, with no key and no sequence number (rule 6). The read-kit form makes one case in this ledger's own spelling, where the rule that decides it treats the two alike: a transaction another account signed that consumed the value is the payer's own run at the signed number, since only a run of a request the wallet's key signed consumes it (rule 16 of `read-status` decides `before-position` before it asks who signed). 10. **Recovery.** `recover({network, tx, option}, reader)` reads the transaction `tx` names, the payer's Jetton wallet's transaction that took the Jetton `transfer`, and returns the H of the comment in its inbound `transfer`'s forward payload. It needs no member of `option`, which must be an object. --- # x402-exact-xrpl.md Source: https://lcp.integraledger.com/profiles/x402-exact-xrpl.md **LCP profile `x402/exact/xrpl`: the ATR hash as the digest the Payment signs in its `InvoiceID`.** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`, as in the profile `x402/exact/eip155/eip3009`, and the chosen option's `extra.invoiceId` is H's LCP string, `lcp:sha256:0x` and 64 lowercase hex digits; an option already holding another `invoiceId` is refused `xrpl/carrier-occupied`. The option is an `exact` option on an `xrpl:` network whose `extra.areFeesSponsored` is present and `false` (the payer pays the fee), and whose `extra.assetTransferMethod` is absent, `sequence` or `ticketSequence`. 2. The client fetches L, computes SHA-256 over the bytes received, and compares it with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs one `Payment`, as the stock `@x402/xrpl` 2.30.0 client writes it from the option: `InvoiceID` the SHA-256 of `extra.invoiceId`'s UTF-8, 64 hex digits; `Destination` the option's `payTo`; `Amount` drops of XRP, or the issued currency's `{currency, issuer, value}`; the account's `Sequence`, or `Sequence` 0 with a `TicketSequence`; a `LastLedgerSequence`; and no `NetworkID` on a network whose id is at most 1024, the network's own id above that, as rippled reads it. It may be single-signed or multisigned. 4. The server refuses a payment whose signed `InvoiceID` is not the one the option names (`xrpl/carrier-mismatch`), whose option's `invoiceId` is not an LCP string (`xrpl/carrier-not-lcp`), whose blob carries a `NetworkID` a node of the option's network does not take (`xrpl/network-mismatch`), or whose blob is over 16,384 bytes (`xrpl/blob-too-large`), before it is verified or settled. A settler's `/verify` also refuses `Delegate` and `Memos`, as x402 requires of every facilitator. 5. H is on chain only as its digest: the `InvoiceID` can be confirmed from the ATR's bytes, and H cannot be recovered from the ledger alone. `recover` reads the transaction by its hash, validated with `tesSUCCESS`, and returns the value it carries in H's place, the `Payment`'s `InvoiceID`, as `0x` and 64 lowercase hex digits; it reads no member of the option. A holder of the ATR computes the SHA-256 of the UTF-8 bytes of its own H's LCP string, `lcp:sha256:0x` and H's 64 lowercase hex digits, and compares the two as 32 bytes (read-status rule 27). 6. A client that does not implement this profile writes another `InvoiceID`, or none, and rule 4 refuses its payment. **The reference.** 7. `reference` gives the network, the presented transaction's hash, H, the option's payee (the `payTo` of the option it is given, the key of the two party tests and no search key), and the payer's instrument as signed: its `Account`, its `Sequence` or ticket, its `LastLedgerSequence`, and its signed body, every field but `TxnSignature`, `SigningPubKey` and `Signers` in the codec's canonical encoding. It refuses a payment whose `accepted` is not that option, compared by RFC 8785 form without `extra.invoiceId` (`x402/accepted-not-option`). **The agreement.** 8. A payment of this pairing can itself be an agreement. The floor is 1 drop of XRP, a `Payment` of zero being malformed; an agreement option names XRP. The buyer pays the fee, in the `Payment` it signs. It succeeded where the transaction is in a validated ledger with `meta.TransactionResult` `tesSUCCESS`; a validated `tec` result destroys the fee, delivers nothing and consumes the sequence number or ticket, and is no agreement. The payee's own signature is no agreement: a `Payment` whose `Account` or `Delegate` is the option's payee is never the act, and one that carries H is a foreign item, `payee-signed`. **The read.** `status` reads a rippled or Clio server through the caller's reader (`server_info`, `tx`, `account_tx`, `account_info`, `ledger_entry`), each `account_info` and `ledger_entry` call naming its ledger, `validated` or `current`, never the server's default; it compares no amount, asset or time with the option. 9. **Marks.** One mark a query can ask for, `validated`: the final mark. A transaction the server answers in a ledger it has not validated was read at `current`, which is no mark: an act there is `pending`, `below-mark`, never `settled`. The position is the ledger index. 10. **Found by the instrument.** The payment is found by the payer's `Account` with the signed `Sequence` or `TicketSequence`, never by a hash, which only helps to look: a re-signed or differently multisigned copy has another hash and is the same payment. The sequence number is read at the validated ledger and at the current one (`account_info`), a ticket by its `ledger_entry`. A `settled` answer states `presented`: `yes` where the act's signed body equals the reference's, its signatures apart, and `no` otherwise. 11. **What moved, and who signed.** What moved is `meta.delivered_amount`, never `Amount`: drops of XRP, an issued currency as `CUR:issuer`, or an MPT by its id, recorded with the `Destination` it reached and, where the `Payment` sets `tfPartialPayment` (131072, ripple-binary-codec 2.11.0 `dist/enums/definitions.json` L5283), `partial` beside it, the amount being what the partial payment delivered, observed and not judged. A `Payment` delivers one amount to its one `Destination`, so each transaction the read takes holds one transfer, named by its transaction alone, its place being the whole transaction; an inner `Batch` payment is named by its own inner transaction. The signer is the `Account`, or the `Delegate` where one acts; a multisigned transaction's `Signers`, a `Delegate`, or an inner `Batch` transaction's parent is recorded as the authority it acted under, for the act and for a foreign item alike. A payment names the payee's account where its `Destination` is the option's payee; an agreement is held to no account. 12. **The lapse.** The payment can no longer land once a validated ledger is past its signed `LastLedgerSequence`; one that signs none has no lapse. `instrument-unused`: past that ledger, the account's `Sequence` not past the signed one or the ticket still present. `instrument-consumed`: another transaction took the sequence number or ticket, a `Payment` to another account among them, named. `transaction-failed`: the payment, or a copy of it under another hash, validated with a `tec` result. Each is answered only once the search for H (rule 13), read whole, holds no act of the payer that is the act asked about (rule 15). 13. **The search for H.** The payer's `account_tx` from the issue ledger, or the search position an earlier answer returned, to the latest ledger the server serves at the read, every transaction of the payer's account whatever it moved, never narrowed to a destination or an asset, at most 16 pages a call. Each transaction is classified by H in any of the XRPL forms, by the instrument, and by the hash presented; one found above the validated ledger is `pending`, `below-mark`. A transaction whose blob does not decode, whose answer is out of the reader's form, or whose result is no ledger's, is named among the items the search could not decode and holds the search's position at its ledger (read-status rule 19). 14. **History, and an account not shown.** An absence counts only where `complete_ledgers` holds the ledgers from the issue ledger to the validated ledger and the search began at its start; otherwise the answer is `unreadable`, `history-gap`. A server that refuses a call for ledgers it does not hold, as rippled on API version 2 refuses `account_tx` from a ledger below those it holds with `lgrIdxMalformed`, gives the same answer: the reader rejects that refusal with `ReaderError` of kind `history`, which the read takes as `history-gap`, never `transport`, so the caller reads again through a server that holds the ledgers. An account the validated ledger does not show, `account_info` answering that it is not found, deleted or never funded, gives no read of the value as unconsumed, since a deleted account may have taken it: the search decides, and with no act found the answer is `pending`, `search-incomplete`, never `not-found`. 15. **Shown.** `account_tx` lists, for every ledger it answers for, each transaction of the payer's account, a delegated payment (`Delegate`) and an inner `Batch` payment among them, each taking the account's sequence number or ticket, as rippled 3.4.1 lists them on the XRPL Testnet (`test/fixtures/xrpl-delegated-batch-testnet.json`). A search read whole therefore proves absence (read-status rule 25): the read answers `failed`, `instrument-unused`, `instrument-consumed` or `transaction-failed` where the ledger gives it, a payment that lapsed, or whose sequence number or ticket another transaction took, among them. **The read kit.** 16. Declared inapplicable to the read kit: `not-found`, since the payment carries the signed transaction, so the read holds its sequence number or ticket (`account_info`, `ledger_entry`); *an act read at the finality asked for, below the final mark*, since a seller names `validated` alone (rule 9); *each transfer of what moved is named by its transaction and its place in it*, since each transaction the read takes holds one transfer, a `Payment` delivering one amount to its one `Destination` (rule 11); and *a payment act carrying H that transferred zero* and *an act carrying H that transferred zero*, since a `Payment` of zero is malformed and a partial payment that delivers nothing does not succeed (rule 8). A case is named by its reason, or by the opening words of its text in `read-status.json`. Where XRPL cannot hold a case's fact as the case states it, the case is made in the ledger's own spelling where the rule that decides it treats the two alike: an act that names no account is made as one naming another account than the payee's (read-status rule 9), and a transaction that took the instrument is the payer's, read-status rule 16 deciding `before-position` before anything asks who signed it. 17. **What a record proves**, as each pairing's `data.proves` states it: - `x402/exact/xrpl`: The payer signed an XRPL Payment whose InvoiceID is the SHA-256 of this ATR's hash in LCP string form, and it is in a validated ledger with tesSUCCESS: it paid the amount meta.delivered_amount states to the account its Destination names. The hash can be confirmed from the ATR's bytes but not recovered from the ledger alone. This does not show that amount, destination, asset or timing match the ATR's content. --- # x402-request-commitment.md Source: https://lcp.integraledger.com/profiles/x402-request-commitment.md **LCP profile `x402/request-commitment`: the request an x402 challenge answers, in the ATR's binding slot.** 1. The ATR's `x402` binding slot holds `{accepts, request}`: every option the challenge offers, exactly as issued, and the commitment to the request the challenge answers. Anyone who holds the ATR and the request reproduces the commitment by the rule for its transport, and so H. 2. **HTTP.** The commitment is `{method, path, query, bodyDigest}`: the request's method token as received; its request-target, which starts with `/` and holds visible ASCII alone, split at its first `?` into `path`, before it, and `query`, after it, `""` where it holds no `?`; and `bodyDigest`, SHA-256 over the body's bytes exactly as received, as `0x` lowercase hex. Nothing is normalised: no percent-decoding, no reordering of the query, no change to the method's case. A request that is not an object, a method or target that is not a string, a method that is not a token (RFC 9110, sections 9.1 and 5.6.2: one or more of the visible ASCII characters other than the delimiters `"(),/:;<=>?@[\]{}`), a body that is not bytes, or a target that does not start with `/` or holds a character outside visible ASCII is refused `x402/request-target-invalid`; a target over 8192 characters, or a body over 1 MiB, is refused `x402/request-too-large`. 3. **HTTP header fields.** A resource server may name request header fields its price or its answer rests on. Where it names one or more, the HTTP commitment also holds `headers`: for each field named, in the order named, `{name, digest}`, `name` the field's name lower-cased and `digest` SHA-256 over the field's value as received, as `0x` lowercase hex, never the value. The value is that of the field's lines, each as HTTP parses it, without its leading and trailing spaces and tabs and with nothing else normalised (RFC 9110, section 5.5); the lines of a field received more than once are joined in the order received by a comma and a space (RFC 9110, section 5.3), and those of `cookie` by a semicolon and a space, as HTTP/2 joins them (RFC 9113, section 8.2.3). A field the request lacks has `digest` `null`, so an absent field differs from an empty one, whose digest is that of no bytes. A named field is a field name (RFC 9110, section 5.1), compared lower-cased, and is named once. A value holding a character outside visible ASCII, the space and the tab is refused `x402/request-header-invalid`, and a value over 1 MiB, its lines joined, `x402/request-too-large`. Fields named with no header fields given are refused `x402/request-header-invalid`, so that a commitment never holds `null` for a field nobody read, as are names that are not a list of distinct field names, header fields that are not a record of strings or lists of strings, and two keys of that record that name one named field, whose order is not known. Only the named fields are read. With no field named the commitment has no `headers` member and is the four members of rule 2 alone. A paid request whose named fields' values differ answers another commitment. The cost, stated: whoever holds the ATR reads each named field's name and digest, and a digest of a short or common value, a tier, a language or a country, is guessed by hashing the candidates, so the commitment hides only a value that cannot be guessed. A resource server names no field that a proxy between it and the client writes or changes, since the paid retry's value then differs from the one committed. 4. **MCP.** An x402 challenge over MCP answers a `tools/call` request (x402's MCP transport). The commitment is `{tool, argumentsDigest}`: `tool` is the request's `params.name` exactly as received, a well-formed string of 1 to 8192 characters; `argumentsDigest` is SHA-256 over the UTF-8 of the RFC 8785 form of `params.arguments`, as `0x` lowercase hex, where `arguments` absent is read as `{}`. A call that is not an object, a `name` that is not such a string, or `arguments` that are present and not a JSON object, `null` among them, is refused `x402/tool-call-malformed`, and arguments whose RFC 8785 form is over 1 MiB `x402/request-too-large`. 5. Over MCP nothing else of the request is committed. `params._meta` is not: the client retries the same tool call with its payment in `_meta["x402/payment"]`, as x402's MCP transport has it and as `@x402/mcp` 2.30.0's client does (`src/client/x402MCPClient.ts:562-580`, the first call `{name, arguments: args}`, `args` being `{}` where the caller gives none; `:684-707`, the retry `{name, arguments: args, _meta}`), and `_meta` may carry other members a client sets per call. The JSON-RPC `id` and envelope are not committed either. A retried call therefore has the commitment of the first, and a call to another tool, or with any argument changed, has another. 6. The resource server computes the commitment from the request it answers, with the header fields it names, ties it into the ATR with the options at issue, and serves a paid retry only where the retry's commitment equals the one the ATR holds. 7. The vectors are `x402-request-commitment.json`: each commitment over HTTP, with and without named header fields, and over MCP, and each refusal with one member of a good request or call changed. Their oracles are Python's `hashlib` for the digests, a `node:http` server that joins a field's lines for the header values, and `canonicalize` 5.1.0, an RFC 8785 implementation of its own, for the arguments' form. --- # x402-upto-eip155-permit2.md Source: https://lcp.integraledger.com/profiles/x402-upto-eip155-permit2.md **LCP profile `x402/upto/eip155/permit2`: the ATR hash as the Permit2 nonce.** This pairing serves x402's `upto` scheme on an EVM chain through Permit2 and x402's `upto` Permit2 proxy, as lcp's client writes it. H is the Permit2 nonce the payer signs, written in decimal, so the pairing is at coverage `full`. The amount settled is the seller's, submitted by the facilitator the witness names, and at most the signed maximum; an `upto` payment is no agreement, since it is no fixed amount. **The payment** 1. The resource server's `PaymentRequired` carries `extensions.legalContext.info` = `{"type":"sha256","value":H,"legalContextUrl":L}`. H is the SHA-256 of the ATR's exact bytes, as `0x` lowercase hex, and L is an `https` URL that serves those bytes. 2. The client fetches L, computes SHA-256 over the bytes received, and compares the result with H as 32 decoded bytes. On a mismatch it does not sign. 3. On a match, the client signs the scheme's `PermitWitnessTransferFrom` with `nonce` = H as a uint256, written in decimal, `spender` x402's `upto` Permit2 proxy (`0x4020A4f3b7b90ccA423B9fabCc0CE57C6C240002`), `deadline` the signing time plus the option's `maxTimeoutSeconds`, the permitted amount the option's amount as a maximum, and the witness `{to: payTo, facilitator: extra.facilitatorAddress, validAfter: 0}`, and echoes `extensions` unchanged. 4. The server refuses a payment whose nonce is not an H it issued for that request and has not seen claimed. 5. H is in the settlement transaction's calldata; Permit2 records its use as bit `H & 0xff` of `nonceBitmap(owner, H >> 8)`, one bitmap per owner for every token, and no event carries it. 6. x402 states no Permit2 nonce derivation. H is unpredictable before issue and unique per ATR, so Permit2's single use of (owner, nonce) holds. A client that draws a random nonce is refused by rule 4. **The reference** 7. `reference` gives the network, the asset, the payer (the permit's owner), the signed `deadline`, H, the members of the payment presented (the permit's `token`, `amount`, `nonce` and `deadline`, its `spender`, the owner, and the witness's `to`, `facilitator` and `validAfter`), the option's payee, and the transaction a settler names, a hint. It refuses a payment whose `accepted` is not the option it is given, compared by RFC 8785 form (`x402/accepted-not-option`). **The read** The read is `x402/exact/eip155/permit2`'s (its rules 10 to 15), through the `upto` proxy, with these differences. 8. **Found by.** A hit counts only where its transaction's input carries the nonce in a call of the `upto` proxy (`0xff11e7b4`, or `0x016c1748` with an EIP-2612 permit first), whose words name the permit, the settled amount after it, the owner, and the witness's `to`, `facilitator` and `validAfter`; the receipt's `Transfer` of the permit's token from the owner to `to` must be of the settled amount, and the owner's bit set at the receipt's block and unset at the block before. One call is taken by owner and nonce: a copy of a call in the same input is that call, and two that differ leave the transaction unread as the act, the search holding on it. A call through the exact proxy is an act of another kind. 9. **What moved** is the settled amount, by its `Transfer`, named by the transaction and its log's place; no log shows the signed maximum. 10. **The payment presented.** The proxy takes the call only from the witness's `facilitator`. Where the proxy call is the transaction's own (its `to` the proxy, the call at the input's start), its decoded arguments are compared as they stand; a call wrapped in another reads `unshown`, since no log shows the permit's maximum or the witness's `facilitator`. **What a record proves** 11. That the payer signed a Permit2 witness transfer whose nonce is this ATR's hash, with x402's `upto` proxy as spender and the payee in the witness; that Permit2 verified the signature when the proxy executed the transfer; and that the hash is in the settlement transaction's calldata as the Permit2 nonce, no event carrying it. The amount settled is the seller's, submitted by the facilitator the witness names, and at most the signed maximum. This does not show that the amount, payee, asset or timing match the ATR's content. **The read kit** 12. Declared inapplicable to the read kit, with the reasons of `x402/exact/eip155/permit2`'s rule 17, the same cases: `transaction-failed` and the cases opening *a failed result that consumed the value*; `not-found`; the three cases of *an act the read cannot place against the position given* and *an item the search could not decode that gives no position*; *a read with no means to read the single-use value*, *search-incomplete is answered before not-found* and *a read that did not read the value at the latest head*; *each transfer of what moved is named by its transaction and its place*; and the ten cases that rule names because the bit is H's own carrier. An `upto` payment is no agreement, so the cases on the act `agreement` are left out by its data. --- # x402-upto-solana.md Source: https://lcp.integraledger.com/profiles/x402-upto-solana.md **LCP profile `x402/upto/solana`: the ATR hash as the Memo instruction of the `open` that escrows the signed maximum.** x402's `upto` scheme on Solana, a one-request payment channel (`@x402/svm` 2.30.0). 1. The option's `extra.memo` is `lcp:sha256:0x` + 64 lowercase hex of H, 77 UTF-8 bytes, which the stock client writes as one Memo Program instruction of the `open` transaction the buyer signs (`@x402/svm` 2.30.0, `src/upto/client/scheme.ts:88`). `bound` holds the presented `accepted` to the option filter and refuses a transaction unless exactly one of its top-level Memo instructions holds an LCP string and it is H's, the only Memo instruction, or whose payment-channels instruction is no `open` (`x402/not-an-opening`): no LCP-form memo is `svm/no-carrier`, more than one `svm/memo-count`, one spelled otherwise `svm/carrier-not-canonical`, one other than `extra.memo` `svm/carrier-mismatch`; a durable nonce account loaded from an address table is `svm/nonce-account-not-static`. `reference` names the message's digest, the buyer, the fee payer, H, the option's payee and the blockhash or durable nonce, and refuses a payment whose `accepted` is not the option it is given, `x402/accepted-not-option`. 2. The settler is the fee payer and the rent payer, and broadcasts the `open`. The amount charged is named later by the seller's server, which sets it in the requirements it sends its settler; that settlement carries no H and is not read, and the sale's amount is the offer's, the maximum the `open` escrows. 3. The client builds the highest message version both `extra.transactionVersions` and lcp admit: version 1 where the list holds 1, version 0 where it holds 0 alone or is absent, as a stock client does (`@x402/svm` at `88b66dd4`, `utils.ts:200-203`); a list that admits neither is refused at the filter (`x402/option-malformed`). `bound` and `reference` decode legacy, version 0 and version 1 messages, and refuse one whose version the list does not admit, `svm/version-not-admitted`, `legacy` being admitted where the list holds 0 and the list absent being `[0]`, as `@x402/svm` 2.31.0's facilitator admits it (`isAcceptedTransactionVersion`): a payment the option does not admit is no answer to it. 4. An option carrying `extra.splits` is refused at the filter, `svm/input-malformed`, before the buyer signs: no Solana build writes split legs, and each pays the whole amount to `payTo`. 5. The read, `status`, as the profile `read-status` answers it: one mark, `finalized`, the default and the final mark. The search for H lists the memo-carrying signatures of the buyer's own account, which every transaction the buyer signs loads, never the fee payer's, from the issue slot to the latest head, `confirmed`, which is no mark: 10 pages of 1,000 and 50 candidates a pass, a pass that meets either bound, or a candidate no lookup finds or one that does not decode, holding a handle the next read resumes from, below the pages it read, with the transactions met that the answer rests on, a consumer of the value or one the payer signed, other than those the caller gave, which the next read looks up by signature. An act met only above the `finalized` slot is `pending`, `below-mark`, named with no finality. The parties come from the landed transaction: who signed it, and the payee and the distribution the `open` names, its payee being its third account, a seed of the channel's address, which the program's `distribute` pays: its deposit counts where its payee is the option's payee or its distribution holds that payee, an `open` with no distribution among them, and is recorded with the option's payee as its beneficiary where the `open` names it, else the distribution's first recipient, or the `open`'s payee where the distribution is empty, and the channel's account as its contract; each transfer of what moved is named by the transaction and its instruction's place, the top-level index or `.` for an inner instruction, and a transaction with a failed result names the destination the payer signed and moved nothing. `presented` compares the landed message with the one presented, by its digest, or with the transaction presented alone. The single-use value is the signed message: consumed by its own landing or by its durable nonce advanced; unused once its blockhash has lapsed, `isBlockhashValid` answering `false` at `finalized` at a `finalized` slot at least 150 past the context slot of the first `isBlockhashValid` answer of `true` at `confirmed`, which the search's handle keeps, a slot count alone deciding nothing, since a skipped slot adds no block and the chain ends the blockhash's validity 150 blocks after its own, and a blockhash read invalid before such an answer deciding nothing; a durable-nonce message never lapses. Until a run shows every transaction the buyer signs listed under its account, a search read whole proves no absence: no `failed` but `before-position` is answered, `pending`, `search-incomplete` in its place. 6. Declared inapplicable to the read kit, cases the read cannot meet on Solana: the case settled at a finality asked for below the final mark, since a seller names `finalized` alone; while the search proves no absence, every case at coverage `full` whose answer is `instrument-unused`, `instrument-consumed` or `transaction-failed`, which the read answers `pending`, `search-incomplete` (`vectors/svm-read.json`); each transfer of what moved is named by its transaction and its place in it, since the act is an opening that holds exactly one `open`, whose one deposit into the channel's token account is what moved, a transaction holding more being no act of this pairing; an act of the pairing's kind that names no account, since every `open` names its payee; and, the read holding the signed message, a read that did not read the value at the latest head, since its search and its lookups read on to `confirmed`, and a value whose validity passed, unconsumed at the final mark and consumed at the latest head, since a blockhash message is consumed only by its own transaction, which that read finds, and a durable-nonce message has no lapse. 7. The payment-channels program is on devnet only: on mainnet the pairing waits until a read shows the program deployed there. It is never an agreement option. 8. What a record of this pairing proves: the payer's own signed act carries this ATR's hash: a Solana transaction the buyer's account signed, whose one Memo instruction is the hash's LCP string, final at `finalized` with no error, which deposited the amount its `open` names into a payment channel whose payee or distribution names the option's payee, recorded with its mint and amount. The memo is in the transaction's instruction data on chain. The deposit is the signed maximum a one-request channel escrows; the amount charged from it, which may be zero, is the seller's metering, settled in a later transaction that does not carry the hash, and the rest returns to the payer. It compares no amount, mint or time with the ATR's terms. --- # x402-upto-xrpl.md Source: https://lcp.integraledger.com/profiles/x402-upto-xrpl.md **LCP profile `x402/upto/xrpl`: x402's `upto` on the XRP Ledger, at coverage `none`, after an agreement on the same network.** x402's `upto` scheme on XRPL as its specification states it (`specs/schemes/upto/scheme_upto_xrpl.md` at x402-foundation/x402 `88b66dd4`, cited below by its lines), with three deviations: the agreement comes first (rule 9), the asset is XRP alone, as the scheme itself has it (rule 5), and nothing the payer signs carries H, so the pairing is at coverage `none` with no link (rule 7). **The scheme.** 1. The payer opens a payment channel to the option's `payTo` with a `PaymentChannelCreate` it submits itself, its `Amount` the option's `amount`, the maximum, in drops, with a `CancelAfter` and a `SettleDelay`, and then signs one claim off the ledger over the channel's id and that maximum (`:25`, `:29-31`, `:77-80`). The channel's id is the `PayChannel` ledger entry's index: the SHA-512Half of the space key `0x0078`, the creating account's AccountID, the destination's AccountID and the create's `Sequence`, or its `TicketSequence` where it signs `Sequence` 0, as a big-endian 32-bit number (`:56`; `xrplChannelId`). The claim signs the four bytes `CLM\0` (`0x434C4D00`), the 32-byte channel id and the maximum as a big-endian unsigned 64-bit number of drops (`:251-254`; `xrplClaim`). Neither carries a network, so one account pair at one sequence number has one channel id on every network (`:55-60`): a read is given the network and reads that network's ledger alone. 2. The payment presented, in `PAYMENT-SIGNATURE`, carries in its `payload` the channel's id as 64 hexadecimal characters (`channelId`), the maximum the claim signs (`maxAmount`), the claim's signature (`signature`), the channel's `PublicKey` (`publicKey`) and the channel's `Account` (`payer`) (`:152-188`). It names a channel and a payer and no transaction. `payload.settlementTransaction` is the resource server's, added at settlement, and is absent from what the client presents (`:190-199`). The payer's client submits the create before it presents the payment, so the pairing's `broadcaster` answers `payer`. 3. The payer pays the create's fee and holds the channel's owner reserve while it is open; the `payTo` account pays the settlement's fee, so the option's `extra.areFeesSponsored` is present and `false` (`:27`, `:33-37`, `:148`, `:218-224`). The payee's precondition, which no check of lcp's reads: an account at `payTo`, funded for the settlement's fee, whose key signs the settlement. 4. The resource server names the charge. Once its metered work has run, it signs a `PaymentChannelClaim` from `payTo` for the actual amount, with `tfClose`, and a settler verifies it and submits it (`:85-91`, `:317-353`); the settler holds no key and pays no fee (`:224`, `:485-488`). That claim moves money under terms already bound: no claim is read under this profile, and no claim is the sale's instrument. **The option.** 5. The option is `upto` on an XRPL network, `xrpl:` and the network's id in its canonical form (`:43-53`). Its `asset` is `XRP`: a payment channel holds XRP alone, and the ledger refuses a create whose `Amount` is an issued currency (`:62-66`, `:497-501`); an `upto` option on an XRPL network that names another asset is refused `xrpl/currency-not-xrp`. It is refused `x402/option-malformed` where its `amount` is not a positive number of drops in canonical decimal below 10^17, its `payTo` is not a classic address whose checksum holds, its `maxTimeoutSeconds` is not a positive safe integer, its `extra` is not an object whose `areFeesSponsored` is `false`, or its `extra.minSettleDelay` or `extra.validAfter` is present, not `null` and not a non-negative integer, `minSettleDelay` being at most 4,294,967,295, the largest `SettleDelay` a create carries, a UInt32 field (ripple-binary-codec 2.11.0 `dist/enums/definitions.json` L552-558) (`:144-150`, `:236-243`). `advertise`, `bound` and `reference` refuse such an option with its code, and `read` offers none of them, before anything moves. 6. `advertise` places `extensions.legalContext`, as every x402 pairing does, and writes nothing into the option, which carries no H. The resource server places the option only once the agreement for its H is recorded (rule 9): a response sent before then carries no `upto` option on XRPL for that H. **What the server refuses.** 7. `bound` holds the presented `accepted` to the option filter (rule 5) and the payload to its form, `payload.channelId` 64 hexadecimal characters and `payload.payer` a classic address whose checksum holds, else `x402/payload-malformed`. Nothing the payer signs carries H, neither the create nor the claim (`:523-526`), so `bound` then refuses every payment, `x402/no-signed-place`: the resource server's check of H is its own record that the agreement for this H is recorded, made before anything moves. 8. A settler's `/verify` makes the scheme's checks (`:229-315`): among them that the `PayChannel` is in a validated ledger, that its `Destination` is `payTo` and its `Account` is `payload.payer`, that `payload.maxAmount` is the option's `amount` and at most the channel's `Amount`, that the claim's signature verifies against the channel's `PublicKey`, that the channel's `Balance` is 0, and its time bounds; and at `/settle`, the bindings of the resource server's claim (`:355-410`). lcp makes none of these checks: they judge what the payment pays. **The agreement first.** 9. The sale's agreement is an XRPL payment carrying H, on the channel's own network, recorded before the `upto` option is placed. The channel counts for the sale only where its create comes after the validated ledger index the resource server read for that network when it recorded the agreement, which it gives the read as the position the create must come after; and only where the channel's `Account` is the account that signed the agreement, which the resource server compares, the read naming the create's signer. A channel created at or before that position is never the sale, whatever follows: its read answers `failed`, `before-position`. A channel opened before the agreement, the payer's own included, stays the payer's until it closes or its `CancelAfter` passes. **The reference.** 10. `reference` gives the network, the channel `payload.channelId` names, in upper case, the payer `payload.payer` names, and the option's payee, the `payTo` of the option it is given, the key of the read's two party tests and no search key. It refuses a payment whose `accepted` is not that option, compared by RFC 8785 form (`x402/accepted-not-option`). The ledger index the create must come after (rule 9) is the caller's. **The read.** `status` reads a rippled or Clio server through the caller's reader (`server_info`, `account_tx`, `ledger_entry`), each `ledger_entry` call naming its ledger, `validated`, never the server's default, which is the current, in-progress ledger on a rippled server (XRPL's documentation, *Specifying Ledgers*); it compares no amount, asset or time with the option. It is the read the profile `mpp/session/hedera-solana-xrpl` states for the stock XRPL session's channel, the payer being the one `payload.payer` names. 11. **Marks.** One mark, `validated`, the final mark. A create the server answers in a ledger it has not validated was read at `current`, which is no mark: an act there is `pending`, `below-mark`. The position is the ledger index. 12. **Found by the channel.** The read takes the `PayChannel` at the validated ledger (`ledger_entry`), then searches the `account_tx` of the channel's `Account`, or, where the validated ledger does not show the channel, of the payer the payment names, from the ledger the create must come after to the latest ledger the server serves, at most 16 pages a call, for the `PaymentChannelCreate` whose metadata creates the channel's entry, or, where the metadata names none, whose `Account`, `Destination` and sequence number or ticket give the channel's id. The create's `Sequence` or ticket is the single-use value: only that create made the channel. 13. **The act.** That create is the act where its `Account` is the payer and its `Destination` the option's payee: `settled`. One another account opened, whose create is not the payer's act, since only that account's sequence number gives the channel's id, is `failed`, `instrument-consumed`, named with its signer; one the payer opened to another account pays no deposit to the payee and is `failed`, `instrument-consumed`; one found at or before the position is `failed`, `before-position`. A create whose `Account` or `Delegate` is the option's payee is never the act. 14. **What moved, and who signed.** What moved is the create's `Amount`, drops of XRP, recorded with the `Destination` it names, the channel's beneficiary, and the channel's id, which XRPL derives from the create's `Account`, `Destination` and sequence or ticket, as its contract, as observed: a `PaymentChannelCreate` makes one deposit, so its place is the whole transaction. A later `PaymentChannelFund` raises the channel's `Amount` (`:247-250`) and is not read. The signer is the create's `Account`, or its `Delegate` where one acts; its `Signers`, a `Delegate` or an inner `Batch` transaction's parent is recorded as the authority. 15. **The payment presented.** A `settled` answer states `presented`: the channel and the payer the payment names compared with the create the read settled on, `yes` where that create's metadata made that channel's `PayChannel` entry and its `Account` is that payer, the channel's id being the ledger's own digest over the create's account, destination and sequence number or ticket. No claim is a member. The cost: the read finds the create by the channel the payer named, so `presented` is `yes` on every `settled` answer, and it shows nothing of what the claim later collects. 16. **Absence.** A channel the validated ledger shows whose create the search, read whole, does not hold was created at or before the position, since `account_tx` lists every transaction of the account, a delegated create and an inner `Batch` create among them (`x402/exact/xrpl`, rule 15): the read answers `failed`, `before-position`. On a server whose `complete_ledgers` does not hold the range, or that refuses `account_tx` for ledgers it does not hold (`x402/exact/xrpl`, rule 14), the answer is `unreadable`, `history-gap`, never absence. A channel the validated ledger does not show whose create the payer's search, read whole, does not hold is `pending`, `not-found`: it is not yet created, its create has not yet validated, or it was opened by another account, or by the payer at or before the position, and has since closed. The cost: a channel opened at or before the position, or by another account, and closed since is answered `not-found` where one the ledger shows answers `failed`. 17. **No recover.** Nothing on the ledger carries H, so the pairing has no `recover`. **The read kit.** 18. Declared inapplicable to the read kit: *an act read at the finality asked for, below the final mark*, since a seller names `validated` alone (rule 11); *each transfer of what moved is named by its transaction and its place in it*, since each transaction the read takes holds one transfer, a `PaymentChannelCreate` making one deposit (rule 14); and `instrument-live`, `instrument-unused` and `transaction-failed`, since a create whose metadata creates the channel's entry has landed and succeeded (rule 12). A case is named by its reason, or by the opening words of its text in `read-status.json`. The case `not-found` is not declared: it runs through this read, a channel the validated ledger does not show whose create the payer's search, read whole, does not hold (rule 16). **The vectors.** 19. `x402-upto-xrpl.json` holds the scheme's own option examples (`:110-124`, `:128-142`); each refusal of rules 5 and 7, a good option or payment with one member changed and the code expected; the create, by `Sequence` and by ticket, its blob encoded by ripple-binary-codec 2.11.0 and signed with @noble/curves 2.4.0's Ed25519 under keys made by XRPL's Ed25519 key derivation, and its channel id by the `PayChannel` ID format over node:crypto's SHA-512; the claim's bytes, ripple-binary-codec's `encodeForSigningClaim`, and the payer's signature over them; the reference, with an `accepted` that is not the option; and the read's answers on a constructed server, written from this profile and the profile `read-status`: the payer's create settled, `presented` `yes`, by sequence number and by ticket, and once the channel has closed; a payer that is not the create's `Account`; a channel to another destination; a create at the position; a channel the ledger shows whose create the search does not hold; a server that does not hold the range; a channel the ledger does not show; and a create in a ledger not yet validated. No published software implements the scheme (`@x402/xrpl` 2.30.0 ships `exact` alone), so no vector is a stock client's output, and none is taken from lcp's builder; a refusal's code has no outside oracle and is this profile's, over the scheme's members. **What a record proves.** An account signed an agreement carrying H on the channel's network before the channel was opened; the create, in a validated ledger with `tesSUCCESS`, shows that the account `payload.payer` names deposited the create's `Amount` into the named channel, whose beneficiary is its `Destination`. It does not show that the account that signed the agreement opened the channel unless the record compares the two, nor what any claim later collected, nor that the amount, the deposit, the destination or the timing match the ATR's content.