The Write Last, Read First Rule
Blog post from TigerBeetle
TigerBeetle is a financial transactions database designed for accuracy, focusing on maintaining system consistency in the absence of traditional transactions. The database uses accounts and transfers for double-entry bookkeeping and works alongside Postgres, which stores master data such as account holder details. This separation allows transfers to scale independently, addressing different security and compliance needs. The system emphasizes the importance of choosing a "system of record" and a "system of reference" to ensure data consistency, with TigerBeetle acting as the system of record where account existence is confirmed. Operations must follow the "Write Last, Read First" principle to maintain consistency, with idempotent functions ensuring operations can be repeated without adverse effects. The implementation involves a structured orchestration through an API, using Distributed Async Await to guarantee eventual completion despite disruptions. Correctness is maintained by careful ordering of operations and detecting violations, ensuring a robust framework for financial transactions without relying on traditional transactional guarantees.