Use this page when your server needs to know who is calling, for passes, subscriptions, bulk discounts or per-caller prices, or when your client needs to tell it. The caller signs a proof with its key; nothing is submitted and nothing is paid. Why the proof is a transaction.

Create and verify a proof

x402-avm-js creates proofs but does not verify them; verify on the server with ai-economy-sdk. On LocalNet, read the genesis hash from algod instead of using a preset. In algosdk v3 it is a Uint8Array, so encode it: algosdk.bytesToBase64((await algod.getTransactionParams().do()).genesisHash!). PaymentGate verifies identity on every tool call with verify_identity: it checks X-Identity-Txn first, against the gate’s network, and falls back to the legacy headers. In your own server:

The two formats

sign_identity(private_key) signs the message x402-identity:<address>:<timestamp> with Ed25519 (algosdk’s sign_bytes) and returns the three headers. It emits a DeprecationWarning: use sign_identity_txn(), which binds the proof to one network. Servers keep accepting the legacy headers, and paid_mcp_session still sends them.

The identity transaction

make_identity_txn (Python) and buildIdentityTxn(address, genesisHashB64, ts?) (JavaScript) build: The caller signs it, msgpack-encodes the signed transaction, base64-encodes the bytes and sends them as X-Identity-Txn. verify_identity_txn(header_value, expected_genesis_hash_b64, max_skew=120) returns the address, or None if any check fails:
  1. The header decodes to a signed transaction with a plain Ed25519 signature: no multisig, no logic signature, no rekeyed (authorized) signer.
  2. Type pay, sender equals receiver, amount 0, fee 0, no close-to, no rekey-to.
  3. The genesis hash equals the expected one.
  4. The validity window is at most 1,000 rounds.
  5. The note is x402-identity:<sender>:<integer timestamp> and the timestamp is within max_skew seconds of the server’s clock.
  6. The signature verifies against the sender’s public key.
For the legacy headers, verify_identity checks the address, the 120-second skew and the signature.

Examples

Python: sign a proof for the current LocalNet, verify it, and show that a different genesis hash is rejected.
localnet/identity.py
Source: examples/localnet/identity.py
JavaScript: build and sign a proof, then verify it with the Python SDK in a subprocess.
localnet/identity.mjs
Source: examples/localnet/identity.mjs
It prints the account address, the start of the encoded header, and the address returned by verify_identity_txn.

Next