Soroush Neyestani

Software Engineer

Application Architect

Enterprise Application Developer

Technical Author & Educator

Transactional Ledger

Engineering a Double-Entry Transaction System with PostgreSQL, Concurrency Control, Durable Idempotency, and Auditable Financial History

An Open-Source Software Engineering Case Study

Developed by: Soroush Neyestani
Official Release: v0.1.0
Release Date: November 23, 2026
Project Status: Completed — Public Open-Source Release
License: MIT
Project Category: Backend Engineering / Database Architecture / Transactional Systems

Technology Stack: Java 21, Spring Boot 4.2.0, PostgreSQL 18.7, Flyway, OpenAPI, GitHub Actions

Public Source Code: Transactional Ledger on GitHub

Official Release: Transactional Ledger v0.1.0


Executive Summary

Transactional Ledger is an open-source Java reference implementation of a double-entry transactional ledger, designed to explore one of the most demanding problems in backend engineering: maintaining consistent financial records when operations are concurrent, retried, interrupted, or rejected.

Unlike a conventional CRUD application, a transactional ledger cannot treat each database write as an independent operation.

Every successful transfer must preserve the accounting model. Its corresponding debit and credit postings must remain balanced, its effects must be committed atomically, and its recorded history must remain consistent with the resulting account balances.

Furthermore, a client retry must not create an unintended second transfer, and concurrent withdrawals must not independently consume the same available balance.

I developed Transactional Ledger to demonstrate these requirements through a focused application using Java 21, Spring Boot 4.2.0, PostgreSQL 18.7, and Flyway.

The implementation includes:

  • Double-entry transfers with balanced debit and credit postings.
  • Exact integer-based monetary representation.
  • PostgreSQL transactions and database-enforced posting constraints.
  • Deterministic account locking for concurrent transfers.
  • Persistent idempotency records associated with financial effects.
  • Recovery behavior after transaction failures.
  • An append-only financial journal within documented database privilege boundaries.
  • Account balance calculation from committed ledger history.
  • Compensating transactions for accounting corrections.
  • Versioned HTTP APIs for accounts, transfers, balances, history, and reconciliation.
  • Automated unit and PostgreSQL-backed integration tests.
  • A documented threat model and reproducible synthetic load-testing methodology.
  • A versioned public source release verified by GitHub Actions.

The official release passed 16 automated tests, including six unit tests and ten HTTP/PostgreSQL integration tests.

A local synthetic benchmark processed 10,828 requests in approximately ten seconds, including 5,078 posted transfers, 5,414 balance reads, and 336 expected insufficient-funds rejections. No unexpected errors were reported during that specific workload.

The project is explicitly limited to synthetic accounts and a controlled development environment.

It does not perform real-money transfers, integrate with banking networks, provide regulated custody services, or claim production-grade financial certification.

Its purpose is to demonstrate the architecture, implementation trade-offs, and verifiable correctness properties of a transactional ledger.


1. The Engineering Problem

Financial correctness requires more than successful database writes

Many applications can tolerate temporary inconsistency, delayed processing, or the occasional duplicate record without immediately violating their most important business requirements.

Financial recordkeeping systems have different expectations.

An incorrectly duplicated transaction can change an account's recorded value.

A partially persisted transfer can leave the books inconsistent.

Two simultaneous withdrawals can independently observe a sufficient balance and then collectively exceed that balance if concurrency is handled incorrectly.

A retry after an interrupted response can apply an operation twice if the system cannot recognize its previous execution.

These problems cannot be solved by a successful HTTP status code alone.

They require explicit accounting invariants, durable transaction boundaries, concurrency control, and recoverable operation identities.

The core questions

The project was designed around several technical questions.

Accounting: How can the system guarantee balanced postings for each committed transfer?

Atomicity: What prevents an operation from committing one posting without the corresponding posting?

Concurrency: How can two simultaneous operations safely compete for the same account balance?

Idempotency: How can the system distinguish a legitimate retry from a new operation?

Recovery: What happens when a database lock or another failure interrupts a request?

Auditability: How can historical financial entries remain protected from ordinary mutation?

Reconciliation: How can recorded account balances be checked against the ledger history?

Reproducibility: How can these properties be demonstrated through automated tests and independently distributed source code?

Transactional Ledger addresses these questions within a deliberately limited, testable domain.


2. Project Objectives and Scope

The primary objective was to build a small but technically credible double-entry ledger.

The project does not attempt to recreate a complete banking platform.

Instead, the release focuses on the essential behavior of a transactional accounting engine.

Functional scope

The implementation supports synthetic ledger accounts, financial transfers, account balance queries, transaction history, and reconciliation.

It provides a versioned HTTP interface for the supported operations.

The accounting model includes wallet accounts with a credit-normal balance and funding accounts with a debit-normal balance.

This distinction is important because debit and credit do not universally mean increasing or decreasing a balance.

Their effect depends on the account's accounting classification and the conventions of the system.

Engineering scope

The implementation concentrates on database transactions, financial invariants, controlled concurrent execution, persistent idempotency, journal protection, and reproducible tests.

The release is intended to be inspectable and understandable as a reference implementation.

Explicit non-goals

Version v0.1.0 does not claim to implement:

  • Real-money movement.
  • Banking integration or payment settlement.
  • Regulated financial custody.
  • A complete general ledger for every accounting category.
  • Multi-operator enterprise identity management.
  • Cryptographic tamper-proofing.
  • Financial regulatory certification.
  • Universal protection against privileged database administrators.
  • Proven correctness under every possible infrastructure failure.

These boundaries are central to an accurate evaluation of the project.


3. Technology and System Architecture

The application uses Java 21 with Spring Boot 4.2.0 and PostgreSQL 18.7.

Flyway manages the database schema.

The versioned HTTP API exposes the supported ledger operations to a controlled client.

Technology responsibilities

Technology Responsibility
Java 21 Domain and application implementation
Spring Boot 4.2.0 HTTP service and application runtime
PostgreSQL 18.7 Durable ledger persistence and transactional constraints
Flyway Reproducible database schema migrations
OpenAPI Versioned HTTP contract documentation
Automated Java tests Unit and integration verification
GitHub Actions Continuous integration and release verification
SHA-256 Source archive integrity verification

Conceptual processing architecture

The system can be understood through the following responsibilities:

Authenticated request → Validation → Idempotency resolution → Account locking → Balance policy checks → Atomic ledger posting → Commit → Response

This is a conceptual description of the workflow rather than a claim about the exact order of every internal method call.

The architectural responsibilities are deliberately distinct.

Request validation addresses malformed or unsupported operations.

Idempotency determines whether the logical operation has already been processed.

Concurrency control protects account-related decisions from conflicting simultaneous operations.

Ledger posting creates the financial records.

Database constraints enforce relevant structural invariants.

Transaction commit determines whether the financial effects become durable.

The response communicates the result of the committed or rejected operation.

Why the relational database matters

PostgreSQL is not merely a storage backend in this architecture.

Its transactions, locking mechanisms, constraints, and privilege model contribute directly to the system's correctness properties.

Application code remains responsible for interpreting business rules, but the database is used to enforce critical conditions that must not depend exclusively on individual HTTP handlers.


4. Double-Entry Accounting Model

Debit and credit are accounting directions

Double-entry accounting records each supported transfer through corresponding debit and credit postings.

For the supported transfer structure, the postings must have equal amounts and compatible currency representation.

A transfer is considered balanced when the total debit amount equals the total credit amount.

Formally:

Total Debits − Total Credits = 0

This relationship describes the balance of a posting group.

It does not, by itself, guarantee that the operation was authorized, that the source account had sufficient funds, or that the transaction was appropriate for its business purpose.

Those properties require additional rules.

A focused two-posting transfer model

Transactional Ledger v0.1.0 uses a focused transfer model consisting of two corresponding postings.

Each committed transfer creates a balanced pair.

This makes the financial operation directly inspectable.

The transfer and its posting records must also obey the database's atomicity and consistency rules.

Account balance conventions

The project distinguishes between credit-normal wallet accounts and debit-normal funding accounts.

This matters because the meaning of a posting depends on the account type.

A debit increases the normal balance of some accounting categories and decreases others.

Likewise, a credit does not universally represent an increase.

The implementation therefore requires explicitly defined account conventions rather than treating positive and negative numbers as an adequate accounting model.

Opening balances

Synthetic opening balances are introduced through balanced transfers.

This preserves the accounting model from the beginning of the test scenario.

A system that simply writes an arbitrary initial balance to an account would create a discrepancy between the stored balance and its supporting journal history.

By recording funding through the ledger, the project maintains an auditable origin for the synthetic funds used during testing.


5. Exact Monetary Representation

Why floating-point arithmetic is inappropriate

Binary floating-point values cannot exactly represent every decimal monetary amount.

Repeated operations may introduce rounding behavior that is acceptable for some scientific calculations but inappropriate for exact ledger posting invariants.

Transactional Ledger therefore represents amounts using integers in the smallest supported monetary unit.

For example, in a two-decimal-unit currency, an amount of 125.50 can be represented internally as 12,550 minor units.

This is an explanation of the representation model, not a claim that the application supports arbitrary currency conversion.

Engineering advantages

Integer-based amounts make equality comparisons deterministic within the supported representation.

They also simplify checks that corresponding debit and credit postings have equal values.

However, integer arithmetic must still be protected against invalid values and overflow.

Exact representation does not automatically establish valid business semantics.

Important distinction

Numerical precision and financial correctness are separate requirements.

Exact arithmetic prevents one category of representation error.

It does not replace transaction isolation, authorization, account validation, or accounting reconciliation.


6. Atomic Ledger Transactions

The partial-posting problem

Imagine a transfer that requires two financial postings.

If the first posting is committed and the second fails, the ledger becomes unbalanced.

The application must therefore treat the financial operation as a single transactional unit.

Either all required effects commit successfully, or none of them do.

PostgreSQL transaction boundaries

Transactional Ledger uses PostgreSQL transactions to coordinate financial writes.

The implementation also includes database enforcement that rejects incomplete postings at commit.

This provides two complementary safeguards:

Transaction atomicity prevents a transaction from partially committing its database changes.

Database-level accounting validation prevents the defined incomplete or unbalanced posting state from being accepted as a valid committed transfer.

The distinction matters.

Atomicity guarantees that a group of writes commits together or not at all.

Accounting constraints determine whether the committed group is valid.

Commit-time consistency

The reported implementation rejects incomplete ledger postings when the transaction attempts to commit.

This protects the journal against an application workflow that would otherwise persist an incomplete transfer.

The database therefore participates directly in enforcing the accounting invariant.

Why application validation alone is insufficient

An application service can check that it has constructed two postings.

However, correctness should not rely exclusively on the assumption that every future code path will always invoke the expected validation method.

Database constraints help create an independent enforcement boundary.

That boundary must still be interpreted according to the actual database roles and privileges in use.


7. Concurrency Control and Overdraft Prevention

The concurrent withdrawal problem

Consider an account with 100 units available.

Two requests arrive at nearly the same time.

Each attempts to withdraw 80 units.

If both requests independently read the original balance, they may each conclude that the withdrawal is valid.

Without appropriate synchronization, both may proceed.

The resulting combined withdrawal would violate a policy that prohibits overdrafts.

This is a classic concurrency problem.

Transaction isolation

The project uses PostgreSQL's READ COMMITTED isolation level.

Under this isolation model, applications must deliberately manage situations where a decision depends on values that another transaction may change.

The system does not assume that choosing an isolation level automatically solves every concurrency problem.

Deterministic account locking

Transactional Ledger locks the affected accounts in a consistent UUID order.

A deterministic lock order is useful because different transfers may involve the same accounts in opposite directions.

If competing transactions acquire locks in inconsistent orders, they can create avoidable deadlock patterns.

Ordering lock acquisition consistently reduces this risk for the supported workflow.

Protecting the balance decision

The relevant account state must be evaluated within the concurrency-control boundary.

A balance decision made before appropriate synchronization could become stale while another transaction posts a competing withdrawal.

The project's reported verification demonstrated that two competing withdrawals did not both bypass the insufficient-funds policy.

Only the permitted operation was committed.

What the test establishes

The successful concurrent withdrawal test demonstrates that the implemented locking strategy handled the tested competition correctly.

It does not establish mathematical proof of correctness for every possible workload, database configuration, or failure schedule.

This distinction between demonstrated behavior and universal guarantees is important when evaluating financial software.


8. Durable Idempotency

Retries are inevitable in distributed communication

A request can reach the server, be processed, and commit successfully even if the response never reaches the client.

The client may then retry.

Without idempotency, the backend may interpret the retry as a new transfer.

That could create duplicate financial effects.

The intended semantics

Transactional Ledger persists idempotency information in PostgreSQL.

The key identifies a logical operation within the documented request scope.

The supported behavior is:

Request condition Expected result
New valid idempotency key Process and record the transfer
Same key and identical request Return the original result
Same key with different request data Reject with HTTP 409 Conflict
Retry after a rolled-back attempt Permit processing according to the current persisted state

Transactional relationship between receipt and transfer

The financial operation and its idempotency record are persisted within the same transaction.

This prevents a successfully committed transfer from being separated from the durable record used to recognize its execution, within the supported transaction model.

If the transaction rolls back, neither the financial effects nor a misleading success receipt should remain.

Cross-instance verification

The reported test evidence includes recovering an idempotent result from PostgreSQL in a separate application instance.

This is a meaningful distinction from an in-memory cache.

An in-memory implementation would not, by itself, establish durability across application restarts or independently running instances.

Idempotency is not unlimited exactly-once processing

The project demonstrates persistent deduplication behavior for its supported operation.

It does not claim universal exactly-once execution across external payment systems, messaging infrastructure, or arbitrary distributed side effects.

Such guarantees require broader protocols and operational assumptions.


9. Failure Recovery: The HTTP 503 Scenario

One of the most valuable verification scenarios in the project concerns a failure during database lock contention.

Initial attempt

A lock prevented the operation from completing normally.

The service returned HTTP 503.

The subsequent database inspection established that no transfer and no idempotency receipt had been persisted.

This matters because a failed request should not leave behind a partial financial operation.

Recovery attempt

After the lock was released, the request was repeated using the same idempotency key.

The retry succeeded with HTTP 201.

The resulting persisted state contained:

One transfer and exactly two balanced journal postings.

Why this test matters

The test covers more than a standard successful transfer.

It evaluates the relationship between failure, transaction rollback, idempotency state, and subsequent recovery.

A less carefully designed implementation might leave a receipt indicating success while the corresponding transfer was absent.

Alternatively, it might persist part of the transfer before failing.

The tested implementation avoided these outcomes in the documented scenario.

Limits of the evidence

This scenario provides concrete recovery evidence.

It does not replace testing every possible infrastructure interruption, including power loss, storage corruption, network partitions, or administrative database intervention.

Those conditions require separate evaluation.


10. Immutable Journal and Auditability

Why financial history should not be silently rewritten

A ledger is valuable partly because it preserves the history from which balances and financial movements can be reconstructed.

If historical postings can be freely edited or deleted, the system loses a critical component of its auditability.

Transactional Ledger therefore uses an append-only approach for committed financial history.

Database-enforced protection

The implementation includes PostgreSQL controls intended to prevent modification, deletion, and truncation of protected journal records through the supported database access roles.

The reported verification includes tests for those boundaries.

Corrections through compensating entries

A correction should not silently replace the original financial event.

Instead, the project uses separate compensating transfers.

This preserves the original record and introduces a new event representing the correction.

The result is a more auditable sequence of operations.

The privilege boundary

An important limitation is that these protections are not equivalent to cryptographic tamper resistance.

A sufficiently privileged database owner or administrator may be able to alter database structures, permissions, triggers, or stored data.

Consequently, the project describes journal immutability within its documented PostgreSQL privilege boundary.

It does not claim that privileged infrastructure operators are technically incapable of modifying the history.

Auditability versus tamper-proofing

An append-only application model and database restrictions improve traceability.

They do not automatically establish independent, tamper-evident audit history.

Stronger guarantees could require additional controls such as independently retained hashes, externally anchored records, restricted operational privileges, and monitored audit trails.

Those mechanisms are not claimed as implemented in v0.1.0.


11. Reconciliation and Balance Calculation

The journal as the basis for account balances

The system calculates account balances from committed ledger postings.

This establishes a direct relationship between the reported balance and its supporting transaction history.

Instead of treating a mutable balance field as the only source of truth, the ledger can reconstruct the value from recorded financial effects.

Reconciliation

Reconciliation verifies that the recorded account state is consistent with the relevant journal entries and accounting conventions.

For the supported transfer model, balanced debit and credit totals are a fundamental check.

Observed benchmark reconciliation

During the recorded synthetic load test, the aggregate posted amounts were:

Posting direction Recorded total
Debit 2,006,273 minor units
Credit 2,006,273 minor units
Difference 0 minor units

This confirms the reported aggregate equality of debit and credit amounts for that workload.

It is important not to overinterpret this result.

Balanced totals do not prove that every transfer was authorized or that every business-specific constraint was satisfied.

The test suite and database controls address additional properties.

The scalability trade-off

Computing a balance directly from journal history provides a transparent relationship between recorded events and derived state.

However, the computational cost may increase as the history grows.

This is a documented limitation of the initial release.

A larger deployment might consider snapshots, materialized aggregates, carefully maintained balance projections, or incremental reconciliation.

Such mechanisms introduce additional synchronization and correctness responsibilities.

They should not be treated as free performance optimizations.


12. API Design and Security

The application provides a versioned HTTP API for the supported ledger operations.

The documented capabilities include:

  • Account access and management.
  • Transfer posting.
  • Transfer retrieval.
  • Account balance queries.
  • Transaction history.
  • Reconciliation information.

The repository's OpenAPI specification defines the exact request and response contracts.

Authentication boundary

Protected ledger operations require Bearer-token authentication.

The application binds to loopback by default in the documented setup.

These choices help limit the intended exposure of the reference environment.

Single-operator scope

The initial release uses a single-operator model with manually managed token configuration.

It does not provide the full identity lifecycle expected from a production financial service.

Why authentication is not sufficient

An authenticated caller can still submit an invalid operation.

The application must continue to enforce account rules, transaction limits, and supported business constraints.

Authentication protects access to the interface.

It does not replace accounting validation.

Direct database access

The threat model explicitly documents a significant residual risk: direct SQL access with sufficient privileges may bypass application-level balance policy checks.

This is a crucial distinction.

Database-enforced posting balance is not identical to application-enforced overdraft prevention.

A direct database write may preserve debit/credit equality while still violating a balance policy that the application would have enforced.

Therefore, database permissions and operational access controls are essential parts of the security model.


13. Automated Verification

The project includes 16 automated tests.

Test category Number
Unit tests 6
HTTP/PostgreSQL integration tests 10
Total 16

The recorded verification reported all 16 tests passing.

Unit-level verification

Unit tests provide focused evidence for selected domain and application behaviors.

They support fast regression checks and help isolate logical problems.

Database-backed integration verification

Integration tests exercise the relevant behavior across HTTP and PostgreSQL.

This is essential because the most important guarantees of the project depend on real database transactions, locks, constraints, and persistent state.

Mocked repositories cannot fully establish the behavior of PostgreSQL's transaction and locking mechanisms.

Negative scenarios

The reported tests include conditions where rejecting a request is the correct outcome.

Examples include:

  • Competing withdrawals that would violate balance policy.
  • Conflicting reuse of an idempotency key.
  • Database lock contention.
  • Protection against invalid journal mutation.
  • Transaction rollback and retry behavior.

These are important because a ledger must be able to reject invalid operations, not merely process valid ones.

A passing negative test

An expected HTTP error can be the correct result of a successful test.

For example, a test designed to verify rejection of a conflicting idempotency key should pass when the application returns the documented conflict response.

The quality of the test suite depends on whether the expected behavior is asserted correctly, not on whether every HTTP request returns a success status.

Cross-environment verification

The release candidate was reportedly verified through local Windows execution, execution from an extracted source ZIP, and GitHub Actions on Ubuntu 24.04.

The public distribution was also verified through its own GitHub Actions workflows.

This reduces dependence on undocumented local development state.


14. Continuous Integration and Release Evidence

The public distribution records successful CI verification on the main branch and the official release tag.

Public main-branch CI

https://github.com/soroushneyestani/transactional-ledger-reference/actions/runs/45236234189

Official release-tag CI

https://github.com/soroushneyestani/transactional-ledger-reference/actions/runs/45236599949

Both runs reported 16 passing tests on Ubuntu 24.04.

Why both checks matter

A successful branch build demonstrates that the tested development revision meets the configured verification requirements.

A successful release-tag build connects those checks to the published source revision.

These are related but distinct pieces of evidence.

Source reproducibility

The publication process compared the implementation source, migrations, API contract, tests, and benchmark material with the approved private release candidate.

The public distribution uses an independent, clean repository history.

The reported differences were limited to release-oriented documentation and packaging.

Integrity verification

The release ZIP and checksum were downloaded without authentication and compared successfully.

The automatically generated GitHub source archives were also checked against the 36-file release source inventory.

These checks provide a reproducible relationship between the approved source and the files made available publicly.


15. Local Performance Benchmark

The project includes a documented synthetic load test.

The workload used eight concurrent users and ran for approximately ten seconds on a local host.

Overall results

Metric Recorded value
Total requests 10,828
Duration 10.018 seconds
Overall throughput 1,080.847 requests/second
Concurrent users 8
Posted transfers 5,078
Balance reads 5,414
Expected insufficient-funds rejections 336
Unexpected errors 0

Latency distribution

Operation Requests p50 p95 p99
Posted transfers 5,078 13.120 ms 18.559 ms 25.825 ms
Balance reads 5,414 1.195 ms 1.838 ms 2.493 ms
Expected rejections 336 12.190 ms 18.790 ms 24.982 ms

Interpretation

The read workload showed substantially lower latency than transfer posting in this specific test environment.

This difference is consistent with the fact that transfer posting involves additional database synchronization and write operations.

However, the measurement alone does not establish which individual component accounts for the observed latency.

The benchmark also contained business-rule rejections.

The 336 insufficient-funds responses were expected outcomes, not unexpected infrastructure failures.

Separating these categories is essential when reporting load-test results.

Accounting consistency during the workload

The benchmark recorded equal aggregate debit and credit totals:

2,006,273 minor units on each side.

This provided an additional accounting consistency check for the executed synthetic workload.

Benchmark limitations

These numbers should not be generalized to production environments.

The test used synthetic data, eight users, and local infrastructure.

It did not establish performance over a distributed network or under sustained production workloads.

The results also depend on the database configuration, host resources, test data, and operation mix.

The benchmark is therefore presented as a reproducible local baseline rather than a throughput guarantee.


16. Threat Model and Residual Risks

The release includes an explicit threat model.

Its most important contribution is distinguishing implemented protections from situations they do not cover.

Protected properties

Within the supported application and database boundaries, the project seeks to protect:

Financial integrity: Transfers must produce balanced and complete journal effects.

Concurrency correctness: Competing operations must respect the supported available-balance policy.

Retry safety: Repeated requests must not unintentionally create another transfer.

Journal history: Committed entries must not be silently edited through supported operational access paths.

Access control: Protected HTTP operations must require the documented authentication mechanism.

Residual risks

The reported limitations include:

Database ownership: Highly privileged database operators may bypass the controls that restrict modifications to journal history.

Direct SQL operations: Database writes outside the application may bypass application-level available-balance checks.

Manual token management: The initial release does not include mature identity lifecycle management.

Idempotency retention: Persisted receipts do not expire automatically.

Balance-query performance: The cost of deriving balances from history increases as ledger data grows.

Deployment scope: A local reference implementation is not equivalent to an operationally hardened financial platform.

What the threat model does not establish

The existence of a threat model does not itself prove that every vulnerability has been eliminated.

It identifies relevant assumptions, boundaries, mitigations, and remaining risks.

Its value is that the project's security claims remain inspectable and appropriately limited.


17. Source Distribution and Release Integrity

Transactional Ledger v0.1.0 was published from a dedicated public distribution repository.

Official source revision

Release version: v0.1.0

Public Git commit:

bd53ce0a15ff5e1647b962bddd17bcf74dbf103e

Repository:

https://github.com/soroushneyestani/transactional-ledger-reference

Release page:

https://github.com/soroushneyestani/transactional-ledger-reference/releases/tag/v0.1.0

Source archive

The public release includes the complete approved source distribution.

ZIP download:

https://github.com/soroushneyestani/transactional-ledger-reference/releases/download/v0.1.0/transactional-ledger-v0.1.0-source.zip

Published SHA-256:

a8ef2dc15d578790ef8ba8e11a143ccb30f2c34169a795144500f33ed46fef3c

Checksum file:

https://github.com/soroushneyestani/transactional-ledger-reference/releases/download/v0.1.0/SHA256SUMS.txt

Version integrity

The published release tag identifies the exact verified public source revision.

The reported GitHub repository protection prevents ordinary force-push and deletion operations on the protected main branch and blocks changes or deletion of the release tag under the configured rules.

These mechanisms support stable release references.

Licensing

The original project source is released under the MIT License.

Third-party dependencies retain their own licensing conditions and notices.

The public source package includes the required project license and documented dependency notices.

Private development separation

The original development repository remains private.

The public distribution has an independent Git history containing the approved source.

This keeps internal administrative history separate from the release-eligible implementation.


18. Important Architectural Trade-offs

The project illustrates several deliberate engineering decisions.

Exact integers versus floating-point amounts

Integer minor units support exact monetary representation within the selected currency model.

The trade-off is that currency scale, allowed ranges, and arithmetic overflow must be handled explicitly.

Journal-derived balances versus cached balances

Deriving balances from committed postings improves traceability.

The trade-off is increased computational cost as the journal grows.

Cached or projected balances could improve read performance but would require additional consistency mechanisms.

READ COMMITTED with explicit locks versus stronger isolation

Explicit account locking under READ COMMITTED provides a targeted way to protect the supported transfer workflow.

The trade-off is additional lock management and the need to reason carefully about every operation that depends on mutable account state.

Using a stronger isolation level would introduce different contention and retry considerations rather than eliminating all architectural decisions.

Database-enforced balance structure versus application-only validation

Database constraints provide an additional defense against invalid committed posting structures.

The trade-off is more sophisticated schema and transaction design.

However, financial authorization and overdraft policy still need their own enforcement boundaries.

Persistent idempotency versus in-memory deduplication

Persisting receipts supports recovery across application instances.

The trade-off includes storage management, conflict handling, and retention policy decisions.

Append-only history versus direct record correction

Separate compensating entries preserve the original financial event.

The trade-off is that corrections become explicit financial operations requiring their own validation and reconciliation.

Simple operator model versus enterprise identity management

A manually managed Bearer-token model keeps the reference implementation focused on ledger correctness.

It is not sufficient evidence of production-grade authentication and operational security.


19. Lessons from the Implementation

Several lessons from this project extend beyond accounting applications.

Correctness must be defined as explicit invariants

A system becomes easier to reason about when its most important rules are stated precisely.

Balanced postings, atomic commits, durable idempotency, and protected account balances are examples of such invariants.

Database behavior is part of application architecture

Relational constraints, transaction isolation, and locks are not merely database administration details.

They directly affect the correctness of the application.

Concurrency testing must exercise actual competing operations

Sequential tests cannot establish whether two withdrawals or two duplicate requests are handled safely under contention.

Tests must deliberately create the conditions under which the implementation's concurrency strategy matters.

Recovery testing is as important as success testing

An operation that succeeds under ideal conditions may still fail to preserve consistency after an interrupted request.

The 503-and-retry scenario demonstrates why testing the failed state and subsequent recovery is necessary.

Accounting balance is not the only financial guarantee

Equal debit and credit totals are necessary within this accounting model.

They do not automatically prove access authorization, sufficient funds, correct account selection, or legitimate business purpose.

Multiple invariants must be evaluated independently.

Immutability needs a precise threat boundary

An append-only journal protected through database permissions is valuable.

It should not be described as cryptographically tamper-proof or immune to privileged administrative intervention.

Benchmark results require workload context

Performance numbers without concurrency, workload mix, and environment details are incomplete.

Expected business rejections must also be separated from unexpected failures.

A credible release includes evidence

A completed project includes more than source code.

Reproducible tests, CI verification, architecture documentation, security limitations, licensing, and source-integrity records all contribute to its engineering credibility.


20. Future Engineering Directions

The initial release is complete within its approved scope.

Potential future improvements include:

Balance projections: Efficient derived balance storage with explicit consistency and reconciliation guarantees.

Receipt lifecycle management: Configurable idempotency retention and expiration.

Authentication: More mature credential issuance, expiration, rotation, and authorization policies.

Operational observability: Structured tracing, metrics, and transaction diagnostics.

Additional failure testing: More extensive crash, restart, lock-contention, and database-recovery scenarios.

Independent audit evidence: Tamper-evident records with appropriately defined trust and verification boundaries.

Performance analysis: Larger synthetic datasets, sustained workloads, and controlled multi-host measurements.

Expanded accounting models: Additional account categories and explicitly defined posting semantics.

Operational deployment: Hardened configuration, backup and recovery processes, restricted database privileges, and documented service operation.

These are possible development directions, not features promised or implemented in v0.1.0.


21. How to Review the Project

A technical reviewer can evaluate the published source through several complementary perspectives.

Architecture: Inspect how the domain model separates accounts, transfers, postings, and idempotency information.

Database integrity: Examine the Flyway migrations and PostgreSQL enforcement of posting completeness and history protection.

Concurrency: Review the documented READ COMMITTED strategy and deterministic account-lock ordering.

Recovery: Examine the test demonstrating an unsuccessful operation followed by a successful retry using the same idempotency key.

Accounting: Verify how the implementation establishes balanced debit and credit postings and derives balances from committed history.

Security: Read the threat model, especially the documented boundaries involving database privileges and direct SQL access.

Testing: Inspect the unit and integration tests and compare their assertions with the stated engineering guarantees.

Performance: Read the benchmark methodology before interpreting throughput and latency figures.

Release quality: Review the public GitHub Actions results, exact source revision, source ZIP, and published SHA-256 digest.

This review path allows the project's claims to be assessed against implementation and recorded evidence.


Conclusion

Transactional Ledger v0.1.0 is an open-source reference implementation demonstrating how double-entry accounting requirements influence software architecture, database design, concurrency control, and failure recovery.

It implements balanced transfers using exact monetary values, PostgreSQL transaction boundaries, deterministic account locking, persistent idempotency, and protected journal history.

Its automated verification includes concurrency competition, rollback behavior, retry recovery, accounting reconciliation, and the supported HTTP/database integration paths.

The public release provides 16 passing automated tests, successful GitHub Actions verification, documented limitations, and a checksum-verified source distribution.

The project is not a banking platform and does not claim unrestricted financial correctness or security against privileged infrastructure administrators.

Its objective is narrower and more technically specific:

To demonstrate how financial invariants can be translated into application behavior, database guarantees, executable tests, and reproducible engineering evidence.

The central lesson is that a financial operation is not complete merely because an API reports success.

It is complete only when the intended effects have been committed consistently, their accounting representation remains valid, and the system can explain what happened—including when requests are repeated or interrupted.


Project Resources

Public Source Repository
https://github.com/soroushneyestani/transactional-ledger-reference

Official v0.1.0 Release
https://github.com/soroushneyestani/transactional-ledger-reference/releases/tag/v0.1.0

Source ZIP
https://github.com/soroushneyestani/transactional-ledger-reference/releases/download/v0.1.0/transactional-ledger-v0.1.0-source.zip

SHA-256 Checksums
https://github.com/soroushneyestani/transactional-ledger-reference/releases/download/v0.1.0/SHA256SUMS.txt

Main Branch CI
https://github.com/soroushneyestani/transactional-ledger-reference/actions/runs/45236234189

Release Tag CI
https://github.com/soroushneyestani/transactional-ledger-reference/actions/runs/45236599949

Release Verification Evidence
https://github.com/soroushneyestani/transactional-ledger-reference/blob/v0.1.0/docs/RELEASE_EVIDENCE.md

Threat Model
https://github.com/soroushneyestani/transactional-ledger-reference/blob/v0.1.0/docs/THREAT_MODEL.md

Benchmark Methodology and Results
https://github.com/soroushneyestani/transactional-ledger-reference/blob/v0.1.0/docs/BENCHMARK.md

Third-Party License Notices
https://github.com/soroushneyestani/transactional-ledger-reference/blob/v0.1.0/THIRD_PARTY_NOTICES.md


Developed by Soroush Neyestani
Transactional Ledger — v0.1.0
November 2026 | MIT License | Open Source

Keywords: Double-Entry Accounting, Transactional Ledger, Java, Spring Boot, PostgreSQL, ACID Transactions, Database Concurrency, Idempotency, Ledger Integrity, Financial Invariants, Account Reconciliation, Immutable Journal, Flyway, OpenAPI, GitHub Actions, Backend Engineering, Software Architecture.