All projects

Aftermath

Test whether payment software can recover without recording the same payment twice.

One payment, repeated confirmations

A customer makes one payment. The message confirming it can arrive several times, especially when a connection fails and the sender retries. Payment software needs to handle those copies without recording the payment again.

Aftermath lets you test that situation. You send repeated confirmations for a simulated payment, make the software crash, and restart it. The result to look for is one saved payment record, even after every copy has been processed. No real money moves.

Try the crash example

  1. Create the default simulation. It queues four confirmations for one payment.
  2. Run the next step twice. The first attempt encounters an outage. The second saves the payment, then the program stops before marking the confirmation as processed.
  3. Restart the processor, then keep running the next step until it finishes. Check that the payment record count stays at one.

What the technical terms mean

The worker is the program that handles payment confirmations. The ledger stores payment records. An acknowledgement marks a confirmation as processed. A replay is another attempt to process it after a failure.

Recovery belongs in the database

The ledger has constraints on the order and payment signature. The credit and its audit event commit in one transaction; acknowledgement happens separately. After a restart, replay finds the existing credit and acknowledges the notification without inserting another credit.

This separates repeated delivery from repeated ledger effects. The integration tests also kill an actual process after a committed credit, then restart the worker against the same database.

What the experiment covers

Worker processes, transactions, and persistence are real. Notifications and chain verification in the experiment are simulated. A separate read-only inspector fetches Solana transaction data, but it cannot write ledger credits.

The lab runs with one local SQLite writer. It does not yet cover distributed workers, arbitrary crash timing, or real merchant settlement validation.

Run the experiment

Use Python 3.10 or later and Node.js 20.19 or later:

git clone https://github.com/ebilesh/aftermath.git
cd aftermath
npm ci
npm run build
python3 -m backend.server

Open http://127.0.0.1:8000. Create Crash after saving the payment and follow the steps above. The payment record count should finish at one.