Verify an anchor
Once a day DEBYKO posts one number to a contract on Base: the root of a Merkle tree over the eligible history rows it stored for a UTC day. Within 24 hours of the day’s end a row of that day can be shown to be under that number, by anyone, with a few lines of code and the chain, without trusting DEBYKO’s word for it.
The anchor proves the data did not change after the anchor time; it proves nothing about its correctness at collection.
Status: anchoring on Base mainnet since 2026-10-08. The contract DebykoAnchor (MIT) is on Base mainnet at 0x0AF8259DBfC613825718d4d49A05F9F6fdA15086 since 2026-10-02 (block 52071448, transaction 0xf518ef40…), owner debyko.base.eth, source verified on BaseScan. The first day anchored is 2026-09-30, root 793d6b65…de60a, in block 52349624 (transaction 0xf82f4b06…, 2026-10-08 19:43 UTC); the days after it follow, one a run. Every day, its root, its transaction and the rows of each table are listed on debyko.com/anchors (GET /v2/anchors, public), each day with the commands that check it.
What is anchored, and when
Section titled “What is anchored, and when”For each UTC day D, the rows of these tables with a time in D: ticker, mark, funding, open interest, stats, depth-derived, trades, liquidations and candles. A day is anchored within 24 hours of its end (at D + 1, owner 2026-10-08; it was D + 7 until then), once the Writer’s window
for it has settled (the same rule that makes an answer about the past settled); never before. After it is anchored the day is final: a row that
arrives later goes to a late table and becomes a revision of the day with its own root (ADR-036), visible as the revision of the day on debyko.com/anchors, never an edit, and GET /v2/anchors/proof answers ANCHOR_CHANGED for a row whose part of the day no longer matches. Rows that retention has dropped are not in the
proofs any more; the day’s root stays on the chain.
Schema version 2 (2026-11-01, issue #781). New roots exclude dummy/test listings marked instrument.synthetic = true by the collector. Schema version 1 included those rows. This is a membership change only: canonical row bytes, ordering and hash algorithms are unchanged. Already submitted or anchored days keep their original version, root and chunks; the proof endpoint reads them with that version, including their dummy/test rows while retained. Unsubmitted computed version-1 roots are rebuilt under version 2 before posting. A dummy/test row has no proof under version 2 (ANCHOR_NOT_FOUND); a retained real row verifies normally. Always use the response’s schema_version to reconstruct a partition leaf; do not substitute the current version.
How the number is made
Section titled “How the number is made”- A row is written as the RFC 8785 (JSON Canonicalization Scheme) text of an object with the listing (
segment,symbol) and every anchored column of the table. Members are sorted, there is no whitespace, strings are escaped asJSON.stringifydoes. Every number is a string, the digits PostgreSQL stores with the zeros after the decimal point that carry no value dropped (100.500is"100.5",2.000is"2"); integers (a sequence number passes 2^53) are strings too; a time isyyyy-MM-ddTHH:mm:ss.ffffffZ, UTC; a boolean istrueorfalse; an empty value is the JSONnull, a member that is present with the valuenull(never left out, never an empty string): a column the venue did not publish, such aspredicted_rateof a Hyperliquid builder-dex listing’s funding row (the column allows it since 2026-10-23; every row anchored before it carries a value, and its hash is unchanged). The proof carries the text that was hashed (canonical). - A leaf is
SHA-256(0x00 ‖ canonical row). A node isSHA-256(0x01 ‖ left ‖ right). The tree over n leaves splits at the largest power of two below n, nothing is duplicated (RFC 6962 section 2.1, the tree Certificate Transparency uses;indexandrowsin a proof are a leaf’s place in it). - A partition is one table’s rows of the day, in a fixed order (the cold class, then the listing, the time and the rest of the table’s key, text by bytes), and its root is the root of the tree over their leaves.
- The day’s tree has one leaf per partition that has rows, in table-name order:
SHA-256(0x00 ‖ text)wheretextis the canonical form of{"day", "root", "rows", "schema_version", "table"}(the partition’s root in hex). The day root is the root of that tree.schema_versionis the form of all of the above; a root is reproducible only under the version it was made under. - The contract
DebykoAnchor(MIT,contracts/anchor/in the repository) stores the day root underyyyymmdd(20261001) and emitsAnchored(day, root, ts). Only the owner address can post, a day can be posted once, androots(day)is public. The transaction that posts a day carries the owner’s Base Builder Code (bc_girn7if9) as an ERC-8021 data suffix after the call’s arguments, which the contract ignores.
The proof
Section titled “The proof”GET /v2/anchors/proof?venue=&symbol=&layer=&at= (public: no key and no account, 30 a minute and 2,000 a day from one address; sent with a key it counts as a history request on it) answers with the row, the text that was hashed, the leaf, and two audit paths: path takes the leaf, as leaf index of rows, to partition.root;
partition.path takes the partition’s leaf, as leaf partition.index of partition.count, to day_root. GET /v2/anchors/{day} (public) answers with the day root, its partitions and the transaction that posted it. A real answer is
an object like this one (an example, not market data: its row is made up, and so are the contract and the transaction):
{ "evaluated_at": "2026-10-02T09:00:00Z", "day": "2026-09-24", "network": "base-sepolia", "schema_version": 1, "layer": "trade", "table": "trade", "row": { "event_time": "2026-09-24T00:00:04.000000Z", "generation": "1", "origin": "ws", "price": "100.5", "received_at": "2026-09-24T00:00:04.100000Z", "segment": "binance-usdm", "sequence": "4", "side": "buy", "size": "0.25", "symbol": "BTCUSDT", "venue_uid": "u-4" }, "canonical": "{\"event_time\":\"2026-09-24T00:00:04.000000Z\",\"generation\":\"1\",\"origin\":\"ws\",\"price\":\"100.5\",\"received_at\":\"2026-09-24T00:00:04.100000Z\",\"segment\":\"binance-usdm\",\"sequence\":\"4\",\"side\":\"buy\",\"size\":\"0.25\",\"symbol\":\"BTCUSDT\",\"venue_uid\":\"u-4\"}", "leaf_hash": "60c4ea47d6b5f1faeffe03cf321ddd4a20bb785f3db49172c15ff25587142e0f", "index": 4, "rows": 7, "path": [ "87122b194b1f4379cc9545d7feff22b8da54f8b3fdf618e4bb863f95cec297f3", "094ca79a6712e8a3388a9d399033904f16c01e144d13af5e0435f8fbdd49311d", "a31afce4571f2d12a5d8325f812f56e8471803c507fcfd51a9cd9a911b9ede1b" ], "partition": { "root": "abac80dbad67260c3ef16428f618398f78e321b1cd396f80d035c0d8890c4e2d", "leaf": "22efd614b937beba880beb7dff69da48e3fdd066ed582576d485834f1e9b9a01", "index": 1, "count": 2, "path": [ "971a078eff0b2f39ef5e869dcbac4145d1b4f636cea71e17f27ab4c1fa0667ea" ] }, "day_root": "868c3a277f83080566093d9f46bb61717a82f808958e3a51fe50fa1f50ced4a8", "anchor": { "anchored": true, "status": "anchored", "contract": "0x1111111111111111111111111111111111111111", "tx_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "block": 4242, "anchored_at": "2026-10-01T02:05:00Z", "anchored_lag_days": 7, "explorer_url": "https://sepolia.basescan.org/tx/0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "verify": "https://docs.debyko.com/attest/verify/"}To verify one:
- Re-serialise
rowas RFC 8785 and check it iscanonical. Hashcanonicalas above: that isleaf_hash. - Walk
pathfrom the leaf topartition.root(RFC 9162 section 2.1.3.2). Rebuild the partition’s leaf fromday,partition.root,rows,schema_versionandtable, and walkpartition.pathtoday_root. - Compare
day_rootwith the chain:eth_callofroots(uint32)(selector0x081dc681) with the day asyyyymmdd, on the contract named inanchor.contract, on the network named innetwork. If the numbers are equal, the row was in DEBYKO’s history on the day the transaction (anchor.tx_hash, in blockanchor.block) was mined, and is unchanged.
A verifier
Section titled “A verifier”In a browser, with nothing installed: debyko.com/anchors/verify fetches the proof of the row you name, recomputes every hash below with the browser’s own SHA-256 and reads the day’s root from the contract through a public Base RPC you choose, then shows each intermediate hash and the verdict. On your machine, independent of DEBYKO’s servers: github.com/debyko/verify (MIT; curl -sO https://raw.githubusercontent.com/debyko/verify/main/verify.py && python3 verify.py proof.json reads the root from the contract on Base mainnet by default and prints ✓ or ✗ with exit code 0 or 1). The short reference version, which the platform’s own tests run against the endpoint’s output:
Standard library only, about fifty lines. python3 verify.py proof.json --rpc https://mainnet.base.org --contract 0x0AF8259DBfC613825718d4d49A05F9F6fdA15086 (or --root <hex> to compare with a root you hold; without either it checks the proof against the day root inside it). Any public Base RPC does for --rpc (https://base-rpc.publicnode.com, https://base.drpc.org); one that refuses or fails is named, with exit code 2. The same check reads the root straight from Base itself, cast call 0x0AF8259DBfC613825718d4d49A05F9F6fdA15086 "roots(uint32)(bytes32)" 20260930 --rpc-url https://mainnet.base.org (Foundry), for comparison with day_root.
#!/usr/bin/env python3"""Verifies a DEBYKO anchor proof (GET /v2/anchors/proof) with the standard library alone.
python3 verify.py proof.json checks the proof against the day root inside it python3 verify.py proof.json --root <hex> ... and against a root you got elsewhere (the chain, GET /v2/anchors/{day}) python3 verify.py proof.json --rpc https://mainnet.base.org --contract 0x0AF8259DBfC613825718d4d49A05F9F6fdA15086 asks the chain itself
Any public Base RPC does for --rpc (https://base-rpc.publicnode.com, https://base.drpc.org, ...). Exit 0 and "valid" when every stepholds; exit 1 and the step that failed otherwise; exit 2 when the chain could not be asked."""import hashlib, json, sys, urllib.error, urllib.request
def h(*parts): return hashlib.sha256(b"".join(parts)).digest()
def walk(leaf, index, size, path): """RFC 9162 section 2.1.3.2: the root an audit path takes `leaf` (index `index` of `size`) to.""" fn, sn, r = index, size - 1, leaf for p in map(bytes.fromhex, path): if sn == 0: return b"" if fn & 1 or fn == sn: r = h(b"\x01", p, r) while not fn & 1 and fn: fn, sn = fn >> 1, sn >> 1 else: r = h(b"\x01", r, p) fn, sn = fn >> 1, sn >> 1 return r if sn == 0 else b""
def chain_root(rpc, contract, day): """roots(uint32) of the DebykoAnchor contract: the selector 0x081dc681 and the day as yyyymmdd in one 32-byte word.""" data = "0x081dc681" + format(int(day.replace("-", "")), "064x") body = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [{"to": contract, "data": data}, "latest"]}).encode() # an explicit User-Agent: Base's public RPC answers 403 to Python's default one request = urllib.request.Request(rpc, body, {"content-type": "application/json", "user-agent": "debyko-verify/1 (+https://docs.debyko.com/attest/verify/)"}) try: answer = json.load(urllib.request.urlopen(request, timeout=20)) except (urllib.error.URLError, OSError, ValueError) as e: answer = {"error": f"HTTP {e.code}" if isinstance(e, urllib.error.HTTPError) else str(getattr(e, "reason", e))} if not isinstance(answer.get("result"), str): print(f"could not ask {rpc}: {answer.get('error', answer)}; another public RPC can be given with --rpc", file=sys.stderr) sys.exit(2) return answer["result"][2:]
def verify(proof, root=None): row, canonical = proof["row"], proof["canonical"] # 1. the text that is hashed is the canonical (RFC 8785) form of the row: sorted members, no whitespace, strings as they are if json.dumps(row, sort_keys=True, separators=(",", ":"), ensure_ascii=False) != canonical: return "the canonical text is not the row" # 2. the row's leaf, and the path from it to its partition's root leaf = h(b"\x00", canonical.encode()) if leaf.hex() != proof["leaf_hash"]: return "the leaf hash is not the hash of the canonical text" partition = proof["partition"] if walk(leaf, proof["index"], proof["rows"], proof["path"]).hex() != partition["root"]: return "the path does not lead to the partition's root" # 3. the partition's leaf in the day's tree commits to its table, size and root, and its path leads to the day's root text = json.dumps({"day": proof["day"], "root": partition["root"], "rows": proof["rows"], "schema_version": proof["schema_version"], "table": proof["table"]}, sort_keys=True, separators=(",", ":")) pleaf = h(b"\x00", text.encode()) if pleaf.hex() != partition["leaf"]: return "the partition's leaf is not what the partition says it is" if walk(pleaf, partition["index"], partition["count"], partition["path"]).hex() != proof["day_root"]: return "the partition's path does not lead to the day's root" if root is not None and root.lower().removeprefix("0x") != proof["day_root"]: return "the day's root is not the one you hold" return None
if __name__ == "__main__": args = sys.argv[1:] proof = json.load(open(args[0])) root = args[args.index("--root") + 1] if "--root" in args else None if "--rpc" in args: root = chain_root(args[args.index("--rpc") + 1], args[args.index("--contract") + 1], proof["day"]) if set(root) == {"0"}: sys.exit("invalid: nothing is anchored for " + proof["day"] + " on that contract") problem = verify(proof, root) print("valid" if problem is None else "invalid: " + problem) sys.exit(0 if problem is None else 1)The same in Node (18 or later), node verify.mjs proof.json ... with the same options:
#!/usr/bin/env node// Verifies a DEBYKO anchor proof (GET /v2/anchors/proof) with Node's standard library alone (Node 18 or later).//// node verify.mjs proof.json checks the proof against the day root inside it// node verify.mjs proof.json --root <hex> ... and against a root you got elsewhere (the chain, GET /v2/anchors/{day})// node verify.mjs proof.json --rpc https://mainnet.base.org --contract 0x0AF8259DBfC613825718d4d49A05F9F6fdA15086 asks the chain itself//// Any public Base RPC does for --rpc (https://base-rpc.publicnode.com, https://base.drpc.org, ...). Exit 0 and "valid" when every step// holds; exit 1 and the step that failed otherwise; exit 2 when the chain could not be asked.import { createHash } from 'node:crypto';import { readFileSync } from 'node:fs';
const h = (...parts) => createHash('sha256').update(Buffer.concat(parts)).digest();const hex = (buffer) => buffer.toString('hex');
/** RFC 9162 section 2.1.3.2: the root an audit path takes `leaf` (index `index` of `size`) to. */function walk(leaf, index, size, path) { let fn = BigInt(index), sn = BigInt(size) - 1n, r = leaf; for (const p of path.map((x) => Buffer.from(x, 'hex'))) { if (sn === 0n) return Buffer.alloc(0); if ((fn & 1n) === 1n || fn === sn) { r = h(Buffer.from([1]), p, r); while ((fn & 1n) === 0n && fn !== 0n) { fn >>= 1n; sn >>= 1n; } } else { r = h(Buffer.from([1]), r, p); } fn >>= 1n; sn >>= 1n; } return sn === 0n ? r : Buffer.alloc(0);}
/** RFC 8785 for what an anchored row holds (strings, booleans, null): members sorted by UTF-16 code units, no whitespace. */const canonicalOf = (value) => (value !== null && typeof value === 'object' ? '{' + Object.keys(value).sort().map((k) => JSON.stringify(k) + ':' + canonicalOf(value[k])).join(',') + '}' : JSON.stringify(value));
/** roots(uint32) of the DebykoAnchor contract: the selector 0x081dc681 and the day as yyyymmdd in one 32-byte word. */async function chainRoot(rpc, contract, day) { const data = '0x081dc681' + BigInt(day.replaceAll('-', '')).toString(16).padStart(64, '0'); let answer; try { const response = await fetch(rpc, { method: 'POST', headers: { 'content-type': 'application/json', 'user-agent': 'debyko-verify/1 (+https://docs.debyko.com/attest/verify/)' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'eth_call', params: [{ to: contract, data }, 'latest'] }), signal: AbortSignal.timeout(20000) }); answer = response.ok ? await response.json() : { error: `HTTP ${response.status}` }; } catch (e) { answer = { error: e.cause?.message ?? e.message }; } if (typeof answer?.result !== 'string') { console.error(`could not ask ${rpc}: ${JSON.stringify(answer?.error ?? answer)}; another public RPC can be given with --rpc`); process.exit(2); } return answer.result.slice(2);}
export function verify(proof, root) { const { row, canonical, partition } = proof; if (canonicalOf(row) !== canonical) return 'the canonical text is not the row'; const leaf = h(Buffer.from([0]), Buffer.from(canonical)); if (hex(leaf) !== proof.leaf_hash) return 'the leaf hash is not the hash of the canonical text'; if (hex(walk(leaf, proof.index, proof.rows, proof.path)) !== partition.root) return "the path does not lead to the partition's root"; const text = canonicalOf({ day: proof.day, root: partition.root, rows: proof.rows, schema_version: proof.schema_version, table: proof.table }); const partitionLeaf = h(Buffer.from([0]), Buffer.from(text)); if (hex(partitionLeaf) !== partition.leaf) return "the partition's leaf is not what the partition says it is"; if (hex(walk(partitionLeaf, partition.index, partition.count, partition.path)) !== proof.day_root) return "the partition's path does not lead to the day's root"; if (root !== undefined && root.toLowerCase().replace(/^0x/, '') !== proof.day_root) return "the day's root is not the one you hold"; return null;}
const args = process.argv.slice(2);if (args[0] !== undefined && import.meta.url === new URL(process.argv[1], 'file:').href) { const proof = JSON.parse(readFileSync(args[0], 'utf8')); const flag = (name) => (args.includes(name) ? args[args.indexOf(name) + 1] : undefined); let root = flag('--root'); if (flag('--rpc')) { root = await chainRoot(flag('--rpc'), flag('--contract'), proof.day); if (/^0*$/.test(root)) { console.error(`invalid: nothing is anchored for ${proof.day} on that contract`); process.exit(1); } } const problem = verify(proof, root); console.log(problem === null ? 'valid' : `invalid: ${problem}`); process.exit(problem === null ? 0 : 1);}What it does not say
Section titled “What it does not say”- It does not say the figures were right when they were collected, only that these are the figures DEBYKO held when the day was anchored (within 24 hours of its end), and that they have not changed since.
- A day anchored on a test network (
base-sepolia, not used for the real anchors) is a rehearsal: nobody is bound by it. Checknetworkin the answer. - It says nothing about rows DEBYKO does not store (a tail listing’s depth, a venue’s trades it does not collect) or that retention has dropped (the day’s root stays; the proofs of the dropped rows are gone).