
Backend Engineer | Web3 | Golang | Laravel | Mod @BerfBased
127.0.0.1
Joined May 2018
- Tweets10.8K
- Following2.9K
- Followers1.8K
- Likes51.2K
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.
馃 Made with AI
Replying to @Somto_babey
Tinubu will round up and hand over the office to Peter Obi in May for sure
77
what? you think is impossible? or not necessary?
I'm trying to understand the exact reason for this foolish question.
I expected you to ask why he wants to build it so that we can educate you, that's a more valid question than "how".....
1
52
Replying to @Meedways1
but your "Lord and personal savior" has drug trafficking-related charges in Chicago and you've been quiet about it 馃し
1
10
Replying to @TheAjakeManger
correct question. y'all should also tag Kenneth Okonkwo to this question.
Why else would men like Yul Edochie and Kenneth Okonkwo be so vocal about their selfish political alignments?
12
It is sad that in this day and age, we still have men like that amongst us who under the guise of "democracy", have decided to align themselves with candidates who are so obviously not the right fit for governance (and this is putting it very politely).
1
7
We had natives betraying their communities and families for favor from the white man - selfish men who were willing to sell out their own for personal gain, or the opportunity to be installed as a puppy ruler with no real authority or autonomy.
1
13
We are very quick to blame the white man; after all he decieved us, he stole from us, he kidnapped and sold our ancestors as slaves. One fact we often overlook however, is the part our own kin played in this.
1
1
33
probably won't be worth even half that much when vesting is over but still: insane generational wealth! 馃敟
JUST IN: Over 400 Anthropic employees are now worth more than $100,000,000 each following the $ANT IPO.
Anthropic's seven co-founders are now worth over $20 billion each.
The average Anthropic employee is worth over $40 million.
1
2
89
Buchy retweeted
Forbes recognises 6 Nigerian billionaires.
Home-based
1. Dangote
2. Rabiu
3. Adenuga
4. Otedola
Diaspora
5. Ogunlesi
6. Awotona
7. Elumelu is also speculated to have reached that milestone, though not officially confirmed included by Forbes yet.
The good thing is, regardless of your view on school, you have one example from the list that can support your view.
If you believe school no too matter, you have an Otedola that is not a graduate and never really took school seriously.
If you are a nerd with heavy belief in book, you have Ogunlesi, a first class graduate of Oxford.
If you played draw (2:2) in school, you have Elumelu as your inspiration.
If you go to a school that is partly theological, partly secular, you have Dangote as an example.
If you do 9-5 and start business early, you have Elumelu.
If you do 9-5 for long, you have Ogunlesi that was a salaried employee for 25+ years.
If you japa, your children have Tope Awotona to look up to.
If you stay in Naija, you have Rabiu, Aliko, Tony to look forward to.
If you (or your children) are a tokunboh - born abroad and brought home - you (or your children) your have Otedola.
If you're fonee-speaking, you have Ogunlesi.
If your oral communication carries heavy dose of your native language, you have Dangote and Elumelu as inspiration.
Whose path to billionaire matches your (academic, career & life) philosophy?
PS: Otedola does not hold the view that school na scam, but he said he knew right from time it wasn't his thing.
If one person gets it by merit, why can that person not be you?
Until you approach life like this, there will always be someone or something you can point to or blame.
It will never make sense to you that maybe there鈥檚 something you could have done differently.








