# Chain bindings

> What a LOPW chain binding supplies, and the Stellar binding in detail: Soroban contracts, USDC stake, x402 exact payments, SEP-40 oracles, ScVal XDR and Ed25519.

*LOPW documentation · Protocol reference.* Canonical page: https://lopw.com/docs/protocol/bindings.html · This Markdown twin: https://lopw.com/docs/protocol/bindings.md · Index of all pages: https://lopw.com/llms.txt · Everything in one file: https://lopw.com/llms-full.txt

The portable core of LOPW is the warranty offer, the service receipt, the validator interface and the claim semantics. A **chain binding** supplies the parts that depend on a chain: the encoding, the signature scheme, the contract functions and the payment-rail binding.

| Binding | Contracts | Stake | Payments | Oracle (P6) | Encoding and signatures |
| --- | --- | --- | --- | --- | --- |
| [Stellar](https://lopw.com/docs/networks/stellar.html) (reference binding) | Soroban: Bond Registry, Claims, six validators | USDC Stellar Asset Contract, 7 decimals (one SEP-41 token per registry deployment) | x402 `exact`, SEP-41 transfer | SEP-40 (Reflector) | ScVal XDR; Ed25519 over a domain-separated SHA-256 |
| [EVM](https://lopw.com/docs/networks/evm.html) (Base first, then Ethereum, Arbitrum, Optimism, Polygon, Avalanche) | Solidity: the same three kinds of contract | Native USDC, 6 decimals | x402 `exact`, EIP-3009 `transferWithAuthorization` | Chainlink `getRoundData(roundId)` | ABI encoding; secp256k1 over EIP-712 typed data (keccak-256) |
| [Solana](https://lopw.com/docs/networks/solana.html) (planned) | Anchor programs | USDC SPL, 6 decimals | x402 `exact`, SPL transfer | Pyth price update verified in-program | Borsh; Ed25519 over a domain-separated SHA-256 |

One protocol, the same semantics on every chain. Each binding adds its own contracts and SDK adapter implementing the same `ChainBinding` shape without changing the offer, receipt, predicate or claim semantics. Per-network details (chain ids, CAIP-2 ids, token and oracle addresses, deployed contracts) are in the [Networks](https://lopw.com/docs/networks/) section.

## The Stellar binding

| Aspect | Stellar binding |
| --- | --- |
| Addresses | Strkeys: `G...` accounts, `C...` contracts |
| Network ID | SHA-256 of the network passphrase (`Test SDF Network ; September 2015` on testnet; `Public Global Stellar Network ; September 2015` on mainnet) |
| CAIP-2 id for x402 | `stellar:testnet`, `stellar:pubnet` |
| Read path | Read-only calls are simulated through Stellar RPC from a throwaway account that never signs |
| Write path | `invoke`: simulate, assemble, sign, send, poll; contract errors are decoded to names |
| Ledger time | Trails wall-clock time by up to one ledger; the SDK waits before submitting a claim so it never lands in a ledger closed before `served_at` |
| Storage | Persistent entries with TTL extended on access; instance storage for contract configuration |

```ts
import { StellarBinding, STELLAR_TESTNET, STELLAR_MAINNET, getNetwork, withContracts } from "@lopw/protocol";

const binding = new StellarBinding(STELLAR_TESTNET);                 // contract addresses included
const main = withContracts(STELLAR_MAINNET, { rpcUrl, registry, claims });   // supply your own for a mainnet deployment
const net = getNetwork();                                             // LOPW_NETWORK + env overrides
```

| `StellarNetwork` field | Meaning |
| --- | --- |
| `name` | `testnet` or `mainnet`; used in API paths |
| `caip2` | CAIP-2 id used by x402 |
| `passphrase` | Network passphrase hashed into every signature |
| `rpcUrl` | Stellar RPC endpoint |
| `registry`, `claims` | Contract addresses |
| `usdc` | The USDC Stellar Asset Contract |
| `oracle` | The SEP-40 fiat-rates oracle used by the reference services |

Contract addresses of the current deployment are listed on the [proofs](https://lopw.com/proofs/) page and inside `STELLAR_TESTNET`.

## What a new binding must provide

- A canonical, deterministic encoding of `Terms`, `Offer`, `Receipt` and the oracle blocks that the contracts and SDKs produce byte for byte, plus a test-vector file in the style of [v1.json](https://lopw.com/docs/vectors/v1.json).
- A signature scheme over the domain-separated message (type tag, network identifier, registry identifier, encoded body).
- Contracts with the registry, claims and validator functions, the same states, checks, outcomes and error semantics.
- A payment-rail binding that yields a settlement reference and payer for the receipt, and carries the offer and receipt alongside the payment.
- An oracle interface for P6 that returns a past observation with its own timestamp.
