Database Transactions
One thing you don't want in a wallet system is money leaving one account without reaching the other.
I am building PropInvest, a property investment platform where users can fund wallets and invest in real estate. When an investor puts money into a property, the system needs to:
- Deduct funds from their wallet
- Create the investment record
- Update the property's funding status
- Log the transaction
Now, what happens if the wallet is debited, but the server crashes before creating the investment?
The investor's money is gone, but they don't own any shares. That's a nightmare.
This is why database transactions matter.
A database transaction lets you group multiple operations together so they either all succeed or all fail.
If the wallet debit, investment creation, and transaction log all succeed, the transaction commits.
If any step fails, everything rolls back. The wallet stays untouched. No partial state.
This is called atomicity, the A in ACID.
ACID stands for:
- Atomicity: All operations succeed, or none do.
- Consistency: The transaction preserves database rules and constraints.
- Isolation: Concurrent transactions don't interfere with each other.
- Durability: Once committed, changes persist even if the system crashes.
For PropVest's wallet operations, every debit, credit, and record is wrapped in the same database transaction.
One important detail though: this protects database changes within that transaction. It doesn't automatically reverse an external action, like a payment already sent to Paystack.
That is why I also used idempotency keys, locked balances, and reconciliation workers. But transactions were the foundation.
When handling money, a successful API response isn't enough. You need to make sure the underlying operations are actually safe.
Never assume your code will complete every step. Design your database operations to handle failure.
i stopped questioning God whenever something bad happened in my life.
i stopped worrying cus,
whenever i feel a load is too much to bear, i end up thanking God for putting me through it cus,
every hard time i've survived has introduced me to a blessing i couldn't have imagined.
I just encountered this on a service I just hosted on Render.
Easy fix for me was to ping a health endpoint in the service with UptimeRobot. very easy to set up, solved the issue for me
Subtle reminder that you're supposed to feel overwhelmed.
It means you're doing something new. You're taking a new path. You're learning. Growing. You branched into the unknown. It will be frustrating. You will feel lost. It will be painful, but staying the same is even worse.
North Korea stole $6.3 billion from Binance by inviting one of its engineers to a job interview at a company that didn't exist.
And the guy didn't even have access to the money.
It took them five months and two separate hacks to pull this off.
Back in June, an engineer on Binance's wallet team went looking for an AI tool and installed a tampered Homebrew package. Binance caught it, swapped the laptop and reset the passwords. Problem solved, they figured. Except by then the attackers already knew who worked on that team and what each person did.
So they went recruiting.
In September a different Binance engineer got a message on a real job site from someone calling himself a project director. First round was a video call with a fake HR person, who even shared a social media account full of personal photos so the whole thing felt legit. Second round was with the "CEO," who told him to download a coding assignment onto his work computer. It was loaded with malware nobody had seen before, and Binance's security software missed it completely.
Then they waited. On October 20 they used his laptop plus one of Binance's own internal AI tools to get onto two wallet engineers' computers, and one of those engineers had permission to spin up new code on Binance's systems. Nine days later the attackers did exactly that. They ran a script and used an Ethereum feature called EIP-7702 to hand themselves control of a hot wallet, one of the wallets Binance keeps online to process withdrawals. Money started pouring out at 8:05pm UTC.
It took Binance four hours to stop it, which works out to more than $25 million a minute.
And it took that long because of a safety feature. Binance splits the signing power on those wallets into pieces held by different parties, so no single employee can ever drain one alone. That sounds great until something goes wrong, because it also meant nobody could hit the off switch on their own.
For context, the previous record was Bybit's $1.5 billion in February 2025, also North Korea. This one is four times bigger. Binance has already refilled about 98% of it out of its own pocket and says customers won't lose a cent.
Binance says it blocked 57 suspected North Korean attacks this year, and the one that got through started with a guy who just wanted a new job.
At my last job, they were looking for a senior React Native + Rust dev with 5 years of professional experience
I had never developed in React Native. I'd never touched Rust before. Completely underqualified.
The only reason why I got an interview is because I met and talked to one of the company's employees in-person.
Despite being a junior with less than a year of professional experience (I had just turned 18), I was hired full-time.
I was thrown into the deep end. I went from making small web PRs to diving into the React Native codebase. I didn't really touch the Rust code but I read a lot of it.
By the time tech layoffs hit, I was the second-to-top contributor of all time (despite writing 95% of my code by hand) and had helped to lead the development of countless major projects.
---
Unlike what they say nowadays, you don't need to lie on your resume. Just send it in.
What you really need is someone who is willing to invest in you, who can get you past the recruiters.
The best way to do that is to meet up with people and talk to them in-person.
If I hadn't gone to that in-person tech conference three years ago, I wouldn't have had that job.
---
Despite having done frontend/mobile for my whole career, I'm currently interviewing for a few roles that I'm completely underqualified for, including a Senior DevOps role that requires prior experience.
Deja Vu.
I talked to someone at a tech conference.
They connected me to someone who got me past the recruiters.
Removing the middle man and the barriers between you and the job market is that easy.
Go forth, my unemployed brothers; meet people, talk to people, and show them what you're capable of.
Database Transactions
One thing you don't want in a wallet system is money leaving one account without reaching the other.
I am building PropInvest, a property investment platform where users can fund wallets and invest in real estate. When an investor puts money into a property, the system needs to:
- Deduct funds from their wallet
- Create the investment record
- Update the property's funding status
- Log the transaction
Now, what happens if the wallet is debited, but the server crashes before creating the investment?
The investor's money is gone, but they don't own any shares. That's a nightmare.
This is why database transactions matter.
A database transaction lets you group multiple operations together so they either all succeed or all fail.
If the wallet debit, investment creation, and transaction log all succeed, the transaction commits.
If any step fails, everything rolls back. The wallet stays untouched. No partial state.
This is called atomicity, the A in ACID.
ACID stands for:
- Atomicity: All operations succeed, or none do.
- Consistency: The transaction preserves database rules and constraints.
- Isolation: Concurrent transactions don't interfere with each other.
- Durability: Once committed, changes persist even if the system crashes.
For PropVest's wallet operations, every debit, credit, and record is wrapped in the same database transaction.
One important detail though: this protects database changes within that transaction. It doesn't automatically reverse an external action, like a payment already sent to Paystack.
That is why I also used idempotency keys, locked balances, and reconciliation workers. But transactions were the foundation.
When handling money, a successful API response isn't enough. You need to make sure the underlying operations are actually safe.
Never assume your code will complete every step. Design your database operations to handle failure.
Transactional Outbox Pattern
One thing I've implemented in PropInvest - a platform I am building for fractional real estate ownership, is the Transactional Outbox Pattern.
Say you're building a wallet system for property investments. A user purchases shares in a property. You debit their wallet, credit the property pool, and commit the transaction. Then you publish an "investment_completed" event to Kafka (or any other message broker e.g RabbitMQ) so that the notification service can alert the user and update their portfolio.
Simple enough, right?
But what happens if your application crashes after the database commit but before publishing the event? The investment succeeded, money moved, but the notification was never sent. Other services that depend on that event - like portfolio tracking - may never know the investment happened.
Now, if you publish the event before committing the transaction, you have the opposite problem. The event gets published, but the database transaction might fail. Other services are reacting to an investment that never actually went through.
This is the dual-write problem.
The Transactional Outbox Pattern solves this by saving the business data and the event in the same database transaction. If the transaction commits, both are saved. If it rolls back, neither is saved.
A separate worker reads pending events from the outbox table, publishes them to the message broker - Kafka in this case, and marks them as processed. If the worker goes down, the event is still in the database and can be published when the worker comes back up.
But there's a catch.
The worker could publish an event successfully, crash before marking it as processed, and publish it again after restarting. That means duplicates are possible.
This is where idempotency comes in. Give every event a unique ID, and let consumers track which events they've already processed. If an event arrives again, the consumer can safely skip the duplicate.
The same principle applies to API requests. If a client retries an investment purchase because of a timeout, an idempotency key helps prevent the same shares from being purchased twice.
One thing to keep in mind: the outbox prevents the database change and the intent to publish from getting out of sync. It doesn't guarantee exactly-once delivery or processing. You still have to handle retries and duplicates yourself.
The outbox handles reliable event delivery.
Idempotency handles repeated execution.
Both matter when building systems where a missed event or a duplicate operation can cause real problems - especially when real money is involved.