Verify a book
For anyone: replay a book's entries and check them against its seals.
On the Verify page
- Open Verify. It loads the book's entries and seals.
- Press Replay.
- Each seal is listed as matching or failing, with the sealed head beside the replayed one.
Switch on Tamper to change one entry's amount before the replay. The seals that cover it fail, and the page names the first entry that no longer produces the head on record.
Yourself
Start from 32 zero bytes, fold in each entry in order, and compare the result with the seal's head when you reach the seal's last entry.
let head = Buffer.alloc(32);
for (const e of entries) {
head = createHash("sha256")
.update(head)
.update(u64(e.index))
.update(Buffer.from([e.kind, e.category]))
.update(u64(e.amount))
.update(e.agent.toBuffer())
.update(e.counterparty.toBuffer())
.update(Buffer.from(e.memo))
.update(i64(e.ts))
.digest();
}
assert.deepEqual([...head], seal.head);u64 and i64 write eight bytes, little endian. The entries come from the program's Entry events; the seal is the Seal account at the index you are checking.
A match proves the entries are the ones that were sealed, in that order. It does not prove what a memo's receipt says, only that the memo has not changed.
NextInstructions