Overview
The Legal Context Protocol reference implementation: the ATR, its hash, and the hash bound into payments.
When one AI agent buys from another, it reads terms, perhaps negotiates, and pays. The Legal Context Protocol (LCP) makes the payment prove what was agreed: the payment carries the hash of the agreement's record, so paying is agreeing to that exact record.
@integraledger/lcp is its reference
implementation, for TypeScript and JavaScript. It assembles the record, hashes it, and binds the hash into payments on
x402, MPP, agentic checkouts and card networks, across EVM chains, Solana, Stellar, the XRP Ledger and every other
rail the rails guide lists.
How it works
sequenceDiagram
participant B as Buyer
participant S as Seller
B->>S: request
Note over S: assemble the ATR, hash it (H), store the bytes at a link
S-->>B: payment challenge carrying H and the link
B->>S: fetch the link
S-->>B: the ATR's exact bytes
Note over B: SHA-256(bytes) equals H, or stop
Note over B: build the payment with H in its field, sign it
B->>S: payment carrying H
Note over S: H read back from the payment equals the H it issued
- The seller assembles the record. The Agentic Transaction Record holds a format marker, a per-transaction id, the values that tie it to this payment, and whatever the parties agreed, byte for byte.
- The seller advertises its hash. H goes into the payment challenge, beside an
httpslink to the seller's copy. - The buyer compares before it signs. It fetches the bytes, hashes them, and signs nothing unless they hash to H.
- The payment carries H. The buyer signs a payment with H in the field its protocol or rail provides: a nonce, a memo, a salt, an invoice field.
- Anyone holding the record can match it. The seller reads H back from the payment, and on most rails from the settlement on chain.
The package fixes the bytes, the hash and where H rides. It does not decide what the record says, and it never compares amount, payee, asset, timing or payer with the record's content: that is between the parties, and the record is what they agreed.
Terms
These pages use each term in one sense:
| Term | Meaning |
|---|---|
| Agentic Transaction Record (ATR) | The agreement's record, a JSON document the seller serves. |
| ATR hash (H) | SHA-256 over the ATR's exact bytes. |
| Legal Context Protocol (LCP) | The pattern this package implements: the payment carries H, so paying is agreeing to that exact record. |
| Pairing | A payment protocol, scheme and rail combination, such as x402/exact/eip155/eip3009. |
| Binding | How H rides in a pairing's payment: the field its specification defines. |
| Buyer gate | The buyer-side check that compares the served bytes with H before anything is signed. |
| Seller | The party serving the resource. |
| Facilitator | The x402 role that verifies and settles. |
| Vectors | The shared test cases that fix the rules byte for byte across languages. |
Where to start
| You are | Read |
|---|---|
| New to LCP | Getting started: one x402 payment, both sides, in one program. |
| Building a seller | Seller: assemble, advertise, check the payment, read the settlement. |
| Building a buyer | Buyer and the buyer gate. |
| Selling by channel, session or subscription | Channels, sessions and subscriptions. |
| Working on one protocol | x402, MPP, or agentic checkouts for ACP, UCP, AP2, ACK, card networks and A2A. |
| Working on one chain | Rails: the field H rides in on each chain and network. |
| Publishing your terms | Discovery: the document at /.well-known/legal-context.json. |
| Implementing LCP in another language | Vectors and the vector files. |
The documentation
- Concepts explain each rule: the ATR, the ATR hash, binding, pairings, the buyer gate, refusals and vectors.
- Guides walk each flow with a program you can run: seller, buyer, channels, sessions and subscriptions, x402, MPP, agentic checkouts, rails and discovery.
- Reference is generated from the package: entry points, pairings, refusal codes, vector files and the API.
Every TypeScript program in these pages is compiled and run against the package in CI, and its output is checked against what the page shows.
For AI agents
The documentation site publishes llms.txt, an index of every page,
llms-full.txt, every page in one file, and each page as Markdown
under /md/, such as /md/getting-started.md.
Source and license
The source is at github.com/IntegraLedger/integra-protocol,
under the Apache-2.0 license. The buyer
packages are in integra-agentic-terms, and the seller
door's contract and connectors in
integra-agentic-connectors.
Last updated on