<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Solana Internals</title>
        <link>https://paragraph.com/@solanainternals</link>
        <description>undefined</description>
        <lastBuildDate>Sun, 15 Nov 2026 04:14:51 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Scripting the Future of Trading]]></title>
            <link>https://paragraph.com/@solanainternals/scripting-the-future-of-trading</link>
            <guid>GZXijz8jJfUDyp7mQGyQ</guid>
            <pubDate>Tue, 19 May 2026 21:02:40 GMT</pubDate>
            <description><![CDATA[1. The Complex Concept: What’s Broken in Web3 Onboarding?If you want to run a trading bot today, the standard onboarding guide looks like a manual for building a rocket ship. You are told to download a browser extension, write down 12 secret words on a piece of paper, fund a wallet, copy-paste a continuous string of letters and numbers (the private key) into a terminal code file, and pray that your server doesn't get hacked overnight. If your computer gets compromised, your entire lifecycle s...]]></description>
            <content:encoded><![CDATA[<h3 id="h-1-the-complex-concept-whats-broken-in-web3-onboarding" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">1. The Complex Concept: What’s Broken in Web3 Onboarding?</h3><p>If you want to run a trading bot today, the standard onboarding guide looks like a manual for building a rocket ship. You are told to download a browser extension, write down 12 secret words on a piece of paper, fund a wallet, copy-paste a continuous string of letters and numbers (the private key) into a terminal code file, and pray that your server doesn't get hacked overnight.</p><p>If your computer gets compromised, your entire lifecycle savings are gone. This structural barrier is why 99% of everyday crypto users never touch automated trading or algorithmic strategies. The UX is intimidating, and the security risk is unmanageable.</p><h3 id="h-2-the-marketing-hook-the-digital-co-pilot-analogy" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. The Marketing Hook: The "Digital Co-Pilot" Analogy</h3><p>To bridge this gap for ordinary users, we don't explain cryptographic signers or key-management architectures. Instead, we use a familiar real-world framework: <strong>The Pre-Paid Corporate Card.</strong></p><p>Imagine you hire a personal assistant to buy coffee and office supplies for you. You wouldn't give them your master bank account login and password. Instead, you hand them a separate corporate card with a strict daily spending limit of $50. If the assistant loses the card, your main savings remain completely safe.</p><p>This is exactly what <strong>Openfort</strong> allows us to do under the hood. It creates a secondary, protected "digital co-pilot" wallet for your trading bot. You give it specific permission to trade on Hyperliquid, but it can never touch or withdraw your main funds.</p><h3 id="h-3-community-engagement-why-the-everyday-user-cares" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">3. Community Engagement: Why the Everyday User Cares</h3><p>By moving the infrastructure to the background, the trading bot changes from a high-risk developer tool into an accessible consumer application. Everyday users can leverage this tech to run automated strategies seamlessly:</p><ul><li><p><strong>Zero Seed Phrases:</strong> Users can interact and initialize their accounts directly through interfaces they already use every day, like a simple Telegram chat.</p></li><li><p><strong>Isolated Risk:</strong> You only fund the bot with the exact amount of USDC you want to trade (e.g., $40). The backend code automatically coordinates the transactions securely.</p></li><li><p><strong>Invisible Gas:</strong> Users don't need to manually calculate network transaction fees or handle complex RPC network switching. The application handles the friction behind the scenes.</p></li></ul><h3 id="h-4-interactive-narrative-engaging-the-modern-trader" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">4. Interactive Narrative: Engaging the Modern Trader</h3><p>In Web3 community building, visual proof and interactive engagement drive retention. By packaging a high-frequency trading backend into an intuitive interface where typing <code>/buy ETH 10</code> instantly places an order on-chain, the product shifts from cold math to active entertainment.</p><p>The community loop is simple:</p><ol><li><p><strong>Connect:</strong> Use social onboarding or a thin application wrapper to spin up your bot profile in seconds.</p></li><li><p><strong>Deploy:</strong> Fund your isolated co-pilot wallet with testnet or small mainnet balances.</p></li><li><p><strong>Automate:</strong> Let the secure script handle market execution while you monitor performance through a clean, human-readable feed.</p></li></ol><p>By focusing on how the product <em>feels</em> rather than how the code is structured, we open up advanced financial primitives to the broader internet culture.</p>]]></content:encoded>
            <author>solanainternals@newsletter.paragraph.com (Solana Internals)</author>
        </item>
        <item>
            <title><![CDATA[How Hyperliquid Bots Work: A Mechanism Analysis of API-Driven Automated Trading with Openfort]]></title>
            <link>https://paragraph.com/@solanainternals/how-hyperliquid-bots-work-a-mechanism-analysis-of-api-driven-automated-trading-with-openfort</link>
            <guid>AY4hbe5jwxLh06tDV3MS</guid>
            <pubDate>Tue, 19 May 2026 21:00:48 GMT</pubDate>
            <description><![CDATA[1. What problem does programmatic on-chain trading solve?In traditional centralized exchanges (CEXs), high-frequency trading (HFT) and automated market making (AMM) rely on private, ultra-low latency APIs. Transitioning these trading strategies to decentralized settings usually introduces a massive trade-off: security vs. speed. Traders either have to manually sign every transaction through a browser wallet (introducing terminal latency) or store raw private keys in plaintext inside a cloud s...]]></description>
            <content:encoded><![CDATA[<h3 id="h-1-what-problem-does-programmatic-on-chain-trading-solve" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">1. What problem does programmatic on-chain trading solve?</h3><p>In traditional centralized exchanges (CEXs), high-frequency trading (HFT) and automated market making (AMM) rely on private, ultra-low latency APIs. Transitioning these trading strategies to decentralized settings usually introduces a massive trade-off: security vs. speed. Traders either have to manually sign every transaction through a browser wallet (introducing terminal latency) or store raw private keys in plaintext inside a cloud server to automate execution—exposing themselves to catastrophic hot-wallet hacks.</p><p>This system provides an alternative architecture. By combining <strong>Hyperliquid’s L1 infrastructure</strong> with <strong>Openfort's server-side account abstraction</strong>, traders can execute automated delta-neutral market making and spatial arbitrage strategies programmatically via API, without ever exposing the wallet's private key to the application layer.</p><h3 id="h-2-the-core-strategy-mid-price-tracking-and-slippage-buffers" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. The core strategy: Mid-Price Tracking &amp; Slippage Buffers</h3><p>The strategy analyzes the orderbook dynamics of Hyperliquid in real-time. Instead of executing market orders—which eat into margins due to taker fees—the bot acts as a liquidity provider/arbitrageur using optimized limit orders based on dynamic pricing formulas.</p><p>The target execution price is derived using a fractional offset from the instantaneous mid-price ($P_{mid}$):</p><p>$$P_{mid} = \frac{P_{bid} + P_{ask}}{2}$$</p><p>To capitalize on sudden liquidity imbalances or to hedge spot holdings against perpetual positions, the bot places a limit buy order with a dynamic slippage buffer ($\alpha$):</p><p>$$P_{limit} = P_{mid} \times (1 - \alpha)$$</p><p>Where $\alpha$ is dynamically adjusted based on 1-minute historical volatility. For standard setups, a baseline $\alpha = 0.05$ (5% discount buffer) is utilized to catch flash crashes or structural price drops before the rest of the market front-runs the L1 state update.</p><h3 id="h-3-the-accounting-primitive-perps-vs-spot-balance" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">3. The Accounting Primitive: Perps vs. Spot Balance</h3><p>To maintain insolvency safety, the execution mechanism continuously queries the clearinghouse state of the decentralized exchange. The account balance is split into two distinct accounting primitives:</p><ul><li><p><strong>Spot Margin:</strong> Assets settled directly on-chain (e.g., raw USDC).</p></li><li><p><strong>Perp Margin:</strong> Unrealized PnL (uPnL) and cross-collateral maintenance margin allocated to active leverage positions.</p></li></ul><p>The execution bot reads these metrics via the <code>clearinghouseState</code> endpoint. If the spot margin falls below the maintenance threshold required to back active positions, the bot triggers a self-regulating loop: it cancels all open limit orders via a single atomized batch call (<code>/cancel_all</code>) and reallocates spot assets from the settlement layer to the perp engine to mitigate liquidation risks.</p><h3 id="h-4-cryptographic-delegation-openfort-backend-wallets" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">4. Cryptographic Delegation: Openfort Backend Wallets</h3><p>The core technical differentiator of this setup is the segregation of signature authority. Instead of keeping a seed phrase in memory, the trading architecture leverages specialized <strong>Server-Side Smart Accounts</strong>.</p><p>The lifecycle of an automated trade works as follows:</p><ol><li><p>The developer initializes an ephemeral backend wallet through the API primitive: <code>accounts.evm.backend.create()</code>.</p></li><li><p>Openfort generates the cryptographic key pair within a secure Hardware Security Module (HSM) / KMS infrastructure.</p></li><li><p>The application backend only receives a reference <code>Wallet ID</code> and the public <code>Address</code>.</p></li></ol><p>When the trading logic identifies a mispricing in the orderbook, it calls the execution client. The private key never leaves the secure signing infra; it signs the order hash inside the backend wrapper and relays the signed transaction payload directly to Hyperliquid's RPC nodes.</p><h3 id="h-5-execution-mechanics-the-viem-interface-integration" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">5. Execution Mechanics: The Viem Interface Integration</h3><p>Hyperliquid requires all trading inputs to conform to specific cryptographic standards for high-throughput order matching. The system achieves sub-second execution times by matching interfaces at the library level.</p><p>Because Openfort implements the native <code>viem</code> Signer interface—the industry standard for Ethereum-virtual-machine-compatible cryptographic operations—it plugs directly into Hyperliquid’s SDK:</p><p>TypeScript</p><pre data-type="codeBlock" text="const exchangeClient = new ExchangeClient(openfortWallet, { isTestnet: true });
"><code>const <span class="hljs-attr">exchangeClient</span> = new ExchangeClient(openfortWallet, { isTestnet: <span class="hljs-literal">true</span> })<span class="hljs-comment">;</span>
</code></pre><p>This structural compatibility eliminates the need for translation wrappers or "glue code" that normally injects 100ms–300ms of latency into Web3 bots. When the command <code>/buy ETH 10</code> is triggered, the order is computed, cryptographically signed, and pushed to the L1 orderbook engine inside a single async event loop cycle (&lt;50ms execution overhead).</p><h3 id="h-6-risk-mitigation-and-fail-safes" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">6. Risk Mitigation and Fail-safes</h3><p>Operating an automated algorithmic trading primitive on-chain exposes the builder to systemic anomalies (API rate limits, RPC drops, extreme oracle deviations). To protect capital, the bot implements three structural fail-safes:</p><ul><li><p><strong>Good-Till-Cancelled (GTC) Enforcement:</strong> All automated limit orders are marked as GTC with a strict expiration time-to-live (TTL). If the bot's server loses internet connectivity, the orders naturally expire on the exchange side within minutes, preventing stale fills.</p></li><li><p><strong>Asymmetric Volatility Kill-Switch:</strong> If the delta between the oracle price and the exchange mid-price exceeds a pre-set threshold (e.g., &gt;2%), the bot halts all market-making operations, assuming an active exploit or a severe liquidity drain.</p></li><li><p><strong>API Secret Segregation:</strong> The <code>OPENFORT_SECRET_KEY</code> and <code>OPENFORT_WALLET_SECRET</code> are strictly contained within decoupled environment variables (<code>.env</code>). If the public-facing interface (e.g., a Telegram UI or front-end interface) gets compromised, attackers cannot drain the funds because they lack the underlying cryptographic primitives to bypass the server-side signing rules.</p></li></ul><br>]]></content:encoded>
            <author>solanainternals@newsletter.paragraph.com (Solana Internals)</author>
        </item>
        <item>
            <title><![CDATA[How marginfi Works: A Mechanism Analysis of Solana's Leading Lending Protocol]]></title>
            <link>https://paragraph.com/@solanainternals/how-marginfi-works-a-mechanism-analysis-of-solanas-leading-lending-protocol</link>
            <guid>6paZpVWDSCgxqShoOi8f</guid>
            <pubDate>Tue, 19 May 2026 20:56:40 GMT</pubDate>
            <description><![CDATA[Tags: DeFi, Solana, Lending, Mechanism AnalysisWhat problem does marginfi solve?In traditional finance, lending requires trust: banks verify identity, credit scores, and income before issuing loans. Decentralized lending protocols like marginfi replace this trust with math. Instead of checking who you are, the protocol checks what you have locked as collateral — and enforces repayment automatically through on-chain rules. marginfi is a non-custodial, overcollateralized lending protocol on Sol...]]></description>
            <content:encoded><![CDATA[<ol><li><p>What problem does marginfi solve?</p></li></ol><p>In traditional finance, lending requires trust: banks verify identity, credit scores, and income before issuing loans. Decentralized lending protocols like marginfi replace this trust with math. Instead of checking who you are, the protocol checks what you have locked as collateral — and enforces repayment automatically through on-chain rules.</p><p>marginfi is a non-custodial, overcollateralized lending protocol on Solana. This means that to borrow $100 worth of USDC, you must first deposit more than $100 worth of another asset (say, SOL) as collateral. The protocol never holds your funds — everything is governed by programs (smart contracts) on-chain.</p><ol start="2"><li><p>The core accounting: asset weights</p></li></ol><p>Not all collateral is treated equally. marginfi assigns each asset two key parameters that determine how much borrowing power it grants or how much debt it counts for:</p><p>Asset Weight (deposit side): how much collateral value the protocol recognizes. SOL might have a deposit weight of 0.80 — meaning $1,000 in SOL only counts as $800 in borrowing power.</p><p>Liability Weight (borrow side): how much borrowed value the protocol counts against you. USDC might have a liability weight of 1.20 — meaning borrowing $100 in USDC is treated as $120 of debt in the risk calculation.</p><p>These weights create an implicit buffer. Even if both asset and liability prices stay flat, you can never borrow the full value of your collateral. The weights are set conservatively based on each asset's liquidity and volatility profile.</p><ol start="3"><li><p>Health Factor: the key metric</p></li></ol><p>The protocol continuously calculates a Health Factor for every account. This is the single number that determines whether your position is safe or at risk of liquidation.</p><p>Health Factor = (Σ deposits × asset_weight × price) / (Σ borrows × liability_weight × price)</p><p>If Health Factor ≥ 1.0 → position is healthy If Health Factor &lt; 1.0 → position can be liquidated</p><p>For example: you deposit 10 SOL at $150 each ($1,500 total). Asset weight = 0.80, so your weighted collateral = $1,200. You borrow 800 USDC. Liability weight = 1.20, so your weighted debt = $960. Health Factor = 1,200 / 960 = 1.25. You're safe — for now.</p><p>If SOL price drops to $100, your weighted collateral falls to $800. Health Factor = 800 / 960 = 0.83. The protocol now allows liquidators to step in.</p><ol start="4"><li><p>Interest rate model: dynamic rates driven by utilization</p></li></ol><p>marginfi uses a kinked interest rate model. The interest rate paid by borrowers (and earned by lenders) is not fixed — it changes dynamically based on how much of the pool is being used.</p><p>Utilization Rate (U) = Total Borrowed / Total Deposited</p><p>If U &lt; Optimal Utilization (e.g. 80%): Borrow Rate = Base Rate + (U / Optimal_U) × Rate_Slope_1</p><p>If U ≥ Optimal Utilization: Borrow Rate = Base Rate + Rate_Slope_1 + ((U - Optimal_U) / (1 - Optimal_U)) × Rate_Slope_2</p><p>The "kink" at the optimal utilization point is intentional. Below 80% utilization, rates rise slowly to attract more borrowers. Above 80%, rates spike sharply — this incentivizes borrowers to repay and depositors to add liquidity, naturally pushing utilization back toward the safe zone. The model is self-regulating.</p><ol start="5"><li><p>Liquidation mechanics</p></li></ol><p>When an account's Health Factor drops below 1.0, any external actor (a liquidator bot) can partially repay the borrower's debt in exchange for a discounted portion of their collateral. This is called a liquidation.</p><p>The liquidation incentive is a fee — typically 5% — built into the discount. If a liquidator repays $100 of USDC debt, they receive $105 worth of SOL collateral. This profit motive ensures that liquidators are always present and that underwater positions are closed quickly, protecting the solvency of the protocol.</p><p>Liquidations on Solana are particularly fast and competitive because of Solana's ~400ms block times and low fees. Liquidator bots can monitor thousands of accounts and execute transactions in near real-time, which dramatically reduces bad debt risk compared to slower chains.</p><p>A portion of the liquidation fee also goes to the protocol's insurance fund — a reserve designed to cover any bad debt that occurs if a position becomes insolvent before liquidation is triggered.</p><ol start="6"><li><p>Why this design matters</p></li></ol><p>The combination of asset weights, a dynamic interest rate model, and competitive liquidation creates a self-sustaining system. Rates equilibrate supply and demand automatically. Liquidators are economically incentivized to keep the system solvent. And the weights act as a first line of defense against volatility.</p><p>marginfi's architecture on Solana takes advantage of the chain's high throughput and low fees to make this system practical at scale. The result is a lending protocol that can serve thousands of concurrent users with sub-second price oracle updates and real-time liquidation coverage.</p><p>Understanding these mechanisms is essential for anyone building on top of lending primitives, integrating with marginfi's SDK, or designing protocols that interact with collateralized debt positions on Solana.</p>]]></content:encoded>
            <author>solanainternals@newsletter.paragraph.com (Solana Internals)</author>
        </item>
    </channel>
</rss>