Append-only ledger
Durable, ordered records.
A ledger where every statement lands atomically and durably, balances that do not depend on arrival order, and the state at any past commit on demand.
The problem
A payments system has a strict correctness bar: every write has to land atomically and durably, balances have to be right, and history has to be reproducible to the state a decision saw. Bolting a ledger onto a general-purpose stack means reconciling an OLTP store, an analytics warehouse and an audit log that can drift from each other.
The drift is unacceptable here: a balance that depends on which copy answered is a balance that is wrong, and an audit trail that cannot reproduce the state at decision time is not an audit trail.
You want an append-only ledger, balances ordered by declared coordinates so late and re-delivered postings converge, and point-in-time reads, in one engine rather than three that have to agree.
Where NYXDB fits
Architecture
Postings land in a durable ledger, each statement its own atomic write, in the write-ahead log before acknowledgement; balances live in versioned tables where the engine settles which version wins; AS OF COMMIT rereads the winners at any commit sequence.
A posting is acknowledged only after the write-ahead log’s group persistence barrier has passed.
Each statement is its own atomic write; there are no multi-statement transactions.
In-order, shuffled and late postings converge to the same current and retained state, with VALID BY and REVISION BY.
Reread the winners exactly as they stood at a commit, with AS OF COMMIT and the sequence from a write receipt.
In practice
CREATE TABLE balances ( chain_id UINT16 NOT NULL, address STRING NOT NULL, token STRING NOT NULL, amount UINT256 NULL, updated_at DATETIME64(3, 'UTC') NULL, balance_index UINT128 NULL, balance_version UINT64 NULL, transfer_count UINT64 NULL, last_transfer_at DATETIME64(3, 'UTC') NULL, activity_index UINT128 NULL, PRIMARY KEY (chain_id, address, token), ATTRIBUTE GROUP holding (amount, updated_at, balance_index, balance_version) VALID BY (balance_index) REVISION BY (balance_version), ATTRIBUTE GROUP activity (transfer_count, last_transfer_at, activity_index) VALID BY (activity_index))MODE VERSIONEDSHARD BY (address) SHARDS AUTOORDER BY (chain_id, address, token);SELECT address, token, amountFROM balances AS OF COMMIT 42WHERE chain_id = 1;The examples use the same two tables on every page. See the SQL reference for full syntax.
Capabilities
Durable, ordered records.
Each statement is its own atomic, durable write.
AS OF COMMIT reads the winners at a commit sequence.
Late and re-delivered postings converge to the same balance.
Learn more