Karar Haider

All my work

SecureBank

Two payment requests. One account. Same time. Do you let the balance go negative?

My part
Team lead. I built the backend with Ali Mohammed. Team NanoTech, four people, two days.
Stack
C#, ASP.NET Core, Entity Framework Core, PostgreSQL, Hangfire, JWT
What's measured and what isn't
  • 1st place measured
  • Public repo measured
  • Built in 2 days measured
Karar presenting in front of a projected sign-in screen for a banking dashboard
Showing SecureBank at the ITS Core Bank Hackathon.
Four team members smiling in front of an ITS, Hub200, Digital Zone and QiCard banner, one holding a small rubber duck
Team NanoTech at the ITS Core Bank Hackathon.

What it is

The ITS Core Bank Hackathon, run by QiCard, Digital Zone and Hub200, gave every team two days to build a core banking backend that could stand up to a set of challenges.

The tests had names. Atomicity was the “crash” test. Race conditions were the “double spend” attack. Input security was the “zero trust” test. On top of that came idempotency and auditability.

One extra rule: the backend had to be in C# and .NET. I was new to it, after years of Python and Django.

We took first place.

My part

I led team NanoTech, four of us. Ali Mohammed and I built the backend.

What the backend does

  • Ledger first. Every change to a balance is an entry, and entries are never changed or deleted.
  • Atomic transfers. The sender and the receiver always move together, or not at all.
  • Idempotency. The same request sent twice is processed once.
  • Concurrency-safe. Optimistic locking stops a double spend.
  • Zero trust. JWT with refresh tokens and role-based access.
  • Interest on its own. Background jobs in Hangfire apply savings interest.
  • Auditable. The full history is there, so any balance can be rebuilt from the entries.

We also wrote docs for the request flow, the system workflow and the database schema.

The decisions

Optimistic locking for the double spend. Two withdrawals read the same version of the account. The first one to commit wins. The second sees the version has changed, and it’s refused. Nobody waits on a lock, and one of the two simply fails.

The balance is a result, not a source. Because the ledger is append-only, the balance can always be worked out again from the entries. If something looks wrong, the history tells you why.

Links

Got something that can't go wrong? Let's talk.