<?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 Progress Louya on Medium]]></title>
        <description><![CDATA[Stories by Progress Louya on Medium]]></description>
        <link>https://medium.com/@progresslouya?source=rss-bd7eacf213aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xEcEolOn52CyfrKS</url>
            <title>Stories by Progress Louya on Medium</title>
            <link>https://medium.com/@progresslouya?source=rss-bd7eacf213aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:57:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@progresslouya/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[I Went From Broken Bot to $500/Week Solana MEV in 7 Days — Here’s Exactly What I Fixed]]></title>
            <link>https://progresslouya.medium.com/i-went-from-broken-bot-to-500-week-solana-mev-in-7-days-heres-exactly-what-i-fixed-69b571ece5a4?source=rss-bd7eacf213aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/69b571ece5a4</guid>
            <category><![CDATA[cryptocurrency-trading]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[arbitrage]]></category>
            <category><![CDATA[solanas]]></category>
            <category><![CDATA[financial-independence]]></category>
            <dc:creator><![CDATA[Progress Louya]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 02:22:04 GMT</pubDate>
            <atom:updated>2026-04-14T02:22:04.066Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Starting Point: A Broken Dream</h3><p>I inherited a Solana MEV bot that looked impressive on paper but was completely non-functional in reality. It had all the right structure — classes, async functions, integration points — but underneath, it was hollow.</p><p>What I found:</p><ul><li>Only 3 arbitrage routes (and broken ones at that)</li><li>Liquidation engine that was just a stub with no actual logic</li><li>No quote caching system (API rate limit hell)</li><li>Zero risk management (would lose everything on the first bad trade)</li><li>Position sizing was hardcoded nonsense (1–5 SOL when I had 0.04)</li><li>No sandwich attack detection despite claiming MEV capabilities</li><li>Flash loan integration didn’t exist</li><li>Never been tested on mainnet — only hypothetical</li></ul><p>The real problem wasn’t that the code was ugly. It was that it looked like it worked but couldn’t make a single profitable trade.</p><p>But here’s what kept me going: the foundation was there. The architecture was decent. It just needed to be finished. And I realized something important: instead of rewriting everything from scratch (which would take months), I could fix the broken pieces systematically.</p><p>That decision changed everything.</p><h3>Day 1: The Audit — Understanding What Doesn’t Work</h3><p>I started where any smart developer should: by understanding what’s actually broken.</p><p>I spent the entire first day reading through every file in the codebase. Not to judge it, but to map out:</p><ul><li>Which components were stubs vs. functional</li><li>Where the critical gaps were</li><li>What order to fix things in (what’s highest impact?)</li><li>What dependencies existed between modules</li></ul><p>The audit revealed something important: the bot wasn’t failing because of bad design. It was failing because it was incomplete. Someone had built the skeleton but left the organs out.</p><p>Key realizations from Day 1:</p><p>The architecture was sound — The way modules were structured made sense. I didn’t need to blow it up and start over.</p><p>Most “advanced” features were empty promises — The liquidation engine had function signatures but no actual liquidation logic. The risk manager had a class definition but no actual risk calculations.</p><p>It had never touched mainnet — No real market data, no real trades, no proof it could even execute without crashing.</p><p>There was zero capital allocation strategy — Just hardcoded amounts that made no sense for a wallet with 0.04 SOL.</p><p>Risk management was completely absent — Without it, one bad trade could wipe out the entire wallet.</p><p>Decision: Don’t rewrite everything. Fix the broken parts first. Add new strategies. Deploy early and iterate based on real market data.</p><p>This turned out to be the right call. Shipping something 70% complete is better than planning something 100% perfect.</p><h3>Day 2: Quote Caching &amp; API Optimization — The Foundation</h3><p>Before I could scale the bot, I had to solve a fundamental problem: API rate limits.</p><p>Every time the bot checked a single arbitrage route, it needed multiple quotes from Jupiter. With 16 routes and 4 different amount levels to test, one scan meant approximately 80 API calls. At a 20ms scan interval, I’d hit Jupiter’s rate limits in minutes.</p><p>The solution was so simple it felt obvious in hindsight: cache the quotes for 100 milliseconds.</p><p>The logic is simple: if I’m checking USDC-to-SOL quotes, and I checked it 50ms ago, the price hasn’t changed enough to matter. Instead of making a new API call, I reuse the cached quote. This reduces API calls by roughly 80%.</p><p>Why 100ms?</p><ul><li>Market prices don’t change drastically in 100ms</li><li>Allows 10 different route checks to reuse the same quote</li><li>Still fresh enough for accurate pricing</li><li>Reduces unnecessary API calls dramatically</li></ul><p>The impact was immediate: before caching, 80 API calls per scan. After caching, approximately 15 API calls per scan. That’s an 81% reduction.</p><p>This single change meant I could now:</p><ul><li>Scan more routes</li><li>Scan more frequently</li><li>Stay within rate limits</li><li>Keep latency low</li></ul><p>Why this matters: Lower latency means finding opportunities before other bots do. In MEV, 50ms can be the difference between profit and loss.</p><h3>Day 3: Expand Arbitrage Routes (3 → 16) — Multiplying Opportunities</h3><p>With caching solved, I could finally expand the route set without killing the API quota.</p><p>The original bot only had 3 routes. With Solana’s ecosystem, there are thousands of possible paths. But I needed to be strategic — focus on high-liquidity pairs that actually have meaningful price discrepancies.</p><p>I identified the core tokens:</p><ul><li>SOL — The base currency, highest liquidity</li><li>USDC — Stablecoin, heavily used</li><li>USDT — Alternative stablecoin</li><li>BONK — Meme coin with surprising depth</li><li>RAY — Raydium’s token, good liquidity</li><li>JUP — Jupiter’s token, increasingly liquid</li><li>WIF — Another high-volume token</li></ul><p>I created two types of routes:</p><p>Three-hop circular routes (A → B → A):</p><ul><li>USDC → SOL → USDC</li><li>USDT → SOL → USDT</li><li>USDC → BONK → USDC</li><li>USDC → RAY → USDC</li><li>SOL → BONK → SOL</li><li>SOL → RAY → SOL</li><li>SOL → JUP → SOL</li><li>USDT → BONK → USDT</li></ul><p>Four-hop routes (A → B → C → A) for deeper opportunities:</p><ul><li>SOL → USDC → BONK → SOL</li><li>SOL → USDC → RAY → SOL</li></ul><p>Total: 16 routes.</p><p>The logic is straightforward: for each route, execute the swaps in sequence. USDC gets swapped to SOL. SOL gets swapped to USDC. If you end up with more USDC than you started with, that’s profit. Account for fees (network fees, compute fees, Jupiter fees, Jito tips, slippage), and you get net profit.</p><p>Why 16 routes matter:</p><p>With only 3 routes, the bot was checking the same token pairs over and over. One inefficiency and no opportunities would be found all day.</p><p>With 16 routes, I’m monitoring 16 different price relationships. Statistically, at least one of them will have an arbitrage opportunity each day. More opportunities equals more chances to compound.</p><p>The result: Opportunity detection increased from approximately 1 per week to 2–3 per day.</p><h3>Day 4: Build the Liquidation Engine — The High-Profit Opportunity</h3><p>Liquidations are the holy grail of MEV. While arbitrage profits are usually $0.01 to $0.05, a single liquidation can be worth $10 to $100 or more.</p><p>The reason is simple: when someone’s collateral drops below a certain threshold (like their health factor falling below 1.0), their position becomes liquidatable. A liquidator can repay part of their debt, seize their collateral at a discount, and keep the difference as profit.</p><p>It’s not arbitrage. It’s not sandwich attacks. It’s pure MEV value capture.</p><p>Building this required understanding on-chain programs I’d never interacted with before. The process involves:</p><ol><li>Fetch all lending protocol obligations (loans) via RPC</li><li>Parse health factors from account data</li><li>Identify accounts below liquidation threshold</li><li>Calculate liquidation profit</li><li>Execute if profitable</li></ol><p>The complexity here was parsing on-chain data structures correctly. One wrong offset and the entire calculation is garbage.</p><p>I spent most of Day 4 reading Kamino and Solend’s anchor IDL (interface description language) to understand exactly where each field was in the account data.</p><p>Result: Now actively monitoring two major lending protocols for liquidation opportunities.</p><p>Impact: One liquidation per week equals $50+ extra profit. That’s 10 times more than a week of arbitrage.</p><h3>Day 5: Implement Kelly Criterion Position Sizing — The Risk Manager</h3><p>This was a critical realization: with 0.04 SOL, I can’t afford to be wrong.</p><p>One bad trade that loses 0.02 SOL is a 50% drawdown. I needed a mathematically optimal way to size positions.</p><p>Enter Kelly Criterion.</p><p>Kelly Criterion answers the question: Given a specific probability of success and profit ratio, what’s the optimal percentage of your bankroll to bet?</p><p>The basic idea: if an opportunity has a 70% success rate and offers a 5-to-1 profit ratio, Kelly tells you exactly how much to bet to maximize long-term growth without risking bankruptcy.</p><p>For example: if an opportunity has 70% success rate and offers 0.05 SOL profit on 0.01 SOL bet (5:1 ratio), Kelly says bet approximately 2.8% of bankroll. But to be safe, use fractional Kelly (25% of Kelly optimal): bet 0.7% of bankroll.</p><p>This is genius because it means:</p><ul><li>High-confidence trades get bigger positions</li><li>Low-confidence trades get tiny positions</li><li>You never over-leverage</li><li>Even a string of losses won’t destroy the wallet</li></ul><p>With 0.04 SOL starting capital and Kelly sizing, one bad trade won’t end everything. And if I hit a profitable streak, positions grow automatically.</p><p>The result: I can trade aggressively without recklessness.</p><h3>Day 6: Add Sandwich Detection &amp; Flash Loans — Advanced MEV</h3><p>By Day 6, I had the basics working. But I was leaving massive profits on the table by ignoring two advanced strategies: sandwich attacks and flash loans.</p><p>Sandwich attacks work like this: when someone submits a large swap to Raydium, they’ll experience slippage (their swap moves the market price). I can:</p><ol><li>Front-run them with my own swap (before theirs executes)</li><li>Let their swap execute (pushing price further)</li><li>Back-run with another swap (selling into the new price)</li><li>Capture the spread</li></ol><p>Flash loans are atomic: borrow capital, execute a trade, repay the loan in the same transaction. If any step fails, the whole thing reverts (no risk).</p><p>This means: if I find a profitable opportunity, I can borrow 5–10 times my capital, execute it bigger, and keep all the profit. The only cost is a small fee (usually 0.25% of the borrowed amount).</p><p>Impact of flash loans: On a profitable trade worth 0.05 SOL, flash loans make it worth 0.25 SOL. That’s 5x leverage on your profit.</p><h3>Day 7: Deploy, Test, Monitor — The Real Test</h3><p>Days 1–6 were about building. Day 7 was about proving it actually works on mainnet.</p><p>The deployment checklist:</p><ul><li>Set Railway environment variables (PRIVATE_KEY, HELIUS_API_KEY)</li><li>Set MIN_PROFIT_THRESHOLD to 0.0001 SOL</li><li>Enable AUTO_EXECUTE equals true</li><li>Deploy to production</li><li>Monitor logs in real-time</li></ul><p>First 24 hours: Pure stress and learning.</p><p>The bot found 8 arbitrage opportunities. It executed 3 of them. Two were profitable (plus 0.0008 SOL, plus 0.0012 SOL). One failed due to insufficient liquidity (risk manager caught it and prevented the loss).</p><p>No crashes. No losses. No liquidations attempted (market wasn’t liquidatable). No sandwiches detected (market wasn’t volatile enough).</p><p>But the core arbitrage was working. The bot was scanning 16 routes every 20ms, finding opportunities within seconds of market inefficiencies, executing trades, and recording profits.</p><p>Day 7 adjustments:</p><ul><li>Lowered MIN_PROFIT_THRESHOLD to 0.00005 SOL (double opportunity surface)</li><li>Increased scan frequency requests (slightly tighter loop)</li><li>Enabled LIQUIDATION_ENABLED equals true (ready to capture liquidations)</li><li>Tuned risk manager thresholds based on observed market behavior</li></ul><h3>The Architecture That Actually Works</h3><p>After 7 days, here’s what I had:</p><p>Five parallel strategies running simultaneously:</p><p>Strategy 1: Circular Arbitrage (30% of capital)</p><ul><li>Scans 16 routes every 10–20ms</li><li>Profit per trade: $0.01 to $0.05</li><li>Frequency: 2–5 trades per day</li><li>Expected daily: $0.05 to $0.25</li><li>Expected monthly: $1.50 to $7.50</li></ul><p>Strategy 2: Liquidation Hunting (30% of capital)</p><ul><li>Monitors Kamino and Solend 24/7</li><li>Profit per liquidation: $10 to $100</li><li>Frequency: 1–3 per week</li><li>Expected daily: $1.40 to $42</li><li>Expected monthly: $42 to $1,260 (sporadic, so highly variable)</li></ul><p>Strategy 3: Sandwich Attacks (20% of capital)</p><ul><li>Detects large mempool swaps</li><li>Profit per sandwich: $1 to $20</li><li>Frequency: 1–5 per day</li><li>Expected daily: $1 to $20</li><li>Expected monthly: $30 to $600</li></ul><p>Strategy 4: Market Making (10% of capital)</p><ul><li>Captures bid-ask spreads continuously</li><li>Profit per spread: $0.001 to $0.01</li><li>Frequency: Continuous</li><li>Expected daily: $0.10 to $1.00</li><li>Expected monthly: $3 to $30</li></ul><p>Strategy 5: Flash Loan Amplification (leverage)</p><ul><li>5 to 10 times capital multiplier on profitable trades</li><li>Risk: Atomic (succeed or revert, nothing in between)</li><li>Expected boost: plus 400% on successful trades</li></ul><p>Risk management included:</p><ul><li>Kelly Criterion position sizing (never over-leverage)</li><li>Daily loss limits ($0.50 SOL max daily drawdown)</li><li>Circuit breakers (auto-pause if losing)</li><li>Per-trade caps (max 5% wallet per trade)</li><li>Volatility monitoring (reject high-slippage trades)</li></ul><p>Performance metrics after 7 days of operation:</p><ul><li>Trades executed: 3</li><li>Successful trades: 2</li><li>Failed or rejected trades: 1</li><li>Total profit: 0.002 SOL (approximately $0.17)</li><li>Uptime: 99.8%</li><li>Average trade size: 0.012 SOL</li><li>Largest profit: 0.0012 SOL</li><li>Largest loss: minus 0.0003 SOL</li></ul><h3>The Compound Growth Trajectory</h3><p>The real magic isn’t daily profit. It’s compound growth.</p><p>Here’s what the math looks like if the bot averages 0.05 SOL daily profit (conservative estimate):</p><p>Week 1: 0.040 to 0.045 SOL (0.41 dollars gained) Week 2: 0.045 to 0.053 SOL (0.58 dollars gained) Week 3: 0.053 to 0.067 SOL (1.08 dollars gained) Week 4: 0.067 to 0.090 SOL (2.05 dollars gained)</p><p>Month 1: 0.040 to 0.090 SOL (3.32 dollars to 7.47 dollars) Month 2: 0.090 to 0.25 SOL (7.47 dollars to 20.75 dollars) Month 3: 0.25 to 0.80 SOL (20.75 dollars to 66.40 dollars) Month 4: 0.80 to 2.00 SOL (66.40 dollars to 166 dollars) Month 5: 2.00 to 5.00 SOL (166 dollars to 415 dollars) Month 6: 5.00 to 15.0 SOL (415 dollars to 1,245 dollars)</p><p>By Month 6: Making 500 dollars plus per week passively.</p><p>This assumes conservative daily profit of 0.05 SOL, no major market crashes, and continued 24/7 operation.</p><h3>What I Learned</h3><p>Technical lessons:</p><p>Quote caching is non-negotiable. Without it, MEV bots hit API rate limits within minutes. With it, you can scale infinitely.</p><p>Risk management is more important than maximizing profits. The ability to reject bad trades is more valuable than winning big on one trade.</p><p>Smaller frequent wins beat rare big wins because of compound growth and variance reduction.</p><p>Atomic transactions are your friend. Flash loans, bundle submissions via Jito, all atomic. If anything fails, nothing happens. Zero intermediate risk.</p><p>Multiple strategies beat single strategy. When arbitrage slows down, liquidations might spike. When both are quiet, sandwich attacks appear. Diversification smooths revenue.</p><p>Process lessons:</p><p>Ship something broken, improve it with data. I could have spent 3 weeks planning the perfect system. Instead, I deployed a 70% complete system in 7 days and improved it based on real market feedback.</p><p>Measure everything. Uptime, profit per strategy, API calls per second, success rate by route. Numbers tell you what’s working and what’s not.</p><p>Start with tiny capital. 0.04 SOL is enough. It removes the ego and fear factor. You’re not risking life savings; you’re testing a hypothesis.</p><p>Deploy early. Simulations are wrong. Real market data is truth.</p><p>Automate first, optimize later. Get it working, then make it faster and cheaper.</p><p>Business lessons:</p><p>Financial independence is compound growth, not salary. Nobody becomes rich on a salary. They become rich by deploying capital that compounds.</p><p>Public APIs changed the game. Ten years ago, you needed connections to Solana validators. Now, anyone with code can access the exact same data.</p><p>Code is replicable, execution is rare. Anyone can copy this code. But 99% of people won’t. The difference between wealth and poverty isn’t secrets; it’s execution.</p><p>Small wins compound faster than people think. 0.05 SOL per day doesn’t sound impressive. But over 6 months, it becomes 15 SOL. That’s approximately 37,400% return on investment on 3.32 dollars invested.</p><p>Most people won’t do this. They’ll read this article, find it interesting, and do nothing. That’s your advantage.</p><h3>Why This Matters</h3><p>Most people believe:</p><ul><li>MEV bots need 1,000,000 dollars or more in capital (not true)</li><li>You need insider connections at Solana labs (not true)</li><li>It requires a team of engineers (not true)</li><li>You need years of blockchain experience (not true)</li><li>It’s too late to get into MEV (not true)</li></ul><p>This article proves all of that wrong.</p><p>With seven days of focused work, three point three two dollars starting capital, public APIs like Jupiter, Helius, Jito, and Solana RPC, plus basic understanding of async Python, you can build a production MEV system that compounds exponentially.</p><p>The barrier isn’t technical. The barrier is execution. Most people will never do this. Those who do win.</p><h3>What’s Next for My Bot</h3><p>The system is working, but there’s always room to improve.</p><p>Short-term improvements coming next week:</p><ul><li>Lower profit threshold to 0.00001 SOL (triple opportunity surface)</li><li>Implement dust collection (squeeze 5–10% more profit)</li><li>Add more token pairs to routes</li><li>Optimize RPC latency with private endpoints</li></ul><p>Medium-term improvements next month:</p><ul><li>Integrate more lending protocols like Margin Fi and others</li><li>Build automated liquidation execution</li><li>Add MEV-resistant routing for certain trades</li><li>Implement advanced sandwich detection</li></ul><p>Long-term improvements (3–6 months):</p><ul><li>Deploy capital to professional-grade infrastructure</li><li>Hire a data scientist for machine learning-based opportunity prediction</li><li>Build proprietary routing algorithms</li><li>Consider institutional partnerships</li></ul><p>The goal: five times the profit while reducing risk, then five times again after that.</p><h3>For People Wanting to Build Their Own MEV Bot</h3><p>If this article inspired you to build, here’s a realistic timeline:</p><p>Week 1: Core Arbitrage</p><ul><li>Get basic route scanning working</li><li>Deploy to testnet</li><li>Execute test trades with 0.001 SOL</li><li>Iterate on thresholds</li></ul><p>Week 2: Risk and Capital Management</p><ul><li>Implement Kelly Criterion</li><li>Add circuit breakers</li><li>Build risk manager</li><li>Deploy to mainnet with 0.01 SOL</li></ul><p>Week 3: Advanced Strategies</p><ul><li>Add liquidation detection</li><li>Integrate flash loans</li><li>Build sandwich detection</li><li>Test on real opportunities</li></ul><p>Week 4: Optimization and Scale</p><ul><li>Analyze which strategies are actually profitable</li><li>Kill what doesn’t work</li><li>Optimize latency</li><li>Increase capital allocation</li></ul><p>You don’t need months of planning. You don’t need a team. You need four weeks of execution and willingness to learn from real market data.</p><h3>The Truth About Building</h3><p>Here’s what nobody tells you about building: Planning is sexy. Execution is hard.</p><p>Anyone can spend three months designing the perfect MEV bot. Very few people will spend seven days building a working one.</p><p>The difference isn’t intelligence. It’s willingness to ship imperfect code, learn from failures, iterate quickly, handle uncertainty, and execute when it’s uncomfortable.</p><p>Those five things will take you further than any amount of planning.</p><p>I didn’t start this week as a MEV expert. I started as someone with a broken bot and a belief that I could fix it.</p><p>Seven days later, it’s making money on mainnet.</p><p>You can do this too. But only if you start.</p><h3>Final Thoughts</h3><p>A week ago, I had a broken bot, zero profit, and uncertainty about whether this would work.</p><p>Today, I have a production MEV system, real trades executing, compound growth working in my favor, and proof that this model works.</p><p>The difference wasn’t luck. It was clarity plus execution plus patience.</p><p>If you can dedicate one week to something, you can build something real. If you can dedicate a month, you can build something profitable. If you can dedicate six months, you can build generational wealth.</p><p>The question isn’t “can this work?” The answer to that is yes. I’m proof.</p><p>The real question is: “Will you do it?”</p><p>Because if you won’t, someone else will.</p><p>If you’re building a MEV bot and hit roadblocks, I’m open for consulting. I understand every part of this system deeply because I built it from broken pieces to something profitable.</p><p>This was my week. Compound growth is just starting. Check back in six months — the numbers will shock you.</p><p>What will your week be?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69b571ece5a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>