
Backend Engineer | Web3 | Golang | Laravel | Mod @BerfBased
127.0.0.1
Joined May 2018
- Tweets10.8K
- Following2.9K
- Followers1.8K
- Likes51.4K
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 @thecyberqueen_
thank u Aeesha.
i just enrolled for this. the right link is:
plus.columbia.edu/content/ai…
and use the promo code above for zero cost.
or simply just search the course title and school name on google, it's the first link that pops up
Replying to @Somto_babey
Tinubu will round up and hand over the office to Peter Obi in May for sure
1
86
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".....
2
58
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
18
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
38
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
94




