# Address attestation: how to check that a payment address is the platform's own

> Each CryptoLike deposit address carries an Ed25519 statement from the Signer: what it signs, how SDKs check it, how to verify it and the public key.

Source: https://cryptolike.net/docs/attestation
Updated: 2026-10-31

Every deposit address the CryptoLike API returns — in an invoice, a static address or the payment page view — comes with `address_attestation`: a statement signed by the platform's Signer with its own Ed25519 key. It says that this address is the platform's own derivation and that it belongs to exactly this invoice or static address. The key that signs it is not on the servers that answer the API, so those servers cannot produce a valid statement for an address of anyone else. Check the statement before you show an address to a payer; the official SDKs do it for you.

## What the Signer signs

`address_attestation` has three fields: `key_id`, `payload` and `signature`. The `payload` is plain text, not JSON: the header `cryptolike-address-attestation/v1` and eight `key=value` lines in a fixed order, joined by `\n`, with no newline at the end.

```text
cryptolike-address-attestation/v1
key_id=1adb76e83afa2848
network=tron
coin=USDT
address=TXYZopYRdj2D9XRtbG411XZZ3kM5VW9t7g
subject=invoice:4e2bc88c-cb79-4afc-b864-c1ba8e9d50c9
amount=49.9
expires_at=2026-10-30T12:30:00Z
issued_at=2026-10-30T12:00:00Z
```

| Line | Meaning |
|---|---|
| `key_id` | Id of the signing key: hex of the first 8 bytes of SHA-256 of the 32-byte public key |
| `network`, `coin` | The API network value (`btc`, `ltc`, `eth`, `tron`) and the ticker |
| `address` | The deposit address |
| `subject` | `invoice:<id>` or `static:<id>` — the one object this address is bound to |
| `amount` | What the payer must send (`payer_amount`) as a canonical decimal: `49.90` is written `49.9`; empty for a static address |
| `expires_at` | The invoice deadline, `YYYY-MM-DDTHH:MM:SSZ`; empty for a static address |
| `issued_at` | When the Signer signed |

`signature` is standard base64 of the 64-byte Ed25519 signature over the exact UTF-8 bytes of `payload`. Before it signs, the Signer derives the address itself from its own extended public key and refuses if the application's address differs; an address once bound to an invoice can never be bound to another one.

## How the SDKs check it

The TypeScript, Python, Go and PHP SDKs verify the statement in every method that returns an address to show: create, get and coin choice of an invoice, create and get of a static address. The check is fail-closed:

1. The signature must verify with a public key pinned in the SDK release, and `key_id` must name that key.
2. The payload must follow the format exactly; a second spelling of the same statement is refused.
3. `network`, `coin`, `address`, `subject` and `amount` must equal the object around it.
4. A statement may follow a new invoice by a few seconds, so the SDK reads the object again after 1, 2 and 4 seconds before it gives up.
5. `qr_payload` must equal that address, and `payment_uri` must pay it: `<scheme>:<address>` with only the `amount`, `value` or `token` parameters, or `ethereum:<contract>/transfer?address=<address>` with only `uint256`. Otherwise whoever controls the API answer could keep the genuine address and put their own one into the QR code or the wallet link.

When the check fails, the SDK raises `AttestationError` (`AttestationException` in PHP) with the reason and the object. Do not show that address: send the payer to `checkout_url` instead. There is no switch to turn the check off. The `attestation_keys` option only replaces the pinned list, for a test environment with its own Signer. Method names per language are in the [SDK guide](https://cryptolike.net/docs/sdk).

## Verify it yourself

Without an SDK, the check takes the standard library of most languages. In Node.js:

```js
import { createHash, createPublicKey, verify } from "node:crypto";

const raw = Buffer.from(PUBLIC_KEY_BASE64, "base64"); // the key published below
const keyId = createHash("sha256").update(raw).digest("hex").slice(0, 16);
const key = createPublicKey({ key: Buffer.concat([Buffer.from("302a300506032b6570032100", "hex"), raw]), format: "der", type: "spki" });

const a = invoice.address_attestation;
const valid = a !== null && a.key_id === keyId &&
  verify(null, Buffer.from(a.payload, "utf8"), key, Buffer.from(a.signature, "base64"));
```

Then split `payload` into lines and compare each value with the invoice: `network`, `coin` with the ticker, `address`, `subject` with `invoice:` and the invoice id, `amount` with `payer_amount` written without trailing zeros. If the signature does not verify, the key is not one you trust or any value differs, treat the address as unknown. Show and encode only that address: `qr_payload` must be the same string, and `payment_uri` must pay it (rule 5 above).

## Public key

**The production key is not published yet.** It is created on the platform's Signer at launch and published on this page together with its `key_id`, before the SDK release that pins it. Until then the SDKs carry no pinned key and refuse every address, so do not upgrade to an SDK version with the check before the key appears here.

When the key changes, the new key is published here and pinned in an SDK release first; only after that does the Signer start signing with it. An answer signed by a key you have not pinned is refused, never trusted by default.

## Test vectors

The section `address_attestation` of the public SDK test vectors, `/docs/sdk/vectors.json` (the file every SDK is tested against, see the [SDK guide](https://cryptolike.net/docs/sdk)), holds a test key, valid statements for an invoice and a static address, and statements that must fail: an edited payload, a zero signature, an unknown key, a trailing newline, and valid statements about another address, invoice or amount. The test key is public — its seed is in the same file — so trust it only in your own tests. The same section holds `payment_targets`: `address`, `qr_payload` and `payment_uri` as the API prints them on every network, and substitutions that must fail.

## The payment page and the widget

The hosted payment page and the [checkout widget](https://cryptolike.net/docs/widget) check the same statement in the payer's browser with the key built into the page. If the statement does not verify, the page hides the address, the QR code and the wallet link and tells the payer not to send anything. The page draws the QR code from the checked address itself and offers the wallet link only when it pays that address; an answer whose QR data or wallet link points anywhere else is treated as a failed check, even before the production key is published. The page itself is served by the platform, so this check catches a wrong or stale address, but it does not replace the check on your server: an integration that shows the address in its own interface ([H2H](https://cryptolike.net/docs/h2h)) verifies it with an SDK. Until the production key is published (see the public key section above), the page has no key to check with and shows the address without this check.

## What it does not cover

The Signer vouches for the address and its binding to the invoice. The amount and the deadline in the statement come from the application, so compare them with your own request — the SDKs compare the amount. A webhook proves that the platform sent it, not that the money moved: before you ship a large order, look up each `details.transactions[].txid` in the network, as described in the [webhooks reference](https://cryptolike.net/docs/webhooks).
