Live today

Receipts

Every preflight verdict comes with Metera's signature over what it decided, about which exact transaction. Anyone can check it, without trusting Metera's servers.

Live

What a receipt states

The verdict, the message hash of the exact transaction, the hash of everything the decision was asked, the policy and code version it ran under, the simulated result, the signatures the transaction carried, the slot, and the decision log row it was recorded under. Metera signs those fields with an Ed25519 key.

{
  "receipt": {
    "version": 1,
    "kind": "preflight",
    "issuer": "api.metera.xyz",
    "key_id": "ed25519:1886527ed07c735b",
    "issued_at": "2026-11-11T02:52:12.833Z",
    "decision_id": "9a14318e-48e0-4492-a423-5b25ee4fcffa",
    "message_hash": "sha256:48da9551…",
    "verdict": "refuse",
    "input_hash": "sha256:af193fc1…",
    "policy_version": "sha256:e1808ca1…",
    "snapshot_hash": "sha256:a0b8593e…",
    "simulated_result": { "simulated_out": null, "outcome_check": "pass", "simulation_slot": 467962267, "deltas": { "…": "…" } },
    "signatures": [],
    "slot": 467962267
  },
  "alg": "Ed25519",
  "signature": "1zZK9Dpl…"
}

Verify it, with nothing installed

// Node 20+, no dependencies. receipt = verdict.receipt, transaction = the base64 you sent.
import { createHash, createPublicKey, verify } from 'node:crypto'

const { keys } = await (await fetch('https://api.metera.xyz/v1/receipts/keys')).json()

// Canonical JSON: keys sorted at every level, no whitespace.
const canon = (v) => Array.isArray(v) ? `[${v.map(canon).join(',')}]`
  : v && typeof v === 'object' ? `{${Object.keys(v).sort().map((k) => `${JSON.stringify(k)}:${canon(v[k])}`).join(',')}}`
  : JSON.stringify(v)

// 1. The Ed25519 signature, with the published key the receipt names.
const key = keys.find((k) => k.key_id === receipt.receipt.key_id)
const spki = Buffer.concat([Buffer.from('302a300506032b6570032100', 'hex'), Buffer.from(key.public_key, 'base64')])
const signed = Buffer.from('metera-receipt/v1\n' + canon(receipt.receipt), 'utf8')
const signature = verify(null, signed, createPublicKey({ key: spki, format: 'der', type: 'spki' }), Buffer.from(receipt.signature, 'base64'))

// 2. The message hash, recomputed from the bytes you sent: skip the signature section.
const tx = Buffer.from(transaction, 'base64')
let n = 0, i = 0, shift = 0, b
do { b = tx[i++]; n |= (b & 0x7f) << shift; shift += 7 } while (b & 0x80)
const messageHash = 'sha256:' + createHash('sha256').update(tx.subarray(i + 64 * n)).digest('hex')

console.log({ signature: signature ? 'valid' : 'invalid', message_hash: messageHash === receipt.receipt.message_hash ? 'match' : 'mismatch' })

message_hash: match means the hash was recomputed from the bytes you hold, so the receipt is shown to be about that very transaction. Change any field of the receipt and the signature turns invalid.

With @metera/sdk

import { verifyReceipt } from '@metera/sdk'

const keys = [{ key_id: 'ed25519:1886527ed07c735b', alg: 'Ed25519', public_key: 'Ylu2TPFCjooUOsm8oz9MbL9kK7/ruOUZwn1xGggqKu8=', status: 'active' }]
const check = await verifyReceipt(verdict.receipt, { keys, transactionBase64: transaction })
// check.valid === true
verifyReceipt ships in @metera/sdk 0.7.0, which is on its way to npm. The 0.6.0 on npm today is an older, unrelated package without it: do not install it for this. Until 0.7.0 is out, use the script above.

The rules, for your own implementation

  • Canonical JSON of receipt: object keys sorted at every level, no whitespace, absent fields omitted.
  • Signed bytes: UTF-8 of metera-receipt/v1\n followed by that canonical JSON.
  • Ed25519 over those bytes, with the published key whose key_id equals the receipt’s.
  • message_hash is the sha256 of the transaction’s message bytes: everything after the signature section.

What it proves, and what it does not

A valid receipt proves that Metera’s key signed exactly that verdict, on that message, under that policy version, with that simulated outcome. It does not prove the decision was right: for that, the decision is replayed from the decision log, named by decision_id and snapshot_hash. It says nothing about whether the transaction later landed.

A receipt is never handed out unsigned. If one cannot be signed, the verdict arrives with receipt null and the reason in receipt_unavailable.