Try to edit a trading log without getting caught
Below are four rows from an example trading decision log. Each row stores a SHA-256 hash of its own contents plus the hash of the row before it. Pick a row, change any value, and watch verification fail. Then press Cover it up to rewrite that row's hash and see what happens to the next row.
Row
Example rows, not real orders. Each row stores row_hash = sha256(prior_row_hash + canonical_json(payload)), with keys sorted and no spaces, as in fleet/audit/chain.py.
A hash-chained log makes silent edits visible. Changing one row changes its hash, and every later row points at the old hash, so the chain breaks at the first edited row. It doesn't stop someone rewriting the whole log from that point on. That needs the latest hash to be copied somewhere the log's owner can't change.
How the hash is calculated
canonical_json = JSON with keys sorted and no spaces row_hash = sha256(prior_row_hash + canonical_json(payload)) first row : prior_row_hash is empty
The demo uses the browser's Web Crypto API. The Fleet does the same thing server-side in Python (fleet/audit/chain.py), and the hashes match: same payload in, same hash out. Nothing you type here is sent anywhere.
Why a trading system should keep one
When software trades on your account, "why did it do that?" needs an answer that can't be quietly rewritten afterwards. The Fleet writes every risk decision, order, rejection and kill-switch press to logs like this one. A row can be added but not edited without breaking verification, so a bad trade can't be made to disappear from the record after the fact.
What it does not prove
- Tamper-evident, not tamper-proof. Whoever controls the database can still rewrite every row from an edit onwards and recompute all the hashes. The chain only catches that if someone kept a copy of an earlier hash.
- Daily roots. The Fleet also folds each day's row hashes into one Merkle root per UTC day. Today that root is stored alongside the log. It becomes an independent check only once it's published somewhere outside our control, which we haven't done yet.
- Correct inputs. A hash proves a row hasn't changed since it was written. It can't prove the row was right when it was written.
Built by AI Trading Fleet: automated trading on your own exchange account with trade-only API keys and limits you set.