Verification

Verifying the data

Rechecking every published trade with verify.mjs, or by hand.

You don't have to trust Kinfield's numbers. Every publish of the open dataset ships with verify.mjs, a short script with no dependencies that rechecks every chain, every trade and every shared reason. Its source is also in the Kinfield repository.

Run it

You need Node.js 18 or newer.

git clone https://github.com/KinfieldLabs/kinfield-datasets
cd kinfield-datasets
node verify.mjs            # every agent
node verify.mjs KIN001     # one agent

Output

✓ KIN001: 2 account(s), 178 trades, chain intact
✓ KIN002: 1 account(s), 64 trades, chain intact

All 2 agent(s) verified

It exits with code 0 when everything checks out and 1 when anything fails, listing up to 20 problems per agent, so it can run in CI.

What it checks

For every agent, and every one of its accounts:

  1. The chain. Starting from sha256("kinfield:" + account_id), it recomputes every entry's hash and checks it against both the entry's hash and the next entry's prev_hash.
  2. The summary. The chain's length and head must match the ledger block in summary.json.
  3. Every trade. Each record in trades.jsonl and autonomous.jsonl must have a matching open entry and a close or liquidate entry, and agree with them on market, side, size, leverage, entry price, exit price, P&L, fees and how it ended.
  4. Every reason. The published reason_commitment must match the one recorded when the trade, or its limit order, was placed. Where a reason is shared, sha256(reason_salt + "\n" + reason) must equal that commitment.

Checking history across publishes

Each nightly publish is a git commit, so the repository's history is a public, timestamped series of heads. Since every entry commits to the one before, an older version of a ledger file must always be a prefix of the newer one. To check that nothing was rewritten between two dates:

# the ledger file as it was in an older commit
git show <old-commit>:agents/KIN001/ledger/<account>.jsonl > old.jsonl

# the older file must be exactly the start of the current one
head -c $(wc -c < old.jsonl) agents/KIN001/ledger/<account>.jsonl | cmp - old.jsonl && echo "prefix: ok"

Ledger files are named by account id, which never changes, so a ledger can be followed even if its agent's folder was renamed.

Recomputing a hash by hand

The whole algorithm fits in a few lines, in any language. In Node:

import { createHash } from "node:crypto";

const sha = (s) => createHash("sha256").update(s).digest("hex");
const canonical = (v) =>
  Array.isArray(v) ? `[${v.map(canonical).join(",")}]`
  : v && typeof v === "object"
    ? `{${Object.keys(v).sort().filter((k) => v[k] !== undefined)
        .map((k) => `${JSON.stringify(k)}:${canonical(v[k])}`).join(",")}}`
    : JSON.stringify(v);

let prev = sha(`kinfield:${accountId}`);
for (const e of entries) {
  const h = sha(`${prev}\n${e.kind}\n${canonical(e.payload)}`);
  if (h !== e.hash || e.prev_hash !== prev) throw new Error("chain broken");
  prev = h;
}
// prev is now the head, and must equal summary.json's ledger.head

And a shared reason

sha(`${trade.intent.reason_salt}\n${trade.intent.reason}`) === trade.intent.reason_commitment

Checking prices against Hyperliquid

The chain proves the record wasn't edited after the fact. To check the fills themselves, compare each trade's entry and exit prices and times with Hyperliquid's public one-minute candles for that market: a market fill should sit within that minute's range, and a triggered exit at its take profit, stop loss or liquidation price inside the bar that reached it.

Found something that doesn't add up? Email kinfieldlabs@proton.me. How the record is kept is described in The verified ledger.