<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shola Emmanuel on Medium]]></title>
        <description><![CDATA[Stories by Shola Emmanuel on Medium]]></description>
        <link>https://medium.com/@olusholaemmanuelfayinminu?source=rss-cdb879f2d98a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rbxUw4ylPuLIWzl2PpeQWA.jpeg</url>
            <title>Stories by Shola Emmanuel on Medium</title>
            <link>https://medium.com/@olusholaemmanuelfayinminu?source=rss-cdb879f2d98a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:31:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@olusholaemmanuelfayinminu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Would Quantum Computers End Crypto and Blockchain?]]></title>
            <link>https://medium.com/@olusholaemmanuelfayinminu/would-quantum-computers-end-crypto-and-blockchain-0e19d818844e?source=rss-cdb879f2d98a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e19d818844e</guid>
            <dc:creator><![CDATA[Shola Emmanuel]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 16:02:10 GMT</pubDate>
            <atom:updated>2026-09-26T16:06:26.224Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*r6LACx7Bec4FiaOHYSmpKw.jpeg" /></figure><p>For years, quantum computing has existed somewhere between a scientific breakthrough and a distant security problem. For crypto, however, the question is more serious.</p><p>Most of the security assumptions behind today’s blockchains were designed for classical computers. Bitcoin, Ethereum and almost every major blockchain depend on cryptographic systems that are extremely difficult to break with conventional hardware.</p><p>A sufficiently powerful quantum computer could change that.</p><p>It could potentially break the cryptography protecting private keys, signatures, consensus systems and other parts of blockchain infrastructure.</p><p>So, would quantum computers end crypto and blockchain?</p><p>They could end the cryptographic model that today’s crypto relies on. But that does not necessarily mean they would end blockchain technology itself. To understand the dynamics you have to understand how crypto works.</p><h3>A security assumption behind crypto</h3><p>At the most basic level, a blockchain needs to answer a simple question:</p><p>&gt; Who is authorized to move these assets?</p><p>Your wallet proves ownership by producing a valid cryptographic signature.</p><p>On Ethereum, for example, externally owned accounts use ECDSA signatures based on the secp256k1 elliptic curve.</p><p>The basic relationship looks something like this:</p><p><em>text<br>Private key<br> ↓<br>Public key<br> ↓<br>Address</em></p><p>The important property is that going in the opposite direction is computationally infeasible for a classical computer : You can know the public key without being able to calculate the private key. This assumption protects the funds.</p><h3>Quantum computing threatens this assumption.</h3><p>Enter Shor’s algorithm<br>The problem is not simply that quantum computers are faster computers. They operate using a different computational model.</p><p>One of the most important quantum algorithms is Shor’s algorithm, which can solve certain mathematical problems much more efficiently than known classical approaches.</p><p>Those problems include the mathematical structures behind widely used public-key cryptography.</p><p>This matters because many blockchain signature systems depend on exactly those structures. Ethereum currently identifies several cryptographic components that would eventually require post-quantum replacements, including ECDSA account signatures, BLS validator signatures, KZG commitments and some zero-knowledge proof systems.</p><p>If a quantum computer becomes powerful enough to run the relevant algorithms at the required scale, an attacker could potentially derive private keys from exposed public keys and produce valid signatures.</p><p>A attack would look roughly like this:</p><p><em>Quantum computer<br> ↓<br>Recover private key<br> ↓<br>Forge valid signature<br> ↓<br>Submit transaction<br> ↓<br>Blockchain accepts it</em></p><p>The blockchain itself may still be functioning perfectly. The problem is that its definition of &quot;valid owner&quot; has been compromised. This could be catastrophic for crypto<br>Imagine waking up one morning and discovering that a quantum computer can derive private keys from public keys in minutes.</p><p>An attacker would not need to rewrite Bitcoin’s entire history. They would not need to control every node. They would not necessarily need to attack the consensus algorithm directly. They could target the cryptographic layer that authorizes transactions. For accounts whose public keys are exposed, the attacker could potentially derive the corresponding private keys and sign transactions as if they were the legitimate owner.</p><p>Ethereum specifically notes that accounts which have already sent transactions expose their public keys onchain, creating a future quantum attack surface. Accounts that have only received ETH have an additional layer of protection because only the address hash is visible.</p><p>That distinction is important when thinking about old or dormant wallets. What happens to dormant coins?<br>Consider a wallet that has held Bitcoin or ETH for 15 years.</p><p>Its owner has not lost the private key. The owner has done nothing wrong.</p><p>But now imagine that the cryptography protecting that wallet can be broken by a quantum computer.</p><p>The problem becomes much larger than simply upgrading a piece of software.</p><p>The network has to answer: What happens to assets whose owners have not migrated to quantum-resistant cryptography?</p><p>Do they remain spendable?</p><p>Can the protocol freeze them?</p><p>Can the owner prove that they are the legitimate owner after the old signature scheme is considered unsafe?</p><p>Can a quantum attacker race the legitimate owner?</p><p>There is no universal answer to these questions. They become protocol and governance problems. And this is where the quantum threat becomes particularly interesting.</p><h4>It is not just about stealing wallets<br>It would be easy to reduce the entire problem to:</h4><h4>&quot;Quantum computers can steal your crypto.&quot;</h4><p>The actual problem is deeper.</p><p>A blockchain is built from multiple cryptographic components.</p><p>Ethereum, for example, uses ECDSA for account signatures and BLS signatures in its proof-of-stake consensus system. It also uses KZG commitments for data availability and various cryptographic proof systems across its scaling ecosystem.</p><p>A sufficiently powerful quantum computer could therefore threaten more than individual wallets.</p><p>It could affect:</p><p>Account authentication</p><p>Validator signatures</p><p>Consensus</p><p>Data availability commitments</p><p>Zero-knowledge proof systems</p><p>Bridges and other cryptographic infrastructure</p><p>Applications that depend on vulnerable cryptographic primitives</p><p>This is why calling quantum computing a &quot;wallet security problem&quot; understates the issue.</p><p>It is a protocol security problem.</p><p>Cryptography is not the blockchain. A blockchain can change its cryptographic primitives.</p><h4>That is the reason quantum computing does not automatically mean the end of Bitcoin, Ethereum or decentralized ledgers.</h4><p>The fundamental idea of a blockchain is not:</p><p>&quot;Use elliptic curves forever.&quot;</p><p>It is closer to:</p><p>&quot;Maintain a shared state according to rules that participants can independently verify.&quot;</p><p>The cryptographic algorithms used to implement those rules can evolve.</p><h3>That transition is already happening</h3><p>Welcome to the post-quantum era<br>The cryptography community has been working on algorithms designed to remain secure against quantum attacks.</p><p>In August 2024, NIST finalized its first three post-quantum cryptography standards.</p><p>They include:</p><p>ML-KEM for key encapsulation</p><p>ML-DSA for digital signatures</p><p>SLH-DSA for hash-based digital signatures</p><p>ML-DSA and SLH-DSA are particularly interesting for blockchain systems because digital signatures are fundamental to proving authorization. This gives the broader industry standardized cryptographic primitives to build around.</p><p>The challenge for blockchains is not simply finding a quantum-resistant algorithm. It is integrating those algorithms into systems that already have enormous amounts of capital, applications and users depending on them.</p><p>Ethereum is already preparing for this Ethereum is a useful example because it is not waiting for a quantum computer to appear before thinking about the problem.</p><p>The Ethereum Foundation created a dedicated Post-Quantum Security team in 2026 and is working on a structured migration toward post-quantum security. Its current &quot;Lean Ethereum&quot; work targets core post-quantum infrastructure around 2029, although these are planning targets rather than guaranteed deadlines.</p><p>The proposed transition involves multiple parts of the protocol. For validator signatures, Ethereum researchers are investigating leanXMSS, a hash-based signature system.</p><p>There is a problem, though. Quantum-resistant signatures can be considerably larger than the BLS signatures Ethereum currently uses. Ethereum’s documentation notes that leanXMSS signatures are roughly 3,000 bytes compared with roughly 96 bytes for BLS signatures. Simply replacing BLS with a larger signature would create serious bandwidth and efficiency problems for a network with hundreds of thousands of validators.</p><p>So researchers are also working on leanVM, a minimal zkVM designed to aggregate those larger signatures efficiently. Ethereum’s current design estimates that this could compress the data substantially.</p><p>This illustrates something important:</p><h4>Post-quantum migration is not just swapping one cryptographic library for another.</h4><h4>It can require redesigning parts of the protocol.</h4><p>Ethereum also needs to rethink accounts, the account layer creates another challenge.</p><p>Today, Ethereum accounts are closely tied to a particular signature scheme.</p><p>A long-term solution requires something closer to cryptographic agility.</p><p>Instead of assuming that an account will always use one signature algorithm, the protocol can allow an account to define how its signatures should be verified.</p><p>That means the same account could eventually move from:</p><p>ECDSA to Post-quantum signature, without requiring every application and every user to abandon the network at once. Ethereum is pursuing this direction through account abstraction and proposals such as EIP-8141, which would give accounts greater flexibility over signature verification. That is a very different response from simply trying to &quot;make ECDSA stronger.&quot;</p><p>The goal is to make the blockchain cryptographically upgradeable. Zero-knowledge systems have a similar problem. The quantum problem also reaches the scaling layer.</p><p>Many blockchain scaling systems use zero-knowledge proofs. Some popular SNARK constructions depend on elliptic-curve pairings, which are vulnerable to quantum attacks.</p><p>But not every ZK system has the same problem. STARKs, for example, are based primarily on hash functions rather than elliptic-curve assumptions and are considered much more suitable for post-quantum security.</p><p>This means the transition is already influencing the architecture of blockchain scaling.Some systems may not simply migrate their existing cryptography.</p><p>They may move toward fundamentally different proof systems.</p><h3>What I think is the real race</h3><p>This leads to what I think is the more interesting question.</p><p>The question is not:</p><p>Will quantum computers eventually become powerful enough to break today&#39;s cryptography?</p><p>If sufficiently capable quantum computers are built, many current public-key systems will have to be replaced.</p><p>The more important question is:</p><h4>Will the crypto ecosystem migrate before that happens?</h4><p>That creates a race.</p><p>Quantum computing<br> ↓<br> Cryptographic threat<br> ↑<br> │<br> Migration speed<br> ↑<br> │<br> Post-quantum blockchain</p><p>The danger is the period in between.</p><p>A blockchain may know that its cryptography will eventually become obsolete while still needing to keep billions of dollars secure today. The migration therefore has to happen before the threat becomes practical, not after.</p><p>And blockchain upgrades are difficult.</p><ul><li>There are wallets.</li><li>There are exchanges.</li><li>There are hardware wallets.</li><li>There are validators.</li><li>There are smart contracts.</li><li>There are bridges.</li><li>There are Layer 2 networks.</li><li>There are custodians.</li></ul><p>There are applications that may have embedded cryptographic assumptions nobody has documented, Changing the underlying cryptography means coordinating an entire ecosystem. The migration itself could create new risks which creates something of an irony.</p><p>The solution to quantum computing introduces its own engineering problems. Post-quantum algorithms can have larger keys and signatures. They can require more computation. They can change bandwidth requirements. They can affect gas costs. They can require new precompiles and verification logic. They can introduce new implementation risks.</p><p>And new cryptographic systems have not necessarily accumulated the same decades of analysis and operational experience as older primitives. Ethereum’s own research has highlighted concerns around implementation complexity, side-channel resistance, signature aggregation and worst-case execution costs when considering post-quantum schemes.</p><p>So the goal is not simply:</p><p>&quot;Use quantum-safe cryptography.&quot;</p><p>The goal is:</p><p>Use quantum-safe cryptography without creating a new class of vulnerabilities or destroying the properties that made the blockchain useful in the first place.</p><h3>Does quantum computing kill Bitcoin?</h3><p>This is where the answer becomes less binary.</p><p>If Bitcoin continues indefinitely with cryptographic assumptions that become practically breakable, then its current security model cannot survive unchanged. But that does not automatically mean Bitcoin itself becomes impossible.</p><p>The protocol could theoretically migrate to quantum-resistant signatures.</p><p>The difficult questions would be around how that migration happens, how old coins are treated, how users prove ownership, and how the network handles coins that never migrate.</p><p>Quantum computing threatens their current cryptographic assumptions, not necessarily the concept of decentralized computation. Crypto was created around the idea that we should not have to trust a central authority to determine ownership.</p><p>Instead, we trust mathematics, cryptography and distributed verification.</p><p>Quantum computing challenges one of those foundations. It does not ask us to trust a bank. It asks whether the mathematics we currently trust will remain hard enough to protect the system. That means the post-quantum transition may become one of the most important infrastructure upgrades in the history of crypto.</p><p>NIST has already standardized post-quantum cryptographic algorithms. Ethereum has dedicated research teams, interoperability testing and a multi-year migration roadmap.</p><p>In Conclusion:</p><p>Quantum computers may eventually break the cryptography that protects today’s crypto. But it does not follow that they will destroy blockchain technology.</p><p>Blockchains will have to evolve from cryptographic systems designed primarily for classical computers into systems designed to remain secure in a world where quantum computation exists.</p><p>The chains that fail to make that transition could become vulnerable.</p><p>The chains that successfully migrate can continue operating.</p><p>So perhaps the better question is not:</p><p>&quot;Will quantum computers end crypto and blockchain?&quot;</p><p>It is:</p><h4>&quot;Can crypto upgrade its cryptographic foundations before quantum computers make today&#39;s foundations obsolete?&quot;</h4><p>That is the real race.</p><p>if you’re needing a professional review on your smart contracts, or just an extra eye on your protocols, reach out to me <a href="https://www.sholaemmanuel.dev/">Shola Emmanuel</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e19d818844e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s Next After You’ve Written Your Smart Contracts?]]></title>
            <link>https://medium.com/@olusholaemmanuelfayinminu/whats-next-after-you-ve-written-your-smart-contracts-efe09e59c614?source=rss-cdb879f2d98a------2</link>
            <guid isPermaLink="false">https://medium.com/p/efe09e59c614</guid>
            <dc:creator><![CDATA[Shola Emmanuel]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 14:31:20 GMT</pubDate>
            <atom:updated>2026-09-22T14:31:20.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*q68_ZVhAMKmtlKO7XZhBQw.jpeg" /><figcaption>Test guy, on test hat and test shirt.</figcaption></figure><p>Writing a smart contract is only one part of building a blockchain application.<br>You can write the Solidity, compile it successfully, and feel like the hard part is over. In reality, that is where another phase begins.<br>A smart contract that is ready for production needs more than working Solidity. You need to know that it behaves correctly under unexpected inputs, understand whether it needs to be upgradeable, decide who can administer it, think about how your frontend will retrieve its data, choose where it should be deployed, and protect the account that performs the deployment.<br>This is the part of smart contract development that is easy to overlook.</p><p>In this article, I use Solidity and Foundry - a framework for testing and deploying Solidity contracts. If you’re not familiar with them, don’t worry; I explain the code snippets as we go, and the core concepts are generalized to be easy to understand.<br>So, what actually happens after you finish writing the contract?</p><h3>Test the Contract</h3><p>Before thinking about mainnet, test everything you can.<br>For Solidity development, Foundry provides Forge, which can compile, test, fuzz, debug, and deploy contracts. Foundry tests are written directly in Solidity and can run with:<br><em>forge test</em></p><p>But testing should go beyond checking the happy path.<br>You should test:</p><ul><li>Expected behavior</li><li>Reverts</li><li>Access control</li><li>Edge cases</li><li>Zero values</li><li>Maximum values</li><li>Multiple users</li><li>State transitions</li><li>Invalid inputs</li><li>Events</li><li>ETH and token transfers</li></ul><p>One of Foundry’s biggest advantages is fuzz testing.<br>Instead of giving your function one predefined input, Foundry can generate many inputs and search for cases that break your assumptions.</p><p>The important mindset is:<br>Do not only test that your contract works. Test how it can fail.<br>A passing test suite does not prove that a contract is secure, but a weak test suite makes it much harder to trust one.</p><h3>Think About Upgradeability Before Deployment</h3><p>One of the most important questions to answer before deployment is:<br>Will this contract ever need to change?<br>Normal Ethereum contract code is immutable after deployment. If you deploy a contract with a bug, you cannot simply edit the Solidity file and replace the bytecode at the same address.<br>This creates an important architectural decision.</p><p>Option 1: Immutable contracts<br>You deploy the contract and never change its implementation.<br>This is attractive for protocols where immutability is part of the trust model.</p><p>Option 2: Upgradeable contracts<br>You use a proxy architecture that allows the implementation behind a proxy to be changed.<br>OpenZeppelin’s upgradeable tooling supports patterns such as Transparent and UUPS proxies. In a proxy system, users interact with the proxy while the implementation contract contains the logic.The important part is that the proxy retains the application’s state while delegating execution to the implementation.<br>But upgradeability introduces another security boundary.<br>Now someone has the ability to change the code users interact with.<br>That means you need to ask:</p><ul><li>Who can upgrade the contract</li><li>How is the upgrade authorized</li><li>Is the upgrade controlled by a multisig?</li><li>Is there a timelock?</li><li>Can an upgrade accidentally corrupt storage?</li><li>Have upgrades been tested before execution?</li><li>What happens if the upgrade authority is compromised?</li></ul><h3>Consider Admin and Maintenance Functions</h3><p>Not every smart contract has an administrator.<br>But if yours does, you need to understand exactly what that administrator can do.<br>Consider a contract with:</p><p><em>function pause() external onlyOwner {<br> _pause();<br>}</em></p><p>That <em>onlyOwner</em> function is not just another function.<br>It is a privileged operation.<br>The same applies to functions such as:<br><em>setFee()<br>setOracle()<br>setTreasury()<br>pause()<br>unpause()<br>upgrade()<br>withdrawFees()<br>changeAdmin()</em><br>These functions can have enormous consequences if the admin key is compromised.<br>Before deployment, document every privileged function and ask:<br>What happens if this account is compromised?<br>For low-risk projects, an owner-controlled account may be sufficient during early development.<br>For production protocols holding meaningful value, you should consider stronger administration such as multisig control, role separation, timelocks, or governance.</p><h3>Think About Indexing Before You Build the Frontend</h3><p>Your smart contract stores data on-chain, but your frontend still needs an efficient way to retrieve that data.<br>This is where indexing becomes important.<br>Imagine your contract emits:<br><em>event Deposit(<br> address indexed user,<br> uint256 amount,<br> uint256 timestamp<br>);</em><br>The blockchain contains this event, but your application may need to answer questions such as:<br>Show me every deposit made by this wallet.<br>Show me the total deposits during the last 30 days.<br>Show me the latest 100 withdrawals.<br>You could query the chain directly, but doing large historical queries from your frontend can become inefficient.<br>This is why indexing systems exist.<br>The Graph, for example, allows developers to define subgraphs that listen to contract events and transform blockchain data into structured entities that can be queried through GraphQL.</p><p>The indexed parameters can be used as filters by indexing systems.<br>This is one reason event design should not be treated as an afterthought.<br>Your smart contract is also a data source for the applications built around it.</p><h3>Decide: Ethereum L1 or an L2?</h3><p>Now comes another major decision:<br>Where should the contract live?<br>Ethereum Mainnet provides the security and decentralization characteristics of Ethereum itself, but transactions can be expensive compared with many Layer 2 networks.<br>An L2 can provide lower transaction costs and higher throughput while still settling to Ethereum.<br>This means the right network depends on your application’s requirements.</p><p>For example:<br>Ethereum L1 makes sense when:</p><ul><li>Security is the highest priority</li><li>The application handles high-value assets</li><li>Users can tolerate higher transaction cost.</li><li>You need direct Ethereum Mainnet composability. <br>L2 Can make sense when:</li><li>Transactions need to be cheap</li><li>The application has frequent user interactions</li><li>You need higher throughput</li><li>The ecosystem you depend on already exists on that L2<br>The choice should not simply be:<br>“Which chain is popular?”<br>Instead ask:<br>“What does this application need from its execution environment?”</li></ul><p>Also consider: Gas costs,Block times, RPC availability, Existing liquidity, Existing protocols, Wallet support, Developer tooling, Bridging requirements, Indexing support, Chain-specific limitations.</p><h3>Deploying With Foundry</h3><p>Once the contract has been tested, you can deploy it.<br>Foundry provides several ways to do this.<br>For a simple deployment, you can use forge create:</p><p><em>forge create src/MyContract.sol:MyContract \<br> --rpc-url $RPC_URL \<br> --private-key $PRIVATE_KEY \<br> --broadcast</em></p><p>Foundry’s deployment documentation notes that forge create requires an RPC endpoint and a private key, while --broadcast actually publishes the transaction. Without broadcasting, the command can be used as a dry run.</p><h3>WARNING! : Treat Private Keys Like Production Infrastructure</h3><p>This is one of the most important parts of deployment.<br>Your private key is not a configuration value that should casually appear in your repository. You could lose funds if your private keys fall into the wrong hands.</p><p>Do not do this:<br><em>forge create ... --private-key 0xYOUR_REAL_PRIVATE_KEY</em></p><p>Foundry’s documentation supports environment-based configuration for deployment scripts.<br>But environment variables are not magic security.<br>You still need to protect the environment where they exist.<br>For production deployments, consider:<br>Hardware wallets.<br>Multisig wallets.<br>Dedicated deployer accounts.<br>Secret managers.<br>CI/CD secret storage.</p><p>if you’re needing a professional review on your smart contracts, or just an extra eye on your protocols, reach out to me: <a href="https://www.sholaemmanuel.dev/">Shola Emmanuel</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efe09e59c614" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Smarter AI Models, What’s Next?]]></title>
            <link>https://medium.com/@olusholaemmanuelfayinminu/beyond-smarter-ai-models-whats-next-0e2103f96fcf?source=rss-cdb879f2d98a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e2103f96fcf</guid>
            <dc:creator><![CDATA[Shola Emmanuel]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 14:36:41 GMT</pubDate>
            <atom:updated>2026-09-15T14:36:41.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vvinnzsurVuyph4P-lMIg.png" /></figure><p>AI progress has largely been measured by one thing: how smart the models are becoming.</p><p>By 2026, frontier models are capable of solving difficult problems across programming, biology, mathematics, and scientific research <a href="https://www.bbc.com/news/articles/cy7zygy3rl2o">https://www.bbc.com/news/articles/cy7zygy3rl2o</a> . AI systems are increasingly able to write production-quality code, reason through complex problems, and contribute to areas that previously required significant human expertise.</p><p>So the question is: what comes next?</p><p>My view, which is becoming increasingly common, is that the next major frontier may not be just smarter models.</p><p>It may be faster AI.</p><p>Faster models. Faster architectures. Faster inference.</p><p>For humans, AI already feels relatively fast. You send a prompt, wait a few seconds, and receive an answer.</p><p>But the equation changes when AI starts working more with other AI systems.</p><p>An agent might need to call multiple models, search databases, execute tools, run code, verify results, and pass its output to another agent. A few seconds of latency at every step can quickly turn into minutes.</p><p>Reduce those operations to milliseconds, and entirely different workloads become practical.</p><p>The next race in AI may increasingly be about not just what a model can do, but how quickly it can do it.</p><h4>Faster Models</h4><p>One path is simply making the models themselves faster.</p><p>This does not necessarily mean making them less capable. It means improving how efficiently they process information, generate tokens, reason through problems, and decide when additional computation is actually necessary.</p><p>A model does not always need to spend the same amount of compute on every task.</p><p>Simple requests could receive an almost instant response, while more difficult problems could trigger deeper reasoning or additional compute. Smaller specialized models could also handle narrow tasks before escalating more complex work to larger frontier models.</p><p>Techniques such as model distillation, quantization, speculative decoding, mixture-of-experts architectures, and better model routing can all contribute to this.</p><p>The goal is not just to build a smarter model but to build a system that can determine how much intelligence and compute a particular task actually requires.</p><p>A future AI system might use a small, extremely fast model to classify a request, route it to the right specialized system, and only involve a large reasoning model when necessary.</p><p>That could make AI feel significantly more immediate while reducing the amount of compute required per task.</p><h4>Faster Architectures</h4><p>But model speed is only part of the problem.</p><p>Even the fastest model can become slow if the infrastructure around it cannot move data efficiently.</p><p>Modern internet infrastructure is the result of decades of work on reducing latency and increasing throughput. Content delivery networks, caching, load balancing, streaming, distributed systems, queues, and optimized networking all exist because moving information efficiently is difficult.</p><p>AI infrastructure is now inheriting many of those same problems, but with additional challenges.</p><p>Instead of simply sending a webpage to a user, AI systems may need to move enormous amounts of model data, stream tokens in real time, coordinate thousands of accelerators, manage memory, schedule workloads, and serve millions of requests simultaneously.</p><p>Faster AI architecture could come from improvements in several areas.</p><h4>Better Model Routing</h4><p>Not every request should go to the largest model.</p><p>AI systems can increasingly route tasks to different models based on complexity, cost, latency requirements, or domain expertise.</p><p>This creates an architecture where intelligence becomes more like distributed computing.</p><p>Use the right resource for the right job.</p><h4>Better Caching</h4><p>Many AI requests involve repeated information.</p><p>Prompt caching, retrieval caching, and reuse of previously computed results could significantly reduce unnecessary computation. If part of a request has already been processed, there is little reason to repeatedly perform the same expensive work.</p><p>Caching has been one of the most important ideas in computing for decades.</p><p>It may become equally important for making AI systems feel instant.</p><h4>Streaming and Parallel Execution</h4><p>AI workloads do not always need to happen sequentially.</p><p>Agents could search the web, query databases, execute code, and prepare follow-up tasks simultaneously. Models themselves may also benefit from parallelization across specialized systems and hardware.</p><p>The challenge will be coordinating these systems without creating bottlenecks.</p><p>The architecture of future AI applications may therefore look less like a single model answering a prompt and more like a distributed system coordinating multiple models, tools, databases, and compute resources at extremely low latency.</p><h4>Faster Inference</h4><p>Then there is the hardware.</p><p>Inference is becoming one of the most important parts of the AI race.</p><p>Training a model is expensive, but once a model is deployed, it may need to answer millions or billions of requests. Even small improvements in inference efficiency can therefore have an enormous effect on cost, scale, and user experience.</p><p>This is where advances in GPUs, TPUs, specialized AI accelerators, memory bandwidth, networking, and chip design become increasingly important.</p><p>Companies are also optimizing the software layer much closer to the hardware.</p><p>Instead of treating hardware as a generic machine, engineers can optimize kernels, compilers, memory usage, scheduling, and inference systems specifically for the accelerators running the models.</p><p>The result is simple: the same model can become faster without making the model itself smarter.</p><p>Progress in hardware could also enable AI to move closer to the edge.</p><p>Smaller, more efficient models running directly on laptops, phones, robots, vehicles, and other devices could remove some of the latency involved in sending every request to a distant data center.</p><p>The future of faster AI may therefore depend as much on advances in hardware and systems engineering as it does on machine learning research.</p><h4>Milliseconds Start to Matter</h4><p>For a human chatting with an AI, the difference between one second and 100 milliseconds may not always seem revolutionary.</p><p>For an AI system coordinating hundreds or thousands of operations, it could be.</p><p>Imagine an autonomous coding system where multiple agents are reading files, searching documentation, writing code, running tests, reviewing changes, and fixing failures.</p><p>If every operation takes several seconds, the entire workflow becomes slow.</p><p>If those operations happen in milliseconds or hundreds of milliseconds, an enormous amount of work could be compressed into a much shorter period of time.</p><p>This is where faster AI becomes more than a better user experience.</p><p>It becomes an increase in what AI systems can practically accomplish.</p><p>Speed creates new possibilities.</p><h4>Beyond Intelligence</h4><p>The AI industry has spent years pushing toward more capable models.</p><p>That work is not going away. Models will continue to become smarter, more capable, and better at reasoning.</p><p>But intelligence alone may not define the next stage of AI.</p><p>The next major improvements could come from a combination of:</p><p>* More efficient models<br>* Smarter model routing<br>* Better caching<br>* Faster data movement<br>* More parallel execution<br>* Specialized hardware<br>* Lower-latency inference<br>* Software optimized directly for AI accelerators</p><p>The future may not simply be a model that is twice as intelligent.</p><p>It could be a model that is intelligent enough, but 10x faster, dramatically cheaper to run, and capable of coordinating thousands of operations in the time today’s systems complete a handful.</p><p>Computers changed the world partly because they could perform calculations faster than humans ever could.</p><p>AI may go through a similar transition.</p><p>We&#39;ve spent years asking:</p><p>How smart can these models become?</p><p>The next question might be:</p><p>How fast can intelligence move?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e2103f96fcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SmartGauge: I built an AI app that understands solidity smart contracts, their gas usage and gas…]]></title>
            <link>https://medium.com/@olusholaemmanuelfayinminu/smartgauge-i-built-an-ai-app-that-understands-solidity-smart-contracts-their-gas-usage-and-gas-3a5e31954db1?source=rss-cdb879f2d98a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a5e31954db1</guid>
            <dc:creator><![CDATA[Shola Emmanuel]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 01:16:58 GMT</pubDate>
            <atom:updated>2026-04-05T01:16:58.258Z</atom:updated>
            <content:encoded><![CDATA[<h3>SmartGauge: I built an AI app that understands solidity smart contracts, their gas usage and gas optimistions</h3><h4>The February Thought</h4><p>I have a lot of random thoughts. Most of them are useless and I forget them by the time I open a new browser tab. In February, I had one that persisted — what if there was a tool that could look at a Solidity smart contract and tell you what deploying it would actually cost you, across different chains, before you go anywhere near a testnet?<br>I thought about it for a few days. Then I opened a doc, wrote a rough plan, told myself it would be a quick weekend project, and proceeded to spend the next several weeks learning that nothing in the smart contract space is ever a quick weekend project.<br>So here’s what I built, how I built it, its flaws, and what I think it could eventually become.</p><h4>SmartGauge</h4><p>The idea is straightforward. You paste in a Solidity smart contract. SmartGauge reads it, estimates what it would cost to deploy and interact with it across the major EVM chains, gives you a complexity score, and then an AI goes through the code and tells you specifically what you could change to spend less gas.<br>The chains it covers right now are Ethereum, Polygon, Arbitrum, Optimism, Binance Smart Chain, and Avalanche.<br>The point is to give you something useful before you commit to deploying, a rough picture of what you’re working with, what it might cost, and where the obvious inefficiencies are. It’s not a replacement for proper testing. It’s the thing you run before proper testing, so you’re not going into your testnet deployment blind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZDC0LLdoxZOG7XXeAOnvag.jpeg" /><figcaption>SmartGauge landing page</figcaption></figure><h4>The Stack</h4><p>The frontend is Next.js 14 with the App Router, TypeScript, and Tailwind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opB0pInhi28BbMaGER_Vug.jpeg" /><figcaption>landing page on light mode</figcaption></figure><p>Nothing unusual here</p><p>The interesting part is what happens on the backend when you submit a contract.<br>There’s a single POST route that receives the contract code and immediately kicks off three things at the same time using Promise.all():<br>Complexity estimation runs locally on the server. It’s a regex-based analyzer that looks at the contract and counts things — how many functions, how many state variables, what kind of storage patterns are present, whether there are loops. From that it produces a score that goes from Simple all the way up to Very High. This one never makes an external call, so it’s always fast regardless of what the other two are doing.<br>Gas data fetching calls the Etherscan Gas Oracle API to get a live ProposeGasPrice for Ethereum. From there it applies chain-specific multipliers to estimate what the same transaction would cost on the other supported chains. Each chain is wrapped in its own error handler, so if one chain’s data fails to come back, it falls back gracefully and the rest of the analysis still goes through.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLFqBoYd8nOpugzfxllrXA.jpeg" /></figure><p>The AI analysis takes the contract code and the live gas data and sends both to Groq’s llama-3.3-70b-versatile model. The system prompt tells the model to use the actual gwei numbers from the gas fetch to estimate real deployment and interaction costs per chain, not just produce generic advice that could apply to any contract. There’s also an instruction in the prompt for the model to return a specific message if what you pasted isn’t actually a Solidity contract — because in testing, a surprising number of people pasted in random text to see what would happen.<br>The three things run in parallel, which means the gas fetch and the complexity check are never waiting on each other or on the AI. The response comes back with all three results combined.<br>On the frontend, the AI response renders as full markdown — headers, bullet points, code blocks, the whole thing — using react-markdown with a Tailwind typography plugin handling the prose styling. The chat interface has dark mode, a copy button on every message, a typing indicator while the analysis is running, and a sidebar that shows live gas prices pulled from the same Etherscan feed. The settings page lets you plug in (securely, encrypted) your own API key for whichever AI provider you prefer — OpenAI, Gemini, Groq, or Anthropic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9JkpUPoBhANJGXd4x15ZbQ.jpeg" /><figcaption>add in your API key on SmartGauge</figcaption></figure><h3>The Challenges, Which Is A Polite Word For What Actually Happened</h3><p><em>The AI provider situation</em></p><p>The original plan was OpenAI. My free credits disagreed. I switched to Gemini and discovered that Nigeria is not included in Google’s free tier, which was information I would have appreciated before spending an hour debugging what I thought was a code problem. Groq ended up being the answer — actually free and fast, no billing required ( unpaid ad as ‘thank you’ here ). The settings page exists partly because of this whole saga, so users can bring their own key and not be at the mercy of whatever provider I happen to have credits with.<br>The body stream bug. At some point during debugging I added request.text() to log the raw request body, then immediately tried to parse the same body with JSON.parse(). In Node.js, once you read a readable stream, it’s gone. The contract was arriving from the frontend perfectly fine. The server just had nothing left to read by the time the parse ran. The error this produced had nothing to do with streams, which is why it took longer than I’d like to admit to find.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b83DWdOgw388463DJLqQDA.jpeg" /><figcaption>SmartGauge is thinking</figcaption></figure><p><em>The Coinstats problem</em></p><p>The original gas data plan involved the Coinstats API. The endpoint I was hitting either didn’t exist in the form I expected or was silently rejecting my requests. What made this particularly annoying is that the error message coming back — &quot;No Solidity source provided&quot; — sounded exactly like a validation error on the contract input, so for a while I was convinced the problem was on the frontend. It wasn’t. It was Coinstats&#39; error message bubbling up through my catch block and pretending to be something else entirely. Switching to the Etherscan Gas Oracle fixed it.<br>Coinstats&#39; second act. After I switched to Etherscan for gas data, the old Coinstats fetchChainGasData function was still imported and being called in the route. So now I had working gas data from Etherscan and a broken Coinstats call happening right next to it, throwing an error before the contract ever reached the AI. The fix was wrapping the gas fetch in .catch(() =&gt; []) so a failure returns an empty array and the analysis continues anyway. This is also why the app still works and shows you an analysis even when the gas data is unavailable — the AI part and the gas part are independent of each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HnKdjg-0hZLQLi2Dxs88mg.jpeg" /><figcaption>menu</figcaption></figure><h3>The Honest Flaws</h3><p>SmartGauge works. I want to be clear about that. It also has real limitations that I think are worth being upfront about.</p><p>· It is not using an EVM tracer. This is the main one. A genuinely accurate gas estimate requires simulating the contract’s execution against an actual EVM — tracking every opcode, every storage write, every external call as it actually happens at the bytecode level. SmartGauge doesn’t do that. It uses static analysis for the complexity score and an LLM for the gas narrative. For simple contracts — a basic wallet, a straightforward ERC-20 — the estimates are roughly 80% accurate. For anything with complex storage access patterns, dynamic loops, or heavy external calls, the numbers become more directional than precise. It will tell you whether something is expensive or cheap in relative terms. It will not tell you the exact gas units with the same reliability as running eth_estimateGas against a fork.<br>· Sometimes the gas multipliers are approximations but the Ethereum chain gas price is always accurate. The Etherscan oracle gives a live Ethereum gas price. Every other chain is derived from that using multipliers based on historical averages. L2 gas prices especially can move around quite a bit, and the current implementation doesn’t capture that movement in real time.<br>I think these are fixable. I also think they’re worth knowing about before you make any decisions based on the output.</p><h3>What SmartGauge Could Look Like Later</h3><p>The thing that exists right now is a proof of concept. Here’s what I think it becomes over time:</p><p>· Proper EVM simulation. Integrating something like Tenderly’s simulation API or running estimates against a local Hardhat fork would take the accuracy from roughly 80% to something you could actually rely on for production decisions. This is the most important thing missing.</p><p>· Wallet connection. Letting users connect a wallet and run estimates against actual chain state — with their specific constructor arguments, their specific deployment parameters — would make the gas estimates significantly more relevant to real use cases.</p><p>· Audit mode. The AI already surfaces security issues alongside the gas suggestions because the two tend to overlap — things that waste gas often also create attack surface. A dedicated audit mode that checks contracts against a structured list of known vulnerability patterns would be a logical next step.</p><p>· Persistent analysis history. Right now every session disappears when you close the tab. Saved analyses, comparison between contract versions, team sharing — these would turn SmartGauge from a tool you use once into something you keep coming back to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rPB3TjBWuJBHM2HZesJvA.jpeg" /><figcaption>pricing on SmartGauge</figcaption></figure><h3>Try It</h3><p>SmartGauge is live and you can use it right now :</p><p><a href="https://smart-contracts-gauge-u2xi2nb1c-emmanuel-s-projects-5c6a2d82.vercel.app/">https://smart-contracts-gauge-u2xi2nb1c-emmanuel-s-projects-5c6a2d82.vercel.app</a></p><p>GitHub repo → https://github.com/shola-devv/SmartContractsGauge-AI.git</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jLdRRfJ5f7fy5zWmNLulw.jpeg" /><figcaption>a chat with SmartGauge</figcaption></figure><p>If you run into something broken, I’m aware that’s possible. If the estimates are significantly off for a contract you tested, I’d genuinely like to know — the flaws section above is honest but it’s not exhaustive. And if you have thoughts on what should come next, I’m easy to find : <a href="/service/scheme:/sholaemmanuel.dev">sholaemmanuel.dev</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a5e31954db1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SendMeFunds: How I Built a Wallet System for a Fintech App And Deployed it to AWS (And Why I…]]></title>
            <link>https://medium.com/@olusholaemmanuelfayinminu/sendmefunds-how-i-built-a-wallet-system-for-a-fintech-app-and-deployed-it-to-aws-and-why-i-14c501e6fb61?source=rss-cdb879f2d98a------2</link>
            <guid isPermaLink="false">https://medium.com/p/14c501e6fb61</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Shola Emmanuel]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 02:04:25 GMT</pubDate>
            <atom:updated>2026-03-26T02:04:25.871Z</atom:updated>
            <content:encoded><![CDATA[<h3>SendMeFunds: How I Built a Wallet System for a Fintech App And Deployed it to AWS (And Why I Rewrote It Twice)</h3><p>I took a break from web3 work some days ago. I was recently in a conversation and was asked if I had done anything in the financial technology area , as much as I dabbled with blockchain finance with previous web3 work, I realized I hadn’t been extensively involved in traditional financial technology systems. This whole project is from the point of a guy building, learning and trying to figure stuff out, so forgive my shortcomings, but here’s what I built and how I built it.</p><h4>SendMeFunds</h4><p>A basic wallet system with create wallet, send, and receive features for accounts, ACID transactions, idempotency checks, audit logs, ledger tracking, and admin features. Think of it as a very stripped-down version of what powers something like Paystack or Flutterwave , minus the billion dollar valuation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBSZf8Qas74PJcyjbIMDmw.jpeg" /><figcaption>sendmefund landing page</figcaption></figure><h3>Stack</h3><p>Backend:<br>Node.js (TypeScript), Express, MongoDB (I’ll explain this later if you consider it a blunder — read on), PostgreSQL.</p><p>Frontend:<br>Next.js (TypeScript) — as a frontend lover I had to quickly pull something up, though this was majorly a backend project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KwF_swfqICXwu-fb7EH61w.jpeg" /><figcaption>sendmefunds login page</figcaption></figure><h4>Deployment:</h4><p>Backend on AWS EC2. <br>Frontend on Vercel (links at the bottom).</p><h4>The Build Process :</h4><p>I’ll walk through every step in the building process.<br>I’ll skip the user model, schemas, and controllers because they’re fairly standard and not the main point here. The important thing to note is that I used a seeder function on server load to create a super-admin user preset in my .env file. A seeder function, for context, is a function that runs once at startup and populates the database with initial data — it’s not a route handler, it takes no req or res, it just simply does its job and logs to the console. This super-admin had permissions to fund wallets, view audit logs, and carry out administrative actions (I’ll explain more towards the end of the article).</p><p>The MongoDB Build (Or: How I Got Here the Long Way)<br>For the wallet system build, I started with MongoDB. (Hold up — I eventually rewrote the whole project with PostgreSQL because that’s where true ACID transactions live.) I used MongoDB first because I wanted to understand how ACID-like behaviour could be simulated when one is restricted to a non-relational database.<br>(<em>Skip to the PostgreSQL section if this will bore you)</em></p><p>For the MongoDB wallet build I had four schemas: Wallet, Ledger, Audit Log, and Idempotency Key.</p><pre>Wallet:<br>userId        → reference to the User<br>balance       → Number, default 0<br>currency      → String, default &quot;NGN&quot;<br>pin           → String (bcrypt hashed before saving)<br>timestamps    → createdAt, updatedAt<br></pre><pre><br><br><br>Ledger:<br>walletId      → reference to Wallet<br>type          → &quot;credit&quot; | &quot;debit&quot;<br>amount        → Number<br>balanceBefore → Number<br>balanceAfter  → Number<br>reference     → String (unique)<br>description   → String<br>status        → &quot;pending&quot; | &quot;success&quot; | &quot;failed&quot;<br>timestamps    → createdAt, updatedAt<br><br></pre><pre>Audit Log:<br>action        → String (e.g. &quot;wallet_transfer&quot;, &quot;fund_wallet&quot;)<br>userId        → reference to User<br>walletId      → reference to Wallet<br>amount        → Number<br>status        → &quot;success&quot; | &quot;failed&quot; | &quot;pending&quot;<br>reference     → String<br>timestamps    → createdAt, updatedAt<br></pre><pre>Idempotency Key:<br>key           → String (unique) — the value from the Idempotency-Key header<br>response      → Object — the cached response to return on duplicate requests<br>timestamps    → createdAt, updatedAt</pre><p>Create Wallet<br>The create wallet route creates a wallet for the authenticated user, automatically credits an initial balance of 1,000 NGN (so users can test immediately without funding), and then creates a corresponding ledger entry recording this initial credit — balance before: 0, balance after: 1000. An audit log entry is also created to record the wallet creation event.</p><p>The Transfer Route<br>The transfer route accepts senderWalletId, receiverWalletId, amount, and pin in the request body, plus an Idempotency-Key header. Here&#39;s the full flow:</p><ul><li>Idempotency check — before starting anything, we check if this exact Idempotency-Key has been used before. If it has, we return the cached response immediately. This prevents duplicate transfers if a client retries a request due to a network timeout. (Nobody wants to send ₦50,000 twice because of bad WiFi.)</li><li>Start a MongoDB session and transaction — all subsequent operations are tied to this session.</li><li>Re-check idempotency inside the transaction — to handle race conditions where two identical requests arrive simultaneously.</li><li>Fetch both wallets with the session — so they’re read within the transaction context.</li><li>Verify PIN — compare the provided PIN against the stored bcrypt hash.</li><li>Check balance — confirm the sender has sufficient funds.</li><li>Update balances — deduct from sender, credit receiver.</li><li>Double-entry ledger — create two ledger entries: one debit for the sender (with reference tx_xxx_debit) and one credit for the receiver (tx_xxx_credit).</li><li>Audit log — record the transfer action.</li><li>Save idempotency key — cache the response so duplicate requests are handled.</li><li>Commit the transaction — if anything throws at any step, the catch block aborts the transaction and rolls everything back.</li></ul><h4>Simulating ACID in MongoDB</h4><p>Here&#39;s how I approached ACID compliance in MongoDB:</p><ul><li>Atomicity — MongoDB multi-document transactions (via sessions) ensure all operations either fully complete or fully roll back. If the ledger insert fails, the balance update is reversed.</li><li>Consistency — validation happens before any writes. PIN check, balance check, and idempotency check all run before touching the database.</li><li>Isolation — by using .session(session) on every query, all reads and writes are scoped to the transaction and invisible to other operations until committed.</li><li>Durability — MongoDB Atlas uses a replica set by default, meaning committed transactions are written to multiple nodes before being acknowledged.</li></ul><p>The caveat: MongoDB transactions only work on replica sets, not standalone instances. If you’re running local MongoDB without a replica set, transactions will fail with “Transaction numbers are only allowed on a replica set” errors. Atlas handles this out of the box which is why I used it. (Lesson learned the slightly painful way.)</p><h3>The PostgreSQL Build (The Real One)</h3><p>After proving the concept with MongoDB, I rewrote the financial core with PostgreSQL — where ACID transactions are a first-class citizen and not something you have to carefully simulate.</p><h4>Local Setup</h4><p>I installed PostgreSQL locally on Windows, created a database called fintech_db, and connected to it from the Express app using sequelize and sequelize-typescript as the connection layer — but crucially, I wrote raw SQL queries rather than using Sequelize’s ORM abstractions. The point was to actually use PostgreSQL properly, not just swap out the connection string.</p><h4>Schema Design</h4><p>All money fields use DECIMAL(15,2) — never FLOAT. Floating point arithmetic and financial data are a famously bad combination. 0.1 + 0.2 equalling 0.30000000000000004 is funny in a JavaScript meme, significantly less funny in a banking system.</p><pre>CREATE TABLE wallets (<br>  id          SERIAL PRIMARY KEY,<br>  &quot;userId&quot;    INTEGER NOT NULL REFERENCES users(id),<br>  balance     DECIMAL(15,2) NOT NULL DEFAULT 0,<br>  currency    VARCHAR(10) NOT NULL DEFAULT &#39;NGN&#39;,<br>  pin         VARCHAR(255) NOT NULL,<br>  &quot;createdAt&quot; TIMESTAMP DEFAULT NOW(),<br>  &quot;updatedAt&quot; TIMESTAMP DEFAULT NOW()<br>);<br><br>CREATE TABLE ledgers (<br>  id              SERIAL PRIMARY KEY,<br>  &quot;walletId&quot;      INTEGER NOT NULL REFERENCES wallets(id),<br>  type            VARCHAR(10) NOT NULL CHECK (type IN (&#39;credit&#39;, &#39;debit&#39;)),<br>  amount          DECIMAL(15,2) NOT NULL,<br>  &quot;balanceBefore&quot; DECIMAL(15,2) NOT NULL,<br>  &quot;balanceAfter&quot;  DECIMAL(15,2) NOT NULL,<br>  reference       VARCHAR(255) NOT NULL UNIQUE,<br>  description     VARCHAR(255),<br>  status          VARCHAR(20) DEFAULT &#39;success&#39;,<br>  &quot;createdAt&quot;     TIMESTAMP DEFAULT NOW(),<br>  &quot;updatedAt&quot;     TIMESTAMP DEFAULT NOW()<br>);<br><br>CREATE TABLE audit_logs (<br>  id           SERIAL PRIMARY KEY,<br>  action       VARCHAR(100) NOT NULL,<br>  &quot;userId&quot;     INTEGER REFERENCES users(id),<br>  &quot;walletId&quot;   INTEGER REFERENCES wallets(id),<br>  amount       DECIMAL(15,2),<br>  status       VARCHAR(20) DEFAULT &#39;success&#39;,<br>  reference    VARCHAR(255),<br>  &quot;createdAt&quot;  TIMESTAMP DEFAULT NOW(),<br>  &quot;updatedAt&quot;  TIMESTAMP DEFAULT NOW()<br>);<br><br>CREATE TABLE idempotency_keys (<br>  id           SERIAL PRIMARY KEY,<br>  key          VARCHAR(255) NOT NULL UNIQUE,<br>  response     JSONB NOT NULL,<br>  &quot;createdAt&quot;  TIMESTAMP DEFAULT NOW(),<br>  &quot;updatedAt&quot;  TIMESTAMP DEFAULT NOW()<br>);</pre><h4>The Transfer Controller with Raw SQL</h4><p>The key feature is SELECT ... FOR UPDATE — this locks the wallet rows for the duration of the transaction, preventing any other concurrent transaction from reading or modifying them until the current one commits or rolls back. This is how i prevent race conditions in a high-concurrency system (two people trying to spend from the same wallet simultaneously).</p><pre>const t = await sequelize.transaction();<br>// Lock both wallet rows — no other transaction can touch these until we commit<br>const [sender] = await sequelize.query&lt;{ id: number; balance: number; pin: string }&gt;(<br>  `SELECT id, balance, pin FROM wallets WHERE id = :senderWalletId FOR UPDATE`,<br>  { replacements: { senderWalletId }, type: QueryTypes.SELECT, transaction: t }<br>);<br>const [receiver] = await sequelize.query&lt;{ id: number; balance: number }&gt;(<br>  `SELECT id, balance FROM wallets WHERE id = :receiverWalletId FOR UPDATE`,<br>  { replacements: { receiverWalletId }, type: QueryTypes.SELECT, transaction: t }<br>);<br></pre><p>After PIN verification and balance checks:</p><pre>// Update balances atomically<br>await sequelize.query(<br>  `UPDATE wallets SET balance = :senderAfter, &quot;updatedAt&quot; = NOW() WHERE id = :senderWalletId`,<br>  { replacements: { senderAfter, senderWalletId }, type: QueryTypes.UPDATE, transaction: t }<br>);<br>await sequelize.query(<br>  `UPDATE wallets SET balance = :receiverAfter, &quot;updatedAt&quot; = NOW() WHERE id = :receiverWalletId`,<br>  { replacements: { receiverAfter, receiverWalletId }, type: QueryTypes.UPDATE, transaction: t }<br>);<br>// Double entry ledger in a single INSERT<br>await sequelize.query(<br>  `INSERT INTO ledgers (&quot;walletId&quot;, type, amount, &quot;balanceBefore&quot;, &quot;balanceAfter&quot;, reference, description, status, &quot;createdAt&quot;, &quot;updatedAt&quot;)<br>   VALUES<br>   (:senderWalletId, &#39;debit&#39;,  :amount, :senderBefore,   :senderAfter,   :debitRef,  &#39;Transfer sent&#39;,     &#39;success&#39;, NOW(), NOW()),<br>   (:receiverWalletId, &#39;credit&#39;, :amount, :receiverBefore, :receiverAfter, :creditRef, &#39;Transfer received&#39;, &#39;success&#39;, NOW(), NOW())`,<br>  { replacements: { ... }, type: QueryTypes.INSERT, transaction: t }<br>);<br>await t.commit(); // all or nothing<br></pre><p>If anything throws — invalid PIN, insufficient funds, a database hiccup — the catch block calls t.rollback() and the database is left exactly as it was before the request came in. No partial writes, no orphaned ledger entries, no phantom balance deductions.</p><h3>Wallet Failsafe Checks</h3><p>Beyond the transaction logic, several layers of validation protect every wallet operation:</p><ul><li>PIN verification — every sensitive operation (fund, transfer) requires the wallet PIN, hashed with bcrypt and compared server-side. The raw PIN never touches the database.</li><li>Idempotency — every transfer requires a unique Idempotency-Key header. Duplicate keys return the original response without re-executing the transfer. This makes the API safe to retry.</li><li>Balance check — transfers are rejected if the sender’s balance is insufficient, checked inside the locked transaction to prevent time-of-check to time-of-use (TOCTOU) race conditions.</li><li>Self-transfer prevention — you cannot transfer to your own wallet.</li><li>Role-based access — funding a wallet is restricted to super-admins only. Regular users can only transfer between wallets.</li></ul><h3>Wallet Balance Audits</h3><p>The ledger is the source of truth for every wallet&#39;s balance history. Each credit and debit is recorded with the balance before and after the operation, along with a unique reference and description. This makes it possible to reconstruct a wallet&#39;s balance from scratch by replaying its ledger entries — which is exactly what the reconciliation endpoint does:</p><pre><br>let balance = 0;<br>for (const entry of ledger) {<br>  if (entry.type === &#39;credit&#39;) balance += entry.amount;<br>  else if (entry.type === &#39;debit&#39;) balance -= entry.amount;<br>}</pre><p>There are two reconciliation routes — one that reconstructs a single wallet’s balance, and a batch version that processes all wallets in a single transaction. Both are restricted to admin and super-admin roles.</p><h3>Admin Features</h3><p>The system has three roles: user, admin, and super-admin.</p><p>· Users can create a wallet, view their own wallet, transfer funds, and view their own ledger and audit logs.</p><p>· Admins can search any wallet, view ledger entries, view audit logs, and trigger balance reconciliation.<br>· Super-admins can do everything admins can, plus fund wallets directly and manage admin accounts.</p><p>Two super-admin accounts are seeded at startup from environment variables. The system enforces a maximum of two super-admins — if both slots are filled, the seeder skips creation silently. There’s also a utility function baked into the seeder (commented out by default) that can delete the second super-admin — useful during testing when I might need to reset the super-admin state without touching the database manually. (Yes, it’s a bit of a hack. Yes, it’s clearly commented.)</p><h4>Deployment on AWS</h4><p>I created an AWS EC2 instance, made the IP public, and SSH’d into the remote server</p><p>then on the server I:</p><pre>install Node.js<br>curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -<br>sudo apt-get install -y nodejs<br><br># cloned the repo<br>git clone https://github.com/your-repo/sendmefunds.git<br>cd sendmefunds<br><br># installed dependencies<br>npm install<br><br># set environment variables<br>nano .env  # paste your env vars<br><br># ran it with pm2 so it stays alive after you close the terminal<br>npm install -g pm2<br>pm2 start npm --name &quot;sendmefunds&quot; -- start<br>pm2 save</pre><p>One thing worth mentioning — I eventually rewrote the entire backend into a Next.js API routes project (just for the frontend I later built) because my EC2 instance’s public IP kept changing and wasn’t stable enough for long-term display. Elastic IPs exist for this but they are on paid subscriptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_pcNOh-TlV1bWwndzP6rw.jpeg" /><figcaption>Testing API routes locally with postman</figcaption></figure><h3>Notable Challenges</h3><p>· AWS deployment — this was my first AWS deployment, but thanks to my experience with the Linux ecosystem through WSL, working in the terminal wasn’t nerve-racking. Knowing your way around a Unix shell is genuinely underrated as a backend skill.</p><p>· CORS errors — yes, the classic. Setting up proper CORS configuration between the Express backend and the Next.js frontend took a moment, especially with credentials: true for cookie-based auth. Not serious, but worth a mention for anyone walking the same path.</p><p>· MongoDB transactions on standalone instances — transactions in MongoDB require a replica set. Running locally without one will give you cryptic errors that aren’t immediately obvious. Atlas saves you from this entirely.<br>· Duplicate ledger references — using the same reference string for both the debit and credit ledger entries hits the unique index constraint. The fix is simple (${reference}_debit and ${reference}_credit) but it took a failed transaction or two to figure out. (The database was right. I was wrong.)</p><h3>Links</h3><p>Backend repo: https://github.com/shola-devv/SendMeFunds-Fintech-model-.git</p><ul><li>the main branch has the mongodb version</li><li>the postgresql-db-setup branch has the postgresql version</li></ul><p>Frontend repo: https://github.com/shola-devv/sendMeFunds-Frontend.git</p><p>find the live version on my portfolio site : sholaemmanuel.dev</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*peKWzdhA7R4QpzqyyYkDTQ.jpeg" /><figcaption>sendmefunds transfer page</figcaption></figure><p>Thanks for reading. If you&#39;re building something in the fintech space and want to talk shop, find me at the link above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c501e6fb61" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>