<?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 Nursca on Medium]]></title>
        <description><![CDATA[Stories by Nursca on Medium]]></description>
        <link>https://medium.com/@margretnursca?source=rss-7430ca25c33f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o-fWG-Oxw3OyZtUb7hlHQg.jpeg</url>
            <title>Stories by Nursca on Medium</title>
            <link>https://medium.com/@margretnursca?source=rss-7430ca25c33f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:17:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@margretnursca/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[Protocol Review: Aavegotchi’s `SvgFacet.sol` The On-Chain Rendering Engine]]></title>
            <link>https://medium.com/@margretnursca/protocol-review-aavegotchis-svgfacet-sol-the-on-chain-rendering-engine-afec3d146a14?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/afec3d146a14</guid>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 14:17:02 GMT</pubDate>
            <atom:updated>2026-04-16T16:33:37.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8hLgOJSYqkx2ldJvvZ4qfw.avif" /></figure><p>Aavegotchi is a DeFi-powered NFT game built on Polygon, where each <em>gotchi </em>is fully on-chain ghost-like creature with numeric traits, equipped wearables, and a collateral type that determines its visual identity. What makes Aavegotchi technically remarkable is that the NFT’s appearance, its SVG artwork is assembled entirely on-chain, inside the contract, at query time.</p><p>SvgFacet.sol is the contract responsible for this feat. It is the rendering engine of the Aavegotchi protocol: given a token ID, it reads raw SVG data stored in contract storage, combines multiple visual layers (body, collateral, eye shape, wearables), injects CSS styles derived from the token’s traits, and returns a complete, valid SVG string without a single pixel sourced from off-chain storage.</p><p>This article performs a thorough code-level review of SvgFacet.sol , covering it’s architectural context, every import, all public and internal function, design decisions, and potential areas of improvement.</p><h3>1. Architectural Context: The Diamond Standard (EIP-2535)</h3><p>Before diving into the contract itself, understanding where SvgFacet.sol lives in the system is essential.</p><p>Aavegotchi is implemented using the <strong>Diamond Standard (EIP-2535). </strong>Rather than deploying a single monolithic contract, the protocol deploys one central AavegotchiDiamond contract found in InitDiamond.sol that routes all external function call to a set of smaller, specialized contracts called <strong>facets. </strong>Each facet holds a subset of the protocol’s logic.</p><p>SvgFacet.sol is one of the facets. Its functions getAavegotchiSvg , previewAavegotchi , storeSvg , etc. are exposed through the diamond’s address. When a user calls getAavegotchiSvg(tokenId) on the diamond, the diamond’s fallback function delegatecall ‘s into SvgFacet , which then runs in the context of the diamond’s storage.</p><p>This is why SvgFacet can access the diamond’s full state (all gotchis, all item types, all SVG data) via the shared AppStorage struct, even thoough SvgFacet itself holds no state.</p><h3>2. Imports What They Are and Why They Matter</h3><pre>import {AppStorage, SvgLayer, Dimensions} from &quot;../libraries/LibAppStorage.sol&quot;;<br>import {LibAavegotchi, PortalAavegotchiTraitsIO, EQUIPPED_WEARABLE_SLOTS, PORTAL_AAVEGOTCHIS_NUM, NUMERIC_TRAITS_NUM} from &quot;../libraries/LibAavegotchi.sol&quot;;<br>import {LibItems} from &quot;../libraries/LibItems.sol&quot;;<br>import {Modifiers, ItemType} from &quot;../libraries/LibAppStorage.sol&quot;;<br>import {LibSvg} from &quot;../libraries/LibSvg.sol&quot;;<br>import {LibStrings} from &quot;../../shared/libraries/LibStrings.sol&quot;;</pre><h4>2.1 AppStorage , SvgLayer , Dimensions from LibAppStorage.sol</h4><p>LibAppStorage defines the <strong>single storage struct</strong> used by the entire Diamond. In the Diamond pattern, all facets share the same storage layout because delegatecall into the diamond’s storage space. By having all state in one AppStorage struct stored at a fixed slot, every facet reads and writes the same data safely.</p><p><strong>AppStorage : </strong>The master state struct. It holds everything the mapping of the token IDs to Aavegotchi structs, items types, SVG layer data, collateral type info, sleeve mappings, and more. SvgFacet accesses it via the inherited s variables from Modifiers .</p><p><strong>SvgLayer </strong>: A struct representing one chunk of on-chain SVG data. SVG images are stored in the contract as raw byte arrays, split into layers, associated with a bytes32 type key (e.g. , <em>aavegotchi , </em><em>wearaables , </em><em>collaterals </em>).</p><p><strong>Dimensions </strong>: A struct containing x , y , width , and height fields. Using when positioning wearables SVGs inside the 64x64 coordinate space of the final image.</p><h4>2.2 LibAavegotchi and its exported constants from LibAavegotchi.sol</h4><p>This is the core Aavegotchi business logic library. SvgFacet imports several things from it:</p><p><strong>LibAavegotchi</strong>: The library itself. SvgFacet uses its status constants ( STATUS_CLOSED_PORTAL , STATUS_OPEN_PORTAL, STATUS_AAVEGOTCHI) to determine which visual state the token is in, and calls portalAavegotchiTraits(_tokenId) to retrieve the 10 candidate gotchis inside an open portal.</p><p><strong>PortalAavegotchiTraitsIO</strong>: A struct representing one of the 10 potential gotchis revealed when a portal is opened. Contains the gotchi’s collateralType and numericTraits , which are the two inputs needed to render the gotchi’s SVG.</p><p><strong>EQUIPPED_WEARABLE_SLOTS</strong> : A constant ( uint256 =16 ) representing the total number of wearable slots (body, face, eyes, head, hands, pet, background, etc.). Used to size the eqippedWearables array.</p><p><strong>PORTAL_AAVEGOTCHI_NUM</strong> : A constant ( uint256 = 10 ) each portal reveals 10 candidate gotchis.</p><p><strong>NUMERIC_TRAITS_NUM</strong> : A constant ( uint256 = 6 ) each gotchi has 6 numeric traits (Eye Color, Eye Shape, Brain Size, Spookiness, Aggressiveness, Energy). These traits drive visual decisions in the SVG renderer.</p><h4>2.3 LibItems from LibItems.sol</h4><p>This library provides wearable slot index constants used to identify which position in the equippedWearables array corresponds to which body part:</p><p>WEARABLE_SLOT_BODY , WEARABLE_SLOT_FACE, WEARABLE_SLOT_EYES, WEARABLE_SLOT_HEAD, WEARABLE_SLOT_HAND_LEFT, WEARABLE_SLOT_HAND_RIGHT, WEARABLE_SLOT_PET, WEARABLE_SLOT_BG</p><p>These numeric constants make the rendering logic readable instead of magic numbers like equippedWearables[0] the code writes equippedWearables[LibItems.WEARABLES_SLOT_BG].</p><h4>2.4 Modifiers , ItemType from LibAppStorage.sol</h4><p><strong>Modifiers</strong> : A contract (not just a library) that SvgFacet inherits from. It provides the onlyItemManager access control modifier used on admin write functions, and crucially, it declares the AppStorage internal s storage variable using Diamond Storage pattern — enabling all facets to reference the same shared state.</p><p><strong>ItemType</strong> : A struct representing a wearable/item. Contains the svgId (which SVG to use), dimensions (where to place it), and traitModifiers among other fields. Used when rendering wearables.</p><h4>2.5 LibSvg from LibSvg.sol</h4><p>This is SvgFaceet ’s most critical dependency. It is the low-level SVG storage and retrieval engine:</p><p><strong>getSvg(bytes32 sygtype, uint256 svgId)</strong> : Retrieves an SVG stored on-chain by its type key and ID. This reads from s.svglayers[svgType] , reassembles the correct byte range, and returns it. Nearly every visual element in the rendering pipeline goes through this function.</p><p><strong>storeSvg / updateSvg</strong> : Write SVG data into contract storage. Called by admin functions in SvgFacet .</p><p><strong>bytes3ToColorString</strong> : Converts a bytes3 RGB value (stored compactly on-chain) into a hex color string like <em>FF69B4</em> for use in CSS.</p><p><strong>uint2str</strong> : Converts a uint256 to its string representation used to construct dynamic CSS class names and SVG attributes.</p><p><strong>bytesToBytes32</strong> : Concatenates two byte arrays into a bytes32 key used to dynamically look up SVG types like <em>eyeShapesH2</em> for haunt 2.</p><p><strong>SvgTypeAndSizes / SvgTypeAndIdsAndSizes</strong>: Struct types used in the admin write functions to describe how to store or update SVG data.</p><h4>2.6 LibStrings from LibStrings.sol</h4><p>A utility library shared across the broader contract system:</p><p><strong>strWithUint(string, uint256)</strong> : Appends a uint256 as a string to an existing string. Used to insert numeric dimension values directly into SVG attribute strings like x = <em>12</em> and y = <em>8</em> .</p><h3>3. Contract Declaration</h3><pre>contract SvgFacet is Modifiers {</pre><p>SvgFacet inherits from Modifiers , which gives it:<br>- The s storage variable (the shared AppStorage pointer)<br>- Access control modifiers like onlyItemManager</p><p>The contract has no constructor and holds no state of its own all state lives in the Diamond.</p><h3>4. Read Functions</h3><h4>4.1 getAavegochiSvg(uint256 _tokenId) Public Entry Point</h4><pre>function getAavegotchiSvg(uint256 _tokenId) public view returns (string memory ag_)</pre><p>This is the primary consumer-facing function. Given a token ID, it returns the full SVG string representing that gotchi’s current visual state. It is also used by tokenURI implementations to serve NFT metadata.</p><p><strong>Flow:</strong><br>1. Validates that the token exists (owner != address(0)).<br>2. Reads the token’s status and hauntId .<br>3. Branches based on status:<br>STATUS_CLOSED_PORTAL: Returns the sealed portal artwork, keyed by `hauntId`.<br>STATUS_OPEN_PORTAL: Returns the open portal artwork.<br>STATUS_AAVEGOTCHI: Calls the internal getAavegotchiSvgLayer(..) to build the full layered gotchi image.<br>4. Wraps the result in a root &lt;svg&gt; element with viewBox = <em>0 0 64 64</em> .</p><p>The branching on status is important a token can represent three different visual states in its lifecycle, and each has distinct artwork.</p><h4>4.2 getAavegotchiSvgLayer(…) Internal Rendering Engine</h4><pre>function getAavegotchiSvgLayers(<br> address _collateralType,<br> int16[NUMERIC_TRAITS_NUM] memory _numericTraits,<br> uint256 _tokenId,<br> uint256 _hauntId<br>) internal view returns (bytes memory svg_)</pre><p>This is the heart of the rendering system. It takes a collateral type, numeric traits, token ID, and haunt ID, and produces the core SVG layers before wearables are added.</p><p><strong>What it builds, step by step:</strong></p><ol><li><strong>Colors from collateral</strong>: Reads primaryColor , secondaryColor, and checkColor from s.collateralTypeInfo[_collateralType, converting stored bytes3 values to hex strings.<br>2. <strong>Body layer</strong>: Loads the base gotchi body SVG using a fixed ID constant ( AAVEGOTCHI_BODY_SVG_ID ).<br>3. <strong>Collateral layer</strong>: Loads the SVG for the specific collateral type (e.g., aDAI, aUSDC each have unique art).<br>4. <strong>Eye shape</strong>: Determined by numeric trait index 4. The trait value is mapped against an 18-point range array to select one of 18 possible eye shapes. Edge cases ( trait &lt; 0= special low, trait &lt; 97= collateral-specific eyes) are handled. Haunt IDs other than 1 use a dynamically-constructed SVG type key (e.g., eyeShapesH2 ).<br>5. <strong>Eye color</strong>: Determined by numeric trait index 5. Mapped against 8 ranges to one of 7 color strings (e.g., <em>FF00FF</em> for mythical low, the primaryColor for common).<br>6. <strong>Token ID special cases</strong>: <br> — type(uint256).max : Portal preview mode renders the gotchi with <em>closed</em> hands (no wearable slots open). Background is included.<br> — type(uint256).max — 1 : Preview mode renders with <em>open</em> hands. Used by previewAavegotchi .<br> — Normal IDs: Calls addBodyandWearableSvgLayers to layer all wearables on top.<br>7. <strong>CSS injection</strong>: Calls applyStyles(…) to prepend a &lt;style&gt; block containing CSS classes that paint the gotchi’s colors.</li></ol><h4>4.3 applyStyles(…) CSS Class Injection</h4><pre>function applyStyles(<br> SvgLayerDetails memory _details,<br> uint256 _tokenId,<br> uint16[EQUIPPED_WEARABLE_SLOTS] memory equippedWearables<br>) internal pure returns (bytes memory)</pre><p>This function generates the inline &lt;style&gt; tag that controls the gotchi’s appearance. The SVG body artwork uses CSS class names like .gotchi-primary , .gotchi-secondary , .gotchi-cheek , and .gotchi-eyeColor . By injecting a &lt;style&gt; block with those classes set to the gotchi’s specific hex colors, a single generic SVG body can be recolored for any of the hundreds of possible color combinations.</p><p>It also controls hand visibility via CSS display rules:<br>- <strong>Open hands</strong> ( .gotchi-handsDownOpen { display : block }): Used when a body, left-hand, or right-hand wearable is equipped.<br>- <strong>Closed hands</strong> (.gotchi-handsDownClosed { display : block }): The default state.</p><p>This is a clever pattern instead of storing separate SVG files for open and closed hand states, one SVG file handles both via CSS display toggling.</p><h4>4.4 addBodyandWearableSvgLayers(…) Wearable Layer Assembly</h4><pre>function addBodyAndWearableSvgLayers(<br> bytes memory _body,<br> uint16[EQUIPPED_WEARABLE_SLOTS] memory equippedWearables<br>) internal view returns (bytes memory svg_)</pre><p>This function assembles all equipped wearables into the final layered SVG. It uses the AavegotchiLayers memory struct to hold each layer as a bytes value before final concatenation:</p><pre>1. Background wearable (or default background)<br>2. Body (gotchi base)<br>3. Body wearable<br>4. Hands layer<br>5. Face wearable<br>6. Eyes wearable<br>7. Head wearable<br>8. Sleeves (overlay for body wearable)<br>9. Left hand wearable<br>10. Right hand wearable<br>11. Pet wearable</pre><p>Wearables are fetched by calling getWearables(wearableId, slotPosition) , which looks up the item’s SVG and wraps it in a &lt;g class = “gotchi-wearable weaarable-[slot]”&gt; tag, positioned using the item’s stored Dimensions .</p><p>Final assembly delegates to applyFrontLayerExceptions .</p><h4>4.5 applyFrontLayerExceptions(…) Layer Order Overrides</h4><pre>function applyFrontLayerExceptions(<br> uint16[EQUIPPED_WEARABLE_SLOTS] memory equippedWearables,<br> AavegotchiLayers memory layers,<br> bytes memory _body<br>) internal view returns (bytes memory svg_)</pre><p>SVG rendering is order-dependent: elements later in the document appear on top. The default layer order is: face - eyes - head. However, some wearables are designed to render <em>above</em> other wearables in non-standard ways.</p><p>This function checks s.wearableExceptions[front][wearableId][slotIndex] a mapping that stores per-wearable flags indicating if they need special layer ordering. There is also a hard-coded special case for wearable ID 301 (“alluring eyes”), which forces a specific render order.</p><p>Depending on which exceptions apply, the face, eyes, and head layers are concatenated in different orders. This is the most complex part of the rendering pipeline and reflects the reality that a generative avatar system needs escape hatches for artistic edge cases.</p><h4>4.6 getWearable(..) and getBodyWearable(..) Individual Wearable Rendering</h4><p>getWearable wraps a wearable’s SVG in a positioned &lt;g&gt; container. For the right-hand slot, it applies an SVG transform = <em>scale(-1, 11)</em>to mirror the left-hand SVG horizontally meaning right-hand wearables don’t need separate artwork, just a mirror of the left-hand version.</p><p>getBodyWearable handles body wearables specially because they can have an associated <strong>sleeves</strong> layer (the sleeve portion that renders <em>over</em> the gotchi’s hands). It returns both the body wearable SVG and the sleeves SVG separately so they can be inserted at the correct z-order positions.</p><h4>4.7 previewAavegotchi(..) Off-Chain Preview Tool</h4><pre>function previewAavegotchi(<br> uint256 _hauntId,<br> address _collateralType,<br> int16[NUMERIC_TRAITS_NUM] memory _numericTraits,<br> uint16[EQUIPPED_WEARABLE_SLOTS] memory equippedWearables<br>) external view returns (string memory ag_)</pre><p>This function renders a hypothetical gotchi without requiring it to exist as a minted token. It accepts all the parameters that would normally come from on-chain storage and renders the SVG. The _todenId is set to type(uint256).max — 1 (the “preview with open hands” sentinel), and wearables are passed directly.</p><p>This is used by the Aavegotchi dApp to show users what their gotchi will look like before or during the claiming process.</p><h4>4.8 portalAavegotchisSvg(uint256 _tokenId) Portal Reveal Rendering</h4><pre>function portalAavegotchisSvg(uint256 _tokenId) external view returns (string[PORTAL_AAVEGOTCHIS_NUM] memory svg_)</pre><p>When a portal is opened, 10 candidate gotchis are pseudo-randomly generated. This function renders all 10 of them as SVG strings. It:<br>1. Requires the portal to be in STATUS_OPEN_PORTAL state.<br>2. Calls LibAavvegotchi.portalAavegotchiTraits(_tokenId) to get the traits of all 10 candidates.<br>3. For each candidate, calls getAavegotchiSvgLayers with type(uint256).max (closed hands, no wearables), appends the hands layer, and wraps it in a root &lt;svg&gt; tag.</p><p>The result is an array of 10 complete SVG strings.</p><h4>4.9 getSvg , getSvgs , getItemSvg Raw SVG Query Functions</h4><p>These three functions expose raw SVG data from storage:<br>- <strong>getSvg(bytes32 sygType, uint256 itemId)</strong> : Returns a single SVG by type+ID. <br>- <strong>getSvg(bytes32 sygType, uint256[] calldata itemId)</strong>: Batch version.<br>- <strong>getSvg(uint256 itemId)</strong>: Returns a wearable item’s SVG wrapped in its own root &lt;svg&gt; element sized to the item’s stored dimensions. Used to display individual items in inventory UIs.</p><h3>5. Write Functions (Admin-Only)</h3><p>All write functions are gated by the onlyItemManager modifier, restricting them to addresses whitelisted as item managers in AppStorage .</p><h4>storeSvg and updateSvg</h4><p>These functions write raw SVG byte data into s.svgLayers . SVG images are stored as contiguous byte blobs split across multiple SvgLayer structs. storeSvg appends new layers; updateSvg replaces layers at specified IDs.</p><h4>deleteLastSvgLayers</h4><p>Pops the most recent SVG layers for a given type. Useful for rolling back a bad upload.</p><h4>setSleeves</h4><p>Maps wearable IDs to their corresponding sleeve SVG IDs. Sleeves are a separate SVG layer that renders over the gotchi’s arms when a body wearable with arm coverings is equipped.</p><h4>setItemsDimensions</h4><p>Sets the x , y , width , height positioning data for items in bulk. This controls where each wearable appears within the 64×64 canvas.</p><h4>getNextSleeveId</h4><p>A view helper that returns the length of the sleeves SVG array used by the admin tooling to know what ID to start uploading new sleeves from.</p><h3>7. Notable Design Patterns</h3><p><strong>On-chain SVG assembly with </strong><strong>abi.encodePacked </strong>: The entire rendering pipeline uses abi.encodePacked to concatenate bytes chunks. This is gas-efficient for string concatenation in Solidity, avoiding the overhead of memory allocation and copying that would come from string concatenation.</p><p><strong>Sentinel token IDs</strong>: Using type(uint256).max and type(uint256).max — 1 as special-purpose “virtual” token IDs is an unusual pattern. It allows the rendering functions to reuse the same code path for both real tokens and preview scenarios, with behavior controlled by the magic value rather than a separate boolean parameter.</p><p><strong>CSS-driven trait expression</strong>: Instead of generating distinct SVG files per color combination, the contract generates one SVG body and controls its appearance entirely through a dynamically generated &lt;style&gt; block. This dramatically reduces the storage cost of supporting hundreds of color variants.</p><p><strong>Wearable mirroring</strong>: The right-hand wearable uses an SVG scale(-1, 1) transform to mirror the left-hand artwork. This halves the asset storage needed for symmetrical hand items.</p><p><strong>Layered exception system</strong>: The wearablesExceptions mapping allows specific wearables to override the default z-ordering of layers. This keeps the rendering system extensible without needing to re-audit all existing wearables when new ones are added.</p><h3>8. Potential Considerations</h3><p><strong>Gas costs on complex gotchis</strong>: Assembling a fully-equipped gotchi’s SVG body + 8 wearable slots, each requiring storage reads and byte concatenation is a heavy view call. While this doesn’t cost gas for off-chain reads, it can be slow and may approach block gas limits if called on-chain.</p><p><strong>Hardcoded wearable exception (ID 301)</strong>: The “alluring eyes” wearable (ID 301) is hardcoded into applyFrontLayerExceptions. This type of hardcoding is a technical debt item ideally, all exceptions would live in the wearablesExceptions mapping rather than in contract logic.</p><p><strong>Magic number sentinel IDs</strong>: While clever, type(uint256).max and type(uint256).max — 1 as sentinel values are non-obvious to new readers and could be replaced with an explicit RenderMode enum parameter for better clarity.</p><p><strong>No events on reads</strong>: This is expected and correct view functions don’t emit events. The write functions (storeSvg, updateSvg, etc.) also do not emit events directly, though LibSvg may handle this internally.</p><h3>9. Summary</h3><p>SvgFacet.sol is a sophisticated on-chain rendering engine. It demonstrates that fully on-chain generative NFT art is achievable in production at scale. Its key responsibilities are:</p><p>- <strong>Reading</strong> the visual state of any Aavegotchi token (portal, open portal, or full gotchi).<br>- <strong>Assembling</strong> multi-layer SVG compositions from data stored natively in contract storage.<br>- <strong>Expressing</strong> numeric traits visually through CSS color injection and SVG asset selection.<br>- <strong>Rendering previews</strong> of hypothetical gotchis before they are minted.<br>- <strong>Administering</strong> the SVG asset registry (store, update, delete layers, configure dimensions and sleeves).</p><p>Its design is tightly coupled to the Diamond pattern it could not function as a standalone contract and it exemplifies how EIP-2535 enables clean separation of concerns in a complex, stateful protocol.</p><h3>Resources</h3><ul><li><strong>Repository</strong>: [aavegotchi/aavegotchi-contracts](<a href="https://github.com/aavegotchi/aavegotchi-contracts">https://github.com/aavegotchi/aavegotchi-contracts</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afec3d146a14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[50 EVM Opcodes Every Solidity Developer Should Know]]></title>
            <link>https://medium.com/@margretnursca/50-evm-opcodes-every-solidity-developer-should-know-4ab03bd6c144?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ab03bd6c144</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 17:25:53 GMT</pubDate>
            <atom:updated>2026-03-31T17:25:53.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Every Solidity contract you’ve ever seen or written compiles down to a sequence of single-byte instructions. Those instructions are EVM(Ethereum Virtual Machine) opcodes. Most developers know they exist. Few know what they actually cost, or what they expect from the stack.</p><p>This article works through 50 opcodes that matter, grouped by category, annotated with their minimum gas cost, stack inputs and outputs, and how to interact with it in low level solidity (inline assembly). All data is drawn from <a href="https://www.evm.codes/"><strong>evm.codes</strong></a>.</p><h4><strong>1. Arithmetic</strong></h4><p>All arithmetic operates on unsigned 256-bit integers and wraps silently at 2²⁵⁶. There is no overflow exception at the opcode level.</p><p><strong>0x01 ADD </strong><em>Gas:</em><strong><em> </em></strong><em>3 gas</em></p><p><em>Stack in: a, b → out: a + b</em></p><p>Integer addition modulo 2²⁵⁶. Wraps silently. If you need overflow detection, do it in Solidity (≥0.8) or manually in assembly with a comparison after the add.</p><pre>assembly {<br>let result := add(0xffffffff…ff, 1)<br>// result == 0 (silent wrap)<br>}</pre><p><strong>0x05 ADDMOD </strong><em>Gas: 8 gas</em></p><p><em>Stack in: a, b, N → out: (a + b) % N</em></p><p>ADDMOD performs addition in <strong>arbitrary precision</strong> before taking the modulus. A naive (a + b) % N in Solidity wraps at 2²⁵⁶ before the mod. ADDMOD does not. The result is mathematically correct even when a + b overflows 256 bits.</p><pre>assembly {<br>// (MAX_UINT256 + 1) % 3 - correct answer is 0<br>let r := addmod(<br>0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,<br>1,<br>3<br>)<br>// r == 0 (full-precision arithmetic)<br>}</pre><p><strong>0x09 MULMOD </strong><em>Gas: 8 gas</em></p><p><em>Stack in: a, b, N → out: (a * b) % N</em></p><p>Same guarantee as ADDMOD. Multiplication happens in full precision, then the modulus is applied.</p><pre>assembly {<br>    let r := mulmod(<br>        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,<br>        2,<br>        3<br>    )<br>    // r == 1  (not 0, which a naive mul+mod would give)<br>}</pre><p><strong>0x0A EXP </strong><em>Gas: 10 + 50 × (byte length of exponent)</em></p><p><em>Stack in: base, exponent → out: base ** exponent</em></p><p>Gas cost scales with the <strong>size of the exponent in bytes</strong>, not its value. Raising anything to zero costs 10 gas and always returns 1. Raising to a 32-byte exponent costs 10 + 50×32 = 1,610 gas. Avoid on-chain exponentiation when you can precompute the result off-chain.</p><pre>assembly {<br>    let cheap  := exp(2, 0)    // 10 gas — result is 1<br>    let normal := exp(2, 255)  // 10 + 50*1 = 60 gas<br>    let costly := exp(2, type(uint256).max) // 10 + 50*32 = 1,610 gas<br>}</pre><p><strong>0x0B SIGNEXTEND </strong><em>Gas: 5 gas</em></p><p><em>Stack in: b, x → out: sign-extend x from (b+1) bytes to 32 bytes</em></p><p>Treats the low (b+1) bytes of x as a signed integer and extends the sign bit to fill all 32 bytes. This is the opcode the Solidity compiler emits when you cast a smaller signed integer to a larger one. Almost never written directly in assembly, but useful if you’re hand-rolling ABI decoding.</p><pre>assembly {<br>    // 0xFF as int8 = -1; extend to int256<br>    let neg := signextend(0, 0xFF)<br>    // neg == 0xffffffff...ff  (which is -1 in two&#39;s complement)<br>}</pre><h4>2. Bitwise Operations</h4><p>Bitwise opcodes are where gas-efficient Solidity tricks live. These are the cheapest ways to pack, unpack, and manipulate data.</p><p><strong>0x1B SHL </strong><em>Gas: 3 gas</em></p><p><em>Stack in: shift, value → out: value &lt;&lt; shift</em></p><p>Added in Constantinople (2019). Before that, shifting left was implemented as MUL(value, 2**n) at 5 gas. SHL does the same thing for 3 gas. The Solidity compiler now emits SHL anywhere it can. Any contract compiled before Constantinople pays extra on every bit shift.</p><pre>assembly {<br>    let x := shl(3, 1)    // 1 &lt;&lt; 3 == 8<br>    let mask := shl(96, 1) // useful for address masking<br>}</pre><p><strong>0x1C / 0x1D SHR / SAR </strong><em>Gas: 3 gas each</em></p><p><em>Stack in: shift, value → out: value &gt;&gt; shift</em></p><p>SHR is logical shift right (fills with zeros). SAR is arithmetic shift right (preserves the sign bit). For signed integers, always use SHL, SHR on a negative number produces a large positive value, not a smaller negative one.</p><pre>assembly {<br>    let a := shr(1, 16)      // 16 &gt;&gt; 1 == 8  (logical)<br>    let b := sar(1, sub(0, 2)) // -2 &gt;&gt; 1 == -1 (arithmetic, sign preserved)<br>}</pre><p><strong>0x1A BYTE</strong> <em>Gas: 3 gas</em></p><p><em>Stack in: i, x → out: byte i of x (big-endian, index from left)</em></p><p>Extracts a single byte from a 256-bit word. Byte 0 is the <strong>most significant</strong> byte (big-endian indexing). Used in custom ABI decoders and RLP parsers. A common pattern: extract the first 4 bytes of calldata to read the function selector.</p><pre>assembly {<br>    let word := 0xAABBCCDD000000000000000000000000<br>    //          ^ byte 0 = 0xAA<br>    let b0 := byte(0, word)  // 0xAA<br>    let b1 := byte(1, word)  // 0xBB<br>}</pre><h4>3. Comparison</h4><p>Comparison opcodes return 1 (true) or 0 (false). They all cost 3 gas. The critical distinction: signed vs. unsigned variants.</p><p><strong>0x10 / 0x12LT / SLT</strong> <em>Gas: 3 gas each</em></p><p><em>Stack in: a, b → out: a &lt; b (1 or 0)</em></p><p>LT is unsigned. SLT is signed. The value 0xFFFF…FF is the largest possible unsigned integer but is -1 in signed two’s complement. Mixing them is one of the classic smart contract bugs.</p><pre>assembly {<br>    let big := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff<br>    let u := lt(big, 1)   // 0  (big is huge unsigned, not less than 1)<br>    let s := slt(big, 1)  // 1  (big is -1 signed,  and -1 &lt; 1)<br>}</pre><p><strong>0x15 ISZERO </strong><em>Gas: 3 gas</em></p><p><em>Stack in: a → out: a == 0 (1 or 0)</em></p><p>Cheaper than eq(a, 0) because it consumes one fewer stack item. The Solidity compiler uses ISZERO ISZERO as its canonical way to normalize any nonzero value to a clean boolean 1. Two ISZERO instructions back-to-back = cheap bool cast.</p><pre>assembly {<br>    let isZero  := iszero(0)          // 1<br>    let notZero := iszero(iszero(42)) // 1  (normalize truthy to bool 1)<br>    let alsoNo  := iszero(7)          // 0<br>}</pre><h4>4. Environmental Context</h4><p>These opcodes read the current execution context. They’re mostly 2 gas, far cheaper than any storage read. If you can replace a storage-based config value with a context read, do it.</p><p><strong>0x33CALLER </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: msg.sender</em></p><p>Two gas to get the caller address. For comparison, a cold SLOAD costs 2,100 gas. Any authorization pattern that reaches for storage when it could use CALLER is burning unnecessary gas.</p><pre>assembly {<br>    let sender := caller()  // 2 gas<br>}</pre><p><strong>0x47SELFBALANCE </strong><em>Gas: 5 gas</em></p><p><em>Stack in: — → out: address(this).balance</em></p><p>Added in Istanbul (EIP-1884). Before this opcode existed, reading your own balance required BALANCE(ADDRESS()) — 2 gas + 400 gas = 402 gas. SELFBALANCE costs 5. That is a 98% reduction for a common operation. Old contracts compiled pre-Istanbul still pay the full price.</p><pre>assembly {<br>    let bal := selfbalance()  // 5 gas<br>    // vs: let bal := balance(address())  // was ~402 gas pre-Istanbul<br>}</pre><p><strong>0x46CHAINID</strong> <em>Gas: 2 gas</em></p><p><em>Stack in: — → out: chain ID</em></p><p>Added in Istanbul (<a href="https://eips.ethereum.org/EIPS/eip-1344">EIP-1344</a>). Essential for <a href="https://eips.ethereum.org/EIPS/eip-712">EIP-712</a> signatures and replay protection. Before this, contracts had to hardcode the chain ID in the constructor or accept it as an argument, both are worse. On mainnet this is 1, on Polygon 137, on Arbitrum 42161.</p><pre>assembly {<br>    let id := chainid()<br>    if iszero(eq(id, 1)) {<br>        revert(0, 0)  // reject non-mainnet calls<br>    }<br>}</pre><p><strong>0x32 ORIGIN </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: tx.origin</em></p><p>The address that <strong>originally signed</strong> the transaction, regardless of call depth. It is nearly always a security mistake to use ORIGIN for authorization. A malicious contract sitting anywhere in the call chain can exploit any check that succeeds when origin == trustedEOA. Know what it does; know not to use it for auth.</p><pre>assembly {<br>    let orig := origin()<br>    // DANGER: do not use for access control<br>}</pre><h4>5. Block Context</h4><p>Block-context opcodes are all 2 gas except SELFBALANCE (5) and BLOCKHASH (20). They surface data from the current block or transaction.</p><p><strong>0x44 PREVRANDAO </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: RANDAO beacon value</em></p><p>Pre-Merge, this was DIFFICULTY. Post-Merge, it became the RANDAO beacona , mix of validator signatures. It is not safe as a sole source of randomness: validators can choose whether to reveal their signature for a given slot, giving them a 1-in-N chance to bias the output.</p><pre>assembly {<br>    let rand := prevrandao()<br>    // Manipulable by validators — do not use alone as RNG<br>}</pre><p><strong>0x40 BLOCKHASH </strong><em>Gas: 20 gas</em></p><p><em>Stack in: blockNumber → out: hash of that block</em></p><p>Returns the hash of a past block but only for the most recent 256 blocks. Requesting an older block returns 0 silently. This is a very common off-by-one trap: if you store a block number and check it later, by block 257 the hash is gone. Do not use block hashes as a randomness source; miners could influence them pre-Merge.</p><pre>assembly {<br>    let recent := blockhash(sub(number(), 1))   // valid<br>    let stale  := blockhash(sub(number(), 300)) // returns 0 silently<br>}</pre><p><strong>0x48 BASEFEE </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: block.basefee in wei</em></p><p>Added in London (<a href="http://eips.ethereum.org/EIPS/eip-1559">EIP-1559</a>). The base fee is burned, not given to the proposer. The miner/validator tip is gasprice() — basefee(). Reading both lets you compute the priority fee, which is useful for MEV-resistant designs and dynamic fee calculations.</p><pre>assembly {<br>    let base     := basefee()<br>    let priority := sub(gasprice(), base)<br>}</pre><h4>6. Memory</h4><p>Memory is temporary, destroyed at call end. Base read/write cost is 3 gas but memory expansion is quadratic and can sneak up on you.</p><p><strong>0x52 / 0x51MSTORE / MLOAD</strong> <em>Gas: 3 gas + expansion</em></p><p><em>Stack in: offset, value / offset → out: — / mem[offset:offset+32]</em></p><p>Base cost is 3 gas each. The cost only rises when you first access a new memory region. The expansion formula is quadratic: cost = (words² / 512) + (3 × words). Memory is cheap below ~750 bytes; above that the quadratic term begins to dominate. Reading and writing within already-expanded memory remains at base cost.</p><pre>assembly {<br>    mstore(0x00, 0xdeadbeef)  // write 32 bytes at slot 0<br>    let v := mload(0x00)      // read it back — still 3 gas<br>    mstore(100000, 1)         // expanding this far is expensive<br>}</pre><p><strong>0x53 MSTORE8 </strong><em>Gas: 3 gas + expansion</em></p><p><em>Stack in: offset, value → out: writes lowest byte of value to mem[offset]</em></p><p>Writes exactly one byte instead of a full 32-byte word. Same base cost as MSTORE. Useful when building byte strings or packed return data. Note: it still triggers memory expansion if the offset is new territory.</p><pre>assembly {<br>  mstore8(0x00, 0x41) // ASCII &#39;A&#39; at byte 0<br>  mstore8(0x01, 0x42) // &#39;B&#39; at byte 1<br>}</pre><p><strong>0x5E MCOPY </strong><em>Gas: 3 + 3×words + expansion</em></p><p><em>Stack in: dst, src, len → out: mem[dst] := mem[src:src+len]</em></p><p>New in Cancun (<a href="https://eips.ethereum.org/EIPS/eip-5656">EIP-5656</a>). Copies memory to memory natively. Before this opcode, the only way to copy memory was a loop of MLOAD + MSTORE — 6 + gas per 32 bytes plus loop overhead. MCOPYdoes it in 3 + 3×words gas. Any contract that copies large memory buffers and was deployed pre-Cancun is leaving significant gas on the table.</p><pre>assembly {<br>    mstore(0x00, 0xdeadbeef)<br>    mcopy(0x40, 0x00, 0x20)  // copy 32 bytes from offset 0 to offset 64<br>}</pre><p><strong>0x59MSIZE </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: current memory size in bytes</em></p><p>Returns memory size as a multiple of 32. Useful as a hand-rolled free memory pointer: let ptr := msize() gives you the next unused memory slot. Solidity reserves slot 0x40 as its own free memory pointer. If you use MSIZEin raw assembly alongside Solidity-generated code, you’ll get the correct size but bypass Solidity’s allocator.</p><pre>assembly {<br>    mstore(0x60, 1)       // expand memory to cover offset 0x60<br>    let sz := msize()     // 0x80 (128 bytes — next 32-byte boundary)<br>}</pre><h4>7. Storage</h4><p>Storage is the most expensive ordinary data region. Each slot is 32 bytes. The cold/warm access distinction introduced in Berlin (<a href="https://eips.ethereum.org/EIPS/eip-2929">EIP-2929</a>) means the <strong>order</strong> in which your code accesses slots now affects total gas cost.</p><p><strong>0x54 SLOAD </strong><em>Gas: 2,100 gas (cold) / 100 gas (warm)</em></p><p><em>Stack in: slot → out: storage[slot]</em></p><p>Cold means this slot hasn’t been touched yet in this transaction. Warm means it has. The first SLOADof a slot costs 2,100 gas; every subsequent read in the same transaction costs 100. Implication: if you read the same storage slot twice, cache it in a local variable, the second SLOADstill costs 100 gas even though you already paid to load it once.</p><pre>assembly {<br>    let val := sload(0)  // 2,100 gas (cold)<br>    let again := sload(0)  // 100 gas (warm — but still unnecessary)<br>    // Better:<br>    let cached := sload(0)  // 2,100 gas<br>    // Use &#39;cached&#39; multiple times — no more SLOADs<br>}</pre><p><strong>0x55 SSTORE </strong><em>Gas: up to 22,100 gas</em></p><p><em>Stack in: slot, value → out: storage[slot] := value</em></p><p>The most complex gas schedule in the EVM. Cost depends on four factors simultaneously: whether the slot is cold or warm, whether you’re writing zero-nonzero, nonzero-zero, or nonzero-different nonzero, and whether the new value matches the slot’s value at transaction start. The worst case cold slot, zero to nonzero is 22,100 gas. Setting a slot back to zero generates a refund, but since London (<a href="https://eips.ethereum.org/EIPS/eip-3529">EIP-3529</a>), refunds are capped at 20% of total transaction gas used.</p><pre>assembly {<br>  sstore(0, 42) // cold, 0→nonzero: 22,100 gas<br>  sstore(0, 42) // warm, same value: 100 gas<br>  sstore(0, 0) // warm, nonzero→0: 2,900 gas + partial refund<br>}</pre><p><strong>0x5C / 0x5DTLOAD / TSTORE </strong><em>Gas: 100 gas each</em></p><p><em>Stack in: slot / slot, value → out: tstorage[slot] / —</em></p><p>New in Cancun (<a href="https://eips.ethereum.org/EIPS/eip-1153">EIP-1153</a>). Transient storage persists across internal calls within one transaction but is wiped at transaction end. No refund mechanics, no cold/warm distinction a flat 100 gas each way. The primary use case is reentrancy guards. Replacing an SSTORE-based mutex (up to 22,100 gas on set, 2,900 gas on clear) with TSTORE/TLOAD(100 gas each) is an immediate and significant saving.</p><pre>assembly {<br>// Reentrancy guard using transient storage<br>if tload(0) { revert(0, 0) } // 100 gas check<br>tstore(0, 1) // 100 gas - lock<br>// … critical section …<br>tstore(0, 0) // 100 gas - unlock<br>}</pre><h4>8. Control Flow</h4><p>The EVM has no structured loops or functions at the bytecode level. Everything is jumps. Understanding how this works explains why certain Solidity patterns are expensive and why the stack-too-deep error exists.</p><p><strong>0x5B JUMPDEST </strong><em>Gas: 1 gas</em></p><p><em>Stack in: — → out: —</em></p><p>The cheapest meaningful opcode in the EVM. It does nothing at runtime except declare a byte offset as a valid jump target. The EVM validates jump destinations before execution begins: if a JUMP or JUMPI lands on any byte that isn’t a JUMPDEST or if it lands inside PUSH data that happens to contain the byte 0x5Bexecution reverts. This is the EVM’s protection against arbitrary code execution through jump table manipulation.</p><pre>assembly {<br>  // Compiler emits JUMPDEST at every loop and branch target automatically<br>  for { let i := 0 } lt(i, 10) { i := add(i, 1) } {<br>    // each iteration jumps back to a JUMPDEST<br>  }<br>}</pre><p><strong>0x56 / 0x57JUMP / JUMPI</strong> <em>Gas: 8/10 gas</em></p><p><em>Stack in: dst / dst, condition → out: —</em></p><p>Unconditional and conditional jumps. The destination must be a JUMPDEST or the transaction reverts. Internal Solidity function calls compile to JUMP + JUMPDEST there is no call instruction for internal functions. This means the EVM manages a software-only return-address stack, which is part of why deeply nested internal calls can cause stack depth issues.</p><pre>assembly {<br>  let x := 5<br>  jumpi(done, gt(x, 3)) // jump to &#39;done&#39; if x &gt; 3<br>  x := 0<br>  done:<br>}</pre><p><strong>0x58 PC </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: current program counter</em></p><p>Pushes the byte offset of the PC opcode itself within the bytecode. Rarely written directly, but used in position-independent bytecode patterns and some gas-golfing optimizations. Under the forthcoming EOF (EVM Object Format) standard, which enforces structured control flow, PC may be deprecated in favor of explicit labels.</p><pre>assembly {<br>    let position := pc()  // where am I in the bytecode?<br>}</pre><p><strong>0x00 STOP </strong><em>Gas: 0 gas</em></p><p><em>Stack in: — → out: —</em></p><p>The only zero-cost opcode that terminates execution. It’s the implicit last instruction of any Solidity function that returns nothing. A bare STOP is one byte; RETURN(0, 0) is more bytes and technically 0 base gas plus possible memory expansion cost. When the compiler can emit STOP instead of RETURN, it will.</p><pre><br>assembly {<br>  stop() // 0 gas - end execution cleanly<br>}</pre><h4>9. Stack Management</h4><p>PUSH, DUP, and SWAPare the EVM’s only mechanisms for moving data around. They’re all 2–3 gas, but their hard architectural limits shape what Solidity can compile.</p><p><strong>0x5F PUSH0 </strong><em>Gas: 2 gas</em></p><p><em>Stack in: — → out: 0</em></p><p>Added in Shanghai (<a href="https://eips.ethereum.org/EIPS/eip-3855">EIP-3855</a>). Before this, pushing zero required PUSH10x00–3 gas and 2 bytes of bytecode. PUSH0is 2 gas and 1 byte. The Solidity compiler adopted it immediately post-Shanghai. Any pre-Shanghai compiled contract wastes 1 gas and 1 byte on every zero push, and contracts push zero constantly.</p><pre>assembly {<br>    let z := 0  // compiler emits PUSH0 on Shanghai+<br>}</pre><p><strong>0x80–0x8F DUP1–DUP16 </strong><em>Gas: 3 gas each</em></p><p><em>Stack in: …, a (at position N) → out: a, …, a</em></p><p>Duplicates the Nth item from the top and pushes a copy. There are exactly 16 DUP instructions. You cannot duplicate anything deeper than position 16. This is the architectural root of Solidity’s <strong>stack too deep</strong> compiler error: if an expression requires referencing a value that has slipped below position 16, the compiler cannot emit valid bytecode. Refactor by introducing intermediate variables or using structs.</p><pre>assembly {<br>    let a := 1<br>    let b := 2<br>    // dup1 duplicates the top of stack<br>    // dup2 duplicates the second item, etc.<br>}</pre><p><strong>0x90–0x9F SWAP1–SWAP16</strong> <em>Gas: 3 gas each</em></p><p><em>Stack in: a, …, b (b at position N+1) → out: b, …, a</em></p><p>Swaps the top of stack with the Nth item below it. Same 16-deep limit as DUP. Together, DUP and SWAPare the compiler’s entire register-allocation mechanism. When the compiler needs a value and it’s buried in the stack, it uses SWAPs to bring it to the top and DUPsto preserve it.</p><pre>assembly {<br>  let x := 10<br>  let y := 20<br>  // swap1 exchanges top two items<br>  // result: y is now on top, x is second<br> }</pre><h4>10. Hashing</h4><p><strong>0x20KECCAK256</strong> <em>Gas:</em> <em>30 + 6 × ceil(len/32) gas</em></p><p><em>Stack in: offset, len → out: keccak256(mem[offset:offset+len])</em></p><p>30 gas base plus 6 gas per 32-byte word hashed. Hashing zero bytes costs 30 gas and returns 0xc5d2… (the well-known empty hash). Mapping storage slots in Solidity are derived by hashing the key and the slot number — every mapping read triggers a KECCAK256 under the hood. If you read a mapping ten times with the same key, you pay for ten hashes.</p><pre>assembly {<br>  mstore(0x00, key)<br>  mstore(0x20, slot)<br>  // Solidity&#39;s mapping slot derivation:<br>  let storageSlot := keccak256(0x00, 0x40) // 30 + 6*2 = 42 gas<br>  let val := sload(storageSlot)<br>}</pre><h4>11. Logging</h4><p>Logs are append-only from inside the EVM. No opcode can read an emitted log. They exist for external observers: indexers, frontend apps, The Graph. They’re more expensive than they feel.</p><p><strong>0xA0–0xA4 LOG0–LOG4</strong> <em>Gas: 375 + 375×topics + 8×data_bytes</em></p><p><em>Stack in: offset, len [, topic1, …] → out: —</em></p><p>Each topic costs 375 gas. Data costs 8 gas per byte. A LOG1 with one topic and 32 bytes of data costs 375 + 375 + 256 = <strong>1,006 gas minimum</strong>. A LOG3 with 64 bytes costs 375 + 3×375 + 512 = 2,012 gas. Emitting events is meaningfully expensive — factor this into designs that emit on every state change.</p><pre>assembly {<br>  // Emit Transfer(address indexed from, address indexed to, uint256 value)<br>  // topic0 = event sig hash, topic1 = from, topic2 = to, data = value<br>  mstore(0x00, transferValue)<br>  log3(<br>  0x00, 0x20, // data: 32 bytes of value<br>  transferSig, // topic0: keccak256(&quot;Transfer(address,address,uint256)&quot;)<br>  fromAddr, // topic1<br>  toAddr // topic2<br>  )<br>}</pre><h4>12. System Operations</h4><p>These are the heaviest opcodes contract deployment, external calls, and process termination. Each has edge cases that have burned protocols.</p><p><strong>0xF5 CREATE2</strong> <em>Gas: 32,000 + 6×initcode_words gas</em></p><p><em>Stack in: value, offset, len, salt → out: deployed address (or 0 on failure)</em></p><p>Like CREATE, but the deployed address is deterministic: keccak256(0xFF ++ deployer ++ salt ++ keccak256(initcode)). The address is known before deployment. You can send ETH to it before the contract exists. This is the foundation of counterfactual instantiation — the pattern used by state channels, Layer 2 wallets, and CREATE2 factory patterns. If deployment fails, the return value is 0, not a revert.</p><pre>assembly {<br>  let addr := create2(<br>  0, // ETH value to send<br>  offset, // initcode memory offset<br>  len, // initcode length<br>  salt // arbitrary 32-byte salt<br>  )<br>  if iszero(addr) { revert(0, 0) }<br>}</pre><p><strong>0xF1 CALL</strong> <em>Gas:100 (warm addr) / 2,600 (cold) + dynamic</em></p><p><em>Stack in: gas, addr, value, argsOffset, argsLen, retOffset, retLen → out: success (1 or 0)</em></p><p>The workhorse of cross-contract interaction. Sending non-zero ETH adds 9,000 gas. If the recipient is a new account, add another 25,000. The return value is 1 (success) or 0 (failure) critically, <strong>CALL does not revert the parent context on failure</strong>. If you don’t check the return value, a failed sub-call is silently ignored. Always check.</p><pre>assembly {<br>  let success := call(<br>  gas(), // forward all remaining gas<br>  target, // recipient address<br>  callvalue(), // ETH to send<br>  0, 0, // no calldata<br>  0, 0 // don&#39;t capture returndata<br>  )<br>  if iszero(success) { revert(0, 0) }<br>}</pre><p><strong>0xF4 DELEGATECALL</strong> <em>Gas: 100 (warm) / 2,600 (cold)</em></p><p><em>Stack in: gas, addr, argsOffset, argsLen, retOffset, retLen → out: success (1 or 0)</em></p><p>Executes code at addr inside the <strong>caller’s context</strong>: same storage, same msg.sender, same msg.value. This is what makes the proxy upgrade pattern possible the proxy holds state; the implementation holds logic; DELEGATECALAL bridges them. There is no value parameter because the ETH context doesn’t change. Storage slot collisions between proxy and implementation are the primary attack vector.</p><pre>assembly {<br>  // Transparent proxy pattern<br>  calldatacopy(0, 0, calldatasize())<br>  let success := delegatecall(<br>  gas(), implementation, 0, calldatasize(), 0, 0<br>  )<br>  returndatacopy(0, 0, returndatasize())<br>  switch success<br>  case 0 { revert(0, returndatasize()) }<br>  default { return(0, returndatasize()) }<br>}</pre><p><strong>0xFA STATICCALL</strong> <em>Gas: 100 (warm) / 2,600 (cold)</em></p><p><em>Stack in: gas, addr, argsOffset, argsLen, retOffset, retLen → out: success (1 or 0)</em></p><p>Like CALL, but the callee is in a read-only context enforced at the <strong>opcode level</strong>. Any attempt to write state SSTORE, LOG, CREATE, SELFDESTRUCT, or sending ETH causes an immediate revert. Solidity’s view and pure external calls compile to STATICCALL.The read-only guarantee is not a convention; the EVM enforces it.</p><pre>assembly {<br>  // Read-only external call<br>  mstore(0x00, sig) // 4-byte function selector<br>  let ok := staticcall(gas(), target, 0x00, 0x04, 0x00, 0x20)<br>  let result := mload(0x00)<br>}</pre><p><strong>0XFD REVERT</strong> <em>Gas: 0 base gas + memory expansion</em></p><p><em>Stack in: offset, len → out: — (halts, returns data to caller)</em></p><p>Zero base gas. Reverts all state changes in the current context and returns data from memory to the caller typically an ABI-encoded error. The critical property: REVERT <strong>refunds remaining gas</strong> to the caller. Every other failure path (invalid opcode, stack underflow, out-of-gas) consumes all remaining gas. This is the entire reason require() exists as a separate construct from assert().</p><pre>assembly {<br>    // Revert with Error(string) encoding<br>    mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000)<br>    mstore(0x04, 0x20)<br>    mstore(0x24, 11)<br>    mstore(0x44, &quot;unauthorized&quot;)<br>    revert(0x00, 0x64)<br>}</pre><p><strong>0xFE INVALID</strong> <em>Gas: consumes all remaining gas</em></p><p><em>Stack in: — → out: —</em></p><p>The designated invalid opcode. Unlike REVERT, INVALID <strong>burns all remaining gas</strong>. Solidity emits INVALID for assert() failures. The rationale: an assert failure means a fundamental invariant has been violated. Burning all gas signals a serious bug and provides no refund a stronger punishment than require’s gas-refunding REVERT. If you see INVALID in your bytecode unexpectedly, you have an assert path that was reached.</p><pre>assembly {<br> invalid() // burns all gas - equivalent to assert(false)<br>} </pre><p><strong>0XFF SELFDESTRUCT</strong> <em>Gas: 5,000 gas base</em></p><p><em>Stack in: recipient → out: —</em></p><p>Post-Cancun (<a href="https://eips.ethereum.org/EIPS/eip-6780">EIP-6780</a>), SELFDESTRUCT no longer deletes contract code or storage <strong>unless the contract was created in the same transaction</strong>. It still transfers all ETH to the recipient. This is one of the most significant silent semantic changes in Ethereum history. Any contract that relied on SELFDESTRUCT for cleanup or as part of a CREATE2-redeploy pattern may no longer work as intended. Always audit pre-Cancun contracts that use it.</p><pre>assembly {<br>  selfdestruct(recipient)<br>  // Post-Cancun: ETH transferred, code deleted ONLY if<br>  // this contract was deployed in the current transaction<br>}</pre><h4>13. Code Inspection</h4><p>Contracts can read their own bytecode and inspect other contracts’ bytecode. This enables proxy patterns, factory patterns, and defensive checks.</p><p><strong>0x3F EXTCODEHASH</strong> <em>Gas: 100 (warm) / 2,600 (cold)</em></p><p><em>Stack in: addr → out: keccak256(addr.code) or 0</em></p><p>Returns 0 if the address has no code (EOA or does not exist), otherwise the keccak256 of the deployed bytecode. This is the canonical and cheapest way to check whether an address is a contract. It’s immune to the constructor-time trick where EXTCODESZE returns 0 while a contract is being initialized code hash is also 0 during construction.</p><pre>assembly {<br>  let h := extcodehash(addr)<br>  // h == 0 means EOA, nonexistent, or being constructed<br>  // h != 0 means deployed contract<br>  let isContract := iszero(iszero(h))<br>}</pre><p><strong>0x3D / 0x3E RETURNDATASIZE / RETURNDATACOPY</strong> <em>Gas: 2 / 3+words gas</em></p><p><em>Stack in: — / dstOffset, srcOffset, len → out: size / —</em></p><p>Added in Byzantium (2017). Before these opcodes, there was no way to read arbitrary-length return data from a sub-call you had to pre-declare a fixed return buffer size. RETURNDATASIZE tells you exactly how many bytes the last call returned. RETURNDATACOPY copies them. Together they enable dynamic ABI decoding of return values and are the backbone of every modern proxy implementation.</p><pre>assembly {<br>  let success := call(gas(), target, 0, 0, calldatasize(), 0, 0)<br>  let sz := returndatasize()<br>  returndatacopy(0x00, 0x00, sz)<br>  // mem[0..sz] now contains the full return data<br>}</pre><h4>What to Take Away</h4><p>A few threads run through all of this:</p><p><strong>REVERT and INVALID are not the same.</strong> REVERT refunds gas and is the correct choice for user-facing validation. INVALID burns all gas and is reserved for invariant violations. The require/assert distinction in Solidity maps directly to this.</p><p><strong>DELEGATECALL is the proxy pattern and nothing else.</strong> Its power, same storage, same sender is also its danger. Storage slot collisions between proxy and implementation have drained contracts. Use a standard like <a href="https://eips.ethereum.org/EIPS/eip-1967">EIP-1967</a> to define where implementation slots live.</p><p><strong>SELFDESTRUCT changed in Cancun.</strong> It no longer deletes code. If your security model, upgrade path, or economic design depends on SELFDESTRUCT clearing state, re-audit.</p><p><strong>Reference</strong>:</p><p><a href="https://www.evm.codes/">evm.codes </a>: An Ethereum Virtual Machine Opcodes Interactive Reference</p><p><a href="https://eips.ethereum.org/all">EIPS</a> : All Ethereum Improvement Proposals</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ab03bd6c144" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Understand Every Ethereum Wallet Standard in 10 Minutes]]></title>
            <link>https://medium.com/@margretnursca/how-to-understand-every-ethereum-wallet-standard-in-10-minutes-e12c827e14b1?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e12c827e14b1</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 10:33:12 GMT</pubDate>
            <atom:updated>2026-03-20T10:33:12.837Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yRm5t5fQcORRLiIbmiEY1A.jpeg" /></figure><p>There is the Ethereum UX problem. Not the technology. Not the vision. The experience. And it’s costing us users every single day.</p><p>But here’s what most people don’t know: Ethereum has been quietly building the fix. A layer of standard each solving a specific friction point that will eventually make wallets feel like normal apps.</p><p>Let me show you the map.</p><h4>The 6-Layer UX Stack (A Simple Mental Model)</h4><p>Think of Ethereum’s UX evolution as a building. Each layer solves one problem:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa072784b95fe712b74aa61d75ddb05e/href">https://medium.com/media/fa072784b95fe712b74aa61d75ddb05e/href</a></iframe><p>You don’t need to memorize these. But understanding what each layer does helps you see where the pain comes from and where it’s going.</p><h4>Standard 1–2: The Foundation (window.ethereum + EIP-1193)</h4><p>In the beginning, there was window.ethereum.</p><p>This is the basic JavaScript object that wallets inject into your browser. When a dApp(Decentralized Application) says <em>Connect Wallet</em>, it’s looking for this object.</p><p>The problem? Every wallet implemented it slightly differently. Developers had to write custom code for MetaMask, then different code for Coinbase Wallet, then different code for Rainbow.</p><p><a href="https://eips.ethereum.org/EIPS/eip-1193"><strong>EIP-1193</strong></a><strong> </strong>fixed this by creating a standard interface. Now wallets speak the same language. Connect once, work everywhere.</p><h4>Standard 3: The Multi-Wallet Problem (EIP-6963)</h4><p>Here’s a scenario you might recognize:</p><p>You have MetaMask installed. You also have Rabby. You click <em>Connect Wallet</em> on a dApp.</p><p>Which wallet opens? Usually MetaMask because it’s aggressive about claiming window.ethereum. Your other wallet gets ignored.</p><p><a href="https://eips.ethereum.org/EIPS/eip-6963"><strong>EIP-6963</strong></a> introduces wallet discovery. Instead of wallets fighting for the same global object, dApps can now ask: <em>What wallets are available?</em> Then show you a proper list for you to choose which wallet you want to connect with.</p><h4>Standard 4: The Big One (ERC-4337 — Account Abstraction)</h4><p>This is where things get interesting.</p><p>Right now, your Ethereum account is controlled by a private key. Lose it? Gone. Get phished? Gone. Want to pay gas in USDC instead of ETH? Can’t.</p><p><a href="https://eips.ethereum.org/EIPS/eip-4337"><strong>ERC-4337</strong></a> introduces smart accounts, wallets that are actually smart contracts. This unlocks:</p><ul><li><strong>Gas sponsorship:</strong> Apps can pay your gas fees</li><li><strong>Batched transactions: </strong>One signature for multiple actions</li><li><strong>Social recovery:</strong> Recover your wallet through trusted contacts</li></ul><blockquote>Real example: Before ERC-4337, swapping on Uniswap required: (1) approve token, (2) confirm approval, (3) submit swap, (4) confirm swap. Four popups. Four chances to abandon the transaction.</blockquote><p>With smart accounts: one signature. Done.</p><p>This is the standard that could actually bring the next billion users. But it has a problem.</p><h4>Standard 5: The Bridge (EIP-7702)</h4><p>ERC-4337 is great for new users. But what about the millions of people with existing wallets? They can’t just migrate their accounts, their history, their tokens are all tied to their current address.</p><p><a href="https://eips.ethereum.org/EIPS/eip-7702"><strong>EIP-7702 </strong></a>solves this. It lets existing wallets temporarily act like smart accounts. You keep your address. You keep your keys. But you get smart account features when you need them.</p><p>Think of it as a software upgrade for your existing wallet. No migration required.</p><h4>Standard 6: The Missing Piece (x402)</h4><p>All of this infrastructure still assumes users want to manually initiate every payment. But what about subscriptions? Recurring donations? Streaming payments? x402 works together with ERC-8004 to achieve this.</p><p><a href="https://eips.ethereum.org/EIPS/eip-8004"><strong>ERC-8004</strong></a><strong> </strong>is the ID for AI agents. It handles onchain identity and reputation, enabling them to get served at the bar.</p><p><a href="https://thegraph.com/blog/understanding-x402-erc8004/"><strong>x402</strong></a> proposes native payment request handling letting applications request payments in a standardized way, similar to how HTTP handles web requests.</p><p>This is still early. But it points to a future where crypto payments are as invisible as tapping Apple Pay.</p><h4>What This Means for You</h4><p>If you’re a user: The wallets you use in 2025–2026 will feel dramatically different. Fewer popups. Fewer gas headaches. More <em>it just works.</em></p><p>If you’re a developer: Start building with smart accounts in mind. Most modern libraries already support these standards.</p><p>If you’re in emerging markets: This matters most for you. Gas sponsorship and easier onboarding remove the biggest barriers to adoption.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e12c827e14b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Hooks: A Technical Guide]]></title>
            <link>https://medium.com/@margretnursca/react-hooks-a-technical-guide-9affbb675210?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9affbb675210</guid>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 00:59:31 GMT</pubDate>
            <atom:updated>2026-03-18T20:03:29.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*0CAZ51xpfB7ZqNrjSemfnQ.avif" /><figcaption>React Hooks</figcaption></figure><p>React provides a set of built-in hooks that enable functional components to manage state, side effects, context, and performance optimizations.</p><p><em>Hooks</em> let you use different React features from your components. In this blog, we’ll explore some of the most commonly used <strong>React Hooks </strong>and provide easy-to-understand technical examples.</p><h4><strong>1. useState Hook</strong></h4><p>The useState hook allows functional components to have state variables. It takes an initial state value as an argument and returns an array with two elements: the current state value and a function to update it.</p><pre>import React, { useState } from &#39;react&#39;;<br><br>function Counter() {<br>  const [count, setCount] = useState(0);<br><br>  const increment= () =&gt; {<br>    setCount(count + 1);<br>  }<br><br>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;Count: {count}&lt;/p&gt;<br>      &lt;button onClick={increment}&gt;Increment&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>In this example, we start with a count of 0 and update it every time the Increment button is clicked.</p><h4>2. useEffect Hook</h4><p>The useEffect hook allows you to perform side effects in a functioning component, such as data fetching, subscriptions, or DOM(Document Object Model) manipulations after the component has been rendered.</p><pre>import { useState, useEffect } from &#39;react&#39;;<br>import { createConnection } from &#39;./chat.js&#39;;<br><br>function ChatRoom({ roomId }) {<br>  const [serverUrl, setServerUrl] = useState(&#39;https://localhost:1234&#39;);<br><br>  useEffect(() =&gt; {<br>    const connection = createConnection(serverUrl, roomId);<br>    connection.connect();<br>    return () =&gt; {<br>      connection.disconnect();<br>    };<br>  }, [serverUrl, roomId]);<br>  // ...<br>}</pre><p>In this example, the ChatRoom component uses an Effect to stay connected to an external system defined in chat.js.</p><h4>3. useCallback Hook</h4><p>The useCallback hook allows you to memoize a function so that it’s only re-created when its dependencies change. This can help improve performance by preventing unnecessary re-renders of child components.</p><pre>import React, { useState, useCallback } from &#39;react&#39;;<br><br>function SearchBar({ onSearch }) {<br>  const [query, setQuery] = useState(&#39;&#39;);<br><br>  const handleQueryChange = useCallback(event =&gt; {<br>    setQuery(event.target.value);<br>    onSearch(event.target.value);<br>  }, [onSearch]);<br><br>  return (<br>    &lt;input type=&quot;text&quot; value={query} onChange={handleQueryChange} /&gt;<br>  );<br>}</pre><p>In this example, we define a SearchBar component that takes an onSearch prop function. We use the useCallback hook to memorize the handleQueryChange function so that it’s only re-created when the onSearch function changes.</p><h4>4. useRef Hook</h4><p>The useRef hook allows you to create a mutable ref object that persists for the lifetime of the component. You can use it to store and access values that don’t trigger a re-render.</p><pre>import { useRef } from &#39;react&#39;;<br><br>export default function Counter() {<br>  let ref = useRef(0);<br><br>  function handleClick() {<br>    ref.current = ref.current + 1;<br>    alert(&#39;You clicked &#39; + ref.current + &#39; times!&#39;);<br>  }<br><br>  return (<br>    &lt;button onClick={handleClick}&gt;<br>      Click me!<br>    &lt;/button&gt;<br>  );<br>}</pre><p>This example uses a ref to keep track of how many times the button was clicked. Note that it’s okay to use a ref instead of state here because the click count is only read and written in an event handler.</p><h4>5. useMemo Hook</h4><p>The useMemo hook allows you to memoize a value so that it’s only re-computed when its dependencies change. This can help improve performance by preventing unnecessary re-computations.</p><pre>import React, { useState, useMemo } from &#39;react&#39;;<br><br>function ExpensiveCalculation({ a, b }) {<br>  const result = useMemo(() =&gt; {<br>    console.log(&#39;Calculating...&#39;);<br>    return a * b;<br>  }, [a, b]);<br><br>  return &lt;p&gt;Result: {result}&lt;/p&gt;;<br>}</pre><p>In this example, we define an ExpensiveCalculation component that takes two props, a and b. We use the useMemo hook to memoize the result of the calculation so that it’s only re-computed when a or b changes.</p><h4>6. useContext Hook</h4><p>The useContext hook allows you to access a context object in a functional component. Context is a way to pass data down the component tree without having to pass props manually.</p><pre>import { createContext, useContext, useState } from &#39;react&#39;;<br><br>const ThemeContext = createContext(null);<br><br>export default function MyApp() {<br>  const [theme, setTheme] = useState(&#39;light&#39;);<br>  return (<br>    &lt;ThemeContext value={theme}&gt;<br>      &lt;Form /&gt;<br>      &lt;label&gt;<br>        &lt;input<br>          type=&quot;checkbox&quot;<br>          checked={theme === &#39;dark&#39;}<br>          onChange={(e) =&gt; {<br>            setTheme(e.target.checked ? &#39;dark&#39; : &#39;light&#39;)<br>          }}<br>        /&gt;<br>        Use dark mode<br>      &lt;/label&gt;<br>    &lt;/ThemeContext&gt;<br>  )<br>}<br><br>function Form() {<br>  return (<br>    &lt;Panel title=&quot;Welcome&quot;&gt;<br>    &lt;/Panel&gt;<br>  );<br>}<br><br>function Panel({ title }) {<br>  const theme = useContext(ThemeContext);<br>  const className = &#39;panel-&#39; + theme;<br>  return (<br>    &lt;section className={className}&gt;<br>      &lt;h1&gt;{title}&lt;/h1&gt;<br>    &lt;/section&gt;<br>  )<br>}</pre><p>In this example, the MyApp component holds a state variable which is then passed to the ThemeContext provider. Checking the “Dark mode” checkbox updates the state.</p><h4>Conclusion</h4><ul><li><strong>useState</strong>: Manages local state in functional components. Returns the current state and a function to update it.</li><li><strong>useEffect</strong>: Handles side effects like data fetching, subscriptions, and DOM manipulation. Runs after render and can clean up resources.</li><li><strong>useCallback</strong>: Memoizes a function, preventing unnecessary re-creations during re-renders.</li><li><strong>useRef</strong>: Creates a mutable reference object that persists across re-renders and can be used to access DOM elements or store mutable values without triggering re-renders.</li><li><strong>useMemo</strong>: Memoizes a value, re-computing it only when dependencies change. Improves performance for expensive calculations.</li><li><strong>useContext</strong>: Allows components to read and subscribe to React context values without prop drilling.</li></ul><p>In summary, React hooks are a powerful tool that every developer should have in their arsenal. By incorporating these hooks into your projects, you can create better, faster, and more responsive web applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9affbb675210" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Contract Inheritance Every Developer Must Know]]></title>
            <link>https://medium.com/@margretnursca/smart-contract-inheritance-every-developer-must-know-ae9b493819ef?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae9b493819ef</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Sat, 14 Feb 2026 20:55:55 GMT</pubDate>
            <atom:updated>2026-02-14T21:12:29.297Z</atom:updated>
            <content:encoded><![CDATA[<p>In the architecture of smart contracts and object-oriented programming like Solidity, when logic is duplicated across contracts, you don’t just get messy structure; you increase your attack surface. Small inconsistencies become expensive bugs.</p><p>To avoid this, that’s where <strong>inheritance </strong>in Solidity<strong> </strong>comes in.</p><p>Inheritance means that you can create an object with some values and methods and use it as a base for other objects. Inheritance lets you define a clear parent-to-child relationship using the is keyword. It’s how you say, “This contract builds on that one.” But here’s the catch: Solidity doesn’t handle inheritance exactly like traditional object-oriented languages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*I6SmMD3io5RJHLYjIkdGIg.jpeg" /><figcaption>Smart Contract Inheritance</figcaption></figure><blockquote>In Solidity, the objects we are referring to are contracts and interfaces. We write contracts with state variables and functions.</blockquote><p>Let’s break down the different types of smart contract inheritance in Solidity.</p><h4>Single Inheritance</h4><p>Single inheritance helps in inheriting the variables, functions, modifiers, and events of base contracts into the derived contract. When you inherit from a base contract, the compiler effectively pulls that parent’s code into the child contract. State variables, functions, modifiers, events all become part of the final compiled bytecode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*q1JTgm2V4qfqHZpUtSLyeQ.avif" /><figcaption>Single Inheritance</figcaption></figure><blockquote>The parent contract is known as the “base contract,” and the child contract is known as the “derived contract.” The term “derives” is one you’ll hear a lot! A contract derives another contract if it inherits from it. Just like a child derives features from a parent!</blockquote><h4>Multi-level Inheritance</h4><p>Multi-level inheritance is similar to single inheritance; however, instead of just a single parent-child relationship, there are multiple levels of parent-child relationships. This is also referred to as a <strong>smart contract inheritance chain.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*rOo3mUvJyYGheO4dvWKIxQ.avif" /><figcaption>Multi-level Inheritance</figcaption></figure><h4>Hierarchical Inheritance</h4><p>Hierarchical inheritance is also similar to simple inheritance. Here, a single contract acts as a base contract for multiple derived contracts. The multiple derived contracts act as siblings but are not interconnected in any way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*OsOBp5GfmSbVokjJgl5maw.avif" /><figcaption>Hierarchical inheritance</figcaption></figure><h3>Advanced Inheritance Patterns</h3><p>In many languages, overriding behavior is implicit. In Solidity, it’s strictly opt-in.</p><p>Solidity forces you to declare your intentions using two keywords:</p><ul><li>virtual — added to a function in the base contract to allow it to be overridden.</li><li>override — added in the child contract to confirm you are intentionally replacing that logic.</li></ul><h4>Function Overriding</h4><p>When a child contract overrides a function from a parent contract, it must use the override keyword, and the parent function must be marked as virtual:</p><pre>contract Parent {<br>    function foo() public virtual returns (uint) {<br>        return 1;<br>    }<br>}<br><br>contract Child is Parent {<br>    function foo() public override returns (uint) {<br>        return 2;<br>    }<br>}</pre><p>For multiple inheritance, you need to specify which contracts are being overridden:</p><pre>contract Child is Parent1, Parent2 {<br>    function foo() public override(Parent1, Parent2) returns (uint) {<br>        return 3;<br>    }<br>}</pre><h3><strong>Inheritance Use Cases</strong></h3><p>Smart contract inheritance is very useful because it allows us to bring in existing code, variables, and functions into any contract we write; all we need to do is use the is keyword.</p><h4>Onwable</h4><p>One of inheritance’s greatest strengths is composability with audited, community-vetted contracts, like those from <a href="https://www.openzeppelin.com/">OpenZeppelin</a>. This means they develop and deploy smart contracts that are so used, audited, and stress-tested that they become industry standards.</p><p>One such standard contract is Ownable.sol. Let&#39;s take a look at some parts of it:</p><pre>contract Ownable {<br>    address owner;<br>    <br>    constructor() {<br>        owner = msg.sender;<br>    }<br>    <br>    modifier onlyOwner() {<br>        require(msg.sender == owner);<br>        _;<br>    }<br>}</pre><p>The above Ownable contract carries functionality specific to access control of a smart contract. Out of this contract, we get:</p><ul><li>a variable of type address called owner</li><li>a constructor that declares the owner is equal to whoever deploys the contract</li><li>a modifier that can be placed on functions to make sure only whoever is the current owner can proceed.</li></ul><p>Instead of writing your own access control contract (and potentially introducing subtle vulnerabilities), you inherit something like Ownable</p><p><em>Writing from scratch is not bad! But you should know when to rely on battle-tested code and when to write your own.</em></p><h3>Conclusion</h3><p>Inheritance is more than a convenience; it’s an architectural decision.</p><p>It keeps your contracts modular, enforces intentional overrides, and enables reuse of hardened security primitives.</p><p>By understanding the nuances of Solidity’s inheritance mechanism, including multiple inheritance, function overriding, and constructor initialization, you can build more sophisticated and efficient contracts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae9b493819ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EIP-4895: Understanding Beacon Chain Push Withdrawals]]></title>
            <link>https://medium.com/@margretnursca/eip-4895-understanding-beacon-chain-push-withdrawals-717e1af377bb?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/717e1af377bb</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[eip-4895]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 10:09:09 GMT</pubDate>
            <atom:updated>2026-02-06T10:28:45.639Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://ethereum.org/roadmap/beacon-chain/">Beacon Chain</a> is the name of the original proof-of-stake blockchain launched on December 1st, 2020. It enabled staking on Ethereum; validators can participate in network security and recieve rewards for duties performed, but there was no way to get that ETH (or the rewards) back into the regular Ethereum network where you could actually use it. <strong>EIP-4895</strong> provided a way for validators to move the staked ETH and rewards from Beacon Chain to <a href="https://ethereum.org/developers/docs/evm/">EVM</a>.</p><h4>A ‘Push,’ not a ‘Pull’</h4><p>A fundamental architectural choice in EIP-4895 is the adoption of a “push-based” system over a “pull-based” alternative. Withdrawals are pushed from the Beacon Chain into the EVM as soon as they are dequeued from the consensus layer,<strong> </strong>meaning the execution layer processes them immediately as part of block execution.</p><blockquote><strong>The consensus layer </strong>is the part of Ethereum responsible for agreement on the blockchain’s state, which blocks are valid, in what order they go, and when they become finalized. The consensus layer doesn’t execute transactions itself; it only decides which proposed blocks are accepted and manages validator coordination, rewards, and penalties.</blockquote><blockquote><strong>The execution layer </strong>handles everything that users care about on Ethereum, processing and executing transactions, running smart contracts via the Ethereum Virtual Machine (EVM), maintaining account balances and contract state, and managing the world-state database i.e., all balances, storage, nonces, etc.</blockquote><h4>The Secret Identity: It’s Not a Transaction</h4><p>One of the most profound distinctions in EIP-4895 is that a Withdrawalis not a transaction; it is a <strong>system-level operation.</strong> While they may appear similar to user-level transactions, withdrawals live in an entirely different domain. They are initiated by the overall system rather than originating from end-user signatures.</p><p>This Withdrawals provide key information from the consensus layer to the execution layer:</p><ul><li><strong>index</strong>: a uint64 global counter that monotonically increases across all withdrawals in Ethereum’s history</li><li><strong>validator_index</strong>: a uint64 identifying the validator on the consensus layer</li><li><strong>address</strong>: the 20-byte execution-layer recipient</li><li><strong>amount</strong>: a non-zero uint64 value representing the withdrawn ETH</li></ul><p>During execution, the amount is converted from Gwei to Wei and applied directly to the recipient’s balance. This balance update is <em>unconditional</em>. According to the specification, it <strong>MUST not fail</strong>. Once the consensus layer dequeues a withdrawal, the execution layer is obligated to reflect it.</p><pre>withdrawal = [index, validator_index, address, amount]</pre><p>Each withdrawal object [index, validator_index, address, amount] is converted into a compact byte representation using RLP before it is included in a block execution payload. These are <strong>not typical user transactions</strong></p><blockquote><strong>RLP (Recursive Length Prefix) </strong>— a serialization format Ethereum uses to turn complex data structure into compact deterministic sequence of bytes that are stored or transmitted between nodes.</blockquote><p>To make this verifiable, the execution payload header was extended with a withdrawals_root: a 32-byte cryptographic commitment derived from a <a href="https://medium.com/codechain/modified-merkle-patricia-trie-how-ethereum-saves-a-state-e6d7555078dd">Merkle-Patricia trie</a> of all withdrawals in the block. Execution clients can independently validate that the consensus layer’s instructions haven’t been tampered with.</p><blockquote>Execution clients (software like Geth and Nethermind) receive transactions, put them into blocks, apply state transitions, and compute resulting state changes.</blockquote><h4>The “Free” Operation: Why Withdrawals Cost No Gas</h4><p>In a network where gas prices dominate every design discussion, withdrawals are a rare exception. They cost <strong>zero gas </strong>by design.</p><p>The workload is tightly bounded. The consensus layer caps how many withdrawals can appear in a block, keeping the added payload to roughly 1% of an average block’s size. Each withdrawal results in a handful of deterministic balance updates. Because the work is minimal and predictable, the gas mechanism would add overhead without adding safety. So Ethereum removes it entirely.</p><h4>Last in Line: Where Withdrawals Fit in the State Transition</h4><p>Withdrawal timing is deliberate. They are processed <strong>after all user transactions</strong> in a block.</p><p>This ordering ensures that user-driven activity, DeFi trades, NFT mints, and contract calls fully resolve before system-level balance updates are applied. The two never compete within the same execution flow.</p><p>By placing withdrawals at the end of the state transition, Ethereum preserves a clean mental and technical model: first, users change state; then, the protocol settles its own obligations.</p><h4>Conclusion: Completing the Loop</h4><p>EIP-4895 was the final chapter of the Merge era. It closed the loop, restoring ETH’s full lifecycle across Ethereum’s dual-layer architecture.</p><p>More than a withdrawal mechanism, it introduced a powerful pattern: <strong>system-level operations with strict isolation and deterministic behavior</strong>. That pattern may echo far beyond staking. EIP-4895 made it possible for Ethereum validators to finally access their staked ETH and rewards.</p><p>Thank you for taking the time to read this article. I hope you found it informative and helpful in understanding how EIP-4895.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=717e1af377bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Ethereum Really Works: EVM, Gas, Blocks, Accounts, and Transactions Explained]]></title>
            <link>https://medium.com/@margretnursca/how-ethereum-really-works-evm-gas-blocks-accounts-and-transactions-explained-6cf058cdcc39?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cf058cdcc39</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 11:43:01 GMT</pubDate>
            <atom:updated>2026-02-05T17:50:35.662Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SELxUblDPJQwsr1JQ35CSA.png" /></figure><p>Ethereum is often compared with Bitcoin as just another <em>distributed ledger. </em>But viewing Ethereum only as a ledger misses its architectural core. Ethereum isn’t simply a record of past events. It’s a continuously running execution environment.</p><p>To really understand Ethereum, you have to look beyond price charts and headlines. Let’s explore the five fundamental concepts:</p><ol><li>The Ethereum Virtual Machine (EVM)</li><li>Accounts</li><li>Transactions</li><li>Blocks</li><li>Gas</li></ol><h3>It’s a Mathematical State Machine: EVM</h3><p>Ethereum is built as a distributed state machine. A state machine tracks the condition of an entire system, accounts, smart contracts, and the logic that governs them.</p><p>The Ethereum Virtual Machine (EVM) is a decentralized virtual environment that executes code consistently and securely across all Ethereum <a href="https://ethereum.org/developers/docs/nodes-and-clients/#what-are-nodes-and-clients">nodes</a>.</p><h4>How the EVM works</h4><ol><li>A transaction triggers a <a href="https://ethereum.org/developers/docs/smart-contracts/">smart contract </a>function.</li><li>The EVM executes the contract’s bytecode step-by-step.</li><li>Each <a href="https://ethereum.org/developers/docs/evm/opcodes/">opcode</a> (e.g., ADD, SSTORE) consumes gas.</li><li>If gas runs out, execution halts, and changes are reverted (but gas is still spent).</li><li>If successful, the new state is recorded on-chain.</li></ol><blockquote>A smart contract is a self-executing program that runs on the Ethereum Virtual Machine (EVM) and performs predefined functions when triggered by certain conditions.</blockquote><p>At its core, Ethereum operates as a single mathematical transition, often expressed as:</p><blockquote><strong>Y(S, T) = S′</strong></blockquote><p>Here, <strong>S</strong> represents the current valid state: a massive data structure known as a <a href="https://medium.com/codechain/modified-merkle-patricia-trie-how-ethereum-saves-a-state-e6d7555078dd">Merkle Patricia Trie</a> that cryptographically links all accounts and balances to one root hash. <strong>T</strong> is a new set of valid transactions. When the function is applied, it produces <strong>S′</strong>, the next valid state.</p><h3>Ethereum’s Two Account Types: Humans and Code</h3><p>Ethereum isn’t just a network of people. It’s a network of agents.</p><p>At its core are two account types: <strong>Externally Owned Accounts (EOAs)</strong> and <strong>Contract Accounts</strong>. Both can hold ETH, but they operate under entirely different rules.</p><ul><li><strong>Creation:</strong> EOAs are free to create. Contract accounts cost gas because they consume permanent storage to house code.</li><li><strong>Initiation:</strong> Only EOAs can initiate transactions. Contracts are reactive; they move only when called.</li><li><strong>Control:</strong> EOAs are governed by private keys. Contract accounts have no keys at all, only immutable logic, defined by a code hash.</li></ul><blockquote>Ethereum’s currency unit is called <strong>ether</strong>, also identified as <strong>ETH</strong>. Ether is subdivided into smaller units, down to the smallest unit possible, which is named <strong>wei</strong>. One ether is 1 quintillion wei (1 × 10¹⁸, or 1,000,000,000,000,000,000).</blockquote><p>Every Ethereum account carries a quiet but critical field: the <strong>nonce</strong>.</p><p>It’s just a counter. It expands every time you send a transaction. Simple but essential.</p><p>Without it, Ethereum would be vulnerable to <a href="https://www.quicknode.com/guides/ethereum-development/smart-contracts/what-are-replay-attacks-on-ethereum#what-are-replay-attacks">replay attacks</a>. A signed transaction could be copied and rebroadcast endlessly, draining your account in a loop. The nonce prevents that. Each transaction must arrive in exact sequence, and once a number is used, it can never be reused.</p><p>Your Ethereum account is your permanent on-chain identity. An Ethereum identity begins as pure mathematics. It starts with a private key: a 64-character hexadecimal number. From that single secret, everything else flows.</p><p>The network derives your public address through a one-way process:</p><ol><li>A public key is generated from the private key using the <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm">Elliptic Curve Digital Signature Algorithm</a>.</li><li>That key is hashed using Keccak-256.</li><li>The final 20 bytes are extracted and prefixed with 0x.</li></ol><p>What emerges is a 42-character address the world can see and verify without ever learning the secret that created it.</p><h3>Inside the Ethereum Engine: Transactions</h3><p>An Ethereum transaction refers to an action initiated by an externally owned account. In other words, an account managed by a human, not a contract.</p><p>An Ethereum transaction isn’t truly “finished” the moment it leaves your account. It traverses a four-step lifecycle: <strong>Hash generation</strong>, <strong>Broadcast</strong>, <strong>Validation</strong>, and finally, <strong>Finalization</strong>.</p><p>Once the transaction has been submitted the following happens:</p><ol><li>A transaction hash is cryptographically generated: 0x97d99bc7729211111a21b12c933c949d4f31684f1d6954ff477d0477538ff017</li><li>The transaction is then broadcast to the network and added to a transaction pool consisting of all other pending network transactions.</li><li>A validator must pick your transaction and include it in a block in order to verify the transaction and consider it successful.</li><li>As time passes, your transaction will be upgraded to “justified” then “finalized.” These upgrades make it much more certain that your transaction was successful and will never be altered.</li></ol><h3>The Shield of Ethereum: Gas</h3><p>Gas is often treated as an annoyance. Architecturally, it’s a safeguard. Every transaction or smart contract operation consumes gas, which is paid in ETH. Gas ensures fair resource allocation and prevents spam.</p><p>Every transaction fee is split in two: a <strong>priority fee</strong>, paid to validators, and a <strong>base fee</strong>, which the protocol itself removes from circulation forever.</p><h4>How Gas Works:</h4><ul><li><strong>Base Fee:</strong> A mandatory fee burned by the protocol (adjusts dynamically based on network demand).</li><li><strong>Priority Fee (Tip): </strong>An optional tip to incentivize validators to include your transaction.</li><li><strong>Gas Limit:</strong> The maximum gas a transaction can consume (e.g., 21,000 gas for a simple ETH transfer).</li><li><strong>Gas Price:</strong> The total cost per gas unit (base fee + priority fee).</li></ul><blockquote>If an execution exceeds the gas limit, the EVM halts and reverts all changes. The computation stops. The network keeps moving.</blockquote><h3>The Building Blocks of Ethereum: Blocks</h3><p>Blocks are the building blocks of Ethereum’s blockchain. They batch transactions together and link them cryptographically to form an immutable chain.</p><p><strong>Components of a Block</strong></p><ul><li><strong>Block Time: </strong>Block time refers to the time separating blocks. Ethereum runs on a precise rhythm called the <strong>slot system</strong>. Time is divided into 12-second slots. In each slot, a single validator is randomly selected to propose a block. This predictable timing allows thousands of nodes across the globe to stay tightly synchronized.</li><li><strong>Block Size</strong>: Each block targets 30 million gas, exactly half of the 60 million gas limit. If a block exceeds that target, the base fee for the next block increases by up to 12.5%. If it falls short, the fee decreases by the same amount.</li><li><a href="https://ethereum.org/developers/docs/blocks/#block-anatomy"><strong>Block Structure</strong>:</a> A block contains the header (parent hash, state root, block number, etc.), transactions (a list of executed operations), and execution payload (smart contract interactions).</li></ul><h3><strong>Conclusion: The Infrastructure in Motion</strong></h3><p>Ethereum is no longer an experiment. Its infrastructure still evolving but increasingly foundational.</p><p>Ethereum’s future won’t be defined by how smooth the experience feels alone, but by whether it can scale <em>without</em> losing the constraints that keep it honest.</p><p>Thank you for taking the time to read this article. I hope you found it informative and helpful in understanding how Ethereum really works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cf058cdcc39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum's Evolution: The Path to World Impact]]></title>
            <link>https://medium.com/@margretnursca/ethereums-evolution-the-path-to-world-impact-6915bb661e7f?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6915bb661e7f</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 09:12:37 GMT</pubDate>
            <atom:updated>2026-02-04T09:12:37.295Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krWRh0vEJRvm79u7H_F1Ew.png" /></figure><p>Ethereum didn’t become <em>World Computer </em>by standing still.</p><p>From day one, it wasn’t presented as a finished product, but as a living system, one meant to grow alongside the internet itself.<strong> </strong>Over the years, Ethereum’s upgrades have done more than improve performance; they have reshaped what&#39;s possible on-chain and positioned Ethereum as the backbone of decentralized innovation.</p><h3>The Original Vision: A World Computer That Can Grow</h3><p>Ethereum&#39;s founding idea was bold: <em>a world computer,</em> a decentralized system where anyone, anywhere can deploy applications that run exactly as programmed, without censorship or intermediaries.</p><p>But a world computer that can’t adapt won’t stay useful for long.</p><p>Ethereum’s roadmap recognized this early. Rather than promise perfection from the start, the network embraced change as a feature, not a flaw. Upgrades, delivered through hard forks, were never admissions of failure. They were signals of intent.</p><blockquote>Ethereum is evolving and it is doing so in public.</blockquote><h3>Laying the Groundwork: Early Network Upgrades</h3><p>The earliest Ethereum upgrades had a clear focus: stability.</p><p>Phases like <em>Frontier</em>, <em>Homestead</em>, and later <em>Metropolis</em> strengthened the protocol’s foundation. They improved security, refined gas mechanics, and introduced more robust cryptographic tools for developers.</p><p>The Metropolis upgrades <em>Byzantium</em> and <em>Constantinople</em> marked a turning point. Smart contracts became safer. Computational costs dropped. The network grew more resilient to attacks.</p><p>More than anything, these upgrades sent a clear message: Ethereum would prioritize developers and long-term usability over shortcuts.</p><h3>The Turning Point: The Merge</h3><p>If Ethereum’s evolution were a story, <em>The Merge</em> would be the chapter where everything shifts.</p><p>In 2022, Ethereum transitioned from Proof of Work to Proof of Stake, cutting its energy consumption by more than 99%. This wasn’t only about improving the technology; it reflected a deeper change in Ethereum’s direction.</p><p>The network became more sustainable.<br>More economically secure through staking.<br>And far better positioned for future scalability.</p><p>What made <strong>The Merge</strong> truly historic wasn’t just its ambition, but its execution. Despite the magnitude of the change, applications kept running. DeFi protocols held. NFTs didn’t disappear. Smart contracts didn’t break.</p><p>That level of coordination is rare in decentralized systems and it significantly elevated Ethereum’s credibility across the entire blockchain space.</p><h3>Scaling Without Sacrificing Decentralization</h3><p>Ethereum didn’t try to scale by inflating block sizes or centralizing control.</p><p>Instead, it leaned into a modular architecture.</p><p>Upgrades like:</p><ul><li><strong>London Upgrade</strong>, which introduced predictable fees and ETH burning</li><li><strong>Shanghai/Capella</strong>, which refined the staking experience</li><li><strong>Dencun</strong>, which dramatically lowered data costs for Layer 2 rollups</li></ul><p>…helped reposition Ethereum as a secure settlement layer, while execution increasingly moved to Layer 2 networks.</p><p>This approach allowed Ethereum to scale without compromising decentralization. The result is an ecosystem of rollups, all anchored to the same underlying trust layer.</p><p>Ethereum didn’t become faster by doing everything itself.<br>It became stronger by letting others build on top of it.</p><h3>Governance in the Open</h3><p>Ethereum’s upgrades don’t happen behind closed doors.</p><p>They emerge through <strong>Ethereum Improvement Proposals (EIPs)</strong>, open developer calls, community debate, and extensive testing across multiple clients.</p><p>The process is slow. Sometimes messy. Often contentious.But it’s also transparent.</p><p>That openness has helped Ethereum maintain legitimacy as neutral, global infrastructure, rather than a product steered by a single company or authority.</p><h3>Why Ethereum Still Leads</h3><p>Ethereum’s strength has never been about perfection.</p><p>It’s about adaptability.</p><p>Through its upgrades, Ethereum has managed to:</p><ul><li>Scale without sacrificing decentralization</li><li>Enable innovation across DeFi, NFTs, DAOs, and Layer 2 ecosystems</li></ul><p>In an industry defined by rapid experimentation and frequent collapse, Ethereum’s willingness to evolve carefully, and in full view of the public, has set it apart.</p><p>Ethereum didn’t try to be the fastest blockchain. It chose to be the most durable.</p><blockquote>And that choice continues to shape the future of decentralized technology.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6915bb661e7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whispers at the Edge of Infinity]]></title>
            <link>https://medium.com/@margretnursca/whispers-at-the-edge-of-infinity-42d60e53ad92?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/42d60e53ad92</guid>
            <category><![CDATA[fiction]]></category>
            <category><![CDATA[short-fiction]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 19:14:14 GMT</pubDate>
            <atom:updated>2025-09-29T19:14:14.189Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Lantern of Silent Stars</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9XF5gf_UkUFwwPYoH20VA.png" /></figure><p>The <strong>Lantern of Silent Stars</strong> did not burn with flame, but with the silence of extinguished suns. It hung within the Oblivion Reach, a place where void bled into creation like spilled ink across the Infinite Canvas.</p><p>Lyra, a seeker of the Horizon, braved the Reach to find it. Her sister was lost in the fractures of war, and she believed the lantern’s glow could show the way back.</p><p>When she touched it, the lantern spoke not in sound, but as thought etched in her marrow.</p><p>“<em>What do you seek in the silence of stars?”</em></p><p>“<em>Not power</em>,” she whispered. “<em>Only her</em>.”</p><p>The lantern bloomed with shadow. Visions swirled her sister, stranded on a shoreline of broken time. Lyra reached, but the lantern would not yield unless she surrendered its gift to the Solverse itself.</p><p>With tears sharp as glass, she released it. The lantern dissolved, scattering motes of stillness across the void. And in their hush, her sister’s hand found hers again.</p><p>The stars hummed where silence had been, a melody only those who’ve lost could ever understand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42d60e53ad92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whispers at the edge of Infinity]]></title>
            <link>https://medium.com/@margretnursca/whispers-at-the-edge-of-infinity-0e8a109cb5f6?source=rss-7430ca25c33f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e8a109cb5f6</guid>
            <category><![CDATA[fiction]]></category>
            <category><![CDATA[short-fiction]]></category>
            <dc:creator><![CDATA[Nursca]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 18:48:43 GMT</pubDate>
            <atom:updated>2025-09-29T19:19:49.958Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Bloom at the Edge of Both Ends</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7RgQ7GLB1VcTUXmvY86mBQ.png" /></figure><p>The Edge of Both Ends was a horizon where time folded upon itself, where the Solverse sang in paradox. Travelers spoke of it with reverence, for none who lingered returned whole.</p><p>Kaelen sought the <strong><em>Chrona Bloom</em></strong>, a flower that unfurled only once every thousand years. It was said to carry the rhythm of reversal, the power to bend a thread of fate backward. Factions scoured for it, but Kaelen’s purpose was simpler: <em>redemption</em></p><p>When he found it silver stalk, starlit veins, petals humming like the breath of galaxies it was guarded.</p><p>A beast of constellations, ever-shifting, lion one moment, serpent the next. <strong><em>The Asterion Sentinel</em></strong>. Its void-born eyes reflected futures Kaelen dared not choose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZwueKW1G6HYIhqfcXlYKgw.png" /></figure><p>“Why should time belong to you?” the Sentinel thundered.</p><p>Kaelen bowed. <em>“Not to rule. To mend.”</em></p><p>The Bloom demanded sacrifice. To pluck it, he gave away his name, cast into the maw of silence. Memory devoured him whole. Yet the flower yielded, gifting him a single petal.</p><p>He left nameless, but not purposeless—carrying in his hand the quiet promise that a broken thread could still be woven anew.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e8a109cb5f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>