Pine Harbor Payments needs a ledger prototype for a developer review. The data contains opening account balances and operations shaped [from, to, amount, id]. Finish with a checked batch decision, rejection of invalid transfers, duplicate protection, and a stated concurrency boundary. Opening balances are nonnegative. Every operation has four integer fields. Per-account balances and intermediate values fit in int; their opening total fits in long. All amounts and organizations are fictional.
Build the ledger in six connected steps. Each step keeps the source from the preceding one and changes the required observable result. Work with integer units so the tests focus on transfer rules rather than floating-point rounding. The browser runs sequential tests, so explain separately how one shared lock protects the ledger on a full JVM.