<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Stylus Saturdays]]></title><description><![CDATA[Stylus Saturdays is a regular deep dive into the Arbitrum Stylus ecosystem.]]></description><link>https://stylus-saturdays.com</link><image><url>https://substackcdn.com/image/fetch/$s_!8a8d!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8586ee73-2f17-4dad-a892-09059adf7dce_387x387.png</url><title>Stylus Saturdays</title><link>https://stylus-saturdays.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 05 May 2026 02:06:23 GMT</lastBuildDate><atom:link href="https://stylus-saturdays.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Stylus Saturdays]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[stylussaturdays@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[stylussaturdays@substack.com]]></itunes:email><itunes:name><![CDATA[Stylus Saturdays]]></itunes:name></itunes:owner><itunes:author><![CDATA[Stylus Saturdays]]></itunes:author><googleplay:owner><![CDATA[stylussaturdays@substack.com]]></googleplay:owner><googleplay:email><![CDATA[stylussaturdays@substack.com]]></googleplay:email><googleplay:author><![CDATA[Stylus Saturdays]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[96kb Contracts, ETH Cluj Stylus, Huff and Stylus precompiles]]></title><description><![CDATA[25th April 2026]]></description><link>https://stylus-saturdays.com/p/96kb-contracts-eth-cluj-stylus-huff</link><guid isPermaLink="false">https://stylus-saturdays.com/p/96kb-contracts-eth-cluj-stylus-huff</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 25 Apr 2026 12:15:43 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d129661c-bbee-4368-badc-23020fce87af_1408x768.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! It&#8217;s been a bit since our last post. I took a break from posting, instead working on <a href="https://code.markovgeist.org/orderbookkit.xyz">Orderbookkit</a> and <a href="https://superposition.so">Superposition</a> (<a href="https://9lives.so">9lives</a>). I can confirm that this blog will be an ongoing project, until we run out of things to write (not likely).</p><p>In this post:</p><ol><li><p>96kb contracts are coming out for the Stylus ecosystem. We all know that contract size is a huge blocker for us! There is some discussion there about codesize optimisations in the Stylus VM that may be interesting to you. I also wanted to talk about a few interesting projects I&#8217;ve seen developing.</p></li><li><p>Stylus at <a href="https://www.ethcluj.org/">ETH Cluj</a>! <a href="https://x.com/0xjsieth">0xjsi</a> (Jack) will be speaking about Stylus teaching people how to build on Arbitrum. We&#8217;ll dive into the talk content, including the open source material that will be coming out as a result of this program.</p></li><li><p>A Huff precompile: I wrote some Huff recently to work as a gas and codesize efficient proxy using our ed25519 and sha512 &#8220;precompiles&#8221;. These contracts are available on Arbitrum One and Superposition, making this code reusable for anyone wanting to build a high performance calldata proxy.</p></li></ol><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>96kb contracts and the current ecosystem</h1><p>To recap, the current contract limit is 75kb. This can be quite painful, as many of us have noticed. For 9lives, some of our contracts push up against the ceiling a fair bit:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">76K&#9;contract-trading-amm-mint.wasm
72K&#9;contract-trading-amm-price.wasm
68K&#9;contract-trading-dppm-extras.wasm
68K&#9;contract-trading-dppm-quotes.wasm</code></pre></div><p>I know from experience that this frustrates a lot of teams. The size problem forces you to write code calling out to other contracts, offsetting the gains we get from having the Stylus contracts.</p><p>A solution that&#8217;s been thrown around a lot is implementing is to bump the ceiling to 96 kilobytes.</p><p>There has also been talk of other solutions, like replacing the <a href="https://github.com/stylus-developers-guild/bobcat-sdk/blob/trunk/bobcat-maths/src/lib.rs#L124">native integer type with a chunk on the stack</a> and implementing the numbers entirely in bit manipulation with software with loops, <a href="https://github.com/OffchainLabs/nitro/blob/6dce8d13902649a1acdfd3f2504129f1f5612358/crates/wasm-libraries/user-host-trait/lib.rs#L903-L917">increasing the amount of external functions in the VM to support more math operations</a>, and more.</p><p>The issues with these approaches is that don&#8217;t make sense when you consider the overhead of the translation from the WASM representation to the native machine that happens when code is compiled.</p><p>The Arbitrum node works during the activation period by using WASM as a host agnostic translation layer, and converting it to the native machine with Ahead Of Time (AOT) compilation. You upload your WASM, then it gets converted to executable code on the Arbitrum node that runs your contract. This approach isn&#8217;t possible/easy with the EVM or with other machines (for the most part, including RISC-V), due to the lack of static jumps (and other reasons).</p><p>Unfortunately, with WASM, we need to work around the fact that the native machine lacks 256-bit numbers and has little endianness, different from the big endian of the EVM. This ends us up with an unfortunate consequence: a dependency on crates and host-provided functions that we could choose to expand on, but always with an encoding overhead.</p><p>In light of this all, the simplest size solution is to increase the limit to 96kb. Presumably the codesize demands would peter out in the future since we&#8217;re all sharing the same code. We could even just keep increasing the codesize if we hit any more blockers.</p><p>My feeling is that for a future size increase, we could also look at ways of adding code to the dynamic code that the VM provides that&#8217;s relevant to application programmers, like muldiv and some approximation methods, and a way of pipelining math operations with a one-time serialisation fee. We could also have some external functions that don&#8217;t make big endian assumptions about their inputs, providing a little endian alternative that lets us provide the location of the ruint tuple of 64-bit words. This would eliminate the current problems with serialisation to and from the external functions, eliminating the codesize costs there too. Should we be careful to avoid having so many external functions that there&#8217;s no point developing them?<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></p><p>Following that though, we could release a version of the SDK with API compatibility with the existing code that replaces alloy and makes less use of abstraction. Alloy is good, but it has a ton of dependencies, and it&#8217;s not as codesize efficient for our usecase is my feeling.</p><p>Looking forward: my feeling is that this size increase is really great for the ecosystem. Thank you to <a href="https://x.com/srinjoycal">Srinjoy</a> and everyone at OCL for listening to the community, and advocating for this change.</p><p>Let&#8217;s also discuss a change on the horizon: multi value returns are leaving the Stylus VM. This probably doesn&#8217;t affect you, but turn it off with compiler settings if you&#8217;re using a custom release pipeline that doesn&#8217;t implicitly use wat2wasm and wasm2wat, which I imagine might cut it out. But someone needs to prove this, since I&#8217;m not sure.</p><h2>Interesting projects</h2><p>I wanted to share some projects that I&#8217;ve seen building with Stylus after adding them to the <a href="https://stylusup.sh">Stylusup</a> page. We now have 51 projects launched there as of this time of writing. Two projects I haven&#8217;t seen receive coverage in other Stylus media:</p><ol><li><p><a href="https://stylusup.sh/ecosystem/stylus-workshop-gol">Arbitrum&#8217;s Game Of Life</a>: an on-chain implementation of the Game Of Life for a workshop.</p></li><li><p><a href="https://github.com/orthonode/Stylus-Hardware-Anchor">Orthonode&#8217;s Stylus Hardware Anchor</a>: cheap hardware proof of provenance that&#8217;s verified on-chain using Stylus. A way to have proof at the hardware level of liveness that could be useful for on-chain distribution, voting, and more. I imagine that at a future conference we might see someone handing out badges that prove you&#8217;re human that you can use on-chain! Launched on Sepolia.</p></li></ol><div><hr></div><h1>Stylus at ETH Cluj</h1><p>I was scheduled to speak at ETH Cluj about Arbitrum and Stylus, but the situation with fuel insecurity (and the broader macro) derailed things. Jack (0xjsi) has taken up the task of speaking and organising the workshops, which run on the day of the 13th of May, 2026. The conference generally is from the 13th to the 14th.</p><p>The content will run like this:</p><ol><li><p>Arbitrum&#8217;s Role in the New Ethereum Roadmap: some cultural and technical background on Ethereum, and how Arbitrum fits into Ethereum now and in the future.</p></li><li><p>Your First Smart Contract on Arbitrum: introducing everyone to building smart contracts using Solidity on Arbitrum. This workshop and open source website introduces several smart contracts that the workshop will build together, including a stablecoin, lending protocol, vault, and DEX. It explains how to build each of them, including the content and context.</p></li><li><p>Stylus for beginners: this workshop and site will introduce how blockchains work, the EVM, how Arbitrum works, and how Stylus differs from the EVM and its context. This step will introduce stack-based machines.</p></li><li><p>Deploy &amp; Go - From Contract to App: this final step will take everything we&#8217;ve done so far, and introduce how to build a webapp from it. It will teach everyone how to work with Stylus.</p></li></ol><p>Our goal is twofold:</p><ol><li><p>Increase the amount of open source literature covering Stylus.</p></li><li><p>Teach students to work with Arbitrum and Stylus in person with a guided lesson-like format of Q&amp;A. Have them walk away with the skills to work on the Arbitrum stack again.</p></li></ol><p>For the first goal, we&#8217;re looking to partner with a team building a AI product atop Stylus to run a chatbot for us. <a href="https://t.me/doggish">If that&#8217;s you, reach out</a> please!</p><p>I&#8217;ll be contributing online via a Telegram channel for questions during the workshop, and making available a faucet for Superposition Testnet, producing the Stylus for beginners content, and also helping create the other content where I can. Jack is doing an excellent job, and the content so far is great.</p><p>If you&#8217;re interested, grab a ticket:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://www.ethcluj.org/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q1DN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 424w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 848w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 1272w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q1DN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png" width="1456" height="757" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:757,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://www.ethcluj.org/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q1DN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 424w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 848w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 1272w, https://substackcdn.com/image/fetch/$s_!q1DN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05503aac-32bd-43cc-a42c-ee142940f767_1854x964.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h1>A Huff calldata proxy</h1><p>Tying out our content for today, I wanted to share a EVM preprocessor snippet we put out for our upcoming RFQ and RPC 9lives feature:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">// LiteAccount: Simple calldata forwarder that takes an argument of the
// form WITH NO PADDING (bytes32 sigA, bytes32 sigB, uint128 nonce,
// address target, bytes... cd). Uses Superposition precompiles to
// validate the ed25519 after converting it to sha512, and the
// expectation is the signature was signed with padding.

#define constant STORAGE_ENABLED = FREE_STORAGE_POINTER()
#define constant STORAGE_NONCE = FREE_STORAGE_POINTER()

#define constant ADDR_SHA512 = 0x1f4350205a556587ff3a1f2cb627613685dacb73
#define constant ADDR_EDVERIFY = 0xc3e443be2cfa4f41a5f5e4978d012847d355b419

// [EDVERIFY] the memory, returning a yes or no word on the stack.
#define macro EDVERIFY() = takes(0) returns(1) {
&#9;0x0 0x0 0xa0 0x0 [ADDR_EDVERIFY] gas staticcall
}

#define macro MAIN() = takes(0) returns(0) {
&#9;0x1000000000000000000000000000000000000001 caller eq PRIVILEGED jumpi
&#9;[STORAGE_ENABLED] sload FALLBACK jumpi
&#9;INTERNAL_ERR:
&#9;&#9;// InternalError()
&#9;&#9;0xfe835e35
&#9;REVERT:
&#9;&#9;0x0 mstore 0x04 0x1c revert
&#9;PRIVILEGED:
&#9;&#9;0x0 calldataload [STORAGE_ENABLED] sstore
&#9;&#9;0x0 0x0 return
&#9;FALLBACK:
&#9;&#9;0x40 0x60 0x64 dup1 calldatasize sub
&#9;&#9;dup4 calldatasize sub dup5 0x20 calldatacopy&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// Memory: ..., nonce, target, cd
&#9;&#9;0x01 [STORAGE_NONCE] 0x0 mstore 0x11 0x1f sha3 dup1 sload INTERNAL_ERR jumpi&#9;// [true, slot for nonce], Memory: padding &lt;32 - 1&gt;, storage slot, nonce
&#9;&#9;sstore
&#9;&#9;address 0x0 mstore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// Memory: padding &lt;32 - 20&gt;, address, nonce, target, cd
&#9;&#9;0x0 0x0 0x2c calldatasize sub 0x0c [ADDR_SHA512] gas staticcall&#9;&#9;&#9;&#9;&#9;// [success], Memory: padding &lt;32 - 20&gt;, address, nonce, target, cd
&#9;&#9;returndatasize 0x0 0x0 returndatacopy&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// Memory: hash A, hash B
&#9;&#9;0x2000000000000000000000000000000000000000000000000000000000000002 dup6 mstore&#9;// Memory: hash A, hash B, operator
&#9;&#9;dup5 0x0 dup6 calldatacopy&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// Memory: hash A, hash B, operator, sig A, sig B
&#9;&#9;EDVERIFY()&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// [success], Memory: hash A, hash B, operator, sig A, sig B
&#9;&#9;// Unverified()
&#9;&#9;0xcba605a3 dup2 iszero REVERT jumpi
&#9;&#9;dup4 dup6 0x0 calldatacopy&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// Memory: cd...
&#9;&#9;0x0 0x0 dup6 0x0 0x0 0x50 calldataload dup12 shr gas call&#9;&#9;&#9;&#9;&#9;&#9;// [success], Memory: cd...
&#9;&#9;returndatasize 0x0 0x0 returndatacopy&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// [success], Memory: rd...
&#9;&#9;returndatasize 0x0 dup3 SUCCESS jumpi revert
&#9;&#9;SUCCESS:
&#9;&#9;&#9;return
}

#define macro CONSTRUCTOR() = takes(0) returns(0) {
&#9;0x01 [STORAGE_ENABLED] sstore
}</code></pre></div><p>Have you ever worked with Huff? It&#8217;s a great macro preprocessor for the EVM. Working with EVM code is easy when you have Stylus to handle your precompiles/complex behaviour, and you can just act as a low-cost proxy. This code works calldata generated like the following:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;rust&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-rust">let k = SigningKey::from_bytes(&amp;priv_key.0);
let mut x = Sha512::new();
x.update(&amp;contract.0);
x.update(&amp;nonce.to_be_bytes());
x.update(&amp;target.0);
x.update(&amp;cd.0);
let sig = k.sign_prehashed(x, None).unwrap().to_bytes();
println!(
    "{}{}{}{}",
    const_hex::encode(sig),
    const_hex::encode(nonce.to_be_bytes()),
    const_hex::encode(target.0),
    const_hex::encode(cd.clone().0)
);</code></pre></div><p>I understand why borsh is somewhat stigmatised as a calldata format (EVM conventions, zero byte rebate, etc), though I believe more developers would benefit from the nonstandard format when it comes to Stylus precompiles. It&#8217;s so flexible to create something quickly and to drop it in. This code is a good example of how it can be pretty easy I think. The precompiles here (sha512, ed25519) are available at <a href="https://github.com/fluidity-money/superposition-precompiles">https://github.com/fluidity-money/superposition-precompiles</a>.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a>. Check me out online: <a href="https://bayge.xyz">https://bayge.xyz</a></p><p>I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps at <a href="https://superposition.so">https://superposition.so</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ivfp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ivfp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ivfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg" width="900" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ivfp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ivfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764de1be-750a-415c-818e-5cad58876d88_900x600.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Meme the SPN team made. How about them token prices and AI revolution? Are we having fun?</figcaption></figure></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>I didn&#8217;t want to monologue for too long here, but having a bytecode interpreter for math that&#8217;s generated by a precompile would be amazing to make someday. Someone could also use this in Solidity like a gradually deferred math operation, passing around a word that&#8217;s the concatenation of a script. Then the Stylus contract is invoked to do all the heavy lifting.</p></div></div>]]></content:encoded></item><item><title><![CDATA[To build an Orderbookkit Part 1, Supporting Stylus on Ethereum RISC-V Part 3, Wizard V2, Interview with Burak from Runtime Verification]]></title><description><![CDATA[18 February 2026]]></description><link>https://stylus-saturdays.com/p/to-build-an-orderbookkit-part-1-supporting</link><guid isPermaLink="false">https://stylus-saturdays.com/p/to-build-an-orderbookkit-part-1-supporting</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Tue, 17 Feb 2026 16:11:33 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!t_7T!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! Welcome to February.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!t_7T!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!t_7T!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 424w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 848w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 1272w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!t_7T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png" width="348" height="232" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:786,&quot;width&quot;:1179,&quot;resizeWidth&quot;:348,&quot;bytes&quot;:850784,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!t_7T!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 424w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 848w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 1272w, https://substackcdn.com/image/fetch/$s_!t_7T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1316794d-43bd-47c8-ab2f-21a536070d78_1179x786.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p><a href="https://www.youtube.com/watch?v=b7IrhYGbMww">Why did January go so quickly, was it something that you said</a>? In this week:</p><ol><li><p>To build an Orderbookkit part 1: Some background on the implementation and the design philosophy at work in the architecture of Orderbookkit, a one-click permissionless DEX for Arbitrum chains!</p></li><li><p>Supporting Stylus on RISC-V part 3: Supporting RISC-V execution on-chain on Arbitrum using the new risc-runner, and the practical application of it.</p></li><li><p>The Wizard V2: Building a Verifiable Delay Function proof generator and verifier for a randomness beacon using The Wizard. Part 1 as we flesh out the code.</p></li><li><p>Interview with Burak from Runtime Verification: We had the luxury of learning more about Burak&#8217;s journey through Web3 and Runtime Verification!</p></li></ol><p>I should share that once upon a time we had a competition for survey respondents to receive a Supercat and a Knower NFT for sharing their feedback about our silly little newsletter. It&#8217;s been some time, and I&#8217;ll be awarding the winners soon. Thanks for your patience.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><p>Want to build Arbitrum dApps even faster? Are you an AI user with Claude Code? Try this!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://hummusonrails.github.io/arbitrum-dapp-skill/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!n3sS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 424w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 848w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 1272w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!n3sS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png" width="492" height="504.34538745387454" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1389,&quot;width&quot;:1355,&quot;resizeWidth&quot;:492,&quot;bytes&quot;:332126,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://hummusonrails.github.io/arbitrum-dapp-skill/&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!n3sS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 424w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 848w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 1272w, https://substackcdn.com/image/fetch/$s_!n3sS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F457a5270-b473-475b-a7f5-4a40bbd85732_1355x1389.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Made by the one and only <a href="https://x.com/hummusonrails/status/2019075681234174241">Ben Greenberg (hummusonrails)</a>, it&#8217;s a MCP and setup toolkit that simplifies creating apps on Arbitrum quickly. Give it a try!</p><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Typescript, Zig, and C. Stylus lets you build smart contracts that are 10-50x more gas effective and orders of magnitude more expressive than Solidity smart contracts.</p><div><hr></div><h1>To build an Orderbookkit Part 1, orderbook structure</h1><p>Readers would know that we&#8217;ve been building an <a href="https://orderbookkit.xyz">orderbook for Stylus</a> for some time. Initially, I built a simple Uniswap V3-style tick orderbook with a queue for orders, but I didn&#8217;t feel it worked very well. There was a lot of slippage and price inefficiency, and storage access worked extremely poorly. After doing some research and discovery, I settled on this architecture:</p><h2>A CLOB and RFQ hybrid orderbook</h2><p>Orderbookkit is a CLOB and RFQ hybrid. It functions like a tree-based Central Limit Orderbook (CLOB) with some scaling for price amounts for orders outside the current spread (a custom defined window around the last fill price). Within the spread, a Request For Quote (RFQ) &#8220;sliplane&#8221; exists for off-chain or on-chain bundling and execution of orders.</p><p>Most orderbook operations are price discovery trades from market makers, which consist of tiny order creation then filling and cancellation. An entirely on-chain contract for this use-case is a poor fit, with order cancellation costing a transaction fee. This makes price discovery for market makers challenging. An upcoming Superposition property, Longtail Pro (powered by Espresso and also built with Stylus) takes a more naive approach on this, with a rolled up calldata and a native CLOB on a validium/state channel experience. This approach differs in its native execution flexibility at the expense of a more natural trading experience, and it makes a natural fit for our other application, <a href="https://9lives.so">9lives</a>. Which is growing a lot by the way, and keeping me VERY busy.</p><p>A RFQ hybrid architecture enables wide price swings from retail users by supporting instant execution with an on-chain fill using the tree skipping the RFQ functionality, but for minute trades within the spread, off-chain bundling and free cancellation with the RFQ system. This architecture also enables a ton of programmability options, including turning the RFQ engine into a liquidity sidecar for applications.</p><p>This liquidity sidecar overlayed on top of the RFQ engine supports several models including the 9lives&#8217; Dynamic Pari-Mutuel (DPM) market model, the original version of <a href="https://9lives.so">9lives</a>. It empowers end users of Orderbookkit to choose their bundling and execution strategy, optionally filling liquidity and RFQ orders using cross-chain sources as opposed to local liquidity. It makes applications possible to be written where the orderbook interaction is an afterthought, <strong>making it possible to add selling to models that would not have had support traditionally</strong>.</p><p>This style of opt-in architecture to sidestep the market forces also means dApps could run almost entirely inside Orderbookkit. This, coupled with a recursive calldata pattern (as we&#8217;ve developed for Longtail Pro Passport and alluded to in <a href="https://stylus-saturdays.com/i/168071547/the-user-story">this post</a>, means dApps that run as an application-specific rollup, making gas-free applications possible on Arbitrum and on any Layer 3 chain for some types of interactions.</p><p>This fundamental rethinking as the orderbook not as the vehicle for matching orders but as the vehicle for execution itself is a fun rethinking of bundling applications themselves on-chain! So Orderbookkit could be considered a fun little rollup architecture depending on how its used.</p><h2>On-chain execution with a new plugin architecture</h2><p>Orderbookkit supports programmability with entirely new plugin architecture leveraging RISC-V. Hooks are built not using contracts that are registered ahead of time, but instead by delegatecalling into contracts that are &#8220;jailed&#8221; using a RISC-V simulator, or submitted natively based on the calldata provided by the user.</p><p>End users or the execution bundler elect to run these programs as guests, and the programs are running inside the contract&#8217;s space, so they have access to the storage layout of a high level bundler that&#8217;s run off-chain, or Orderbookkit&#8217;s order matching engine. This means the program can import the storage layout for Orderbookkit very simply, and use it themselves, without a series of onerous callbacks. The simulator enforces a <a href="https://man.openbsd.org/pledge.2">pledge(2)</a>-style syscall restriction on contracts executing alongside a higher level programmable interface inside the guest so these plugins have no escape from their intended purpose or have any potential for collateral damage. The intended purpose of this architecture is that we can develop plugins without needing to permission or register them ahead of time, a problem with existing hooks AMMs and platforms. This approach also works nicely with privacy and other addons by supporting a private order matching engine sidecar that feeds into the same space as everyone else, making opt-in privacy possible.</p><p><a href="https://github.com/fluidity-money/bobcat-sdk">bobcat-sdk</a> has been extended to support RISC-V as a backend, and it can be used this way without any friction.</p><h2>Genetic programming market makers</h2><p>One of the goals of the Orderbookkit project is supporting evolutionary programming for the plugins, optionally generated using a Proof of Work algorithm, like <a href="https://github.com/TecharoHQ/anubis">Anubis</a>. I can&#8217;t say whether this will actually take place, but I imagine it would be fun. Maybe someday someone could write a scalable marketplace for proof of work algorithms that run instead of captchas.</p><p>This type of generated code enables a type of &#8220;cooperative orderbook&#8221;, with limited inherent value to the book. This enables a use-case I&#8217;m very passionate about, figuring out ways to do software timeline estimation within an organisation. Google and HP tried this, and failed due to liquidity issues. We can do better!</p><p>It&#8217;s simple: define a constraint and have your program automatically find the best fit. Evolutionary programs are better at functioning in resource constrained environments as an orchestration layer. The evolutionary programs can compose multiple programs together, including machine learning helpers for example. In our context, they&#8217;re very simple, but later, as we find ways to include more information points on-chain in a way they understand, they could do things like arbitrage spread when there&#8217;s enough liquidity elsewhere.</p><p>These are useful for our cooperative orderbook use-case by enabling us to take lots of information points and combine them together in ways that fit within the code constraints of the on-chain execution. In our prediction context inside organisations, this provides liquidity in a safe way. For everyone else, this fills the gap with missing liquidity amounts.</p><p>I envision a future where end user code searches an application space of user submitted programs that automatically execute in the context of the orderbook. A client, before placing an order in the sliplane, executes a number of programs in parallel before making the order to see if they can automatically fill themselves.</p><p>Contract interactions take place not with a series of external calls out or registrations of callbacks, but as a series of pipelining that took place automatically. I envision that this community search space of execution hooks that are opted into by the user&#8217;s client pay a small premium to the application developer, making it a landscape of programs that greedily consume liquidity chain-wide. It makes arbitrage not a function of professional market makers, but instead automatic programmers who&#8217;ve algorithmically identified opportunities that they pass down to end users. This rethinking that&#8217;s fundamental to Orderbookkit makes the exchange function less as a marketplace of orders but more as a octopus that constantly expands its web of liquidity sources, until it encapsulates everything on-chain.</p><h2>Where&#8217;s the code?</h2><p>I&#8217;m working on it! The risc-runner guest features has made its way to <a href="https://github.com/stylus-developers-guild/bobcat-sdk">bobcat-sdk</a> (missing heap allocation features right now however). There are a few more goals I want to have hit before opening this up to the world, namely:</p><ol><li><p>Support for extending using stylus-sdk for the matching engine for basic accounting that the plugin layer doesn&#8217;t capture.</p></li><li><p>A bundler with multiple signature schemes supported, including the ed25519 precompile supported by Superposition.</p></li><li><p>Better testing.</p></li></ol><p>Keep your eyes peeled for a part 2 on this. Thank you to Pruitt, Srinjoy, and the rest of the grant committee as well as the Arbitrum DAO (the sponsors of this project) for making this development possible! The code will also need to be audited. We&#8217;ll be discussing during our part 2 the implementation, pointing to how to leverage Orderbookkit in your project. We&#8217;ll be making use of this for 9lives to support a direct to market maker feature with the CLOB functionality disabled probably. For 9lives at least, this lets us scale our architecture without setup liquidity for now.</p><div><hr></div><h1>Supporting Stylus on Ethereum RISC-V Part 3</h1><p><a href="https://stylus-saturdays.com/i/168621615/stylus-on-risc-v-32im-part-2-the-sdk-and-environment-calls">Previous post</a></p><p>Part 3 of this series, the conclusion! A working running ELF-parsing example that runs on-chain, with a deployer available at a precompile address on Superposition and Arbitrum One. The code is bundled with Orderbookkit as it forms the basis of the plugin architecture. Let&#8217;s do some review:</p><h2>An example program in Stylus RISC-V</h2><p>Programs in RISC-V Stylus are like the following using bobcat-sdk:</p><pre><code>#![no_std]
#![no_main]

use bobcat_sdk::prelude::*;

#[export_name = "_start"]
pub extern "C" fn _start() -&gt; ! {
    let args = read_args_safe!(args_len(), { 32 * 2 });
    let (x, y) = read_words!(&amp;args, 2);
    write_result_word(&amp;(x + y));
    unsafe { exit_early(0) }
}</code></pre><p>This program simply multiplies two numbers together after reading them off the contract&#8217;s calldata. Behind the scenes, it uses environment calls that function almost identically to the classic WASM Stylus environment, though the way the program asks for memory will be different and require a custom allocator. stylus-sdk is very similar with its RISC-V form, and you can see that in the previous post.</p><h2>Deployment</h2><p>Deploying is like the following once this contract&#8217;s entrypoint is called, with a CREATEX-style hub. This runs inside the entrypoint to the loader:</p><pre><code>let src = OurLzss::decompress_heap(
    lzss::SliceReader::new(&amp;read_args_vec(len)),
    lzss::VecWriter::with_capacity(74 * 1024),
)
.unwrap();
check_elf(&amp;src);
// Make the contract code:
let c = make_contract(src);
// Get the sender's nonce, and use that with CREATE2 so they get
// consistent deployment addresses on every chain they do this with:
let sender = msg_sender();
let slot_key = slot_map(&amp;U::ZERO, &amp;sender.into());
let user_nonce = storage_load(&amp;slot_key);
// Bump their nonce preemptively:
storage_store(&amp;slot_key, &amp;(user_nonce + U::ONE));
// Now we deploy the implementation, with the user's address and nonce:
let salt_pre: [u8; 20 + 32] = concat_arrays!(sender, *user_nonce);
let (impl_addr, _, _) = create2_slice_pre_keccak256::&lt;0&gt;(&amp;c, U::ZERO, &amp;salt_pre);
if impl_addr == [0u8; 20] {
    panic!("bad impl deployment");
}
// Now that we have the implementation, we can deploy the proxy contract
// that calls the loader:
let (proxy_addr, _, _) = create2_slice_pre_keccak256::&lt;0&gt;(
    &amp;make_proxy_loader(impl_addr, RUNNER_ADDR),
    U::ZERO,
    &amp;salt_pre,
);
if proxy_addr == [0u8; 20] {
    panic!("bad proxy deployment");
}
write_result_word(&amp;proxy_addr.into());
0</code></pre><p>The deployment takes the contract and provides the code on-chain, with a prefix to cause the code loaded under normal circumstances to junk out with an INVALID operation. The runner skips this, after beginning its entry of the code.</p><pre><code>#[unsafe(no_mangle)]
pub unsafe extern "C" fn user_entrypoint(len: usize) -&gt; usize {
    let args = read_args_vec(len);
    let features = u16::from_be_bytes(args[20..22].try_into().unwrap());
    libriscrunner::entry(args[..20].try_into().unwrap(), features, &amp;args[22..]).unwrap()
}</code></pre><p>The entrypoint for the runner is to load feature flagging that was given for what should be supported, a restriction like <a href="https://man.openbsd.org/pledge.2">pledge(2)</a>/sysjail, where the host opts into restricting the syscall surface for the guest (or the rest of the program&#8217;s life if we&#8217;re being very literal).</p><p>It loads the entrypoint, the same way we discussed in the <a href="https://man.openbsd.org/pledge.2">OCaml code</a>. The code was loosely ported over, though Rust&#8217;s types for integer types made things a bit easier.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jM5Q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jM5Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 424w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 848w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 1272w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jM5Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png" width="736" height="331" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:331,&quot;width&quot;:736,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48435,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jM5Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 424w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 848w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 1272w, https://substackcdn.com/image/fetch/$s_!jM5Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7d125a7-25c1-4568-8d5c-1fcf25d27662_736x331.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The code differs from the OCaml code in the last post since we could use the program headers instead of section headers (I had some tooling weirdness and couldn&#8217;t use this easily).</p><h2>What&#8217;s next?</h2><p>I&#8217;d like to support the Linux syscall surface and riscv64imgc so we can run Linux and OpenBSD on-chain. It should be achievable, and why not as a nice show and tell? It would be interesting to support an actual operating system or&#8230; Doom(?) on-chain. I&#8217;ve never done the latter (or the former).</p><p>The commercial imperative for me right now is to support Orderbookkit&#8217;s plugin system and competition solver, so this is a future task. With the Linux syscall interface and the rest of the extension, it should be possible to simulate most programming languages where WASM support is weak. Maybe an OCaml loader could come someday, so we can run the bytecode on-chain?</p><p>I&#8217;d like to also support a stylus-sdk trait inheritance extension of the runner for the ecall interface. This means that developers could build custom extensions to the plugin architecture easily. I would like developers to have access to a script interface similar to Bitcoin, where you can send a nice transaction that includes everything you want to do using this support. It should be achievable to have an interface that does this this way, something like this:</p><pre><code>#[public]
impl IRiscRunner for MyToken {
    type Error = permit::Error;

    fn handle_ecall(
        &amp;mut self,
        cpu: &amp;mut Cpu,
        sender: Address,
        ecall_no: usize
    ) -&gt; Result&lt;(), Self::Error&gt; {
        // Do your handling here of anything custom!
    }
}</code></pre><p>As a reminder, you can always sign up for Orderbookkit as it becomes generally available with a user interface at <a href="https://orderbookkit.xyz">https://orderbookkit.xyz</a> to see this in action.</p><div><hr></div><h1>The Wizard V2</h1><p><a href="https://thewizard.app">The Wizard V2</a> came out recently! We&#8217;ve been following their journey for some time, and the newest release includes some major features we&#8217;ll highlight here:</p><ol><li><p>Github integration! Clone repos to work on using the editor without any extra friction.</p></li><li><p>Deployment takes place entirely in the browser using the browser wallet. Deploy a contract using MetaMask or Rabby!</p></li><li><p>Multiple chains are supported with a simple RPC feature!</p></li><li><p>Editor user experience improvements including using multiple networks seamlessly.</p></li></ol><p>These are great improvements for the major V2 release, and to test it out, I set out to create a new contract using only The Wizard.</p><h2>Building a Verifiable Delay Function evaluator with The Wizard</h2><p>We&#8217;re going to build a new contract, a <strong>Verifiable Delay Function</strong> (VDF) proof generator and evaluator!</p><p>A VDF is a problem that&#8217;s solved recursively in a way that can&#8217;t be parallelised, which functions well as a proxy for time and as a randomness beacon. The problem that&#8217;s solved recursively serves as a proxy for whether time has passed and as a randomness beacon, since the problem can&#8217;t be solved in parallel.</p><p>This is useful for the Superposition projects, since this way we can have randomness that&#8217;s not dependent on a randomness committee (with callbacks, a major programming hassle in my opinion) by having the resolving worker ask a service for a number. Our service will run this code constantly, and send it on request. Since our beacon is running on a non soft realtime system, it&#8217;s not perfect, but it&#8217;s a nice combination piece to be used with a random secret commitment from our infrastructure type of situation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q0ae!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q0ae!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 424w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 848w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 1272w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q0ae!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png" width="995" height="405" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:405,&quot;width&quot;:995,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47345,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Q0ae!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 424w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 848w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 1272w, https://substackcdn.com/image/fetch/$s_!Q0ae!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4cab8e1a-997b-405b-bcfb-68b077112eee_995x405.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Setting the scene</h3><p>To begin, we&#8217;ll figure out which VDF algorithm we want to implement. I chose the Pietrzak VDF algorithm depicted literally in <a href="https://arxiv.org/abs/2405.06498">Implementation Study of Cost-Effective Verification for Pietrzak&#8217;s Verifiable Delay Function in Ethereum Smart Contracts</a> from 2024. There are two VDFs I&#8217;m aware of, the Wesolowski and Pietzrak VDFs, and as I understand, the latter&#8217;s prover is more efficient. The estimated gas savings in the paper we&#8217;re paraphrasing here provides us with a way to also say how much gas we&#8217;d save if we implemented the refined verification in Rust Stylus.</p><p>Ordinarily, algorithms like this would be implemented using the GNU Multiple Precision Arithmetic (GMP) library, though for our learning purposes we&#8217;ll be implementing it using Ruint for portability reasons. I imagine that GMP could be used in the WASM context, but I have no idea how. Is it even important since you wouldn&#8217;t net any performance benefits? Maybe someone can implement a &#8220;<a href="https://github.com/fluidity-money/superposition-precompiles">precompile</a>&#8221; with a light scripting language for pipelined gmp operations or simply expose each function this way, I don&#8217;t know the impact on codesize for this.</p><p>We need 2048 bit numbers using Ruint (the size used in the paper), and we&#8217;ll be avoiding optimisations including Montgomery modular multiplication.</p><h3>Implementing the evaluation algorithm</h3><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kK1l!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kK1l!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 424w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 848w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 1272w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kK1l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png" width="446" height="219.07788944723617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:391,&quot;width&quot;:796,&quot;resizeWidth&quot;:446,&quot;bytes&quot;:45623,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kK1l!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 424w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 848w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 1272w, https://substackcdn.com/image/fetch/$s_!kK1l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09b75733-14c3-4c41-8887-e181a8b14f24_796x391.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1oBj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1oBj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 424w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 848w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 1272w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1oBj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png" width="381" height="165" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:165,&quot;width&quot;:381,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12015,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1oBj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 424w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 848w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 1272w, https://substackcdn.com/image/fetch/$s_!1oBj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66987922-b5cb-4e1c-bcd5-527d2a8004ec_381x165.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We&#8217;ll be evaluating all code using The Wizard. The evaluation algorithm is pretty simple. It&#8217;s <code>y = x^(2^T) % T</code>. The evaluation algorithm is the time consuming delay function code that we need to use to generate the proof. It&#8217;s the crux of the algorithm, we need it to consume time, since its applied recursively without known parallelism.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> The maximum size of the input we&#8217;ll use for U is the largest Ethereum word we can use, so we don&#8217;t need to adjust the number here to avoid overflowing.</p><p>The inputs to this function and the rest are (paraphrased from the paper, almost literally copied):</p><ul><li><p><code>x</code>: The input for the VDF evaluation.</p></li><li><p><code>N</code>: The modulus (an RSA modulus <code>N = p * q</code>), where <code>p</code> and <code>q</code> are large primes.</p></li><li><p>T: The time delay parameter, where <code>T = 2^tau</code> for some tau (&#964;).</p></li><li><p>tau: The number of iterations needed for the proof. The higher this is, the greater the amount of time we&#8217;d have to spend.</p></li><li><p><code>y</code>: The output value, computed as <code>y = x^(2^T) mod N</code>. Aka, the evaluation function we just showed off.</p></li></ul><h3>Implementing the proof generation algorithm</h3><p>Let&#8217;s implement the proof generation. This is the algorithm in the paper:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dUlf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dUlf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 424w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 848w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 1272w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dUlf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png" width="457" height="470" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:470,&quot;width&quot;:457,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50912,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dUlf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 424w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 848w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 1272w, https://substackcdn.com/image/fetch/$s_!dUlf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a4bf03d-15f2-45de-8fc9-d3e1de4c0662_457x470.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What this essentially does is split the evaluation algorithm&#8217;s chain in half (the halving protocol). The implementation looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SZ-m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SZ-m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 424w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 848w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 1272w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SZ-m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png" width="779" height="460" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:460,&quot;width&quot;:779,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:83228,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SZ-m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 424w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 848w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 1272w, https://substackcdn.com/image/fetch/$s_!SZ-m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5b47884-f36e-437f-b019-e7688e6e5cc2_779x460.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This function is pretty ugly and leaves much to be desired with its performance and readability characteristics. The implementation here makes use of variables instead of vectors. While taking T, it will use a 64-bit number here. The reason is that T is the amount of time that needs to pass, and we want to tolerate that number being quite high. Though the wasm32 machine natively doesn&#8217;t support words of this size, it supports 64-bit operations. We&#8217;ll be pushing the higher end of the 64-bit numbers for our time spent here.</p><h2>Implementing the refined verification algorithm</h2><p>This ability to skip time features in the refined algorithm:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6pU2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6pU2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 424w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 848w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 1272w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6pU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png" width="636" height="595" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:595,&quot;width&quot;:636,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:71801,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6pU2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 424w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 848w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 1272w, https://substackcdn.com/image/fetch/$s_!6pU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb808ed8c-48de-4e68-b09b-bbadfa4a41e3_636x595.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"></figcaption></figure></div><p>Which looks like this in The Wizard:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IdTd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IdTd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 424w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 848w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 1272w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IdTd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png" width="817" height="433" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:433,&quot;width&quot;:817,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89310,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!IdTd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 424w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 848w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 1272w, https://substackcdn.com/image/fetch/$s_!IdTd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb039c397-5dcc-49d1-a5e1-6f766b03a3b0_817x433.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Since the protocol works with halving to verify the generated proof, the larger the time parameter, the larger the proof size (and therefore the calldata we send on-chain). Since we can&#8217;t afford to have a situation where this is the case, Pietrzak implemented a way to skip an amount of time in the proof. For this reason, we avoid calculating when someone enforces a time skip parameter to avoid wasteful computation.</p><p>We do bitshifting math instead of performing 2 to the power of 2 here, to save a few cycles. We use pow_mod to avoid overflowing the number. Special shoutout to Claude for doublechecking my work, Erik of Fluidity Labs for a review, and Tolga for fixing problems I ran into when using The Wizard!</p><p>In a part 2, we&#8217;ll review this code and test it properly, and do a formal comparison to the paper to understand the gas consumption differences!</p><div><hr></div><h1>Interview with Burak from Runtime Verification</h1><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Yo21!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yo21!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yo21!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg" width="400" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35522,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/184192411?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Yo21!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Yo21!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b626c00-5d3a-4aed-956b-e68538f77147_400x400.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Runtime Verification are working on extending their Skribe tool to support Stylus! We&#8217;ve recently been collaborating with them as they have their tool work on the 9lives repo. I can tell that Burak is a heavy dev based on the modifications they&#8217;ve been making to the 9lives repo to support <a href="https://github.com/runtimeverification/skribe">Skribe</a>.</p><h2>Who are you, and what do you do?</h2><p>I&#8217;m a Research Engineer at <a href="https://runtimeverification.com/">Runtime Verification</a>. My focus is on building formal verification and property-based testing tools for blockchains, using the <a href="https://github.com/runtimeverification/k/">K framework</a> and formal semantics as the foundation. In practice, that means trying to make strong correctness guarantees usable by everyday smart contract developers.</p><p>Most of my work revolves around Rust and WebAssembly. Recently, I&#8217;ve been working on Skribe, a property-based testing tool for Arbitrum Stylus. <a href="https://github.com/runtimeverification/skribe">Skribe</a> is intended to be the Arbitrum equivalent of Foundry&#8217;s fuzz testing for Solidity, with support for both Rust and Solidity contracts.</p><h2>What web3 ecosystems have you worked in?</h2><p>Most of my work has been on WASM-based blockchains. So far, that includes MultiversX, Stellar, and now Arbitrum. Across all three, I&#8217;ve worked on similar problems: building formal verification and property-based testing tools for smart contracts.</p><p>For MultiversX, we developed a tool called <a href="https://kasmer.runtimeverification.com/">Kasmer</a>, which we used for the formal verification of real-world contracts such as multisigs and AMMs. For Stellar, we built Komet, which we actively use in Stellar smart contract audits for property-based testing. More recently, I&#8217;ve been working on Skribe for Arbitrum Stylus.</p><h2>What are your impressions of working with Stylus?</h2><p>Rust + WASM + EVM is a genuinely exciting combination. On the EVM side, there is already a mature ecosystem that has been built up over many years. Rust complements that with a strong type system, good performance, and more explicit control over memory and correctness, things I personally care about a lot.</p><p>From that perspective, Rust fits smart contract development well: it is type-safe, predictable, and efficient. Its popularity and wide adoption can also make Arbitrum more appealing to a broader developer audience. Another nice upside is that existing general-purpose Rust libraries can potentially find their way into smart contracts, which opens the door to reusing well-tested building blocks.</p><h2>What software do you use?</h2><p>We mainly work with the K Framework, a formal semantics framework developed at Runtime Verification. With K, we define the semantics of a programming language in the K language, and from that definition the framework gives us, almost automatically, an interpreter and a symbolic execution engine. On top of these, we build formal verification and property-based testing tools.</p><p>Up to this point, this might sound quite theoretical and a bit intimidating. In practice, though, our focus is on using this foundation to build practical tools that regular developers can actually use. We take the underlying mathematical foundation and turn it into accessible, developer-facing tooling, rather than something that only formal methods experts interact with.</p><p>As I mentioned earlier, we work across multiple blockchain ecosystems. What makes this feasible is that semantics written in K are reusable, modular, and extensible. For example, the same WASM semantics can be shared across MultiversX, Stellar, and Stylus, instead of reimplementing everything from scratch each time. As a result, improvements made for one project often carry over to others, which lets us move faster and build on accumulated work rather than starting over for each ecosystem.</p><h2>What hardware do you use?</h2><p>Most of my time on a computer is spent compiling code or running large test suites. Because of that, I use a Linux desktop with the fastest CPU I can reasonably get and plenty of RAM.</p><p>CPU performance matters a lot for compilation and symbolic execution workloads, and having enough memory helps keep things smooth when running multiple tests or analyses in parallel. Beyond that, I honestly don&#8217;t care much about the rest of the hardware, and I&#8217;m not even sure what kind of GPU is in the machine.</p><h2>How can we get in touch with you?</h2><p>You can reach me via Telegram (<a href="https://t.me/bbyalcinkaya">bbyalcinkaya</a>). For broader questions or collaborations, getting in touch through Runtime Verification (https://runtimeverification.com/) is also a good option.</p><h2>What&#8217;s a piece of advice you&#8217;d give someone new to web3?</h2><p>I&#8217;d suggest starting with a security mindset from day one. In web3, mistakes tend to be permanent and expensive, so correctness matters much more than in many other areas of software development.</p><p>It&#8217;s worth looking at the methods and practices used in the industry to write safer and more reliable smart contracts: things like testing, fuzzing, audits, and, where possible, formal verification. Even if you don&#8217;t use all of these tools yourself at the beginning, understanding why they are used helps shape how you design and reason about your code.</p><p>Just as important as doing formal verification is adopting a formal verification mindset. Thinking explicitly about the properties and invariants of the system you are building, and trying to express them as precisely as possible&#8212;even mathematically&#8212;can be very valuable, regardless of which tools you end up using.</p><div><hr></div><p>Runtime Verification can be contacted via their <a href="https://runtimeverification.com/">website</a>. Burak can be connected with <a href="https://tr.linkedin.com/in/bbyalcinkaya">via Linkedin</a>. He can also be <a href="https://github.com/bbyalcinkaya">followed via Github</a>!</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps at <a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c3Js!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c3Js!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 424w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 848w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c3Js!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg" width="546" height="401.00666666666666" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:900,&quot;resizeWidth&quot;:546,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!c3Js!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 424w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 848w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!c3Js!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F776c1540-b8af-40b0-9ccc-fd065f375e3d_900x661.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Using the Montgomery form here could be a major performance improvement, which is important, since we&#8217;re using the same Rust code in the production application. I don&#8217;t know and need to learn more about this. The version that Superposition ships may use this optimisation.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Why learn Stylus in 2026? Port Solana contracts to Arbitrum with StylusPort!]]></title><description><![CDATA[11th of January, 2026. An essay and sharing a link to StylusPort.]]></description><link>https://stylus-saturdays.com/p/why-learn-stylus-in-2026-port-solana</link><guid isPermaLink="false">https://stylus-saturdays.com/p/why-learn-stylus-in-2026-port-solana</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sun, 11 Jan 2026 08:59:50 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/194e6fa7-67a7-4987-a468-b98a4c51c256_1024x733.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! Happy New Year and early January! It was a fun year, what are your resolutions? I generally stay away from resolutions, since you can&#8217;t &#8220;become successful&#8221; or &#8220;stop &lt;activity&gt; here&#8221;. You can &#8220;spend 10 minutes every day programming on that task you wanted to do&#8221;, or in my case, &#8220;spend 10 minutes writing <a href="https://rust-for-smart-contracts.com/">my book</a> each day&#8221;.</p><p>In our case here, for our newsletter, we&#8217;ll be focusing back on trying new things to keep the blog fun and fresh. A goal for us is to avoid heavy technical Goliath tasks, and to focus on space recaps. I enjoy the hard tasks, but they&#8217;re time consuming and people report they can be hit and miss, unless they solve a specific technical purpose. I&#8217;m going to make more of an emphasis on interesting technical storytelling. A New Years Resolution will be to also &#8220;write something opinionated at least once in a storytelling voice&#8221;. Let&#8217;s see how that goes.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>We&#8217;ll kick this year off with a freeform opinion piece on why you should take an interest in Stylus this year, and we&#8217;ll discuss StylusPort and everything they&#8217;ve been up to.</p><div><hr></div><h1>Why learn Stylus in 2026?</h1><p>Why learn Stylus in 2026? You may have heard about Stylus last year, and wondered, how has the adoption been? Should I invest time into learning? In this little writeup, I&#8217;ll make the case that you should, for a few reasons. To recap: Arbitrum Stylus is a technology to build Ethereum Virtual Machine (EVM) compatible smart contracts using Rust and several other programming languages. The smart contracts are executed after a compilation to native code from WebAssembly, an alternative instruction set and execution environment than the EVM. This means natively higher performing smart contracts!</p><h2>Stylus makes more ideas possible</h2><p>Stylus makes it possible to do things like implement Bayesian statistics on-chain without a major compute-driven gas hit. It made Renegade possible, a fully anonymous swap with on-chain and off-chain elements. It makes our boring CPMM model possible to implement for 9lives without doing an off-chain binary search, and it supports our uniquely weird contract development process, including a vertical integration with the rest of our tool ecosystem alongside our feature flag experimentation. Teams like Fairblock are long-term bullish on Stylus, and they&#8217;re building essential privacy tools that do things from anonymous swaps to anonymous prediction markets.</p><p>For hard hitting teams, Stylus is the 10x enabler since you can implement ideas with without going &#8220;uhhh&#8230; should/can we even implement this on-chain?&#8221; You&#8217;re not caught in that philosophical trap the Ethereum developers were caught in when they built the EVM. At first, state channels and validiums were seen as the only legitimate way to build applications for users, owing to the Bitcoin philosophical history of not wanting to pollute the blockspace. This is the historical baggage of the virtual machine and language tooling we have available with Solidity and the classic EVM, including its block and codesize restrictions. Eventually, sidechains and layer 2s came around, inheriting the programmability of the base chain to provide economic guarantees to their users for more programming flexibility. Now, it&#8217;s not even a topic for debate that this method of a hub-and-spoke model of contract ecosystems is superior to a walled garden of various isolated state channels or <a href="https://lightning.network/">solving graph optimisation problems for which there is no known solution</a>.</p><p>Building on the technical opportunity of the Arbitrum L2, Stylus is the fundamental gamechanger that we can build applications with the way we do for web2. Thanks to the broader suite of languages we can choose from and the technical capabilities of the Arbitrum VM executing complex code with ten times the cost efficiency, we can express ideas more succinctly and focus more on the business logic of what we&#8217;re building. This unlocks faster development and faster ideation, and a more relentless user focus other than engineering problem solving.</p><p>We don&#8217;t need to be concerned with the discussion of &#8220;should this even be on-chain in the first place?&#8221;. We can build without needing to get our backs thrown out by being restricted to the language intended for Ethereum&#8217;s architecture and philosophical setting. Freeing ourselves from the complexities of working within the classic EVM means faster development, which means faster idea turnover, which means faster building of ideas that matter. <strong>The conversation goes from &#8220;how can we effectively compress the product story to eventually land on-chain&#8221; to &#8220;how can we implement the coolest shit?&#8221;</strong></p><h2>Stylus is positioned to grow a lot</h2><p>Stylus will continue growing. My team built on Solana during the earlier days. This was before Anchor was a thing, and it was ROUGH. These were the days of before Helius, when RPC was a total nightmare. I still have nightmares about our providers going out of sync with each other. We were building a new stablecoin for Solana that would pay you for making transactions with it, and we needed live updates without interfering with the SPL token standard.</p><p>Building with Rust was a challenge for us back in those days. Despite our best efforts at the time, Solana&#8217;s ecosystem at the time was partly captured by a pair of brothers who pretended to be more than five different people. We could not get integrated with anything, nothing was documented, the entire experience was rough. Eventually the brothers got caught out in their fraud, hurting the ecosystem for a time. Nothing spells grit in this ecosystem like a Solana dev that stayed building with Solana after that period, that was a hard time.</p><p>They wash traded the transactions between their ecosystems, counting TVL several times over, and you couldn&#8217;t verify that they were actually organic transactions because <strong>Solana did not back then have an open source ecosystem like Arbitrum and Ethereum</strong>. We tried at one point to add ourselves to the most popular multisig provider, and we couldn&#8217;t! It was completely closed source (and by that same dev, we learned). If Solana can make Rust and a new programming model work in those circumstances, we can with our open source mindset and superior measurement tools. We have the major technical advantage over this with our storied open source development story and ecosystem narrative that code should be for everyone to see.</p><p>Stylus unlocks that flexibility and Solana, the closest success story, was operating on unfavourable technology terms compared to us, and they still made it work. We have the best devex as an ecosystem for building and measuring smart contracts. Stylus will succeed in combining that with one of the best language ecosystems for development.</p><h2>The commercial opportunity is there</h2><p>Arbitrum is the home of defi. Out of the layer 2s at the time of writing, we have the highest TVL. We have some of the most proactive supporters in the ecosystem. I&#8217;ve lost count of the number of times I&#8217;ve felt thankful to people in the space for promoting my silly lil&#8217; projects, these people range from growth and devex (though I have an aversion to doing anything other than shipping product, so I let my guys Ivan and Shahmeer talk to people on my behalf). We have the most established and proactive DAO, with the most vocal community, the most sustainable economics owing to clever solutions instead of blasting vanity metrics like speed of block creation.</p><p>If you want support, you build on Arbitrum. You can DM me or anyone else in the ecosystem, and we&#8217;d be happy to promote and help you however we can. Arbitrum is an established player with leading defi distribution for ecosystem reasons, the airdrop was long ago. Build with Arbitrum and get the best of a great community, and the best product enabler for your ideas.</p><h2>You should be nerdsniped by Stylus</h2><p>Let me speak to the Miladys who should be uniquely excited by this opportunity: Why are you gas golfing the EVM? You&#8217;re finding ways to circumvent human invented rules around consumption of resources on an imaginary super computer. Why don&#8217;t you solve hard of how to implement and represent programming ideas, in ways tangible to the raw expression of your concept? Free your wetware from the constraint of the EVM tooling stack itself!</p><p>Please try Stylus! This is an open call to people, if you want to learn Stylus, I will spend time with you, I will take your complaints directly to the team building Stylus tooling, you can write for this blog, I&#8217;ll pay you to do it even (for an article). Build something, get frustrated with the type system, get frustrated with the learning curve of Rust, hit a codesize blocker, dig deeper, understand, enjoy the nearly infinite skill ceiling of this tech stack. And yes, it&#8217;s just Rust with WASM on the EVM when it comes down to it. I know money doesn&#8217;t appeal to you &#8212; I&#8217;ve seen you working with your SMT solvers, I&#8217;ve seen you posting unhinged takes on X &#8212; I know you don&#8217;t care about money like that. But please, you&#8217;re so cool doing your optimisation! Try Stylus out, see what&#8217;s about to come.</p><p>The thing is, 2026, this is only the beginning. This is the year the chickens have come home to roost from the last year of fermenting the tooling Kefir. This is the year that you can leverage arbos-foundry for on-chain testing if you must integrate with Solidity, Walnut is in a good place (if GDB is your fancy), there are a few projects that are in the scaling stage of development, and the codesize restriction will be lifted &#8212; this is the main complaint with Stylus. Come and enjoy the pleasure of working on product and computational problems instead of EVM engineering.</p><p>When you work at a high level and you program every day for hours on end, your brain forms a new section that&#8217;s a mixture of the traditional centers of math and language. Like the mirror neuron section of your brain in a nice conversation (I know this may be unknown to you autists out there), you mirror the problem of a technical exercise when you model the domain. The act of programming in Stylus unlocks your brain in the sense that the metaphor is richer, the idea is more succinct, courtesy of Rust (and the phethora of other languages Stylus supports). The higher level programmer understands that to mock the idea, you mock the context. This is why many strong programmers build DSLs and mini languages to solve their problems. The highest level programmers translate their <a href="https://mitpress.mit.edu/9780262045490/software-design-for-flexibility/">expression to the same medium of expression and combine the pieces like a jigsaw</a>.</p><p>This is why railway-style programming exists, why category theory is reasoned about by functional programmers, why programmers translate their ideas into units of combinators then combine them together. Why APL programmers slam their applications together into one term, even putting aside the engineering context. If any of these ideas are new to you, or even the tools I&#8217;m using to express them, open your mind! There&#8217;s a saying, if you want to think, write! Write better with Stylus. Everything I&#8217;ve just said here is foreign to the classic EVM toolchain thanks to Solidity. Play with Stylus and let us know. The domain is rich, the opportunity is massive, build bodies of financial concepts bundled in technology.</p><div><hr></div><h1>Stylusport&#8217;s handbook for Solana and MCP server</h1><p>How do you convert a Solana project to run on Arbitrum?</p><p>StylusPort have been up to a lot, having written a handbook on how to port projects from Solana to Stylus! Solana&#8217;s memory model fundamentally differs from the EVM&#8217;s, with an account-based model as opposed to a contract model with key value storage. Solana&#8217;s method of storage is more akin to allocating virtual memory pages, then having a location for writing.</p><p>The reason for this stems from explicit parallelism (needing to explicitly indicate the resources you intend to contend), and providing developers flexibility to choose the serialisation method in their Rust applications.</p><p>How do you port code under these circumstances of needing to opt into what you intend to do? StylusPort have built a handbook and MCP server that you can use to guide your translation efforts.</p><p>Let&#8217;s dive in!</p><h2>The handbook</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://oak-security.github.io/stylusport/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uSWC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 424w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 848w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 1272w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uSWC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png" width="1029" height="627" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4820506c-ebe2-4918-a348-f029690519fc_1029x627.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:627,&quot;width&quot;:1029,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:173413,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://oak-security.github.io/stylusport/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/181570232?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uSWC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 424w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 848w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 1272w, https://substackcdn.com/image/fetch/$s_!uSWC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4820506c-ebe2-4918-a348-f029690519fc_1029x627.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The handbook introduces types in Solana from a contract-first perspective, some background of the memory approach in Solana, and the cross-program calling interface.</p><p>The key distinction in my mind between Solana and Ethereum is that in Solana, you&#8217;re mostly building programs in the present and post Unix sense that they fulfill some role with some shared storage somewhere that the calling domain has access to with permissions. A useful analogy is the way that programs on your computer access files on disk, with their varying permissions and such. EVM-compatible machines like Arbitrum have the storage of the contract revolve around the contract itself, so there&#8217;s no distinction between the contract&#8217;s storage and the application.</p><p>I felt that the handbook does a good job of explaining this difference. The handbook provides examples for transitioning a contract implemented without the Solana DSL Anchor, as well as with. The book provides a helpful exploration of the builtin types that the SDK provides, as well as an explanation of the type of storage that takes place.</p><p>I encourage you to check it out if you&#8217;re curious about bringing a Solana app to Arbitrum!</p><h2>MCP</h2><p>The team have actually provided a Model Context Protocol (MCP) integration that teaches a locally running LLM instance how to port Solana to Arbitrum! It actually detects context about your project, guides you through the process of making the replacement, and more!</p><p>It&#8217;s pretty comprehensive in the sense that the MCP server completely understands the handbook, as well as even having the capabilities of suggesting a path to a full migration! The example for Raydium really impressed me:</p><p><a href="https://github.com/oak-security/stylusport/blob/main/mcp/docs/sample-plan-prompt-output-raydium-cp-swap.md">https://github.com/oak-security/stylusport/blob/main/mcp/docs/sample-plan-prompt-output-raydium-cp-swap.md</a></p><p>It actually breaks down the entire process including how to guarantee appropriate access control.</p><p>These are some screenshots:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Yo4s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yo4s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 424w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 848w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 1272w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yo4s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;MCP Inspector Resources Page&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="MCP Inspector Resources Page" title="MCP Inspector Resources Page" srcset="https://substackcdn.com/image/fetch/$s_!Yo4s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 424w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 848w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 1272w, https://substackcdn.com/image/fetch/$s_!Yo4s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8141e0b6-7aa7-4687-b39a-199a1583061e_3024x1728.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xGsR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xGsR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 424w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 848w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 1272w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xGsR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;MCP Inspector Prompts Page&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="MCP Inspector Prompts Page" title="MCP Inspector Prompts Page" srcset="https://substackcdn.com/image/fetch/$s_!xGsR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 424w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 848w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 1272w, https://substackcdn.com/image/fetch/$s_!xGsR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f312986-4b20-4acc-a233-8730ea807bfb_3024x1728.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Very impressive! Check it out at <a href="https://github.com/oak-security/stylusport/">https://github.com/oak-security/stylusport/</a>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/oak-security/stylusport/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hdoo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hdoo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/oak-security/stylusport/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hdoo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!hdoo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe74e93a0-70c2-4ec0-a479-f5d47f6c7a5f_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>StylusPort are hosting a workshop on the 21st of this month! Check out the tweet and follow them here:</p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://x.com/SecurityOak/status/2009173822285685056&quot;,&quot;full_text&quot;:&quot;The third and final StylusPort workshop is happening on January 21.\n\nSign up here:&quot;,&quot;username&quot;:&quot;SecurityOak&quot;,&quot;name&quot;:&quot;Oak Security&quot;,&quot;profile_image_url&quot;:&quot;https://pbs.substack.com/profile_images/1985667651813638145/_tIQNDO3_normal.jpg&quot;,&quot;date&quot;:&quot;2026-01-08T08:02:22.000Z&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{&quot;full_text&quot;:&quot;Building on Solana and curious about Arbitrum Stylus?\n\nJoin our workshop on StylusPort, the framework that makes Solana to Stylus migrations faster and more secure.\n\nLive demos, security best practices, and Q&amp;amp;A.\n\nSign up here: https://t.co/Sjmvonb0sB&quot;,&quot;username&quot;:&quot;SecurityOak&quot;,&quot;name&quot;:&quot;Oak Security&quot;,&quot;profile_image_url&quot;:&quot;https://pbs.substack.com/profile_images/1985667651813638145/_tIQNDO3_normal.jpg&quot;},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:1,&quot;like_count&quot;:4,&quot;impression_count&quot;:173,&quot;expanded_url&quot;:null,&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps at </p><p><a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nk5M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg" width="545" height="411.77777777777777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1088,&quot;width&quot;:1440,&quot;resizeWidth&quot;:545,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:&quot;Image&quot;,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!nk5M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[RIP BOZO, Devconnect Buenos Aires Stylus meetup by WakeUp Labs]]></title><description><![CDATA[7th December 2025]]></description><link>https://stylus-saturdays.com/p/rip-bozo-devconnect-buenos-aires</link><guid isPermaLink="false">https://stylus-saturdays.com/p/rip-bozo-devconnect-buenos-aires</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sun, 07 Dec 2025 10:58:45 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0e64d384-05c4-4023-802e-ae1f545f8cc0_3500x2333.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! I hope late December is treating you well. We&#8217;ve been away for so long, I&#8217;ve been busy doing development on <a href="https://orderbookkit.xyz">Orderbookkit</a>, and we have a deficit of posts in the newsletter at this moment. In this week:</p><ol><li><p>Devconnect Argentina happened! It was amazing. <a href="https://x.com/wakeuplabs">WakeUp Labs</a> organised a fantastic get together for the community, and yours truly was there! Let&#8217;s discuss.</p></li><li><p>Announcing <a href="https://ripbozo.lol">RIP BOZO</a>: A production app show and tell for bobcat-sdk. Deposit more than the last user, and be the last Bozo standing to win the prize pool! Including a silly little video.</p></li></ol><div><hr></div><p>Read on, and as always, if you have any feedback, please share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="516" height="208.6171875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:516,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Typescript, Zig, and C. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts. </p><div><hr></div><h1>Devconnect Argentina recap</h1><p>Devconnect Argentina happened! I headed there to give a talk on the history of Stylus including it&#8217;s on-chain penetration. Unfortunately, on the flight over, I got sick and lost my voice, so we gave my talk a miss. Thankfully <a href="https://ar.linkedin.com/in/jessfogel">Jess</a> and the <a href="https://x.com/wakeuplabs">WakeUp Labs</a> team were very forgiving. At their Stylus event, there were several speakers, including:</p><ol><li><p><a href="https://x.com/Pememoni">Peyman, co-founder of Fairblock</a> spoke about <a href="https://x.com/0xfairblock">Fairblock</a>&#8217;s on-chain confidentiality with Stylus. Fairblock are super contributors to the ecosystem!</p></li></ol><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3277848-5252-4d7d-9003-a7338b5db64e_3500x2333.jpeg&quot;},{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bc7fdfde-b031-466b-b5e8-7a5083923607_3500x2333.jpeg&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41bf7931-9a2b-49d7-9dd0-7dbad6bbcd67_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><ol start="2"><li><p><a href="https://x.com/srinjoycal">Srinjoy</a>, product manager at <a href="https://x.com/Offchain">Offchain Labs</a> managing Stylus, reflected on the adoption of Stylus, what&#8217;s working, and what&#8217;s next.</p></li></ol><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/befe9a09-fcca-44a9-becd-7f9ad45489c2_3500x2333.jpeg&quot;},{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f97ce11e-d104-453a-9dc5-59e04b33d810_3500x2333.jpeg&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11b83efd-8460-414a-9be3-b4b64add2b2b_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><ol start="3"><li><p><a href="https://x.com/SDLerner">Sergio</a>, co-founder of <a href="https://x.com/FairGateLabs">Fairgate</a> discussed smart contract execution on Bitcoin, and how Stylus uniquely enables the sidecar that&#8217;s needed using Arbitrum and BitVMX. This was a very engaging talk!</p></li></ol><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0625d20d-9754-4bce-937b-6cf94c239d99_3500x2333.jpeg&quot;},{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d72659c1-31fd-4509-bd9b-57f8c49d1350_3500x2333.jpeg&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33125978-ca92-4966-9f03-b3df3da09a2c_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><ol start="4"><li><p><a href="https://x.com/0xMilton">Milton</a>, co-founder of <a href="https://x.com/wakeuplabs">WakeUp Labs</a> spoke at length about their AssemblyScript (TypeScript) to Stylus compiler. <a href="https://stylus-saturdays.com/p/time-travelling-debugging-with-codetracer">We covered this in a previous post</a>!</p></li></ol><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b21490af-6e66-49e9-b039-337985e9070e_3500x2333.png&quot;},{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23b6a9f3-ae9c-42a9-a580-2948b37dc412_3500x2625.png&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00cf8d6d-64fd-4a8c-9846-d104f4066ee7_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><p>The rest of the event was nice, it was great to meet so many contributors from the space.</p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0615d55e-5f0e-49d7-ba04-5cead771c241_3500x2333.png&quot;},{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/875d114b-35d3-4a7f-ab9f-ff0a95b669ef_3500x2333.png&quot;},{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad43f1fc-2c83-4493-a504-eeb681f7a02f_3500x2333.png&quot;},{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3e9632d-0223-4b8e-989f-17d21387c4b9_3500x2333.png&quot;},{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ebe39b4-fb44-4fd6-b2cf-b3a1dc3f2ade_3500x2333.png&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/246b3ff7-d010-4625-a8fb-b9289b24239c_1456x1210.png&quot;}},&quot;isEditorNode&quot;:true}"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V3XZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V3XZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 424w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 848w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 1272w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V3XZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19246682,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175316248?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V3XZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 424w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 848w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 1272w, https://substackcdn.com/image/fetch/$s_!V3XZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1096764b-3c32-42a3-9d62-096a73f4dbce_3500x2333.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At Arbitrum Day, the mood was electric. It was great to name so many faces! WakeUp Labs spoke at a panel on Stylus, which was really great.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7H8F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7H8F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 424w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 848w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 1272w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7H8F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png" width="595" height="916" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:916,&quot;width&quot;:595,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:355571,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175316248?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7H8F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 424w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 848w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 1272w, https://substackcdn.com/image/fetch/$s_!7H8F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36f72634-0ad7-4f31-99fe-ba5d61c2db91_595x916.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>My talk will make a reappearance in the future at another venue, and in a recorded video for WakeUp Labs to distribute. We&#8217;re really lucky to be a part of the ecosystem, and Arbitrum at large!</p><div><hr></div><h1>Announcing RIP BOZO</h1><p><a href="https://ripbozo.lol">RIP BOZO</a> is a defi game of chicken where the rules are simple: <strong>be the last to deposit when the time runs out, and win everyone&#8217;s deposits</strong>. I developed this as a fun little show and tell for <a href="https://github.com/stylus-developers-guild/bobcat-sdk">bobcat-sdk</a>, and it <a href="https://github.com/stylus-developers-guild/bobcat-sdk/tree/trunk/examples">lives fully open source in the examples directory</a>. The code includes the graph that takes comments, the webapp, and the contract code. The game is powered by USND, the stablecoin by <a href="https://nerite.org/">Nerite</a> by <a href="https://x.com/CupOJoseph">CupOJoseph</a>, a decentralised algorithmic stablecoin for the Arbitrum ecosystem.</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;4485ffba-6709-4139-8011-c4004c4e722e&quot;,&quot;duration&quot;:null}"></div><p>I vibecoded the frontend with Codex after making the frontend in Figma. Each match lasts 45 minutes, with the last depositor to a growing prize pool that can only be added to if the amount exceeds 110% of the last deposit winning. The contract, despite reverting with an actual stack trace when a revert happens (using <code>Error(string)</code>) is only 30kb. Cool!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OC4i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OC4i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 424w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 848w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 1272w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OC4i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png" width="544" height="993" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2beac141-019e-40e3-8663-18dd503107f2_544x993.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:993,&quot;width&quot;:544,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:121172,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175316248?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OC4i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 424w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 848w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 1272w, https://substackcdn.com/image/fetch/$s_!OC4i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2beac141-019e-40e3-8663-18dd503107f2_544x993.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m developing this project in collaboration with <a href="https://x.com/ivansn_">Ivan of Superposition</a>. We&#8217;ll have socials and a points program soon! The app is live on Farcaster, and we&#8217;re adding support for using Relay to buy from another chain virtually instantly into USND and a position.</p><p>The source code includes the entire webapp, the graph code, and more. It also includes the crank script that automatically resets the game and supplies it with randomness.</p><h2>bobcat-panic</h2><p>bobcat-panic is a crate with multiple panic-related features to make Stylus development simpler and safer. Enabling it with <code>no_std</code> and the feature <code>panic</code>, it supports the following flags:</p><ol><li><p><code>panic-revert</code>: On panic, print the full panic message. This is usually an explanation (if you were to use assert! for example), and the line that the error took place. Super helpful for understanding why something broke down.</p></li><li><p><code>panic-loc</code>: On panic, print the filename and line that the issue took place in.</p></li><li><p><code>panic-trace</code>: On panic, print the last register of a transient storage slot that was written to, decoding a string or number that was written there.</p></li></ol><p>RIP BOZO actually uses <code>panic-revert</code>, and it falls under codesize anyway!</p><h2>Testing with Forge Foundry (arbos-foundry)</h2><p>The testing code was developed in collaboration with Bernard of the <a href="https://github.com/iosiro/arbos-foundry">arbos-foundry</a> team, so the <a href="https://github.com/stylus-developers-guild/bobcat-sdk/tree/trunk/e2e-test">end-to-end tests</a> are a good example of how to use arbos-foundry to test your code.</p><p>The tests in the broader bobcat-sdk repo include fuzzing, with this example being testing an exotic permissionless upgradeable proxy, which we titled the metamorphic migration pattern. This is such a great tool for testing Stylus contracts in the real world!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_Xcj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Xcj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 424w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 848w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 1272w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Xcj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png" width="909" height="1029" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1029,&quot;width&quot;:909,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:158258,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175316248?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Xcj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 424w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 848w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 1272w, https://substackcdn.com/image/fetch/$s_!_Xcj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa472d871-d1d1-42a5-9c71-79e0939c2277_909x1029.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps at <a href="https://superposition.so">https://superposition.so</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nk5M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg" width="545" height="411.77777777777777" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1088,&quot;width&quot;:1440,&quot;resizeWidth&quot;:545,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!nk5M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nk5M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dd74fb5-7b83-40f1-b887-b7ad11acb050_1440x1088.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Introducing bobcat-sdk, a TINY (3x smaller than Stylus SDK) community owned SDK for Rust Arbitrum Stylus]]></title><description><![CDATA[15th October 2025]]></description><link>https://stylus-saturdays.com/p/introducing-bobcat-sdk-a-tiny-3x</link><guid isPermaLink="false">https://stylus-saturdays.com/p/introducing-bobcat-sdk-a-tiny-3x</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Tue, 14 Oct 2025 15:31:27 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!5Gvv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! I have a smaller post here today, as I&#8217;m working on <a href="https://orderbookkit.xyz">Orderbookkit</a>. I&#8217;m excited to share that I&#8217;ve developed a new SDK for Stylus that&#8217;s 3x smaller than the default SDK with the counter example! We wanted to build an extremely small SDK for ourselves, since we know that this is one of the main pain points in the ecosystem right now. We&#8217;ve used it in our upcoming rollup <a href="https://superposition.so">Superposition</a> Passport for a 10kb gas saving with a simple drop in.</p><p>The standard Stylus SDK is one of the most expressive kits out there for development. It&#8217;s super user friendly, making it easy for pros and juniors alike to onboard into the world of Stylus. For us, as we&#8217;ve settled into development and figured out our own strategies, we found it interfering with our development, thanks to the sheer amount of features.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>We accomplished gas savings by reducing the amount of abstractions in the SDK, using host features for checked math, not using the allocator by default, and more! As a development practice, I&#8217;m also working on aggressively regression testing feature release against a suite of examples, to avoid codesize creep. The goal with this SDK will be to mainly get the code size lower. Together, let&#8217;s do a quick overview of the features, and how to use it yourself!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Gvv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Gvv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Gvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Gvv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!5Gvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3ed8b03-df50-4bcf-981d-20a6e9e708ad_1200x600.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>No native types except for signed and unsigned 256 bit numbers</h2><p><a href="https://github.com/stylus-developers-guild/bobcat-sdk/blob/trunk/bobcat-maths/src/lib.rs">We don&#8217;t support any numbers natively except the U256 and I256 types.</a> These are implemented simply, as a slice that&#8217;s assumed to be big endian. The default SDK leverages ruint through alloy to support EVM words, and this is can be wasteful, as there are several optimisations baked directly into ruint for performance. These result in more code being generated that we don&#8217;t benefit from (I assume), given the wasm backend.</p><h2>Using the host features to do checked math</h2><p>Another way we reduce codesize is by using the host provided external functions to do math. These functions are:</p><pre><code>unsafe extern &#8220;C&#8221; {
    fn math_div(x: *mut u8, y: *const u8);
    fn math_mod(x: *mut u8, y: *const u8);
    fn math_add_mod(a: *mut u8, b: *const u8, c: *const u8);
    fn math_mul_mod(a: *mut u8, b: *const u8, c: *const u8);
}</code></pre><p>By using these, we can implement checked math in a super codesize effective way. For example:</p><pre><code>pub fn checked_mul(x: &amp;U, y: &amp;U) -&gt; Option&lt;U&gt; {
    if x.is_zero() || y.is_zero() {
        return Some(U::ZERO);
    }
    if x &gt; &amp;(U::MAX / *y) {
        None
    } else {
        let z = x.mul_mod(y, &amp;U::MAX);
        if z.is_zero() {
            Some(U::MAX)
        } else {
            Some(z)
        }
    }
}</code></pre><p>For wrapping math, it&#8217;s a different story, so we provide it as a code implemented function. But, this is provided as a constant-time function, so it could be used for constant time code that&#8217;s not provided at runtime. In practice, developers developing for the EVM will likely use checked math everywhere (except for fees). Codesize-minded developers can use saturating math if they really want to save space, since that will use the checked code.</p><h2>No allocator required (and many ways of doing calls)</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://docs.rs/bobcat-call/latest/bobcat_call/index.html" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hTkn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 424w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 848w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 1272w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hTkn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png" width="949" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/13301608-90f5-4827-b956-0044a151928a_949x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:949,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:105544,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.rs/bobcat-call/latest/bobcat_call/index.html&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175633818?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hTkn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 424w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 848w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 1272w, https://substackcdn.com/image/fetch/$s_!hTkn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F13301608-90f5-4827-b956-0044a151928a_949x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Calls are made to be dirt simple, with plenty of different ways to make the call and access the calldata. Safe variants are available for every type of call, checking the codesize of the target before execution. There are different return types with different levels of abstraction, providing ways for programmers to reduce codesize or improve devex however they want.</p><p>No allocator is required to use bobcat_sdk, saving lots of space in the code output! All the outgoing calls can be performed using slices for the returndata, or vectors. This approach is used to let the user pick if they want to read simple boolean data, or to unpack an entire slice. This is implemented throughout the codebase.</p><h2>Interfaces made easy</h2><p><a href="https://github.com/stylus-developers-guild/bobcat-sdk/tree/trunk/bobcat-interfaces/src">Several interfaces are available for operations including EIP20, EIP2612</a>. More will be made available. It makes calling easy. This is a contract&#8217;s entire codebase:</p><pre><code><code>#![no_main]
#![no_std]

use bobcat_sdk::{
    call::static_call_slice,
    entry::*,
    interfaces::eip20::make_fn_allowance,
    maths::U,
};

#[unsafe(no_mangle)]
pub unsafe extern &#8220;C&#8221; fn user_entrypoint(args_len: usize) -&gt; usize {
    let args = &amp;read_args_safe!(args_len, { 32 * 3 + 4 });
    let (contract, owner, spender) = read_word_slices!(&amp;args[4..], 3);
    write_result_exit_call!(static_call_slice::&lt;32&gt;(
        contract.into(),
        &amp;make_fn_allowance(owner.into(), spender.into()),
        u64::MAX,
        0,
    ))
}</code></code></pre><p>This function simply calls a contract to ask for its allowance, returning the results. This contract is 4kb large!</p><p>Lots of versions of the calling interface are available:</p><pre><code><code>safe_call_bool_opt(address, &amp;make_fn_transfer(recipient, amt))
    .unwrap_or(Error::BadTransfer)</code></code></pre><p>Which would check the contract&#8217;s codesize before making the call, only returning if the contract either returned nothing but code exists, or returning something but true. Good for backwards compatibility with ERC20? It should play nice with the interfaces!</p><h2>Exotic types of storage accessors</h2><p>Many types of storage accessor functions are made available, also with access to transient storage. These can be used to implement code that manipulates the underlying state in a way that&#8217;s more application-centric. An exchange function is also available, letting the user &#8220;check and set&#8221; like an atomic interaction. Each math operation is available over the storage.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!U2NY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!U2NY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 424w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 848w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 1272w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!U2NY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png" width="245" height="431" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:431,&quot;width&quot;:245,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24031,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175633818?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!U2NY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 424w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 848w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 1272w, https://substackcdn.com/image/fetch/$s_!U2NY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fa8513b-b973-4b26-b0c1-54e3107a3119_245x431.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Proxies made easy</h2><p>Several proxies are made available in the SDK that make new contract deployment easy. These include a proxy that simply forwards calldata to an address in the contract bytecode, one that checks a storage slot for sending, and one that calls the <code>implementation</code> function on a beacon to get the address.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/stylus-developers-guild/bobcat-sdk/blob/trunk/bobcat-proxy/src/lib.rs" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!viM8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 424w, https://substackcdn.com/image/fetch/$s_!viM8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 848w, https://substackcdn.com/image/fetch/$s_!viM8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 1272w, https://substackcdn.com/image/fetch/$s_!viM8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!viM8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png" width="690" height="710" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:710,&quot;width&quot;:690,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:125283,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/stylus-developers-guild/bobcat-sdk/blob/trunk/bobcat-proxy/src/lib.rs&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/175633818?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!viM8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 424w, https://substackcdn.com/image/fetch/$s_!viM8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 848w, https://substackcdn.com/image/fetch/$s_!viM8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 1272w, https://substackcdn.com/image/fetch/$s_!viM8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6a4c12d-f7e1-4a53-a317-b8c1d2f1dea6_690x710.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These were implemented in Huff to reduce the code overhead, and are simple to use:</p><pre><code>#![no_main]
#![no_std]

use bobcat_sdk::{
    cd::{const_keccak_sel, read_word_slices},
    create::create1_slice,
    entry::*,
    maths::U,
    proxy::make_beacon_proxy,
};

const SEL: [u8; 4] = const_keccak_sel(b&#8221;deploy(address)&#8221;);

#[unsafe(no_mangle)]
pub unsafe extern &#8220;C&#8221; fn user_entrypoint(args_len: usize) -&gt; usize {
    let args = &amp;read_args_safe!(args_len, { 32 + 4 });
    if args[..4] != SEL {
        return 1;
    }
    let beacon = read_word_slices!(&amp;args[4..], 1);
    let r = create1_slice::&lt;1024&gt;(&amp;make_beacon_proxy(beacon.into()), U::ZERO);
    write_result_exit_create!(r)
}</code></pre><p>This contract consumes 16kb. The macro that returns the data doesn&#8217;t work with the Result type, instead unpacking a tuple and checking a boolean flag. There are several return macros provided that work with different shapes.</p><h2>Coming soon</h2><p>Currently, storage access is function driven. We&#8217;ll be releasing a storage guard similar to what&#8217;s in the main SDK in the future. We&#8217;ll be porting over the examples form the Stylus SDK as well, and focusing on improving the codesize profile with inline optimisations where we can. We also need to have muldiv implemented, as well as the rounding up equivalent, for serious use. We&#8217;ll be working on supporting the example in the README, at which point, we&#8217;ll be considered complete! Stay aware of this space!</p><h2>How do you test?</h2><p>No testing functions are available to mock chain state. That&#8217;s why it&#8217;s important to combine it with another project, <a href="https://github.com/iosiro/arbos-foundry">arbos-foundry</a>, for on-chain end to end testing! We found that in practice, the only kind of development we were doing was mocking local functions. We&#8217;ll continue to do our testing development in Rust for our core algorithms. <a href="https://stylus-saturdays.com/p/templates-with-scaffold-stylus-openzeppelin">We&#8217;ll do a writeup on how this can be used in the future, though last&#8217;s post also discussed this topic</a>.</p><h2>Read the README!</h2><p>Make sure to read the README to learn more! If you wind up using the SDK, <a href="https://t.me/doggish">drop me a message</a>.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a></p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_utC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_utC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg" width="400" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:&quot;Image&quot;,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!_utC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_utC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Templates with Scaffold Stylus, OpenZeppelin 3.0 and testing with Forge Foundry, What's next for Stylusup? Interview with Philip Stanislaus]]></title><description><![CDATA[8th October, 2025]]></description><link>https://stylus-saturdays.com/p/templates-with-scaffold-stylus-openzeppelin</link><guid isPermaLink="false">https://stylus-saturdays.com/p/templates-with-scaffold-stylus-openzeppelin</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Tue, 07 Oct 2025 16:14:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7cfd9d64-9ff1-415c-ac39-fd551398a9c0_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! In today&#8217;s post, we&#8217;ll be featuring the following:</p><ol><li><p>An introduction to Scaffold Stylus &#129513;, a template installing tool &#128230; for getting started with Stylus &#129504;, including using Chainlink&#8217;s data feeds &#128279; and VRF &#127922;, and ERC20/ERC721 contracts &#128176;&#127912;.</p></li><li><p>OpenZeppelin &#129521; have had their contracts fully audited &#9989; in their 3.0 release! Let&#8217;s do another round of discovery &#128269; of what&#8217;s available in their Stylus suite &#9881;&#65039;. We&#8217;ll implement a proxy using their contract &#129694;!</p></li><li><p>What&#8217;s next for Stylusup &#128640;? Stylusup is about to see a huge change &#128260;, with a new emphasis on community tooling &#129309; within the ecosystem &#127760;. Stylusup will see a transition into community ownership &#128101;, and will be developed further with an ambition to become the community hub &#127959;&#65039; for Stylus &#128171;.</p></li><li><p>We&#8217;ve been lucky &#127808; to feature Philip Stanislaus &#127908; in an interview! Philip is the founder of Oak Security &#127795;, a leading team building security tools &#128272; and performing audits &#129534;. They&#8217;re working on building StylusPort &#128736;&#65039;, a tool to convert Solana contracts &#9889; to Arbitrum Stylus &#127744; without friction &#10024;.</p></li></ol><p>Read on, and as always, if you have any feedback, please share it here:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="516" height="208.6171875" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:516,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Typescript, Zig, and C. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts.</p><div><hr></div><p>StylusPort, a tool to convert Solana projects to Stylus, is looking for people to fill out a 5 minute survey. If you&#8217;re building in the Stylus and Solana ecosystem, be sure to fill out their <a href="https://form.typeform.com/to/zhChasFV?typeform-source=stylus-saturdays.com">Typeform</a>!</p><div><hr></div><h1>Scaffold Stylus</h1><p><a href="https://scaffoldstylus.com/">Scaffold Stylus</a> is a project creation tool for a number of contracts and frontends, including a simple ERC20, a ERC721, Chainlink Data Feeds, and Chainlink VRF. They also provide a block explorer for local development, and a Wagmi frontend for interacting with the contracts made using their platform!</p><p>There are several templates that you can extend from, including:</p><ul><li><p>A ERC20 contract.</p></li><li><p>A ERC721.</p></li><li><p>A Chainlink price oracle frontend (and skeleton contract).</p></li><li><p>A Chainlink VRF contract.</p></li></ul><p>Check out an example dApp here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://scaffoldstylus.com/https://scaffold-stylus.vercel.app/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mnO_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 424w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 848w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 1272w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mnO_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png" width="1456" height="823" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:823,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:370166,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://scaffoldstylus.com/https://scaffold-stylus.vercel.app/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173416540?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mnO_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 424w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 848w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 1272w, https://substackcdn.com/image/fetch/$s_!mnO_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5a9c5e31-8cb2-492a-a82b-4cedfa37d44d_1932x1092.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is the default interface from creation! As you can see, it includes a block explorer built into the automatically created UI, which you can scan to see transactions that happened on the local network (or Sepolia).</p><p>It also includes a page to invoke methods on the contract you create:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://scaffoldstylus.com/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UjJo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 424w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 848w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 1272w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UjJo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png" width="1456" height="824" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:824,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:334890,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://scaffoldstylus.com/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173416540?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UjJo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 424w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 848w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 1272w, https://substackcdn.com/image/fetch/$s_!UjJo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8654a78-a7bf-4e0f-8ba6-f0bb8cf739d0_1932x1094.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Make sure to check the site out and give it a shot:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://scaffoldstylus.com/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kWmf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 424w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 848w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 1272w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kWmf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png" width="1456" height="821" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:821,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:567224,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://scaffoldstylus.com/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173416540?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kWmf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 424w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 848w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 1272w, https://substackcdn.com/image/fetch/$s_!kWmf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7a874b0-430d-43ad-a527-1ab9f944f474_1932x1089.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h1>OpenZeppelin&#8217;s 3.0 release!</h1><p>OpenZeppelin <a href="https://github.com/OpenZeppelin/rust-contracts-stylus/releases/tag/v0.3.0">have made their 3.0 release</a>, and it&#8217;s fully audited! Congratulations to everyone involved with this! I&#8217;m going to use this opportunity to recap what&#8217;s possible today, and what&#8217;s going to be possible in their future roadmap. For development, we&#8217;ll be testing using ArbOS-Foundry. ArbOS-Foundry is a fork of Foundry </p><h2>In the 3.0 release</h2><p>I really encourage everyone to <a href="https://github.com/OpenZeppelin/rust-contracts-stylus/releases/tag/v0.3.0">read the release notes on this</a>! <a href="https://github.com/qalisander">Alisander</a> (the dev that is powering a ton of the development on this) has introduced a TON of new contracts and features to the package. These include (and this is a selection):</p><ol><li><p>Proxies, with a proxy supporting the beacon pattern, and a proxy supporting the transparent upgradeability pattern.</p></li><li><p>Sets for efficient storage, much like their Solidity equivalent.</p></li><li><p>Traits for various token receivers that can be used with the various token receiving specs out there! These include the function needed to be used in a callback for ERC721, which is used by any spec-conforming ERC721 implementation if your contract has code, and the one for ERC1155.</p></li></ol><h2>Using the new proxies</h2><p>Let&#8217;s do a quick overview of how to make use of the OpenZeppelin proxies. We&#8217;ll create a new repository using <code>cargo stylus new</code>, and after making some hygiene changes in line with my personal preference, we&#8217;ll <code>cargo add openzeppelin-stylus</code>, and then we&#8217;ll begin to use Stylus trait inheritance features to build a virtual tollbooth contract in line with how I imagine this piece of Ice from the game Netrunner is like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://netrunnerdb.com/en/card/01090" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XeP_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 424w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 848w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XeP_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg" width="300" height="418" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:418,&quot;width&quot;:300,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Tollbooth&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://netrunnerdb.com/en/card/01090&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Tollbooth" title="Tollbooth" srcset="https://substackcdn.com/image/fetch/$s_!XeP_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 424w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 848w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!XeP_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F262c358b-4177-469b-9fd2-9d27efe725f3_300x418.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Netrunner is a cyberpunk asymmetric card game where a player, a hacker (&#8220;Runner&#8221;), works to breach the security of the servers of another player, a Corporation. The Corporation is able to deploy security programs called Ice to protect their servers, which the Runner must circumvent using hacking programs called Icebreakers. You can play online for free at <a href="https://jinteki.net/">Jinteki.net</a>! We&#8217;re going to use OpenZeppelin&#8217;s upgradeable proxy to implement a virtual toolbooth, like the card shown above.</p><p>To invoke any method on the underlying implementation of a proxy, the user must pay 3 DAI. If the user fails to pay the 3 DAI, they will be disconnected from the contract with a revert!</p><p>We&#8217;ll be using the UUPS proxy pattern for this, which is a type of proxy pattern where the implementation contract is the one that&#8217;s responsible for its upgradeability. This makes a lot of sense, since the strong point of Stylus is its performance, which I visualise like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kQyb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kQyb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 424w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 848w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 1272w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kQyb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png" width="496" height="492.5934065934066" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1446,&quot;width&quot;:1456,&quot;resizeWidth&quot;:496,&quot;bytes&quot;:160822,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173416540?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kQyb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 424w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 848w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 1272w, https://substackcdn.com/image/fetch/$s_!kQyb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a5d1a53-ea16-436b-a65d-14282cccec16_1867x1854.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Where the blue line is Stylus, and the green line is Solidity. Source? It came to me in a fever dream. This is how I internalise my thinking with the setup and gas costs of Stylus.</p><p>For a proxy contract, you don&#8217;t want to pay that setup gas cost that you have to pay to warm the Stylus execution engine up (which is a fixed number), since your job is to send the calldata to another contract using a delegatecall, a very simple operation relatively. So upgrades might be something better supported by the implementation here, where maybe the contract observes a metamorphosis-like pattern (where the contract tears itself down when criteria is met) or something similar.</p><h3>The contract</h3><p>To use the new proxy code to make a proxy ourselves, we must implement several traits, and make them invokable using the public macro. These are functions to allow the user to set the owner of this contract, which we need to upgrade the proxy, and to invoke trusted functions.</p><p>We first create our contract storage like so:</p><pre><code>#[entrypoint]
#[storage]
pub struct Storage {
    pub fee_collector: StorageAddress,
    pub token: StorageAddress,
    pub fees_collected: StorageU256,
    ownable: Ownable,
    uups: UUPSUpgradeable,
}</code></pre><p>We have three extra storage items beyond the two that we need for OpenZeppelin. One functions as a trusted role that has the power to invoke methods to collect fees collected in DAI. One stores the token address for DAI (that we could otherwise store as a constant if we so choose), and one contains a simple counter of fees collected, for demonstration purposes. It might be better to simply check the balance of the contract using the DAI ERC20 instead of maintaining a counter ourselves, but for our discussion, we&#8217;ll do it this way.</p><p>Following setting this in the storage of the contract, we can start to implement some functions for setup of the contract. <strong>Note that this contract does not have a constructor, which the implementation contract would have called!</strong> This calls the UUPS constructor, which prevents users from the implementation contract, who might have intended to call the proxy upgrade methods instead.</p><p>We implement our first implementation:</p><pre><code>#[public]
#[implements(IOwnable, IUUPSUpgradeable, IErc1822Proxiable)]
impl Storage {
    pub fn init(
        &amp;mut self,
        owner: Address,
        fee_collector: Address,
        token: Address,
    ) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        self.uups.set_version()?;
        self.ownable.constructor(owner)?;
        self.fee_collector.set(fee_collector);
        self.token.set(token);
        Ok(())
    }
}</code></pre><p>This method invokes trusted functions on the storage items for the UUPS implementation (that does the fallback method) to set storage that indicates it should be impossible to invoke the methods responsible for proxy setup. It sets a storage slot intended for the storage of the logic contract, which has a nice side effect of preventing us from calling this setup function more than once. We implement the rest of the traits:</p><pre><code>#[public]
impl IUUPSUpgradeable for Storage {
    #[selector(name = &#8220;UPGRADE_INTERFACE_VERSION&#8221;)]
    fn upgrade_interface_version(&amp;self) -&gt; String {
        self.uups.upgrade_interface_version()
    }

    #[payable]
    fn upgrade_to_and_call(
        &amp;mut self,
        new_implementation: Address,
        data: stylus_abi::Bytes,
    ) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        self.ownable.only_owner()?;
        self.uups.upgrade_to_and_call(new_implementation, data)?;
        Ok(())
    }
}</code></pre><p>In the code that does the upgrade and call, we could implement some additional access control there. In the above, it uses the ownable code to check if the sender is the owner of the contract. We need to implement some functions that ownable expects to support it fully. These functions implement the basics in OZ contracts:</p><pre><code>#[public]
impl IOwnable for Storage {
    fn owner(&amp;self) -&gt; Address {
        self.ownable.owner()
    }

    fn transfer_ownership(&amp;mut self, new_owner: Address) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        Ok(self.ownable.transfer_ownership(new_owner)?)
    }

    fn renounce_ownership(&amp;mut self) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        Ok(self.ownable.renounce_ownership()?)
    }
}</code></pre><p>Following the implementation code doing access control and setting slots, we need to implement the contract that reads the slot before a delegatecall. Since the implementation manipulates the storage slots, our proxy needs to check the standard location to know where to call into.</p><p><a href="https://github.com/stylus-developers-guild/oz-proxies-example/blob/trunk/src/Proxy.sol">We can implement a simple Solidity contract</a>:</p><pre><code>bytes32 constant SLOT_LOGIC = bytes32(uint256(keccak256(&#8217;eip1967.proxy.implementation&#8217;)) - 1);

contract Proxy {
    address private feeCollector;
    IERC20 private token;
    uint256 private collected;
    uint256 private feeAmount;

    event TollPaid(
        address indexed payer,
        uint256 indexed amount
    );

    constructor(
        address _owner,
        address _feeCollector,
        address _token,
        uint256 _feeAmount,
        address _impl
    ) {
        bytes32 slot = SLOT_LOGIC;
        assembly {
            sstore(slot, _impl)
        }
        (bool success,) = _impl.delegatecall(abi.encodeWithSelector(
            IImpl.init.selector,
            _owner,
            _feeCollector,
            _token,
            _feeAmount
        ));
        require(success);
    }

    fallback() external {
        address impl;
        bytes32 slot = SLOT_LOGIC;
        assembly {
            impl := sload(slot)
        }
        require(token.transferFrom(msg.sender, address(this), feeAmount));
        emit TollPaid(msg.sender, feeAmount);
        collected += feeAmount;
        (bool success, bytes memory data) = impl.delegatecall(msg.data);
        if (data.length &gt; 0 &amp;&amp; !success) {
            assembly {
                revert(add(data, 0x20), mload(data))
            }
        } else {
            require(success);
            if (data.length &gt; 0) {
                assembly {
                    return(add(data, 0x20), mload(data))
                }
            }
        }
    }
}</code></pre><p>This simply forwards all calldata to the implementation address at the standard EIP1967 slot (computed at the top of the contract). It also calls the init function inside the implementation during the contract&#8217;s construction. It&#8217;s the code that actually enforces the tollbooth collection during the fallback operation, using a transferFrom each time it&#8217;s called. It also emits a handy event for monitoring how the tollbooth is performing.</p><p>The issue with this code is that it&#8217;s a pain to approve before each invocation of the contract. It might be better to have a calldata forwarder, or to restructure the caldata to include a permit blob beforehand. You could imagine that this code is useful for an administrative task though, or something like those &#8220;trick the AI to send you something&#8221; challenges.</p><p>Note how during the setup, we don&#8217;t actually set any values ourselves apart from the storage slot? This is because Stylus has 1-to-1 equivalence with the EVM, down to the storage layout! So our implementation contact can be fully responsible for its upgrades, as well as how the proxy is performing.</p><h3>Testing Arbitrum Stylus with Forge Foundry</h3><p>In today&#8217;s post, we&#8217;ll be testing using <a href="https://github.com/iosiro/arbos-foundry">ArbOS-Foundry</a>, a project developed by the team at iosiro. It lets us test Solidity and Stylus side by side, as first class citizens! It&#8217;s a fork of Foundry with the hope of eventually providing that experience there. We&#8217;ll be testing that the proxy is taking fees every time someone calls the implementation. We&#8217;ll be doing a later post on this, since ArbOS-Foundry is such a great opportunity for the space.</p><p>After pulling down the repo and installing everything (I just ran <code>make build</code>, which created the executables <code>arbos-forge</code> and <code>arbos-cast</code> in the target debug directory), I created this test:</p><pre><code>import {SLOT_LOGIC, Proxy} from &#8220;../src/Proxy.sol&#8221;;

interface IArbFoundry {
    function deployStylusCode(string calldata artifact) external returns (address);
}

interface IProxy {
    function upgradeToAndCall(address newImpl, bytes memory data) external;
}

interface IHello {
    function hello() external returns (string memory);
}

contract TestErc20 {
    bool public wasSpent;
    function transferFrom(address, address, uint256) external returns (bool) {
        wasSpent = true;
        return true;
    }
}

contract World {
    function world() external returns (string memory) {
        return &#8220;World!&#8221;;
    }

    function proxiableUUID() external returns (bytes32) {
        return SLOT_LOGIC;
    }
}

contract TestProxy is Test {
    TestErc20 erc20;
    address impl;
    Proxy proxy;
    address impl2;

    function setUp() public {
        erc20 = new TestErc20();
        impl = IArbFoundry(address(vm)).deployStylusCode(&#8221;oz-proxies.wasm&#8221;);
        proxy = new Proxy(address(this), address(this), address(erc20), 1e6, impl);
        impl2 = address(new World());
    }

    function testImpl() public {
        assertNotEq(address(0), impl);
        assertEq(&#8221;Hello!&#8221;, IHello(impl).hello());
    }

    function testProxy() public {
        assert(!erc20.wasSpent());
        assertEq(&#8221;Hello!&#8221;, IHello(address(proxy)).hello());
        assert(erc20.wasSpent());
        IProxy(address(proxy)).upgradeToAndCall(impl2, &#8220;&#8221;);
        assertEq(&#8221;World!&#8221;, World(address(proxy)).world());
    }
}</code></pre><p>This tests that we can upgrade, that we can invoke the functions on the implementation, and that we can use the proxy. You might notice that we implement a function called <code>proxiableUUID</code> in the second implementation. OZ give us some sanity checks, and this function returns the slot that&#8217;s responsible for the logic. This is so that the UUPS proxy knows for certain that we know what we&#8217;re doing. Once we do the upgrade in this example, we can&#8217;t go back and do another upgrade!</p><p>Thanks to the implementation-led mutability of the deployment, we can have code that might mutate itself to become immutable after a release cycle or an audit for example. This code captures that phenomenon!</p><p>Before we run our tests, we&#8217;ll first create a Makefile to build our code before testing:</p><pre><code><code>oz-proxies.wasm: $(shell find src -name &#8216;*.rs&#8217;)
&#9;@rm -f oz-proxies.wasm
&#9;@cargo build --target wasm32-unknown-unknown --release
&#9;@wasm-opt \
&#9;&#9;--dce \
&#9;&#9;--rse \
&#9;&#9;--signature-pruning \
&#9;&#9;--enable-bulk-memory \
&#9;&#9;--strip-debug \
&#9;&#9;--strip-producers \
&#9;&#9;-Oz target/wasm32-unknown-unknown/release/oz_proxies.wasm \
&#9;&#9;-o oz-proxies2.wasm
&#9;@wasm2wat oz-proxies2.wasm &gt;oz-proxies.wat
&#9;@wat2wasm oz-proxies.wat &gt;oz-proxies.wasm
&#9;@rm -f oz-proxies2.wasm oz-proxies.wat</code></code></pre><p>Why do this? A step is needed before using the raw wasm output with arbos-foundry right now. The node does a processing step of using the wasm2wat/wat2wasm toolchain to compile the WASM code to a SEXP-like representation, the WAT format, then back. I&#8217;m assuming this is needed to strip some bits of code as a side effect, though it&#8217;s not known to me what the literal need is. We can make a testing script that invokes the Makefile and the tests like so:</p><pre><code>#!/bin/sh -e

make -B

arbos-forge test $@</code></pre><p>In our code creation pipeline, we first create the code using a Makefile that runs Cargo to compile this wasm blob. This test then picks up the file, deploys it, then constructs the Proxy. With a fake ERC20 that checks if the token was fake transferred. Cool!</p><div><hr></div><h2>What&#8217;s next for Stylusup?</h2><p>Stylusup is undergoing a huge change! Stylusup will transition from being a on-ramping page for Stylus to becoming a community ecosystem landing page. The development of the new page is still in progress, but we&#8217;ve created a new community organisation to take ownership of it! You can see it here: <a href="https://github.com/stylus-developers-guild">https://github.com/stylus-developers-guild</a></p><p>Currently, we have the following members:</p><ol><li><p>Alex (this author), CTO of Fluidity Labs (building Superposition), <a href="https://fluiditylabs.io">https://fluiditylabs.io</a></p></li><li><p><a href="https://www.linkedin.com/in/tolgayayci/">Tolga</a>, Founder of The Wizard, <a href="https://thewizard.app">https://thewizard.app</a></p></li><li><p><a href="https://twitter.com/ohyeahdavid">David</a>, Senior Product Manager at Offchain Labs, <a href="https://www.offchainlabs.com/">https://www.offchainlabs.com/</a></p></li></ol><p>The goal is to transition the site to a new format where we can aggregate projects from the community in one place, with a transparent listing process based on pull requests. We have something cooking, and I can&#8217;t wait to share it with you! A very appreciate thank you to Tolga and David for supporting this!</p><div><hr></div><h1>Interview with Philip Stanislaus</h1><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vbor!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vbor!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 424w, https://substackcdn.com/image/fetch/$s_!vbor!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 848w, https://substackcdn.com/image/fetch/$s_!vbor!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 1272w, https://substackcdn.com/image/fetch/$s_!vbor!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vbor!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png" width="200" height="200" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a36c3617-a309-4ded-8aea-ccf71f649378_200x200.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40301,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173416540?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vbor!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 424w, https://substackcdn.com/image/fetch/$s_!vbor!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 848w, https://substackcdn.com/image/fetch/$s_!vbor!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 1272w, https://substackcdn.com/image/fetch/$s_!vbor!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36c3617-a309-4ded-8aea-ccf71f649378_200x200.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h2>Who are you, and what do you do?</h2><p>I&#8217;m Philip Stanislaus, co-founder and Managing Director of Oak Security.</p><p>My journey began in traditional software engineering, freelancing for over a decade and co-founding several startups. I later transitioned into blockchain, working as a developer at Centrifuge and architecting projects like Snowfork. I then co-founded <a href="https://www.oaksecurity.io/">Oak Security</a> to help Web3 projects build safely and confidently by offering security audits, penetration testing, training, and other related services.</p><p>Recently, we launched StylusPort with Range, a framework that simplifies migrating Solana programs to Arbitrum&#8217;s Stylus environment. My focus is enabling developers to innovate while maintaining security, efficiency, and interoperability across ecosystems.</p><h2>What Web3 ecosystems have you worked in?</h2><p>I&#8217;ve worked in Ethereum, Arbitrum, Solana, Cosmos, Polkadot, and Flow. Currently, Arbitrum is a key focus because of its growing adoption, developer-friendly environment, and the ability to deploy Rust-based smart contracts via Stylus. <a href="https://x.com/SecurityOak/status/1960003072299815166">StylusPort</a> helps Solana developers bring their Rust projects into Arbitrum without rewriting in Solidity, bridging ecosystems efficiently.</p><h2>What are your impressions of working with Stylus, good and bad?</h2><p>Stylus is a breakthrough for Rust and C++ developers wanting to build without EVM constraints. Its low-cost computation, strong tooling, and Ethereum liquidity enable use cases that were previously out of reach.. Moving from another ecosystem to Arbitrum Stylus is not straightforward, though. We are building StylusPort to address that by providing clear guidance and AI-assisted tooling to reduce friction. Overall, Stylus is a vibrant, exciting ecosystem with huge potential.</p><h2>What software do you use?</h2><p>I primarily use Visual Studio Code with Rust and Solidity extensions. For project management and collaboration, Google Docs/Sheets and GitHub are essential. During our security work, we use numerous tools, like static analyzers, fuzzers, formal verification tools, and LLMs.</p><h2>What hardware do you use?</h2><p>I connect a MacBook to a remote machine using VSCode&#8217;s Remote Development using SSH. Our LLMs run on more powerful remote machines with GPU support.</p><h2>How can we get in touch with you?</h2><p>You can reach me on <a href="https://www.linkedin.com/in/philipstanislaus/">LinkedIn</a>, <a href="https://x.com/pstanislaus">X/Twitter</a>, or via email at <a href="mailto:philip@oaksecurity.io">philip@oaksecurity.io</a>. I enjoy connecting with developers and founders who are building cross-chain projects, securing protocols, or exploring the adoption of Stylus and Arbitrum. If you are interested in using or giving feedback on StylusPort, please get in touch!</p><h2>What&#8217;s a piece of advice you&#8217;d give someone new to Web3?</h2><p>Focus on both product market fit and security from the beginning. Web3 is exciting, but lasting success comes from solving real problems and prioritizing safety. Focus on creating value and keeping your users&#8217; funds and your reputation safe, not just following trends.</p><div><hr></div><p>To get in touch with the Oak Security team, you can check their website at <a href="https://www.oaksecurity.io/">https://www.oaksecurity.io/</a>.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_utC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_utC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg" width="400" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!_utC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_utC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_utC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e7971b4-2241-491b-8b5f-d14721fe18d6_400x400.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>None of this is real. If you&#8217;re reading this, you&#8217;re in a coma, and you need to wake up! We love you.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Extreme Codesize Optimisations: Reentrancy combined with transient storage]]></title><description><![CDATA[16th September 2025]]></description><link>https://stylus-saturdays.com/p/extreme-codesize-optimisations-reentrancy</link><guid isPermaLink="false">https://stylus-saturdays.com/p/extreme-codesize-optimisations-reentrancy</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Tue, 16 Sep 2025 09:17:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!8a8d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8586ee73-2f17-4dad-a892-09059adf7dce_387x387.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Hello everyone! A bit of an oddball post outside our normal format, but hopefully one that everyone will enjoy. I wanted to discuss a real problem we&#8217;re all facing, which is how to take codesize lower. This is a tactic we&#8217;re implementing in our Passport smart contract to get things under the limit, despite the huge amount of thirdparty code we&#8217;re using. I wanted to share this technique since it&#8217;s been so effective for us on a very large and complex project.</em></p><p>Let&#8217;s set the scene: you&#8217;re building something complex, and the lion&#8217;s share of the codesize lives in a single function. You are right up against the limit. Your boss (Ivan in this case) wants extra features (cross-chain features, anyone?) but you&#8217;re not able to push things any further.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NMdO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NMdO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NMdO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg" width="299" height="168" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:168,&quot;width&quot;:299,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;42 - I'm tired boss&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="42 - I'm tired boss" title="42 - I'm tired boss" srcset="https://substackcdn.com/image/fetch/$s_!NMdO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NMdO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0315b807-6484-4ca4-8518-6117116b7b8e_299x168.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>How can we go lower? The tactic in this case might be to use a reentrant pattern within your code, and a proxy entrypoint. With this method, we can break up a function that&#8217;s quite large into small pieces that are gradually executed, until the final result is handed back to the user. This is an extremely effective method for a large chained operation! You can take any complex interaction, and break it up into contract part 1, part 2, part 3, and so forth. You store each step of the operation using transient storage, which you read like registers.</p><p>Why use transient storage instead of reusing the calldata to the contract next in the chain? Decoding is often the number one source of codesize overhead, and with a transient storage method you can completely remove the classic entrypoint, instead preferring to check registers instead.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Transient storage operation is a custom storage type similar to memory in the EVM, except that it lives for the length of the transaction. It could be used to protect a contract from reentrancy, implement role based authentication, and more. It&#8217;s accessed using the <code>TSTORE</code> and <code>TLOAD</code> functions, two functions that allow addressing with a 32 byte key, like the classic EVM storage.</p><p>This feature is not available in the SDK, but it is in the runtime. To use this feature in this context (with reentrancy), you must disable reentrancy guard using a feature, and it&#8217;s not documented, and even putting aside Stylus it&#8217;s an advanced technique.</p><p>Let&#8217;s peer behind the curtain and explore a strategy to make this work. Our contract (<a href="https://github.com/stylus-developers-guild/reentrancy-transient-storage">repo here</a>) will look like this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UDQb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UDQb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 424w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 848w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 1272w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UDQb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png" width="421" height="155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:155,&quot;width&quot;:421,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12749,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173731961?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UDQb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 424w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 848w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 1272w, https://substackcdn.com/image/fetch/$s_!UDQb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11e839e-6277-463d-a2d9-9dad7c2e43ca_421x155.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>A proxy will handle dispatch into two different contracts depending on the function that&#8217;s used. The proxy will need to understand which functions go where, a method we&#8217;ll leave up to the implementor. We have implemented different approaches for proxies in the past, with <a href="https://github.com/fluidity-money/long.so/blob/development/pkg/sol/SeawaterAMM.sol">explicit function matching in Longtail</a> (our first foray into Stylus, a bit yuck in retrospect), hardcoded magic byte matching in <a href="https://github.com/fluidity-money/9lives.so/blob/main/src/TradingBeaconProxy.sol">9lives with a beacon</a>, and in a <a href="https://github.com/fluidity-money/9lives.so/blob/main/src/trading-proxy.huff">previous release a classic proxy</a>, and <a href="https://gist.github.com/af-afk/cdeeb93a9670856b9148f1efe9f1964c">purely dynamic matching in Passport</a> (which serves as the impetus for this method). Superposition Passport is unique in that it leverages a Borsh decoding-style method similar to Solana entrypoints, which it uses to know when to decompress incoming calldata as opposed to a classic 4byte selector match, so we won&#8217;t elaborate on that further today.</p><p>Our contract will implement behaviour like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gewt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gewt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 424w, https://substackcdn.com/image/fetch/$s_!gewt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 848w, https://substackcdn.com/image/fetch/$s_!gewt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 1272w, https://substackcdn.com/image/fetch/$s_!gewt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gewt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png" width="466" height="462.79945054945057" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1446,&quot;width&quot;:1456,&quot;resizeWidth&quot;:466,&quot;bytes&quot;:154330,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/173731961?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gewt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 424w, https://substackcdn.com/image/fetch/$s_!gewt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 848w, https://substackcdn.com/image/fetch/$s_!gewt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 1272w, https://substackcdn.com/image/fetch/$s_!gewt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2e0f9ed-d98b-4052-ac89-6cb9031de3f6_1867x1854.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In a real world example, any interaction that&#8217;s multiple step could be broken up this way. In Superposition Passport, we do some cryptography heavy lifting, coming up with some facts about the user, then we use this method to initiate the next part of the contract chain, a function that begins a cross-chain asset transfer.</p><p>In our code, we&#8217;ll simply have some code inside the first contract generate a number, and the second step of the contract return it to the user. This is a drop-in for any complex behaviour you might implement this way. Though a serious user might prefer to avoid the entrypoint decoder (like we discussed at the beginning of this article), we&#8217;ll continue using it here to keep the discussion simple. We&#8217;ll show off how to replace the entrypoint with something way more codesize efficient in a future Extreme Codesize Optimisations post.</p><h3>A refresher on reentrancy</h3><p>Reentrancy is the practice of a contract calling itself. It often makes headlines in the context of an exploit that took place when a chain of contract interruption was broken thanks to a contract calling back to its original calling contract when it shouldn&#8217;t have, before the state has been persisted. We won&#8217;t be using it this way of course! Reentrancy is useful for reducing codesize and recursive patterns that would be otherwise difficult to implement in size-constrained contracts.</p><p>We can implement a reentrant contract in the Solidity context:</p><pre><code>// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

contract Token {
    function invoke() external {
        Counter(msg.sender).kickoff(this);
    }
}

contract Counter {
    uint256 public counter;

    function kickoff(Token _invoker) external returns (uint256) {
        if (msg.sender == address(_invoker)) {
            counter++;
        } else {
            _invoker.invoke();
        }
        return counter;
    }
}</code></pre><p>This code is visually similar to process forking and threading in the Unix context. The Counter contract is started using the <code>kickoff</code> function, which checks to see if the invoker address is the caller, and if it&#8217;s not, it calls the function &#8220;invoke&#8221; on the invoker. The invoker contract then calls the <code>kickoff</code> function again on the Counter, which then bumps the counter, which it returns. This returns 1.</p><h3>Reentrancy in Stylus</h3><p>To use reentrancy in Stylus, we need to enable a specific feature that disables the check for reentrancy in the contract. We do this by setting a feature in <code>stylus-sdk</code> to be <code>reentrant</code>:</p><pre><code>// Cargo.toml

[dependencies]
...
stylus-sdk = { version = "0.9.0", features = ["reentrant"] }</code></pre><p>This totally disables the built-in check that checks for reentrancy in the contract. The Stylus SDK developers wisely made the decision to protect us from this huge vulnerability for most contracts by default, and we&#8217;re right on the edge, so we have to disable it.</p><p>Reentrantly entering a contract again is as simple as invoking itself:</p><pre><code>#[entrypoint]
#[storage]
struct TStoreExample;

sol! {
    function hello() external view returns (string);
}

#[public]
impl TStoreExample {
    pub fn hello() -&gt; U256 {
        U256::from(123)
    }

    pub fn reentrant(&amp;self) -&gt; FixedBytes&lt;32&gt; {
        let addr = self.vm().contract_address();
        FixedBytes::from_slice(
            &amp;self
                .vm()
                .static_call(&amp;self, addr, &amp;helloCall {}.abi_encode())
                .unwrap(),
        )
    }
}</code></pre><p>You can see that we return a fixed bytes word instead of a <code>Vec&lt;u8&gt;</code> here. The reason is that encoding a Vec&lt;u8&gt; will <strong>literally encode a vector of u8 if it&#8217;s used as the Ok return type</strong>, something to be mindful of generally. Using a FixedBytes word when we&#8217;re trying to return the calldata here enables us to avoid decoding the return type.</p><h3>Transient storage in Stylus</h3><p>Transient storage use in Stylus is possible to use by explicitly using a hostio that&#8217;s unavailable to us ordinary SDK plebs, <code>transient_load_bytes32</code> and <code>transient_store_bytes32</code>.</p><p>We can implement support for the missing functions like this:</p><pre><code>#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "vm_hooks")]
unsafe extern "C" {
    fn transient_load_bytes32(key: *const u8, dest: *const u8);
    fn transient_store_bytes32(key: *const u8, value: *const u8);
}

#[cfg(not(target_arch = "wasm32"))]
pub fn transient_load_bytes32(key: *const u8, dest: *const u8) {}

#[cfg(not(target_arch = "wasm32"))]
pub fn transient_store_bytes32(key: *const u8, value: *const u8) {}

fn tload(key: U256) -&gt; U256 {
    let mut dest = [0u8; 32];
    unsafe {
        transient_load_bytes32(key.to_be_bytes::&lt;32&gt;().as_ptr(), dest.as_mut_ptr());
    }
    U256::from_be_bytes(dest)
}

fn store(key: U256, val: U256) {
    unsafe {
        transient_store_bytes32(
            key.to_be_bytes::&lt;32&gt;().as_ptr(),
            val.to_be_bytes::&lt;32&gt;().as_ptr(),
        );
    }
}</code></pre><p>We could&#8217;ve used any type here instead of <code>U256</code> (including <code>FixedBytes</code>) technically. This code simply uses the <code>TSTORE</code> and <code>TLOAD</code> functions. <code>tload</code> and <code>tstore</code> wrap the code by getting the array underneath the complex <code>U256</code> type as a big endian array (the default endianness format for the EVM).</p><p>We can simulate it like this:</p><pre><code>#[entrypoint]
#[storage]
struct TStoreExample;

#[public]
impl TStoreExample {
    pub fn begin(&amp;self) -&gt; U256 {
        let k = U256::from(123);
        store(k, U256::from(456));
        tload(k)
    }
}</code></pre><p>The code returns 456 here, as you might imagine! This will be the case for the life of the transaction:</p><pre><code>#[public]
impl TStoreExample {
    pub fn hello() -&gt; U256 {
        tload(U256::from(123))
    }

    pub fn reentrant(&amp;self) -&gt; FixedBytes&lt;32&gt; {
        store(U256::from(123), U256::from(456));
        let addr = self.vm().contract_address();
        FixedBytes::from_slice(
            &amp;self
                .vm()
                .static_call(&amp;self, addr, &amp;helloCall {}.abi_encode())
                .unwrap(),
        )
    }
}</code></pre><h3>Bringing the technique together for our POC</h3><p>So we can start to combine the reentrancy with the transient storage pattern here. Now, what if we were to split up our contract into two contracts:</p><pre><code>#[cfg_attr(any(feature = "contract-1", feature = "contract-2"), entrypoint)]
#[storage]
struct TStoreExample;

sol! {
    function hello() external view returns (string);
}

#[cfg_attr(feature = "contract-1", public)]
impl TStoreExample {
    pub fn hello() -&gt; U256 {
        tload(U256::from(123))
    }
}

#[cfg_attr(feature = "contract-2", public)]
impl TStoreExample {
    pub fn reentrant(&amp;self) -&gt; FixedBytes&lt;32&gt; {
        store(U256::from(123), U256::from(456));
        let addr = self.vm().contract_address();
        FixedBytes::from_slice(
            &amp;self
                .vm()
                .static_call(&amp;self, addr, &amp;helloCall {}.abi_encode())
                .unwrap(),
        )
    }
}

#[cfg(not(any(feature = "contract-1", feature = "contract-2")))]
compile_error!("contract-1 and contract-2 not enabled!");</code></pre><p>This code uses feature flags and a Stylus trick to allow us to compile either contract 1 or contract 2 at a given time. The Stylus team are adding the ability for multiple contracts to be compiled at any time, but for now, this approach is sufficient. In Passport, we&#8217;ve discovered other techniques for this that we&#8217;ll elaborate on another time.</p><p>We need a proxy that lets us do dispatch into either contract:</p><pre><code>// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

contract Proxy {
    address public immutable FACET_HELLO;
    address public immutable FACET_REENTRANT;

    constructor(address _hello, address _reentrant) {
        FACET_HELLO = _hello;
        FACET_REENTRANT = _reentrant;
    }

    function directDelegate(address to) internal {
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), to, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    function hello() public returns (uint256) {
        directDelegate(FACET_HELLO);
    }

    function reentrant() external returns (uint256) {
        directDelegate(FACET_REENTRANT);
    }
}</code></pre><p>This proxy is of the kind that explicitly loads a facet for the function given. Let&#8217;s deploy everything:</p><pre><code>#!/usr/bin/env -S rc -e

SPN_SUPERPOSITION_URL=https://testnet-rpc.superposition.so
SPN_SUPERPOSITION_KEY=`{QEP superposition}

make

contract_1=`{./deploy.sh contract-1.wasm}
contract_2=`{./deploy.sh contract-2.wasm}

forge create \
&#9;--json \
&#9;--broadcast \
&#9;--rpc-url $SPN_SUPERPOSITION_URL \
&#9;--private-key $SPN_SUPERPOSITION_KEY \
&#9;src/Proxy.sol:Proxy \
&#9;--constructor-args $contract_1 $contract_2 \
&#9;&#9;| jq -r .deployedTo</code></pre><p>In my case, the proxy contract was deployed at <code>0x70f694eA46a11965067aF701d5F410E314262b72</code> on Superposition Testnet. Testing it, we can see it works:</p><pre><code>cast call --rpc-url https://testnet-rpc.superposition.so 0x70f694eA46a11965067aF701d5F410E314262b72 'reentrant()(uint256)'</code></pre><p><em>Side note, it&#8217;s a terrible practice to take a private key as an argument. Linux (and BSD to an extent) systems have total transparency for running processes on the system by default, and I&#8217;m a repeat offending criminal for building tools that ignore this fact. It&#8217;s better to use environment variables!</em></p><p>I hope this very short article engages your imagination with how far you can push contracts to reduce codesize in the Stylus context! The sky is the limit with this technique.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div><hr></div><p>Thumbnail photo by <a href="https://unsplash.com/@sixteenmilesout?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Sixteen Miles Out</a> on <a href="https://unsplash.com/photos/three-bright-sunflowers-in-a-glass-vase-4hoe1yzgBl4?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>. Thank you!</p>]]></content:encoded></item><item><title><![CDATA[Time travelling debugging with CodeTracer, AssemblyScript on Stylus, interview with Gonza]]></title><description><![CDATA[September 12th, 2025]]></description><link>https://stylus-saturdays.com/p/time-travelling-debugging-with-codetracer</link><guid isPermaLink="false">https://stylus-saturdays.com/p/time-travelling-debugging-with-codetracer</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Fri, 12 Sep 2025 06:26:27 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9f3cf7bb-6171-4c30-a2c5-494098e7951a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! Bayge here, once again. A LOT slower on the draw with this post, we have some MAJOR catching up to do to make our usual cadence. Covered in today&#8217;s post:</p><ol><li><p>&#128640; CodeTracer launched their Stylus deployment! &#9203; Time-travelling debugging is now possible &#8212; interactively view your contract&#8217;s execution! Super cool! &#128377;&#65039; We&#8217;ll be testing this with a contract that generates &#127984; rooms for priories.</p></li><li><p>&#9889; AssemblyScript (very TypeScript-like &#128187;) is now live thanks to the WakeUp Labs team! &#128293; They&#8217;ve been shipping tons of cool stuff &#8212; we&#8217;ll feature them with a &#129518; test contract that runs a lightweight on-chain NFT recommendation engine &#127912;.</p></li><li><p>&#127908; Interview with Gonza from the WakeUp Labs team &#127881; Gonza is the co-founder of WakeUp Labs! &#128588;</p></li></ol><p>Read on, and as always, if you have any feedback, please share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and Go. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interoperability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><p>You can get started very quickly using a (community maintained) setup website at <a href="https://stylusup.sh">https://stylusup.sh</a>, with official resources at <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a>, or fully online, without any setup, using The Wizard at <a href="https://thewizard.app/">https://thewizard.app/</a>!</p><div><hr></div><p>StylusPort, a tool to convert Solana projects to Stylus, is looking for people to fill out a 5 minute survey. If you&#8217;re building in the Stylus ecosystem, be sure to fill out their <a href="https://form.typeform.com/to/zhChasFV?typeform-source=stylus-saturdays.com">Typeform</a>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://form.typeform.com/to/zhChasFV?typeform-source=stylus-saturdays.com" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Phma!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 424w, https://substackcdn.com/image/fetch/$s_!Phma!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 848w, https://substackcdn.com/image/fetch/$s_!Phma!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 1272w, https://substackcdn.com/image/fetch/$s_!Phma!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Phma!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png" width="964" height="927" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:927,&quot;width&quot;:964,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:103294,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://form.typeform.com/to/zhChasFV?typeform-source=stylus-saturdays.com&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Phma!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 424w, https://substackcdn.com/image/fetch/$s_!Phma!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 848w, https://substackcdn.com/image/fetch/$s_!Phma!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 1272w, https://substackcdn.com/image/fetch/$s_!Phma!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0aafe0b4-4a04-4abc-b43e-cc1a348c5e36_964x927.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>CodeTracer, time travelling interactive debugging (part 1)</h2><p>Wow! CodeTracer have released an extension for their time travelling debugger, which you should check out here:</p><div id="youtube2-8nnkLmnsngE" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;8nnkLmnsngE&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/8nnkLmnsngE?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>This is really amazing! Time travelling debugging is the process of stepping through and backwards in your contract&#8217;s execution life to see the setting of variables, the execution of calldata, and more. Solidity developers might be familiar with Tenderly, which is a product that lets you step through your code&#8217;s execution, and this is similar, except it&#8217;s way more powerful in this author&#8217;s opinion!</p><p>This is a full on IDE-style code explorer that you can use to see line annotations as you peruse your source code, fully contextual, even letting you see inside your loop as it executes! In this post, we had some issues with the testing of the contract I wrote for CodeTracer, so this is a part one of this series, setting the scene mostly.</p><h3>How to get started</h3><p>I found instructions that I could&#8217;ve followed here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/metacraft-labs/codetracer/blob/b9dcf290aeb16a367027c8c86924792acc7a290e/docs/book/src/getting_started/stylus.md?plain=1" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Q8h!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 424w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 848w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 1272w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Q8h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png" width="1407" height="1088" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1088,&quot;width&quot;:1407,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:196653,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/metacraft-labs/codetracer/blob/b9dcf290aeb16a367027c8c86924792acc7a290e/docs/book/src/getting_started/stylus.md?plain=1&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Q8h!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 424w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 848w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 1272w, https://substackcdn.com/image/fetch/$s_!_Q8h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe730c126-dc7e-4673-bfb0-c6354e5d4cfc_1407x1088.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Though, I noticed that it was possible for me to download a AppImage, so I grabbed that and installed it to my <code>PATH</code> at <code>$HOME/.bin</code>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gC9k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gC9k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 424w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 848w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 1272w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gC9k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png" width="1191" height="1041" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1041,&quot;width&quot;:1191,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:195511,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gC9k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 424w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 848w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 1272w, https://substackcdn.com/image/fetch/$s_!gC9k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f89634b-a380-46d2-9461-d5375b57b3f6_1191x1041.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>A sample contract</h3><p>We will create a fictional room generator for the grounds of a religious facility called a priory. Full disclosure, I had some fun learning about the history of monasteries for this little snippet, so if you&#8217;re not interested in this, feel free to skip!</p><p><a href="https://github.com/stylus-developers-guild/priories-example">You can find the repo here</a>.</p><p>A priory is a type of monastery that existed before a period of the Protestant Reformation in Europe, before Henry VIII dissolved monasteries between 1536 and 1541. It was a type of religious compound that was used as the administrative hub of a monastic order, so it had a practical function for administrative tasks, and scholarly research, as well as religious practice. Monasteries are interesting in that they observed isolation from their communities, despite forming the intellectual base for the community that housed them, often existing as a vehicle for the passing down of knowledge to the next generation, and this created an interesting social interplay.</p><p>Monasteries had to be mostly self sufficient, and to sustain themselves, would either receive gifts from the community, or they would farm and maintain land themselves. Farming would take time from their spiritual obligations, and monasteries were considered so essential for their societies, so it was considered commonplace for them to receive gifts and entitlements. They also had a variety of internal functions, including clothing their staff, feeding them, and maintaining their mental and physical well-being.</p><p>In communities, the monasteries would run around the clock, receiving visitors for different purposes, these purposes of which include official visits, health care, the receiving of tithes and such, and each monastery would function according to their own internal Rules and regulations, which varied from monastery to monastery.</p><p>Our fictional priory room generator will generate the following spaces, remaining mostly focused on its intended management function:</p><ol><li><p>A place for reading, a place for the storage of scrolls, books, and derivative religious texts. The internals of this place could be a stock room with chests, bookshelfs, desks for reading, beds for napping, and desks equipped with writing material.</p></li><li><p>A place for financial controlling, the storage of rare grains, the storage of entitlements, original religious texts, and legal documentation relevant to the broader community. The internals of this place might be a bed for the financial controller to sleep in instead of the dormitories (for security reasons), various locked chests, desks for writing and for reading, a desk for the measurement, an altar, and samples of goods.</p></li><li><p>A dormitory for the monks to sleep in. The dormitory is simple in that it&#8217;s filled with prayer stools (the monks would pray before sleep), beds, wash basins, and a desk with a bell to summon the monks to Matins, a nightly service at 5am.</p></li><li><p>A kitchen. The kitchen should be made up of fireplaces, cauldrons, tables for the preparation of bread, and on occasion, meat, if the monks were undertaking manual labour (like maintaining some farmland). It should also include shelves for jars, and buckets and barrels.</p></li></ol><p>Each of these functions will observe restrictions from the physical layout of which they were designated, inside the space we provide for the priory. We won&#8217;t include a section for the performance of the Sacraments, as in my understanding, this function is external to the space, as our focus is administration.</p><p>Our contract will take as seed a number supplied by the author during the creation of the contract (with the constructor method), and the block timestamp. This randomness seed will serve as a restriction of the dimensions of the priory, and our algorithm will generate the layout of the room of a priory as a SVG as ASCII art.</p><p>The creation of the space will be a bruteforce method of trying to insert different items inside a room. If the function fails to make the insertion, it will simply try again, so less attempts = more free space in each subsection.</p><p>One of the myriad strengths of working with Stylus is how higher level algorithms can be built succinctly in ways that would be difficult to implement in Solidity. Our choosing of the placement of the items in the room can be implemented using randomness with the ChaCha algorithm, and by combining multiple iterators together to create a generator.</p><h3>Our priory generator</h3><p>Our type will look like this:</p><pre><code>pub enum ReadingRoom {
    Stocks,
    Bookshelf,
    DeskForReading,
    Bed,
    DeskForWriting,
}

pub enum FinancialRoom {
    Storage,
    Bed,
    LockedChest,
    DeskForReading,
    DeskForWriting,
    DeskForMeasurement,
    Altar,
    SampleCollection,
}

pub enum Dormitory {
    WoodenBedstead,
    PrayerStool,
    WashBasin,
    DeskWithBell,
}

pub enum Kitchen {
    Fireplace,
    Cauldron,
    TableForBread,
    TableForMeat,
    Shelf,
}

pub enum Room {
    ReadingRoom(ReadingRoom),
    FinancialRoom(FinancialRoom),
    Dormitory(Dormitory),
    Kitchen(Kitchen),
}</code></pre><p>In breaking tradition with our usual kind of post, we won&#8217;t be discussing the implementation of the contract and the generator, but instead giving a high level description, then focusing on the testing of the contract.</p><p>Our contract will expose the following method (and constructor):</p><pre><code>constructor(uint256 seed);

function generate() returns (string memory);</code></pre><p>The generate function will read from the current timestamp, and the seed in contract storage, which it will use to seed a ChaCha random number generator, a fast random number generator for 32 bit word machines (like the Stylus environment). The generate function will return a SVG string. An invocation of the generate function will update the contract&#8217;s internal seed.</p><p>A generated room could look like the following:</p><pre><code>"""""""""
Dormitory
"""""""""
|  uubbbb  |
| bbbb     |
| uubbbb uu|
|      !   |
|      !!!!|
|  bbbb    |
|  bbbb    |
|  uu bbbb |
|  bbbb uu |
|          |</code></pre><p>Very Dwarf Fortress-like! Note that the <code>u</code> is means a wash basin, and <code>b</code> means a bed. <code>!</code> means a desk. A kitchen is similar:</p><pre><code>"""""""
Kitchen
"""""""
|ooo    hh |
|ooo       |
|          |
|     hh   |
|  hh  f f |
|   f ffff |
|   fff    |
|f f       |
|fff       |
| ttt  TTTT|</code></pre><p>This type of code provides us with ample opportunity to manipulate its execution, so it&#8217;s a good usecase for CodeTracer I imagine.</p><h2>Using CodeTracer</h2><p>Diving into the repo, I can see this works using a Lisp-like language as scripting glue, a great design decision (imo) for building applications like this.</p><p>Running CodeTracer&#8217;s downloaded AppImage (and skipping the installation prompt since CodeTracer is already in my <code>PATH</code> at <code>$HOME/.bin</code>),</p><p>I started experimenting with the code, and made a deployment that will go unused to Superposition Testnet. I found that the only way to get the debug tooling into the program is to do a deployment through it, so I went to initiate a deployment using <code>ct arb deploy</code>.</p><p>I had some issues where the program couldn&#8217;t find some trace artifacts in the tmp directory, so I ran <code>cargo stylus check</code>. I found that check wasn&#8217;t finding my compiled wasm blob in the deps directory, so I set my Cargo.toml file to be a <code>crate-type</code> of <code>rlib</code>, to create a Rust dynamic library. This created a wasm blob in the deps directory for us to use.</p><p>I then used <code>ct arb deploy</code> to deploy to the local Nitro testode, which created the deployment. I noticed that to do the deployment, I needed to support the feature <code>export-abi</code>, so I added it (the previous entrypoint would simply run the generator with pre-seeded randomness). I also removed the constructor, which seemed to cause problems (and we don&#8217;t support this yet on SPN Testnet).</p><p>With the deployment out of the way, it relocated the wasm blob to the right location! So I was able to continue with development. I was a little disappointed to see that the only way for me to use my code here was to do a deployment using the tool (also that the command line argument passing for the RPC url is non-functional, so I was stuck in an offline situation), but I imagine with a later release this will change.</p><p>I went to invoke the contract:</p><pre><code>cast send --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 --rpc-url http://127.0.0.1:8547 0x11b57fe348584f042e436c6bf7c3c3def171de49 'generate()'</code></pre><p>And encountered a panic! A wasm stack trace! It seems we blew out the stack potentially. Let&#8217;s see if we can tweak the compilation of the contract to use less of it. I adjusted the stack size using a new link argument in <code>.cargo/config.toml</code>:</p><pre><code>[build]
target = "wasm32-unknown-unknown"
rustflags = [
  "-C", "link-arg=-zstack-size=32768",
  "-C", "panic=abort",
]</code></pre><p>And this unfortunately caused a out of bounds memory access in the simulator! It seems that there are some differences between the simulation of the WASM here, and what&#8217;s on-chain. We&#8217;ll revisit this in the future, so this will make up a part one of this series.</p><div><hr></div><h2>AssemblyScript on Stylus</h2><p>AssemblyScript is a Typescript-like language that&#8217;s intended for WebAssembly. WakeUp Labs have been hard at work, and have brought it to Stylus! So, we can use TypeScript on Arbitrum. Very exciting!</p><p>The way the code works is with a AssemblyScript code generation pipeline that generates code with stubbed out native ArbOS functions (like keccak, getting the sender, etc), and they&#8217;ve built high level classes including types we use in the EVM (like the U256 type, Bytes, String, etc), that is then fed to an optimising pipeline, that eventually spits out WASM code we can deploy. The team have added state and visibility selectors, and have also built a online introspective tool (and eventual development webapp) at <a href="https://as-stylus-playground.wakeuplabs.link/">https://as-stylus-playground.wakeuplabs.link/</a> (featured below), which you can use to introspect your code to see the generated output of your contract development.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kV2V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kV2V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 424w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 848w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 1272w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kV2V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png" width="1456" height="813" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:813,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:784801,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kV2V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 424w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 848w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 1272w, https://substackcdn.com/image/fetch/$s_!kV2V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a10217d-d648-44c1-9bde-a2a4284b931b_1932x1079.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Using WakeUp Labs&#8217; AssemblyScript on Stylus, you can develop code with visibility and state selectors, and do more. It&#8217;s currently in alpha! We&#8217;ll include some links for you to check out at the end of this section of the post.</p><h3>Introduction</h3><p>Together, we&#8217;re going to build a smart contract that helps us perform on-chain recommendations of NFTs. We can use this to make a simple on-chain NFT recommendation algorithm. Imagine we have a group of NFT influencers:</p><ol><li><p>Hunter, from Offchain Labs.</p></li><li><p>Ivan, from Superposition.</p></li><li><p>Churro, also from Offchain Labs.</p></li><li><p>Marko (Blazeaster), from Superposition.</p></li></ol><p><a href="https://github.com/stylus-developers-guild/nft-recommendation">You can find the repo here</a>!</p><p>These NFT influencers will shill some NFTs to their communities. How can you, a user, know which NFT influencer to listen to the most? Answer: we implement an algorithm that computes the similarities between points in a &#8220;preference space&#8221;, aka, a Euclidean Distance Score. This is the type of calculation that would be done at scale using a time series database, prior to the advent of machine learning at large.</p><p>Let&#8217;s pick the top few NFTs by market cap, and use Q<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> to generate a random dataset of ratings out of 10:</p><pre><code>name,CryptoPunks,Bored Ape Yacht Club,Infinex Patrons,Pudgy Penguins,Chromie Squiggle by Snowfro,Autoglyphs,Fidenza by Tyler Hobbs,Moonbirds,Lil Pudgys
Hunter,8,4,2,7,6,8,9,5,0
Ivan,3,3,1,7,6,0,3,9,3
Churro,6,9,3,3,2,5,3,5,7
Marko,9,6,9,9,0,1,5,6,3</code></pre><p>These rankings look like this, if we display it as a scatter graph:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DOTp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DOTp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 424w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 848w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 1272w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DOTp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png" width="1200" height="742" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:742,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DOTp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 424w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 848w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 1272w, https://substackcdn.com/image/fetch/$s_!DOTp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2d107ba-9550-4ffe-9c47-193eac44f6c1_1200x742.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>How do we make sense of this noise, and find a best fit situation for a would be user looking to buy a NFT per the advice of one of our influencers here? Let&#8217;s dive in!</p><h3>Installation</h3><p>I visited AssemblyScript&#8217;s getting started documentation at <a href="https://as-stylus.wakeuplabs.io/Getting%20Started/quick-start">https://as-stylus.wakeuplabs.io/Getting%20Started/quick-start</a> to create a fresh project:</p><pre><code>npx @wakeuplabs/as-stylus generate nft-recommendation</code></pre><p>This creates a directory called &#8220;nft-recommendation&#8221; in the local directory. I appreciated how simple it was to get started using this, I didn&#8217;t have to install any extra tools or anything!</p><p>The directory contained the following:</p><pre><code>total 60K
-rw-rw-r--  1 user   89 Aug 25 22:31 tsconfig.json
-rw-rw-r--  1 user  578 Aug 25 22:31 package.json
-rw-rw-r--  1 user  468 Aug 25 22:31 contract.ts
-rw-rw-r--  1 user  41K Aug 25 22:31 package-lock.json
drwxrwxr-x 78 user 4.0K Aug 25 22:31 node_modules</code></pre><p>So, I jumped into <code>contract.ts</code> to get started with editing. The example contract looked like the following:</p><pre><code> // @ts-nocheck

@Contract
export class Counter {
  static counter: U256;

  constructor() {
    counter = U256Factory.create();
  }

  @External
  static increment(): void {
    const delta: U256 = U256Factory.fromString("1");
    counter = counter.add(delta);
  }

  @External
  static decrement(): void {
    const delta: U256 = U256Factory.fromString("1");
    counter = counter.sub(delta);
  }

  @View
  static get(): U256 {
    return counter.toString();
  }
}</code></pre><p>According to StackOverflow&#8217;s 2024 technology survey, JS ranked as the most popular programming language for developers, with TypeScript coming in fourth place, being beaten out by Python, and HTML/CSS. To WakeUp Labs are poised to onboard a TON of developers to Arbitrum with this technology!</p><p>I built the reference contract with:</p><pre><code>npx @wakeuplabs/as-stylus compile contract.ts</code></pre><p>Wow, it even verified the contract as well using the Sepolia endpoint! I did a test deployment to Arbitrum Sepolia (this seems to be the only supported external network right now) with:</p><pre><code>npx @wakeuplabs/as-stylus deploy contract.ts</code></pre><p>Which will prompt you for your private key as a argument using a TUI-like experinece (I had to use a terminal emulator here). And wow, it deployed without any issues! This has been an extremely seamless experience.</p><h3>Implementing our contract</h3><p>First, we&#8217;ll implement a reference function, in Python. We&#8217;ll bake our dataset and implement the following:</p><pre><code>import math

votes={
&#9;"Hunter": [8,4,2,7,6,8,9,5,0],
&#9;"Ivan": [3,3,1,7,6,0,3,9,3],
&#9;"Churro": [6,9,3,3,2,5,3,5,7],
&#9;"Marko": [9,6,9,9,0,1,5,6,3]
}

def distance(x, y):
&#9;# sum each nft: math.pow(votes[x][i] - votes[y][i], 2)
&#9;return 1 / (1 + math.dist(votes[x], votes[y]))</code></pre><p>In Python, we get a simple function inside the math library which lets us quickly get the Euclidean Distance score between a dataset. We do this operation of division to &#8220;normalise&#8221; the results, so that the numbers aren&#8217;t arbitrarily large. In the AssemblyScript code, we won&#8217;t be doing this operation to avoid floats, but also since U256 is quite large and we should be fine for space.</p><p>This code lets us determine the similarities between two datapoints in our set, for example, if we were to run this program:</p><pre><code>&gt;&gt;&gt; reference.distance("Hunter", "Marko")
0.07142857142857142</code></pre><p>If we were to compute the Euclidean Distance score between everyone and Ivan:</p><pre><code>&gt;&gt;&gt; for n in votes:
&gt;&gt;&gt;&#9;if n == "Ivan": continue
&gt;&gt;&gt;&#9;print(f"{n},{distance("Ivan", n)}")

Hunter,0.07502535103270168
Churro,0.07844773813482285
Marko,0.07263669959755374</code></pre><p>Which looks like this visually, with the most similar NFT influencer having the lowest score:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dwk1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dwk1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 424w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 848w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 1272w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dwk1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png" width="381" height="468" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:468,&quot;width&quot;:381,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12704,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dwk1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 424w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 848w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 1272w, https://substackcdn.com/image/fetch/$s_!dwk1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06663b90-5a56-4adf-88b9-131a090c3b02_381x468.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So we can see that Marko is the most similar to Ivan! Recommendation algorithms can use this method to sample a user&#8217;s interaction with a product, find a group that best fits them in terms of similarity scores, then recommend products that create the most conversions for them.</p><p>We&#8217;ll implement a contract that has the following functions:</p><pre><code>function registerInfluencer(uint256 nftId, uint256 score) external;

function registerUser(uint256 nftId, uint256 opinion) external;

function getMostSimilar(address user) external view returns (address mostSimilar);</code></pre><p>So far, the tower of operations that the U256 type supports seem to be the following, and we don&#8217;t have any power of operations available yet (the team are building the software in alpha):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vi-q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vi-q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 424w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 848w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 1272w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vi-q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png" width="321" height="308" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:308,&quot;width&quot;:321,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33644,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/169853329?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vi-q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 424w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 848w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 1272w, https://substackcdn.com/image/fetch/$s_!Vi-q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd53a19c4-8702-43ff-b58e-4f0967d1ab91_321x308.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So our first function will be a simple pow function using a loop. We&#8217;ll create a contract that looks like the following for the state:</p><pre><code>@Contract
export class NftRecommendation {
  static influencerCount: U256;
  static influencerIds: Mapping&lt;Address, U256&gt;;
  static influencerAddrs: Mapping&lt;U256, Address&gt;;
  static scores: MappingNested&lt;U256, U256, U256&gt;;
  static opinions: MappingNested&lt;Address, U256, U256&gt;;
}</code></pre><p>This contract lets us store the NFT count that our influencer group have recorded their thoughts on, record the influencer themselves, and also store the scores for each NFT, using the sender address. We need to have a count since arrays are not implemented yet here. We have a mapping for scores (per recorded influencer id), and for opinions (per end user thoughts on NFTs). We need to implement it this way until arrays are available as calldata arguments.</p><p>We add a constructor to let the user determine how many NFTs are in the recommendation set:</p><pre><code>constructor(count: U256) {
  nftCount.set(count);
}</code></pre><p>And we implement a function that lets us register an influencer, including a custom revert Error type, and require function:</p><pre><code>@Internal
@Pure
static requireNftCountScore(i: U256, score: U256): void {
  if (i &gt; nftCount) {
    TooHighNft.revert(i);
  }
  if (score &gt; U256Factory.fromString("10")) {
    TooHighScore.revert(score);
  }
}

@External
static registerInfluencer(i: U256, score: U256): void {
  requireNftCountScore(i, score);
  if (influencerIds.get(msg.sender) == U256Factory.create()) {
    influencerCount = influencerCount.add(U256Factory.fromString("1"));
    influencerIds.set(msg.sender, influencerCount);
    influencerAddrs.set(influencerCount, msg.sender);
    InfluencerRegistered.emit(msg.sender);
  }
  ScoreSet.emit(msg.sender, i, score, influencerCount);
  scores.set(influencerIds.get(msg.sender), i, score);
}</code></pre><p>This function counts the amount of influencers we have tracked, then increases the number each time a new influencer is added. We use a two nested mapping to make this easier. We defined the event and error type outside the scope of the contract, with:</p><pre><code>@Event
export class InfluencerRegistered {
  @Indexed influencer: Address;
}

@Event
export class ScoreSet {
  @Indexed scorer;
  @Indexed nft;
  @Indexed score;
}

@Error
class TooHighNft {
  no: U256;
}

@Error
class TooHighScore {
  amt: U256;
}</code></pre><p>It&#8217;s great that we can define the visibility and whether an event is indexed or not here!</p><p>We need to define some code that lets an end user define what they think about a NFT:</p><pre><code>@External
static registerUser(i: U256, opinion: U256): void {
  requireNftCountScore(i, opinion);
  opinions.set(msg.sender, i, opinion);
}</code></pre><p>We can keep this pretty simple.</p><p>We need to implement our pow function after setting the amount of NFTs we want to record the opinions of, so, we implement this code:</p><pre><code>  @Internal
  @Pure
  static pow(x: U256, y: U256): U256 {
    const one = U256Factory.fromString("1");
    let acc = U256Factory.fromString("1");
    for (let i = U256Factory.create(); i &lt; y; i = i.add(one)) {
      acc = acc.mul(x);
    }
    return acc;
  }</code></pre><p>This code uses a loop to compute the power of results, which we need for our similarity calculation.</p><p>Finally, we can start to implement our getScore function, which will use the power of function with an accumulator to compute the similarity scores of the set of the users for the user given, then return the address that has the greatest similarity:</p><pre><code>@External
@View
static getScore(user: Address): Address {
  const zero = U256Factory.create();
  const one = U256Factory.fromString("1");
  const two = U256Factory.fromString("2");
  let topId = zero;
  let topScore = zero;
  for (let influencerI = one; influencerI &lt;= influencerCount; influencerI = influencerI.add(one)) {
    let sum = U256Factory.create();
    for (let nftI = zero; nftI &lt; U256Factory.fromString("10"); nftI = nftI.add(one)) {
      const influencerScore = scores.get(influencerI, nftI);
      const userScore = opinions.get(user, nftI);
      let abs = U256Factory.create();
      if (influencerScore &gt; userScore) abs = influencerScore.sub(userScore);
      else abs = userScore.sub(influencerScore);
      sum = sum.add(pow(abs, two));
    }
    if (topScore == zero || topScore &gt; sum) {
      topId = influencerI;
      topScore = sum;
    }
  }
  return influencerAddrs.get(topId);
}</code></pre><p>This code literally goes through each influencer, then compares the top most similar user against what&#8217;s stored as the current top user.</p><p>For the joy of it, let&#8217;s deploy our contract like so:</p><pre><code>npx @wakeuplabs/as-stylus deploy contract.ts --constructor-args 9</code></pre><p>Which prompts me again for my private key, and deploys correctly!</p><p>We can invoke the method to see if it generates the events we want (I deployed the contract to <code>0x605638d05aee4aeaf9bb1784b0ec0e2727b1d84b</code>, without using the constructor feature, since SPN testnet doesn&#8217;t have this feature right now):</p><pre><code>cast send --private-key &lt;privatekeyhere&gt; --rpc-url https://testnet-rpc.superposition.so 0x605638d05aee4aeaf9bb1784b0ec0e2727b1d84b 'registerInfluencer(uint256,uint256)' 0 10</code></pre><p>Wow! I can see the generated events in my transaction receipt here! Very impressive.</p><h3>Testing</h3><p>To make a recommendation, we&#8217;d first ask a user to provide some thoughts on the various NFTs that we&#8217;re selling here. We&#8217;re going to ask our friend Erik what he thinks about our NFT set.</p><pre><code>CryptoPunks,Bored Ape Yacht Club,Infinex Patrons,Pudgy Penguins,Chromie Squiggle by Snowfro,Autoglyphs,Fidenza by Tyler Hobbs,Moonbirds,Lil Pudgys
8,2,0,8,0,0,0,6,9</code></pre><p>When I asked my friend why he rated some NFTs 0, the reason is that he hadn&#8217;t heard of them before. Let&#8217;s build a program to load our example set, and then our user into the contract. We&#8217;ll create some accounts and prefund to test the contract on-chain!</p><p>We&#8217;ll <a href="https://github.com/stylus-developers-guild/nft-recommendation/blob/trunk/tests.rc">create a script</a> that makes the recommendation for each of the accounts, and then is invoked to get the recommendation for the main user. The script uses several private keys to submit on-chain recommendations, then from the sending private key, asks the contract for the address of who&#8217;s the closest NFT recommender by address.</p><p>It was around this point that Franco from the WakeUp Labs team provided me with some online (based on the node) examples of how to write tests. <a href="https://github.com/wakeuplabs-io/assembly-script-stylus-sdk/tree/main/packages/as-stylus/__tests__/e2e">You could read more based on the approach in their repository</a>, though the approach is dependent on calls to the node, which we&#8217;ll implement ourselves using a (Plan9 rc) shell script. As time moves on, we&#8217;ll cover another article in the future on developing tests with AssemblyScript in a more enshrined/native way.</p><p>You can find the repo at <a href="https://github.com/stylus-developers-guild/nft-recommendation">https://github.com/stylus-developers-guild/nft-recommendation</a> to see the entire package. Brave to the Wakeup Labs team for bringing AssemblyScript to Stylus!</p><div><hr></div><h2>Interview with Gonza</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Rsaq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Rsaq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 424w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 848w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 1272w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Rsaq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png" width="1456" height="823" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:823,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Rsaq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 424w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 848w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 1272w, https://substackcdn.com/image/fetch/$s_!Rsaq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63874aaf-85db-43a8-b709-1201987aa6df_1600x904.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Who are you, and what do you do?</h3><p>Hey! I&#8217;m Gonza. Most people in crypto know me as <em>gonzacolo.eth</em>. I&#8217;m the co-founder of WakeUp Labs, a company that helps startups, DAOs, and big corporations solve complex technical challenges, speed up their product roadmap, and experiment with new ideas through research and rapid prototyping.</p><p>Before diving into Web3, I studied Economics and taught History of Economic Thought at university. One of the main reasons I got into economics was to better understand the chaos of Argentina&#8217;s economy and make smarter decisions in uncertain environments. Funny enough, crypto felt like a natural extension of that: lots of volatility, fragmented and noisy information, and a constant need to evaluate risk.<br><br>Eventually, that curiosity turned into action. With WakeUp Labs, we wanted to share the knowledge we had, support projects we believed in, and make crypto simpler &#8212; not just for users, but for the developers and teams trying to build in this space. That&#8217;s still our north star today.</p><h3>What web3 ecosystems have you worked in?</h3><p>Yeah, most of our work has been in EVM-compatible chains &#8212; that&#8217;s where we feel the strongest fit. Arbitrum, in particular, has been a key partner for WakeUp Labs. We've had the chance to work closely with them on several initiatives.</p><p>We built a UI for a bridge that enables a transaction even when the sequencer misbehaves (<a href="https://x.com/wakeuplabs/status/1943730988288201157">https://x.com/wakeuplabs/status/1943730988288201157</a> ), worked on SDKs and libraries, and more recently, we&#8217;ve been contributing to <strong>Stylus</strong>. There, we&#8217;re making Stylus compatible with AssemblyScript, which we think is an exciting way to bring more developers, especially those outside the usual Rust or Solidity crowd, into the ecosystem.</p><p>Beyond that, we&#8217;ve collaborated with <strong>Velora</strong> (formerly ParaSwap), <strong>The Sandbox DAO</strong>, <strong>Coinbase</strong>, and some cool Argentine startups like <strong>Win investments</strong> and <strong>Num Finance</strong>. We&#8217;ve also gotten more involved in the DeFi and privacy space &#8212; contributing to <strong>Noir</strong> and experimenting with new DeFi protocols and ideas around private execution.</p><p>We&#8217;re drawn to ecosystems where we can make a real impact, technically and strategically. Right now, Arbitrum is one of those &#8212; not just because of the tech, but because there&#8217;s space to build things that matter.</p><h3>What are your impressions of working with Stylus, good and bad?</h3><p>We built our solution using AssemblyScript, which we ran on the Stylus VM. We really appreciate that Stylus supports building solutions in multiple languages that can compile to WASM and integrate with its ABI. When we deployed to testnet, we were particularly impressed by the execution speed of transactions</p><h3>What software do you use?</h3><p>WakeUp Stacks leverages Cursor as our primary development environment. For the frontend, we work with React + Vite. Our APIs are mainly built in Node.js (TypeScript), with an increasing adoption of Rust for high-performance services. Our infrastructure is hosted on AWS. In the blockchain space, we develop EVM smart contracts in Solidity. More recently, we&#8217;ve been implementing Zero-Knowledge proof solutions using Noir, a <em>domain-specific language </em>inspired by Rust for writing ZK circuits.</p><h3>What hardware do you use?</h3><p>Most of our team works on Mac, out of 20 people, 17 use macOS as their daily driver. While a few still run Windows or Linux, Mac has clearly won the race within our organization. We particularly value its development-friendly environment, reliability, and smooth integration with our toolchain.</p><h3>How can we get in touch with you?</h3><p>The easiest way to reach us is through Telegram &#8212; feel free to message me at @gonzacolo.</p><p>If you&#8217;d like to stay updated, learn more about what we do, or explore ways to collaborate, check out our Twitter:<a href="http://www.x.com/wakeuplabs"> www.x.com/wakeuplabs</a> and our website: <a href="http://wakeuplabs.io">wakeuplabs.io</a>.</p><p>People usually reach out to us when they&#8217;re looking to move fast, whether that means testing an idea, building a new product, or contributing to ecosystems like Arbitrum, Starknet, Rootstock, and others. We specialize in working with DAOs, foundations, and startups. So if you&#8217;re building something ambitious and want a team that cares about the code, let&#8217;s talk.</p><h3>What's a piece of advice you'd give someone new to web3?</h3><p>Our advice for anyone starting out in Web3 is to treat it as a marathon, not a sprint. With new projects launching every day and technology moving fast, it&#8217;s easy to get caught up in the noise. But the people who stick around are the ones who understand the philosophy behind it and make long-term bets in long-term ecosystems, with long-term partners.</p><p>Your reasons might be different from ours, but it&#8217;s important to connect with the &#8220;why&#8221; &#8212; decentralization, privacy, ethos&#8230;</p><p>Once that clicks, your research starts to matter more. The deeper you go into projects, the more you&#8217;ll understand them &#8212; and the better your chances of building something meaningful, contributing ideas, investing wisely, or getting involved in a way that lasts.</p><p>After that first phase, a great next step is showing up in person. There are three global conferences I&#8217;d recommend: EthCC in France, ETHDenver in the US, and DevConnect, which changes location each year.</p><p>This year, <a href="https://devconnect.org/">DevConnect</a> is happening in Argentina, and we&#8217;re excited to welcome everyone! :)</p><div><hr></div><p>To get in touch with the Wakeup Labs team, follow the team at <a href="https://x.com/wakeuplabs">https://x.com/wakeuplabs</a>! Be sure to read their introductory post for their project at:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://www.wakeuplabs.io/blog/arbitrum-wakeuplabs" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZRsD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 424w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 848w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 1272w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZRsD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png" width="1020" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:1020,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://www.wakeuplabs.io/blog/arbitrum-wakeuplabs&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZRsD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 424w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 848w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 1272w, https://substackcdn.com/image/fetch/$s_!ZRsD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b87ba47-4a14-482d-90fb-690e311a584b_1020x576.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This team is one of the more proactive teams I&#8217;ve had the pleasure of interacting with, so I&#8217;m really looking forward to seeing how this evolves gradually!</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div><hr></div><blockquote><p>By the way, I&#8217;ve been travelling through Japan, and recently stayed at <a href="https://www.booking.com/hotel/jp/guest-house-gui-tang-seidou.en-gb.html">this guest house</a> during a period of intense rain (and flooding) in the Mount Fuji region. Satoshi has been an excellent host!</p></blockquote><p><a href="https://www.booking.com/hotel/jp/guest-house-gui-tang-seidou.en-gb.html">Guesthouse</a></p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/731ffb21-82a3-46b7-acc2-553c1761d064_1200x1600.jpeg&quot;},{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f96eabb9-6744-45c4-80b3-2ef746768d2a_576x768.jpeg&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c525182b-b413-4617-bd9f-fddc3a7d8152_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yWmN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yWmN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yWmN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg" width="552" height="433.7142857142857" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1144,&quot;width&quot;:1456,&quot;resizeWidth&quot;:552,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!yWmN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yWmN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec7b9c03-5593-47a9-abda-7992d87f7837_3631x2854.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><pre><code>nfts:`CryptoPunks,(`$"Bored Ape Yacht Club"),(`$"Infinex Patrons"),(`$"Pudgy Penguins"),(`$"Chromie Squiggle by Snowfro"),`Autoglyphs,(`$"Fidenza by Tyler Hobbs"),`Moonbirds,(`$"Lil Pudgys")
people:`Hunter`Ivan`Churro`Marko
flip (`name,nfts)!flip ({x,{(1?10)0}@'nfts}@'people)</code></pre></div></div>]]></content:encoded></item><item><title><![CDATA[How to verify your Stylus contracts with the Blockscout API, Multiple contracts in a Stylus project, Supporting Stylus on Ethereum RISC-V (part 2)]]></title><description><![CDATA[1st of August 2025. Developer guides, and continuing the Stylus on RISC-V exercise.]]></description><link>https://stylus-saturdays.com/p/how-to-verify-your-stylus-contracts</link><guid isPermaLink="false">https://stylus-saturdays.com/p/how-to-verify-your-stylus-contracts</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Fri, 01 Aug 2025 15:42:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/39b0c455-7b72-4768-8392-dc42258b06fe_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone! <a href="https://x.com/baygeeth">Bayge</a> here (<a href="https://farcaster.xyz/bayge">Farcaster</a>)! We&#8217;re back. In today&#8217;s post, we&#8217;ll cover the following:</p><ol><li><p><strong>&#129514; </strong>How to Verify Your Contracts with Blockscout&#8217;s API (No UI Needed!) &#128640;</p></li><li><p>&#129521; How to Deploy <em>Multiple</em> Contracts in a Stylus Project &#8211; July 2025 Edition &#128736;&#65039;&#128230;</p></li><li><p>&#128187; Stylus on RISC-V (RV32IM) &#8211; Part 2: SDK Support, Missing Simulator Features, and a Sample Contract &#129516;&#9881;&#65039;&#128220;</p></li></ol><p>Read on, and as always, if you have any feedback, please share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and Go. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interoperability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><p>You can get started very quickly using a (community maintained) setup script at <a href="https://stylusup.sh">https://stylusup.sh</a>, with official resources at <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a>, or fully online, without any setup, using The Wizard at <a href="https://thewizard.app/">https://thewizard.app/</a>!</p><div><hr></div><h2>How to verify your contracts with Blockscout&#8217;s API</h2><p>It&#8217;s possible to use the Blockscout API to verify your Stylus smart contracts. Special shoutout to Rim Rakhimov from Blockscout for graciously sharing some information on how their system works behind the scenes! I&#8217;ve slightly edited what they sent me and collected it here. Read on:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><em>Q. How does Blockscout verify Stylus contracts?</em></p><p>Currently, we support verifying Stylus contracts located in public GitHub repositories. The swagger file for our API endpoint to request the verification can be found <a href="https://app.swaggerhub.com/apis/blockscout-f58/stylus-verifier/v1#/StylusSdkRsVerifier/StylusSdkRsVerifier_VerifyGithubRepository">here</a>. The endpoint accepts the following fields: <code>deployment_transaction</code>, <code>rpc_endpoint</code>, <code>cargo_stylus_version</code>, <code>repository_url</code>, <code>commit</code>, and <code>path_prefix</code></p><p>The path_prefix is required so that repositories with several contract crates inside can be used. The repository <a href="https://github.com/blockscout/cargo-stylus-test-examples">https://github.com/blockscout/cargo-stylus-test-examples</a> contains some great examples.</p><p>When a user visits the verification UI, they provide the <code>cargo_stylus_version</code>, <code>repository_url</code>, <code>commit</code>, and <code>path_prefix</code> values. These values, along with the address of the contract being verified are sent to an Elixir backend. The backend retrieves the <code>deployment_transaction</code> from the internal database, and sends the data it collected so far, and the <code>rpc_endpoint</code>, to a separate verification service. </p><p>The service validates the repository, clones the repo the user provided, and checks out the commit hash. If <code>path_prefix</code> is provided, it enters the corresponding <code>prefix</code>, which is calculated relative to the repository root directory.</p><p>Stylus requires the Rust toolchain version to be specified in a <code>rust-toolchain.toml</code> file. The file has to be located inside the working directory.</p><p>For verification, Blockscout uses the command <code>cargo stylus verify</code> <code>--no-verify --endpoint {rpc_endpoint} --deployment-tx {deployment_transaction}</code>`.</p><p>We opt out of running verification inside in-stylus docker container by adding the <code>--no-verify</code> flag. We opt out because <code>cargo-stylus</code> requires the docker daemon to be run locally, but we would like to run the service and docker daemon on different machines. We implemented our own docker container startup process which allows us to run containers on the remote docker daemon.</p><p><code>cargo stylus verify</code> prints the result into console. We parse the <code>stdout</code> and look for the line: "<code>Verified - contract matches local project's file hashes</code>". If found, the verification is considered successful, otherwise the verification fails. </p><p>If successful, we also attempt to retrieve the contract ABI as it is not returned by the verify command. To get the abi, we run the <code>cargo stylus export-abi</code> command, and parse its result. It prints the ABIs of all included contracts, and the verified contract ABI is printed as the last one. The name of this ABI is also used as a contract name inside a response.</p><p>If you need the code, the main function is implemented here: <a href="https://github.com/blockscout/blockscout-rs/blob/main/stylus-verifier/stylus-verifier-logic/src/stylus_sdk_rs.rs#L76">https://github.com/blockscout/blockscout-rs/blob/main/stylus-verifier/stylus-verifier-logic/src/stylus_sdk_rs.rs#L76</a></p><p>An example of making a request to the Blockscout API for verification:</p><blockquote><pre><code>curl 'https://arbitrum.blockscout.com/api/v2/smart-contracts/&lt;address_hash&gt;/verification/via/stylus-github-repository' -H 'Content-type: application/json' -d '{"cargo_stylus_version":"v0.5.6","repository_url":"https://github.com/OffchainLabs/stylus-erc20","commit":"d109002ffff3df7589cbbc92f8f104567a84f085","path_prefix":"","license_type":"none"}'</code></pre></blockquote><p><em>Thanks again to Rim Rakhimov and the Blockscout team for this in-depth explanation! Be sure to let their team know if you found the explanation useful. You can follow them on X at <a href="https://x.com/blockscout">https://x.com/blockscout</a>, and you can check out their Github organisation at <a href="https://github.com/blockscout/blockscout-rs/blob/main/stylus-verifier/stylus-verifier-logic/src/stylus_sdk_rs.rs#L76">https://github.com/blockscout</a>. Blockscout is a fully open source, and community contributions are always welcome.</em></p><div><hr></div><h2>How to do multiple contracts in a Stylus project, July 2025 edition</h2><p>I&#8217;ve seen some discussion lately in the community, with people wondering how to do multiple contracts in one location! At the time of writing, the 1.0 version of Stylus will include a feature that manages this for you. For now, we still have two ways to do this ourselves. Let&#8217;s review!</p><h3>Multiple packages/Cargo workspaces</h3><p>This is an approach I don&#8217;t prefer, after experiencing the frustrations of this with <a href="https://github.com/fluidity-money/long.so">Longtail</a>, the Superposition concentrated liquidity AMM.</p><p>The trick is to use separate packages internal to the project using a Cargo workspace. An example of how this works in practice is to look at <a href="https://github.com/fluidity-money/long.so">Longtail</a> or <a href="https://github.com/renegade-fi/renegade-contracts/blob/main/Cargo.toml">Renegade</a>. <a href="https://github.com/OpenZeppelin/rust-contracts-stylus">OpenZeppelin</a> also take this approach with their Stylus contracts, as this method is the easiest to use if you&#8217;re vendoring dependencies for end users.</p><p>At the root of your repository, you would need a Cargo.toml file that indicates a workspace is in use, <a href="https://github.com/renegade-fi/renegade-contracts/blob/main/Cargo.toml">like so</a>:</p><pre><code>[workspace]
members = [
    "contracts-stylus",
    "contracts-core",
    "contracts-common",
    "scripts",
    "contracts-utils",
    "integration",
]
resolver = "2"</code></pre><p>Then, inside each contract folder, you would <a href="https://github.com/renegade-fi/renegade-contracts/tree/main/contracts-stylus">have a separate project for the contract you&#8217;re supporting</a>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Fmvv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Fmvv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 424w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 848w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 1272w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Fmvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png" width="671" height="379" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc5953ae-1096-4269-9886-524c8101f2ee_671x379.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:379,&quot;width&quot;:671,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30071,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Fmvv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 424w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 848w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 1272w, https://substackcdn.com/image/fetch/$s_!Fmvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc5953ae-1096-4269-9886-524c8101f2ee_671x379.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Most tools in the Stylus ecosystem let you set the specific package during your deployment and use of the tools! I imagine this will see the most support in the reproducible build department in an ongoing way.</p><h3>Feature flagging</h3><p>It&#8217;s possible to use a approach based on feature flagging to support multiple contracts! We use a method like this for our <a href="https://github.com/fluidity-money/9lives.so">prediction market 9lives</a>. I prefer this method since comparatively it&#8217;s a lot simpler than using workspaces. The key is to use conditional compilation to import the <code>user_entrypoint</code> function depending on which contract is being built at the time. This is what our <code>lib.rs</code> entrypoint (partly) looks like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/fluidity-money/9lives.so/blob/main/src/lib.rs" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hyoq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 424w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 848w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 1272w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hyoq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png" width="416" height="269" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:269,&quot;width&quot;:416,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39275,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/fluidity-money/9lives.so/blob/main/src/lib.rs&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hyoq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 424w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 848w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 1272w, https://substackcdn.com/image/fetch/$s_!hyoq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa78ad3cc-54fe-4f56-ad1a-d7afd594b702_416x269.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, if contract-factory-1 is set as the feature flag, then the <code>user_entrypoint</code> function that&#8217;s generated inside <code>contract_factory_1</code> is imported, setting the entrypoint to the contract. This means, that we have to set the feature flag <code>contract-factory-1</code> to get the entrypoint to the contract, so the compiled wasm file is the contract for the factory!</p><p>For <code>contract_beauty_contest,</code> (and <code>contract_infra_market</code>, and <code>contract_lockup</code>, and <code>contract_trading</code>), conditionally generating the user entrypoint by checking the feature flag results in a conditionally generated entrypoint:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/fluidity-money/9lives.so/blob/main/src/contract_beauty_contest.rs" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wRu7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 424w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 848w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 1272w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wRu7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png" width="710" height="69" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:69,&quot;width&quot;:710,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19023,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/fluidity-money/9lives.so/blob/main/src/contract_beauty_contest.rs&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wRu7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 424w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 848w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 1272w, https://substackcdn.com/image/fetch/$s_!wRu7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71c033b6-3f33-4dde-b4ab-7ba58f09144a_710x69.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Which is by default exported from this file. So, our import from above where we import everything, we can import the entrypoint this way.</p><p>Though I have a preference, the ideal approach depends on your team&#8217;s DNA. My team are sophisticated shell script operators, so, we don&#8217;t mind <a href="https://github.com/fluidity-money/9lives.so/blob/main/Makefile">maintaining a Makefile</a> that orchestrates the feature flagging, moving files around where appropriate. The problem with this approach is that we can&#8217;t parallel the creation, all compilation needs to happen sequentially.</p><p>I&#8217;m interested in seeing what people prefer over time, and for the new version of the SDK to come out with a better approach for this!</p><div><hr></div><h2><strong>Stylus on RISC-V (32IM) Part 2 - The SDK and environment calls</strong></h2><p>This is a continuation of part 1 of this series:</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;98f1599a-e021-4b5a-9d33-4bb4f38961d8&quot;,&quot;caption&quot;:&quot;Hey everyone! Bayge here. This week:&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Supporting Stylus on RISC-V (part 1), Interview with Levan (blockcraft3r)&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:258941827,&quot;name&quot;:&quot;Stylus Saturdays&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a99cbcb8-2755-4696-b78e-c9421575fe75_387x387.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-06-16T19:19:53.871Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2ae896a-ad87-45a1-9eb6-26fa2c812b64_1024x1024.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://stylus-saturdays.com/p/supporting-stylus-on-risc-v-part&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:163347969,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Stylus Saturdays&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!8a8d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8586ee73-2f17-4dad-a892-09059adf7dce_387x387.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png" width="415" height="207.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:415,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">The simulator</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/stylus-sdk-rs-riscv32" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IAAi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IAAi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png" width="426" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/stylus-sdk-rs-riscv32&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IAAi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!IAAi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae3f44c2-fe1d-40d2-8442-2586933ddba9_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">The forked SDK</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/stylus-risc-hello-world" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K1wC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K1wC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png" width="426" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/stylus-risc-hello-world&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K1wC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!K1wC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26bb54bb-5198-46ad-99dd-f836e50da2b5_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">An example RISC-V smart contract made with Stylus</figcaption></figure></div><p>It&#8217;s been a month! Wow, time flies! Let&#8217;s continue our support for RISC-V with the Stylus SDK. To continue our journey, we need to do the following:</p><ol><li><p>Get the missing features from the EVM supported in our simulator. This includes the remaining host operations.</p></li><li><p>Get the SDK fully updated to let us generate binaries with RISC-V! Fix the entrypoint and the rest of the storage code! Release a forked SDK anyone can use as a dependency.</p></li></ol><p>To recap what RISC-V is, and what we&#8217;re up to, <a href="https://en.wikipedia.org/wiki/RISC-V">RISC-V</a> is a &#8220;<em>reduced instruction set</em>&#8221; instruction set architecture (ISA) that&#8217;s developed as an open source standard. An ISA is a set of instructions that a processor understands that you, an end programmer, provide by compiling your code written in a higher level language down to. So when you compile your Rust code (and it&#8217;s not to be run on Arbitrum), it spits out &#8220;native code&#8221;, which is code capable of being run with the native instruction set for your processor type. If you&#8217;re on a Mac, and you have a M4 chip, then you run the ARM instruction set, which is different from the instruction set my Intel i7 processor runs.</p><p>We&#8217;re interested in running Stylus smart contracts on the RISC-V 32 instruction set (with the Integer and base Multiplication extensions) since there was some discussion last month of running the entire Ethereum Virtual Machine on RISC-V. My goal is to potentially establish Arbitrum Stylus as the main programming environment alongside Solidity and Vyper in the Ethereum space, so my ultimate goal with this exercise is to eventually simulate RISC-V on-chain inside a WASM runner.</p><p>So far, we&#8217;ve developed a testing simulator for offline development in OCaml. In this article, we&#8217;ll support missing EVM features in the simulator using environment calls (where the guest running program can indicate to the CPU that the CPU needs to step in and do something before giving back control). We&#8217;ll also patch the SDK to support RISC-V as a compilation target, and release a contract for this.</p><p>Read on!</p><h3>Missing features supported in the simulator</h3><p>To do this, we&#8217;ll first implement the external functions that Stylus needs:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/OffchainLabs/stylus-sdk-rs/blob/856597767d2d24d7d93a58a970a155c5979e7903/stylus-sdk/src/hostio.rs#L59-L384" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tVI5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 424w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 848w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 1272w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tVI5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png" width="926" height="908" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:908,&quot;width&quot;:926,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:220515,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/OffchainLabs/stylus-sdk-rs/blob/856597767d2d24d7d93a58a970a155c5979e7903/stylus-sdk/src/hostio.rs#L59-L384&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tVI5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 424w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 848w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 1272w, https://substackcdn.com/image/fetch/$s_!tVI5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25125a25-c8e1-4dde-9f4f-e29d142bbdab_926x908.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These are implemented by the host environment to support the EVM storage trie, calldata, and the classic calling operations. These are normally provided in WASM as external functions. We need to support them in our OCaml simulator by allowing a user to trigger a environment call with the A7 register set to an offset of the function number to use! Let&#8217;s create a new file, and define a type of each external function we want to support:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v_dd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 424w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 848w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 1272w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v_dd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png" width="303" height="693" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:693,&quot;width&quot;:303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50884,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!v_dd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 424w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 848w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 1272w, https://substackcdn.com/image/fetch/$s_!v_dd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F643aa9e4-dc33-4833-97d8-0436ec92f85d_303x693.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Note the &#8220;<code>enum</code>&#8221; preprocessor: this create a function that converts a integer to one of the variant fields here, and vice versa. Note that we add a helper console function, as well as a function for reading the length of the return arguments! We need it to match dispatch to our functions here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hmXG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 424w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 848w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 1272w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hmXG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png" width="505" height="211" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:211,&quot;width&quot;:505,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23601,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hmXG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 424w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 848w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 1272w, https://substackcdn.com/image/fetch/$s_!hmXG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00760acf-4e99-4829-a85b-7c5a05078ce5_505x211.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Shortened to save space in this article!</figcaption></figure></div><p>In line with the standard calling convention with RISC-V, we store the syscall number in the register A7. To accommodate the new supported EVM features, we need to update the amount of information available to our virtual CPU. We do so by adding a new file, which has this definition:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zdjJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 424w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 848w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 1272w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zdjJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png" width="644" height="521" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:521,&quot;width&quot;:644,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79525,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zdjJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 424w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 848w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 1272w, https://substackcdn.com/image/fetch/$s_!zdjJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2aa3492-b768-4963-a9f7-892bc44e2a03_644x521.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Note the extra fields beyond the memory that we need for the program from last time! Specifically, the &#8220;<code>Ethereum_cd.t</code>&#8221; type in the fields <code>e_cd</code>, and <code>e_rd</code>, which we use for the calldata and the returndata for the program respectively. We&#8217;ll service some of the external functions using these fields in the type for the CPU here.</p><p>So a function supporting an environment call would look like this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eVoF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 424w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 848w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 1272w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eVoF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png" width="591" height="138" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:138,&quot;width&quot;:591,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21588,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eVoF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 424w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 848w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 1272w, https://substackcdn.com/image/fetch/$s_!eVoF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc07a271-efce-4dc2-ae62-d0061262e6ed_591x138.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This function would create a U256 from the integer given (currently, the default setting that SPN Mainnet has), then set it to the location of memory given, equivalent to the host features that the WASM runner would implement.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7UjQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 424w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 848w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 1272w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7UjQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png" width="471" height="71" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:71,&quot;width&quot;:471,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10491,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7UjQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 424w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 848w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 1272w, https://substackcdn.com/image/fetch/$s_!7UjQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc8f392b-abb7-46e9-b920-d9dab871ed5e_471x71.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Reading the arguments is similar. We simply read from the custom type that contains the calldata:</p><pre><code>(* Ethereum_cd.ml *)
type t = int32 Array.t</code></pre><p>Very simple! We need a function that lets the guest RISC-V program set the returndata type:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tRmI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 424w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 848w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 1272w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tRmI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png" width="513" height="75" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:75,&quot;width&quot;:513,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13919,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tRmI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 424w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 848w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 1272w, https://substackcdn.com/image/fetch/$s_!tRmI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F111e9bdc-bc70-4a1d-b765-db2f6a3a9e9a_513x75.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Using the A0 and A1 registers is how we find the read pointer, and the length. This pattern will repeat throughout our implementation, in line with the standard calling convention with RISC-V.</p><p>You can read the <a href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/lib/ecalls.ml">repo</a> to see the extent of the functions that we implemented here.</p><h3>Tweaking the SDK</h3><p>Now that we&#8217;ve got a reasonable implementation of some of the foreign functions that the contract needs, we can start to support RISC-V in the SDK. We need to extend the <code>vm_hooks</code> macro, to add branching for the RISC-V target that copies the arguments that the functions would provide to the external function as arguments to the registers, in line with the calling convention.</p><p><a href="https://github.com/af-afk/stylus-sdk-rs-riscv32/blob/main/stylus-sdk/src/hostio.rs#L12-L143">This means code like the following</a>:</p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/webp&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6fc7be68-147d-429d-9ed1-def86039fac0_714x1137.webp&quot;},{&quot;type&quot;:&quot;image/webp&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/572c9a3c-7cdc-4d47-9400-18fc4a6101b8_709x911.webp&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/802a6d16-8c30-4f6b-b9ac-94fd756c7d92_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p>This code copies the arguments from the functions given after making a slice of the arguments (in their u32 type as usize type), and sets the registers with it. It invokes the associated function based on a count that increments per number. It generates functions that read the registers and reconstruct them based on the arguments.</p><p>This new macro spits out code like this for the RISC-V target:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nR7X!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nR7X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 424w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 848w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 1272w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nR7X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png" width="558" height="246" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:246,&quot;width&quot;:558,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39725,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nR7X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 424w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 848w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 1272w, https://substackcdn.com/image/fetch/$s_!nR7X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51229de8-cfc1-4f3f-87e0-c95d61df0cdb_558x246.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For the above contract address, this is simply a pointer to the offset for the 20 byte address to be written. A better implementation of the macro would set the single field, as well as the syscall number, instead of setting every argument for the standard calling convention. A problem this macro has is that an argument with a u64 is simply cast to the u32 type, instead of leveraging an extra register implicitly.</p><p>We needed to also make some changes to the <a href="https://github.com/af-afk/stylus-sdk-rs-riscv32/blob/main/Cargo.toml">Cargo.toml file</a> to accommodate the bytes package, and some dependency on arc. I also needed to upstream a patch to dyn-clone to accommodate <code>target_has_atomic</code> since we don&#8217;t have access to anything involving sync (RISC-V 32IM is a tier 3 target with no parallelism).</p><h3>Our first (somewhat legit) contract</h3><p>Having adjusted the SDK, and added features to the simulator, we can write our first contract! Inside the risc-hello-world contract, we can create the following:</p><pre><code>// src/main.rs

#[entrypoint]
#[storage]
struct Storage {
    pub message: StorageString,
}

#[public]
impl Storage {
    pub fn hello(&amp;mut self) -&gt; String {
        self.message.set_str("Hello!");
        self.message.get_string()
    }
}

#[export_name = "_start"]
pub extern "C" fn _start() -&gt; ! {
    unsafe {
        let heap_start = HEAP.as_mut_ptr() as usize;
        let heap_len = HEAP.len();
        ALLOCATOR.init(heap_start, heap_len);
    }
    let len: usize;
    unsafe {
        core::arch::asm!(
            "ecall",
            in("a7") 34,
            lateout("a0") len,
            options(nostack, preserves_flags)
        );
    }
    let status = user_entrypoint(len);
    unsafe {
        core::arch::asm!("mv a0, {}", in(reg) status);
    }
    unsafe {
        asm!("ebreak");
    }
    loop {}
}

#[panic_handler]
fn panic(_info: &amp;core::panic::PanicInfo) -&gt; ! {
    unsafe {
        core::arch::asm!("mv a0, {}", in(reg) 2);
    }
    unsafe {
        asm!("ebreak");
    }
    loop {}
}</code></pre><p>We create a simple allocator (we defined this in the previous post), and set it up in our entrypoint. We call a custom function at number 34 (<code>args_len</code>) to get the length of the calldata argument, and then we set the contents of <code>A0</code> after the execution to the variable <code>len</code>.</p><p>Knowing the length lets us invoke the <code>user_entrypoint</code><a href="https://github.com/OffchainLabs/stylus-sdk-rs/blob/856597767d2d24d7d93a58a970a155c5979e7903/stylus-proc/src/macros/entrypoint.rs#L130-L163"> function that the code normally generates</a>! This will let us pick the entrypoint, in this case the function &#8220;<code>hello()</code>&#8221; which returns a string! Our program sets &#8220;Hello!&#8221; to the storage, and then reads it off, returning it.</p><p>The <code>user_entrypoint</code> function reads the contents of the arguments, using the <code>read_args</code> in memory it provided to our RISC-V simulator. It then returns the status, which we set to the register <code>A0</code>. Among our changes here, we also changed the simulator to check the value stored in the <code>A0</code> register when exiting:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/bin/main.ml#L118-L127" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VmaQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 424w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 848w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 1272w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VmaQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png" width="635" height="543" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:543,&quot;width&quot;:635,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:74903,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus/blob/trunk/bin/main.ml#L118-L127&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168621615?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VmaQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 424w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 848w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 1272w, https://substackcdn.com/image/fetch/$s_!VmaQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58a0b470-e744-432b-bbeb-05c7d5021594_635x543.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Any calls to the <code>write_result(data: *const u8, len: usize)</code> function invoked by the <code>user_entrypoint</code> code will set the return value for the contract. The function that sets the return data will set the <code>e_rd</code> field in the record that we have in the <code>Cpu.t</code> type. Our program then prints and returns it for us!</p><h3>Running the simulator</h3><p>We can run this code now! The RISC-V runner also includes a argument that we can provide that sets the sender. We can run the copy of the test code <a href="https://github.com/af-afk/ocaml-riscv32im-stylus">inside the simulator repo</a>. This contract will slightly differ from the above, so that we can supply an argument of the string to set to the storage:</p><pre><code>#[entrypoint]
#[storage]
struct Storage {
    pub message: StorageU256,
}

#[public]
impl Storage {
    pub fn hello(&amp;mut self, x: String) -&gt; String {
        self.message.set(x);
        self.message.get()
    }
}</code></pre><p>First, we build:</p><pre><code>dune build bin/main.exe</code></pre><p>Then we run:</p><pre><code>./_build/default/bin/main.exe test/risc-hello-world $(cast calldata 'hello(uint256)' 456)</code></pre><p>Which returns:</p><pre><code>0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000</code></pre><p>The operation <code>$(cast calldata 'hello(string)' Hello)</code> substitutes in the argument list the calldata for &#8220;<code>hello(Hello)</code>&#8221; and the argument we want, which is 0xa777d0dc0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000! This is provided to the program as calldata by setting the <code>e_cd</code> field in the simulator!</p><h3>What&#8217;s next?</h3><p>We need to fix our simulator to not use <code>libbinutils</code> to read the ELF section headers, so that we can support release generated (stripped) builds. This is a problem for my system since I&#8217;ve had some issues linking against my preference library (<code>libelf</code>) for this, and I don&#8217;t want to roll support myself natively. For our research simulator, it would be nice to support multiple contracts, and transactions/blocks/mining. It would be nice to support the compressed and vector extensions to RISC-V as well, so we can start to support our silly little simulator as a nice research tool for the respective ISAs. We could even support a coprocessor for large words (or something)!</p><p>We also need to move our allocator to a crate, identify any problems with it (the heap being small?), and streamline the development experience of working with RISC-V this way. The ultimate goal here though is to simulate RISC-V 32IM on-chain in the WASM on-chain environment to show that the performance penalty is acceptable, and to build awareness and establish Stylus as the main programming environment in the alt EVM space!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZiHa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 424w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 848w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZiHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png" width="574" height="348.1057692307692" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:883,&quot;width&quot;:1456,&quot;resizeWidth&quot;:574,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!ZiHa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 424w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 848w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!ZiHa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c399483-9099-4dfb-b71a-864e983b1903_3560x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Building a chain agnostic dApp with Stylus using state channels, and introducing Valley Game! Part 1: the foundation]]></title><description><![CDATA[22 July 2025. Introducing the "Planning Poker but for valuations" houseparty game.]]></description><link>https://stylus-saturdays.com/p/building-a-chain-agnostic-dapp-with</link><guid isPermaLink="false">https://stylus-saturdays.com/p/building-a-chain-agnostic-dapp-with</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Mon, 21 Jul 2025 17:58:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/5ecaccbf-9828-4cad-8f10-98ac3a7d35e1_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello! <a href="https://farcaster.xyz/bayge">Bayge</a> here. Inspired by recent events of Robinhood launching on Arbitrum, in this article, we&#8217;re going to begin building a complete dApp from scratch including a backend, contract, and frontend, using a state channel technique with Stylus for a fully chain-agnostic experience without gas fees!</p><p>This will be a new type of game for VCs and partygoers, where players work to discover the true value of a fictional or real company. Like planning poker, but for valuations!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://planningpokeronline.com/">Planning poker</a> is a project complexity estimation tool where developers estimate the complexity of a task privately, then revealing at the same moment. The developers repeat this game until they find consensus of the time it takes to complete a task. This makes planning poker a very useful tool for discovering misconceptions about project timelines.</p><p>In this part 1 article, we&#8217;ll be:</p><ol><li><p><strong>Writing state machine diagrams</strong> &#128202;&#128260; for the user journey and technical story.</p></li><li><p><strong>Creating a recursive game playing type</strong> &#128257;&#127919; for the contract. Since this is a state channel/validium/rollup, depending on your nomenclature use, we'll be compressing a recursive structure for submission on-chain to trigger side effects. We will use a UTXO style of optimistically consuming Layerzero &#127760;&#9889; on the server side, and deposits with a debt derivative &#128176;&#128200; for a frictionless user experience.</p></li><li><p><strong>Building a GraphQL backend and database</strong> &#128452;&#65039;&#128295;. We'll be building a AWS Lambda function &#9729;&#65039;&#9889; that works with a Postgres database &#128024; to store signatures and game state.</p></li><li><p><strong>Defining the contract entrypoint</strong> &#128221;&#10024;. We'll be defining a high level interface with the types, then starting to build it and discussing the implementation! &#128640;&#128187;</p></li></ol><p>Finally, following these steps, our next post will create the frontend and complete the contract! For now, we&#8217;ll focus entirely on the backend and broad strokes! Read on!</p><div><hr></div><p>I&#8217;m excited to announce Valley Game, a game and tool like planning poker, but for valuations!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bmCw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bmCw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 424w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 848w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 1272w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bmCw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png" width="489" height="507.7049180327869" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:950,&quot;width&quot;:915,&quot;resizeWidth&quot;:489,&quot;bytes&quot;:89088,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bmCw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 424w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 848w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 1272w, https://substackcdn.com/image/fetch/$s_!bmCw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb34daa7d-676f-48b6-ab51-5af19d14657e_915x950.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This is an edited screenshot from Planning Poker Online as a concept for what the final product will look like.</figcaption></figure></div><p>The game is either played in a fictional setting, with a fake company, or a real world company in a limited setting.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jnNs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jnNs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 424w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 848w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 1272w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jnNs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png" width="390" height="556.5501519756839" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:939,&quot;width&quot;:658,&quot;resizeWidth&quot;:390,&quot;bytes&quot;:55161,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jnNs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 424w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 848w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 1272w, https://substackcdn.com/image/fetch/$s_!jnNs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d56769a-8fe7-4993-af85-9648b58823c1_658x939.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Users play rounds of Valley Game, and are awarded points based on how close they are to each other each round!</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nsqa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nsqa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 424w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 848w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 1272w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nsqa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png" width="333" height="100.05633802816901" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:64,&quot;width&quot;:213,&quot;resizeWidth&quot;:333,&quot;bytes&quot;:3073,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nsqa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 424w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 848w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 1272w, https://substackcdn.com/image/fetch/$s_!nsqa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F968d08ae-83a7-46f3-95cf-52a571b4baf1_213x64.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In the images above, the players would play 4 more rounds of this. Then a fictional token would be divided up by the points distribution!</p><p>Points are also awarded retrospectively based on how close a user was at the beginning of the game to the final outcome.</p><p>It is played entirely in a rollup using a neat state channel compression technique we&#8217;ll discuss and develop in this post (meaning zero gas fees per transaction except when onramping and offramping funds, and instant confirmation), and is optionally played with real money with some token I&#8217;ll pick from the FC community, and playable using Farcaster using Ben Greenberg&#8217;s Farcaster template, which we&#8217;ll develop with with a live video of doing so in a later post.</p><p>Users can play from any chain, including Arbitrum, Base, and Superposition, with no degradation of experience, by leveraging &#8220;satellite&#8221; contracts on the chains supported, and the state channel technique developed in this post. We&#8217;ll also be discussing support for web2 users on-ramping using Stripe.</p><p>Since no actual numbers are ever specified in this game, it&#8217;s entirely subjective based on the audience, making this a great game for repeated play! The game will never tell you what the valuation should be, the audience imagines it entirely by itself. It&#8217;s also illustrative of a unique approach to oracle design.</p><p>While the game itself is intended to be played with fictional companies, a mode is supported where real companies are used, and this could perhaps be used in an environment where . The playing team could make a prediction for a year from now, and state their estimation natively using Farcaster!</p><p>You can find the repo here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/valleygame.xyz/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1INR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!1INR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/valleygame.xyz/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1INR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!1INR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>The user story</h2><p>This game is played as a state channel that&#8217;s opened after a deposit to a contract on Superposition Mainnet. The deposit of the asset on the contract triggers the creation of a spendable UTXO input. Our Stylus contract validates compressed signed calldata, and releases funds when a signature and transaction is provided to do so, all stemming from user consumption of the UTXO input. The application runs optimistically across multiple chains, validating optimistically on the server side with deterministic creation of the balance UTXO coin for users when a transaction enters the Layerzero transaction pool.</p><blockquote><p>Quick interlude: What&#8217;s a UTXO? A UTXO input is a asset that can be &#8220;spent&#8221; to produce an &#8220;output". Funnily enough, we introduced coins in the last post when we discussed Sui: <a href="https://stylus-saturdays.com/i/167568457/objects-and-parallelism">https://stylus-saturdays.com/i/167568457/objects-and-parallelism</a> &#8592; check this out for more!</p></blockquote><p>To begin with, we&#8217;re going to implement a user-centric user journey without discussing the randomness and variation that would need to be injected into the game for fictional play, so just focusing on making a game that is played more than once with points allocated for how close users are. It should look like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EwE4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EwE4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 424w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 848w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 1272w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EwE4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png" width="245" height="774.9588138385502" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:3840,&quot;width&quot;:1214,&quot;resizeWidth&quot;:245,&quot;bytes&quot;:184590,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EwE4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 424w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 848w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 1272w, https://substackcdn.com/image/fetch/$s_!EwE4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ad83f0d-4426-461b-bc43-fca845ada1f8_1214x3840.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So basically, a user opens the game, makes a prediction alongside everyone else, then they aggregate everyone&#8217;s predictions. The user plays back and forth inside the &#8220;Makes prediction&#8221; stage, dependent on some state, then the user withdraws their funds from the contract.</p><p>With a UTXO-style pattern of allocating a balance object then consuming it later that&#8217;s similar to what&#8217;s going to come live in Longtail Pro Passport in the near future, we can mock a user state machine like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dPGD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dPGD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 424w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 848w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 1272w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dPGD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png" width="367" height="347" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:347,&quot;width&quot;:367,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26878,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dPGD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 424w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 848w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 1272w, https://substackcdn.com/image/fetch/$s_!dPGD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F805a17ca-c5c1-4feb-a3f6-e94a4d2a2c3e_367x347.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which would actually resemble in terms of a technical user story the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FftZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FftZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 424w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 848w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 1272w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FftZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png" width="1456" height="1426" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1426,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:360187,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FftZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 424w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 848w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 1272w, https://substackcdn.com/image/fetch/$s_!FftZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3aa8e8a-2ef5-413e-9527-743540010369_3840x3761.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, we allow users to deposit their asset, we mint a debt derivative that could be converted to the underlying asset at any time, and we let them play the game back and forth for a while before returning to where we started. Once the user is at square one, we consume their debt token to send them back their asset optionally, or we allow them to reenter the game. It&#8217;s important that we mint a debt token. Minting a debt token is a tool that allows you to underwrite your token with a custodial asset to support web2 users, without minting friction. This is consistent with the social goals of this project (supporting web2 users with no crypto wallets and in-browser signatures). This exposes your project to bank runs, so it&#8217;s important that you shore up your on-chain position to be consistent with what&#8217;s available in circulation inclusive of your web2 users, and that you keep your signing process for creating assets very safe.</p><p>For a UTXO-style system with compressed messages, we need to support a join operation at least for deposits (where a user has multiple games completed and they want to keep playing without leaving). We can skip implementing a split, assuming that user deposits are full of intent and that they don&#8217;t plan on reducing their allocation after making the deposit with funds.</p><h2>Application pseudocode</h2><p>Let&#8217;s implement some pseudocode in Python. We&#8217;ll make our game state resemble the following:</p><pre><code>class Game:
    """
    The current round the game is on.
    """
    round = 0

    """
    Simple knowledge of who has the right to participate in this
    game.
    """
    players = {}

    """
    The predictions made by users at each step of the game for
    five rounds. The key for each round is their unique id. Stored
    privately from each player's perspective.
    """
    player_predictions = [{} for _ in range(5)]

    """
    The amount that every user invested to play the game.
    """
    fixed_buyin = 5

    """
    A fixed size circular buffer for messages. Maybe 200 items long.
    """
    messages = []

    """
    Points awarded for each bip based on how close the user is to
    the mean (1 bip = 0.1%).
    """
    bip_points = 100</code></pre><p>Like a lot of games, there&#8217;s a lack of incentive for users to invest large amounts unless others do it first. For this game, we&#8217;ll implement a fixed buy-in from every participant, and scale the number of rounds according to the amount at stake. This lets us discover a skill level of sophistication, enriching the game structure itself through observation. For our game here, we&#8217;ll require a buy-in of $5 of our concept token.</p><p>We&#8217;ll mock this game as a evolutionary algorithm later. An evolutionary algorithm is a set of programs that run inside a shared space that each feature a fixed buffer of DNA. DNA are functions that operate on a bit of internal state to the program, which could include in this case a amount of information stored in a circular buffer, and information on whether other players have made predictions. The DNA won&#8217;t have any information extrinsic to the generated code itself except a shared buffer. The program&#8217;s performance is quantified, and at the end of the game, the top performers of a game played amongst randomly generated programs are combined together randomly to create new programs, until the top programs emerge naturally from randomness.</p><p>For our game, in the state we&#8217;ll support a broadcast layer of messages that can be sent amongst the players. In the fictional game, this could be the fake evidence list about the company (ie, their competitor was acquired by a bigger company, or their founder was embroiled in a scam, generated at random), but in the game that we&#8217;re designing where the randomness injection is outside the scope, this could be used for program messaging amongst themselves.</p><p>This will enable our generated algorithms to send tagged Lisp-style lists similar to the following amongst itself, and reuse this structure for information updates in our game:</p><pre><code>(&lt;topic&gt; &lt;message&gt;)</code></pre><p>Then support List accessors like this:</p><pre><code>def unpack_last_msg(field, depth)</code></pre><p>So that our generated programs can later unpack and understand messages that were sent inside the game, using it like a scratch pad of sorts for memory. This lets us keep our state pretty small, having the programs interrogate each other for information, and only learning by encoding their performance in their program code. However! We won&#8217;t be including this on-chain, since this isn&#8217;t relevant to the contract&#8217;s final rolling up of decision made during the course of the game.</p><p>The code gameplay loop looks like the following for the round deposit. We&#8217;ll award 100 points multiplied by a certain number of bips (how many percentage points the user is distant from the average):</p><pre><code>exception GameOver(Exception):
    pass

class GameOver(Exception):
    pass

def merge_record(a, b):
    return {k: a.get(k, 0) + b.get(k, 0) for k in a.keys() | b.keys()}

class Game:
    ...

    def calc_points(self, avg, p):
    &#9;return max(0, self.bip_points - abs(avg - p))

    def buyin(self, user):
        """
        Buy in an amount, only possible if the game is the first round.
        """
        if self.round &gt; 0: raise GameStarted()
        self.players[user] = True

    def predict(self, user, value):
        """
        Lock in the prediction for this round. Bump the round if we hit
        the limit of the participants right now.
        """
        if self.round == len(self.player_predictions): raise GameOver()
        self.player_predictions[self.round][user] = value
        if len(self.player_predictions[self.round]) == len(self.players):
            self.round += 1

    def proximity_points(self):
        """
        Get the points for each user at the current round.
        """
        acc = {}
        for predictions in self.player_predictions[:self.round]:
            mean = sum(predictions.values()) / len(predictions)
            for k, p in predictions.items():
                acc[k] = acc.get(k, 0) + self.calc_points(mean, p)
        return acc

    def early_points(self):
        """
        Get the points the user is owed for how close they were at the
        beginning to the end consensus.
        """
        # Short circuit if the game isn't over yet.
        if self.round &lt; len(self.player_predictions):
            return {k: 0 for k in self.players.keys()}
        first_predictions = self.player_predictions[0]
        final_predictions = self.player_predictions[self.round-1].values()
        m = sum(final_predictions) / len(final_predictions)
        return {k: self.calc_points(m, first_predictions[k]) for k in self.players.keys()}

    def points(self):
        """
        Get the points for each user at the current round.
        """
        return merge_record(self.proximity_points(), self.early_points())

    def allocate(self):
        """
        Return the funds each user should receive as a result of the
        game.
        """
        available = self.fixed_buyin * len(self.players)
        p = self.points()
        all_points = sum(p.values())
        return {k: available * (v / all_points) for k, v in p.items()}</code></pre><p>This is a simple reference, reusing the bip calculation for the end of points calculation. Games will be played where the first action is the most valuable most likely, but will also create a dynamic where maybe the leading player will be targeted by the other players if they are in the lead by the end of the game, creating a interesting dynamic I imagine for adversarial play. This code is so simple we could probably implement it with a APL one liner.</p><h2>State channel architecture</h2><p>Since this is a game with UTXO-like on-ramping and spending of signatures, we need an approach to our database that accommodates the storage of signatures that users supply, after verifying it ourselves.</p><p>First, let&#8217;s flesh out our user journey from before with another type:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GG4e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GG4e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 424w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 848w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 1272w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GG4e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png" width="799" height="827" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:827,&quot;width&quot;:799,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:91787,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GG4e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 424w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 848w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 1272w, https://substackcdn.com/image/fetch/$s_!GG4e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48463c74-f488-437c-8fcc-25eec1d6fe3e_799x827.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This type is literally converted to calldata. Users sign at every stage of the process. In Rust, the types would look like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RaOw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RaOw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 424w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 848w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 1272w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RaOw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png" width="689" height="963" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:963,&quot;width&quot;:689,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:163619,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RaOw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 424w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 848w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 1272w, https://substackcdn.com/image/fetch/$s_!RaOw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f479c0c-bd4e-4204-a490-d063a8c4bd3c_689x963.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Note that this code does not include the derive statements for the encoding format that we&#8217;ll use, which we&#8217;ll also bootstrap ourselves off of for hashing.</figcaption></figure></div><p>For signature handling in our code, we use ed25519. This lets us benefit from WebCrypto in the browser, and there is decent support in the Rust ecosystem with the ed25519_dalek package. The key can be created in the browser and remembered using cookies, then included in a signature with Permit to a contract to bond and allocate funds. This is similar to what we use for Longtail Pro&#8217;s passport frontend, and it results in a seamless experience for the most part, powered by Stylus.</p><p>There are some tools here that we&#8217;ve introduced for compression&#8217;s sake, including information on who should be signing what, and whether it was previously seen on-chain, but I&#8217;m not including this in the above screenshot. Hopefully you can see how the state machine works here! The reason for this approach is that it&#8217;s completely offline until it&#8217;s finally aggregated at the end of the user journey. In the withdraw step, we ask for the server-side signature as well as the user signature. This lets us prevent abuse from taking place, like a user withdrawing their spent balance after they&#8217;ve started to accumulate a losing position.</p><p>A note on the encoding taking place: we&#8217;ll use Borsh encoding that we&#8217;ll supply as a bytes argument to the functions here. The reason for this is to maintain some level of composability with the rest of the contract ecosystem, though this is technically a redundant action, as you could build the entrypoint to the code yourself as switching on a enum field, as we do in Longtail Pro&#8217;s codebase. It&#8217;s not necessarily the most efficient approach, since the encoding of the length will be repeated somewhat, but for our example, it&#8217;s the best way, since we don&#8217;t need to overload the entrypoint.</p><h2>The backend/database architecture</h2><p>In the spirit of reuse, we&#8217;ll be using Rust for the entire package of this application, but generating GraphQL code to be run on AWS Lambda. So, we need a persistent place to store the aggregated calldata to send to users on request.</p><p>A simple series of Postgres tables should suffice for storage, and we&#8217;ll add some helper types to make storage more explicit:</p><pre><code>-- 0x + [u8; 32]
CREATE DOMAIN ED_ADDR AS CHAR(66);

-- 0x + [u8; 64]
CREATE DOMAIN ED_SIG AS NUMERIC(130, 0);

CREATE DOMAIN HUGEINT AS NUMERIC(78, 0);

CREATE TABLE valleygame_game_info_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;round_limit INTEGER NOT NULL,
&#9;bip_points INTEGER NOT NULL,
&#9;fixed_buyin HUGEINT NOT NULL,
&#9;whitelisted_ids JSONB NOT NULL,
&#9;-- This is also used externally to convert to this game's id.
&#9;random_nonce HUGEINT NOT NULL
);</code></pre><p>The round limit will be the amount of rounds that we can run before the game is considered finished, and the bip points (and the rest of the code) is like the reference in Python. The random nonce is needed to avoid a signature reuse situation, and whitelisted IDs are used to allowlist only a fixed set of users to play the game. These fields are stored in JSON to avoid having a one to many table relationship (and multiple insertions). We can simply read the column, then unpack it ourselves as JSON.</p><p>As a development practice, I like explicitly versioning my tables, and building views over raw event data being ingested in as opposed to mutating tables. This lets us add additional features but maintaining the ability to roll back quickly, and to support versioned APIs and versioned encoded datastructures. You can see this in the naming convention.</p><p>Let&#8217;s create some tables to accommodate the creation and spending of deposits and amounts:</p><pre><code>-- Server-side deposits that were created from a centralised source.
CREATE TABLE valleygame_server_deposits_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;recipient ED_ADDR NOT NULL,
&#9;amount HUGEINT NOT NULL,
&#9;nonce INTEGER NOT NULL,
&#9;sig ED_SIG NOT NULL
);

CREATE TABLE valleygame_mint_debt_token_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;from_deposit_ticket HUGEINT,
&#9;from_previous_game_id SERIAL,
&#9;from_server_id SERIAL,
&#9;signer ED_ADDR NOT NULL,
&#9;sig ED_SIG NOT NULL,
&#9;FOREIGN KEY (from_previous_game_id) REFERENCES valleygame_game_info_1(id),
&#9;FOREIGN KEY (from_server_id) REFERENCES valleygame_server_deposits_1(id)
);

CREATE TABLE valleygame_enter_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;-- We get the args from the game info when someone asks for this.
&#9;game_id SERIAL NOT NULL,
&#9;FOREIGN KEY (game_id) REFERENCES valleygame_game_info_1(id)
);</code></pre><p>Here, we do have a one-to-many table relationship, as we need to record on-ramping/creation of the deposit asset. We overload the &#8220;debt token&#8221; table to have multiple, possibly null, fields that include the originating source of the token, which we convert to the serialised type that we saw earlier.</p><pre><code><code>CREATE TABLE valleygame_prediction_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;game_id SERIAL NOT NULL,
&#9;estimated HUGEINT NOT NULL,
&#9;round_number INTEGER NOT NULL,
&#9;signer ED_ADDR NOT NULL,
&#9;sig ED_SIG NOT NULL,
&#9;FOREIGN KEY (game_id) REFERENCES valleygame_game_info_1(id)
);

CREATE TABLE valleygame_withdraw_1 (
&#9;id SERIAL PRIMARY KEY,
&#9;created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
&#9;debt_token_id SERIAL NOT NULL,
&#9;user_signer ED_ADDR NOT NULL,
&#9;user_sig ED_SIG NOT NULL,
&#9;server_sig ED_SIG NOT NULL,
&#9;FOREIGN KEY (debt_token_id) REFERENCES valleygame_mint_debt_token_1(id)
);</code></code></pre><p>You can see that this is almost one-to-one with the types we defined above!</p><p>Having defined the database types, we can start to look at setting up the repo structure for our code. Then, we&#8217;ll implement the code that does the verification and the storage of the data.</p><p>Unlike some of our previous posts, we won&#8217;t implement this in the most verbose way. We&#8217;ll instead focus on the structure and broad strokes of the implementation, then elaborate further with the video that you can see at the top!</p><p>We&#8217;ll create three entrypoints in the Rust code:</p><pre><code>[[bin]]
name = "contract"
path = "src/contract/main.rs"

[[bin]]
name = "frontend"
path = "src/frontend/main.rs"

[[bin]]
name = "graph"
path = "src/graph/main.rs"</code></pre><p>The <code>contract</code> and <code>frontend</code> entrypoints will run as <code>wasm32-unknown-unknown</code> targets. The contract will be built with the contract deployment on-chain in mind, but the latter will use exported code to access the browser APIs using <code>wasm-bindgen</code>. <code>graph</code> will be run as a Lambda function, and as such will run natively on my laptop.</p><h2>Implementing the backend</h2><p>We start to implement the backend by generating a GraphQL schema consistent with the type we defined above. In our game, the server functions more like a storage backend for the signatures as they&#8217;re aggregated (and some validation mixed in to save time for the client, including checking deposits when they&#8217;re spent), with the frontend dressing up what&#8217;s available to be presentable in a format consistent with a game.</p><p>We implement a schema:</p><pre><code>enum DepositStatus {
  Unspent,
  Withdrawn,
  AfterGame,
}

type Deposit {
  lzTx: String
  ticketId: String!
  status: DepositStatus!
  amount: String!
}

type Lobby {
  randomNonce: String!
  game: Game!
  lockedInPlayers: [String!]
}

type Game {
  creator: String!
  roundLimit: Int!
  bipPoints: String!
  fixedBuyin: String!
  whitelistedIds: [String!]!
  randomNonce: String!
}

type Prediction {
  amount: String!
  addr: String!
}

type Round {
  ongoing: Boolean!
  predictions: [Prediction!]
}

type Ongoing {
  rounds: [Round!]!
  game: Game!
}

type Query {
  lobbies: [Lobby!]!
  ongoing: [Ongoing!]!
  deposits(addr: String!): [Deposit!]!
}</code></pre><p>For brevity&#8217;s sake, this schema is lacking comments. The <code>DepositStatus</code> type is indicative of the state of a UTXO, whether it should be considered spent, or available to be used in its original form. It might have changed its value after a game has been played, at which point the amount in it should be rendered differently to the end user.</p><p>The <code>Deposit</code> includes information about a Layerzero transaction, which could be used to optimistically progress a interaction, assuming that the underlying token was successfully bridged. If the bridging does not take place, then the submission of the calldata and verification of amounts would fail on the base chain, assuming that LZ&#8217;s sending would fail. This is a nice UX hack with a degradation in a worst-case scenario of a fork or something taking place, which is not very likely in practice.</p><p>A <code>Lobby</code> is made available with information on the game as well as any players that committed to play. A problem with the approach of this system is that users choosing to be unavailable causes a degraded situation where the funds are stuck. We won&#8217;t be addressing this here, though a trivial solution is to include an optimistic submission stage at the end of the game, where a user can stake their token on liveliness from each player. Players that fail to submit at the time will lose their tokens to the staker, but if every user submits (all the way up to the completed game), then the staker themselves will lose the funds.</p><p>Finally, the <code>Ongoing</code> type is available to include information on ongoing games that the user is participating in based on their <code>Authorization</code> header. This includes Rounds that were played, and the predictions made by each user.</p><p>I implemented the schema manually (pain), then chatted with the database using boring raw SQL. I&#8217;m lucky that with Claude in a conversational format it handled the translation of my schema for the most part. Parts of the code look like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f8N8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f8N8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 424w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 848w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 1272w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f8N8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png" width="507" height="927" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:927,&quot;width&quot;:507,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108885,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f8N8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 424w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 848w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 1272w, https://substackcdn.com/image/fetch/$s_!f8N8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2620d5dd-6936-4b25-a36d-1e2f3d3490c4_507x927.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These types resemble the schema from above. In other places, we set up a database pool that we use with Postgres, and later in the code we have the implementation for the looking up of these values. We also start to define an entrypoint inside the Lambda graph to run inside AWS Lambda:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JnT5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JnT5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 424w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 848w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 1272w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JnT5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png" width="642" height="438" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:438,&quot;width&quot;:642,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:68948,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/168071547?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JnT5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 424w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 848w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 1272w, https://substackcdn.com/image/fetch/$s_!JnT5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce02e695-a5c2-40bd-bf20-e469f3416609_642x438.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is some basic setup code to allow us to use the Authorization header for our schema to branch the loading of the lobbies request using the database.</p><h2>Implementing the contract entrypoint</h2><p>Finally, let&#8217;s define the entrypoint to our contract! Let&#8217;s define an interface like the following:</p><pre><code>interface IValleyGame {
    function nonces(address spender) external view returns (uint256);

    function deposit(uint256 amount, address recipient) external view returns (uint256);

    function play(bytes calldata) external;
}</code></pre><p>The first function is simple nonce management. It&#8217;s useful for optimistic depositing of funds using Layerzero messaging, by having the user simply initiate the process of the deposit, since their nonce can be combined with their address to create the deposit ticket. The second function is a simple interface for depositing the native asset using the deposit ticket. It simply takes the amount, and the creditor address. The issue with this approach is that a griefing vector lies here, but we&#8217;ll continue as-is for now.</p><p>Finally, the play function is the actual interaction with the contract. This is the bit of code that takes the Borsh-encoded data we&#8217;ve seen earlier and generates the side effects by stepping through the rolled up calldata!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><p>We&#8217;ll have to  pick this up next time! I&#8217;m out of time for now.</p><p>I like games with emergent social properties. Games like this include Nomic and Aneurism IV, where players themselves create the structure of the gameplay themselves. In the next post, we&#8217;ll build the rest of the contract, including the functions that translate the local state to side effects inside a reimplementation of the pseudocode. Maybe later we&#8217;ll even build a videogame using this method in between our usual programming, who knows? I have something in mind aside from this&#8230;</p><p>Stay tuned!</p><p>As a reminder, you can find the code here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/valleygame.xyz/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1INR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!1INR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/valleygame.xyz/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!1INR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!1INR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!1INR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5044923-3d12-4b97-bfaa-537fb11c25db_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vfLC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 424w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 848w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 1272w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vfLC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png" width="471" height="472.29395604395603" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1460,&quot;width&quot;:1456,&quot;resizeWidth&quot;:471,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!vfLC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 424w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 848w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 1272w, https://substackcdn.com/image/fetch/$s_!vfLC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4289f298-9b31-4061-ab78-cda59af43604_2896x2904.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Stylus Contract Deployments list, Move language on Arbitrum Stylus overview]]></title><description><![CDATA[A single place for every Stylus contract deployment, and Move on Stylus by Rather Labs!]]></description><link>https://stylus-saturdays.com/p/stylus-contract-deployments-list</link><guid isPermaLink="false">https://stylus-saturdays.com/p/stylus-contract-deployments-list</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Mon, 14 Jul 2025 13:21:47 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a49778fb-be95-44cf-b9c2-09834b4b9f9d_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone! <a href="https://x.com/baygeeth">Bayge</a> (<strong><a href="https://farcaster.xyz/bayge">Farcaster</a></strong>) here. In this week we&#8217;ll touch on the following topics:</p><ol><li><p>&#128452;&#65039; <strong>A Stylus smart contract tracker:</strong> A new ingestor and web application that tracks the deployment of Stylus on several chains, and can be used to plot the growth on each chain!</p></li><li><p>&#9201;&#65039; <strong>Moving Stylus by Rather Labs:</strong> An in-depth overview of the taking Move to Stylus project by Rather Labs, including some discussion of Move and the team&#8217;s development.</p></li></ol><p>Read on, and as always, if you have any feedback about the newsletter, you can share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and C++. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interopability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><p>You can get started very quickly at <a href="https://stylusup.sh">https://stylusup.sh</a> or by using the official resources at <a href="https://docs.arbitrum.io/stylus/gentle-introduction">https://docs.arbitrum.io/stylus/gentle-introduction</a>!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2>Stylus Contract Deployments</h2><p>I&#8217;m pleased to share that I&#8217;ve tracked every contract deployment of Stylus on several chains, and made it available as a <a href="https://stylus.fluiditylabs.io/contracts.tsv">TSV download</a> using the Superposition in-house ingesting stack. You can find it at <a href="https://stylus.fluiditylabs.io">https://stylus.fluiditylabs.io</a>! I&#8217;ll be having this keep itself up to date and possible to download at any time for everyone to use.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://stylus.fluiditylabs.io" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-gOu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 424w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 848w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 1272w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-gOu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png" width="1456" height="698" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:698,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:396631,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://stylus.fluiditylabs.io&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-gOu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 424w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 848w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 1272w, https://substackcdn.com/image/fetch/$s_!-gOu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18eb4c9d-03a7-49a6-9eb7-23e6092d11b9_2308x1106.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The networks tracked are:</p><ol><li><p><a href="https://arbitrum.io">Arbitrum One</a> and Arbitrum Sepolia</p></li><li><p><a href="https://superposition.so">Superposition</a> Mainnet and Testnet</p></li><li><p><a href="https://sanko.tv">Sanko</a></p></li><li><p><a href="https://apechain.com/">Apechain</a></p></li><li><p><a href="https://usecorn.com/">Corn</a></p></li><li><p><a href="https://xai.games/">Xai Mainnet</a></p></li><li><p><a href="https://gravity.xyz/">Gravity Alpha Mainnet</a></p></li><li><p><a href="https://plume.org/">Plume</a></p></li><li><p><a href="https://www.degen.tips/">Degen Chain</a></p></li><li><p><a href="https://educhain.xyz/">EDU Chain</a></p></li><li><p><a href="https://docs.sx.technology/validators-staking-and-delegating/sx-network-motivation">SX Rollup</a></p></li><li><p><a href="https://duckchain.io/">DuckChain</a></p></li><li><p><a href="https://rarichain.org/">RARI Chain</a></p></li></ol><p>It includes everything emitted by the precompile for contract activation, including the codehash, the creation timestamp, the transaction hash, the chain id, etc.</p><p>You can register a new chain easily by simply making a pull request to <a href="https://github.com/fluidity-money/stylus.fluiditylabs.io/blob/trunk/chains.tsv">https://github.com/fluidity-money/stylus.fluiditylabs.io/blob/trunk/chains.tsv</a>.</p><p>You can download the list at <a href="https://stylus.fluiditylabs.io/contracts.tsv">https://stylus.fluiditylabs.io/contracts.tsv</a>.</p><p>There are a few interesting facts we can discuss from the data here:</p><h3>More than 10,000 contracts have been deployed!</h3><p>10844 contracts have been deployed at the time of writing!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QoZ8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QoZ8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 424w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 848w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 1272w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QoZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png" width="559" height="264" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:264,&quot;width&quot;:559,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23731,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QoZ8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 424w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 848w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 1272w, https://substackcdn.com/image/fetch/$s_!QoZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49fea0e5-f99b-4838-9104-4c0c778cb64a_559x264.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The overwhelming majority of deployments took place on Arbitrum Sepolia, and following that, Superposition Testnet. Superposition Testnet saw several deployments during a period of competition for the ETH Bucharest hackathon, and our internal team regularly uses the testnet, so it would be important to examine this data in the future by examining the unique deployer addresses additionally. Excluding testnet, mainnet deployments across Superposition Mainnet, and Arbitrum One, total 842.</p><h3>Arbitrum One sees a median of 8 Stylus contracts deployed a week!</h3><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rx1l!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rx1l!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 424w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 848w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 1272w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rx1l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png" width="1456" height="232" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:232,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40553,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rx1l!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 424w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 848w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 1272w, https://substackcdn.com/image/fetch/$s_!rx1l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c759fa2-d58e-4b6f-8aea-829540acc12e_1467x234.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Very exciting! We need a good growth indicator of developer awareness to accompany this in the future.</p><h3>Arbitrum Sepolia sees the bulk of Stylus deployments</h3><p>Which makes sense. Sepolia is the testing environment where developers can quickly deploy to to test their built Stylus contracts, which our friends <a href="https://thewizard.app/">The Wizard</a> make very easy to deploy to (and developers have a natural interest to do so). Perhaps a good step would be to improve access to the testnet for developers?</p><h3>We haven&#8217;t recorded interest within the other Orbit chains with Stylus</h3><p>Stylus is still a new technology and we&#8217;re all trailblazers, and frankly, if you&#8217;re reading this newsletter, congratulations on being early! From what we&#8217;ve seen so far, none of the Orbit chains (except for Superposition) are making use of Stylus, with no deployments recorded on their mainnets. This is a shame, because Stylus&#8217; strengths lies in its range of expressiveness once you understand the range of what you can build with it!</p><h3>The end of last year was the peak of mainnet deployments per month</h3><p>The beginning of this year was the peak window of deployments taking place to testnet. Interestingly enough, the last month of last year was when the most deployment activity was recorded for mainnet. I wonder why? From my perspective, our community is only growing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!naBH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!naBH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 424w, https://substackcdn.com/image/fetch/$s_!naBH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 848w, https://substackcdn.com/image/fetch/$s_!naBH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 1272w, https://substackcdn.com/image/fetch/$s_!naBH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!naBH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png" width="1456" height="654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:654,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109103,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!naBH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 424w, https://substackcdn.com/image/fetch/$s_!naBH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 848w, https://substackcdn.com/image/fetch/$s_!naBH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 1272w, https://substackcdn.com/image/fetch/$s_!naBH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0def896e-35d3-4400-95cf-c0d78d7cd7c0_2310x1037.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>Move on Stylus, an implementation overview</h2><p>Rather Labs is bringing the programming language <a href="https://move-language.github.io/move/">Move</a> to Stylus! Move is a programming language invented at Facebook as a part of the Libra project. It&#8217;s a VERY secure programming language, where capabilities are expressed using UTXO-like coins, which are also used to support explicit parallelism in the Move blockchains. The compiler has a type checking stage which can be used to statically enforce access controls. This level of granularity means much safer code than we otherwise have access to! </p><p>Let&#8217;s break down these concepts:</p><h3>Capabilities and coins</h3><p>In a Solidity contract, permissions and ownership might look like this:</p><pre><code>contract DogWalker {
    address public owner;

    constructor() {
        owner = msg.sender;
    }

    event IWalkTheDog();

    function walkTheDog() external {
        require(msg.sender == owner, "not the dog owner");
        emit IWalkTheDog();
    }
}</code></pre><p>Ownership and permissions are stored in the contract storage which is read from, and compared with, the sender. But what if there were a better way? Move&#8217;s approach is to give users a &#8220;<strong>object</strong>&#8221;, a coin which can be spent to express a capability:</p><pre><code>module dog_walker::dog_walker;

use sui::event::emit;

public struct IWalkTheDog has copy, drop {}

public struct CanWalkDogCap has key { id: UID }

fun init(ctx: &amp;mut TxContext) {
    transfer::transfer(
        CanWalkDogCap { id: object::new(ctx) },
        tx_context::sender(ctx)
    );
}

entry fun walk_the_dog(_: &amp;CanWalkDogCap) {
    emit(IWalkTheDog{});
}</code></pre><p>In this example, the contract once its initialised, gives the sender the <strong>capability object</strong> <strong>CanWalkDogCap</strong>, a object that must be provided to invoke the function <code>walk_the_dog</code>.</p><p>Note the ampersand (<code>&amp;</code>) in the function signature and the decorator denoting its an entrypoint function? This designates that the function can be called into by someone invoking the contract, and that the function is dependent on, but must not consume, the coin we received earlier, <strong>CanWalkDogCap</strong>! So imagine going to call a function, and it&#8217;s dependent on you having a token, pretty great! You could drop the <code>&amp;</code> to make it that the coin must be <strong>consumed</strong>, after which the object would be considered spent, and gone from the user&#8217;s account!</p><p>You could imagine mocking a complex series of interactions this way, and implementing complex semantics using the capabilities object model. Move even supports the ability to denote that a coin cannot be destroyed by the sender, in that it must be returned to the contract, using a pattern titled the &#8220;<a href="https://move-book.com/programmability/hot-potato-pattern/">Hot Potato</a>&#8221;. Move has a very expressive landscape for type-annotated programming this way.</p><h3>Objects and parallelism</h3><p>With the Move blockchains (Aptos, Sui), spending coins like this tells the nodes how to perform a &#8220;pipelining&#8221; of operations, where it&#8217;s possible to batch execution of smart contracts and transactions in a way where they are processed as they arrive, not sequentially, making better use of the node&#8217;s execution compute and database resources. This means potentially a higher throughput when it comes to transaction processing, and it&#8217;s baked into the type system! This form of type-enabled high throughput execution is a form of &#8220;explicit parallelism&#8221;, where the nodes are explicitly told with some information users provide how to execute transactions.</p><p>It&#8217;s an open question whether ultra high high throughput chains are a victim of the problems associated with filling blocks, or &#8220;block stuffing&#8221; Block stuffing is where a block must be filled to a certain extent for the node operators to extract enough gas fee compensation to justify their ongoing operation costs. Solana suffers from this problem and subsidises its validator set by diluting the SOL token to send to their validator set on a constant inflationary schedule. Some chains that bill themselves as performance orientated use a method of optimistic parallelism, where the chains optimistically try to batch transactions together, or use a method of hinting to themselves beforehand what things should be. EVM chains like this include Monad, and Pharos.</p><p>Arbitrum has a single sequencer model, and does not feature (to my understanding) any explicit or implicit parallelism on the node level. You might argue that it&#8217;s not needed, since Arbitrum itself has soft confirmation of transactions, but not instant bundling and execution of them to have a more sustainable model of transaction inclusion, and having a single sequencer means the potential pool of rewards for transactions are maximised for the node. My mind is that OCL&#8217;s approach to scaling Arbitrum isn&#8217;t to scale the execution of the blocks coming in, but to provide developers with the ability to spin up Orbit chains with their own rules to resolve this issue themselves.</p><p>I would say that to have end user visible high throughput, we should focus on executing transactions using alt signature execution methods, and having optimistic transaction inclusion. Which is the approach we can take today with the Orbit chains, and natively on Arbitrum One in a compute efficient way, thanks to Stylus.</p><h3>Rather Labs and Move on Stylus</h3><p>Rather Labs are building an Intermediate Representation (IR) compiler from Move bytecode provided by the Sui Move toolchain to WASM. This way, we can deploy Move smart contracts ourselves to Arbitrum!</p><p>They&#8217;ve been so kind to write a <a href="https://docs.google.com/document/d/1mhLoNy6vlvF61kLpMRrULv8q3rW5xmN1OnF9Qfr0ywc">writeup for us</a> documenting their approach, and they&#8217;ve been writing consistent status updates, which we&#8217;ll paraphrase here.</p><h4>Move Bytecode</h4><p>Move Bytecode, from what I gather, in its high level form <a href="https://github.com/MystenLabs/sui/blob/292600a16f23efe8ce17f244dda68a4e6830474c/external-crates/move/crates/move-ir-types/src/ast.rs">looks like the following</a>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GqfN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GqfN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 424w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 848w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GqfN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png" width="438" height="1038" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1038,&quot;width&quot;:438,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:107712,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GqfN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 424w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 848w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!GqfN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25a7a894-49f6-42fe-ac64-e58062d43d5a_438x1038.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">There are more functions below that include packing and unpacking of vectors, probably to do with the ecosystem encoding format, Binary Canonical Serialisation.</figcaption></figure></div><p>Unlike WASM, some of Sui-relevant operations are natively available to the programmer in the operation set, meaning a more bespoke and potentially complex optimisation pipeline, but to the benefit of less code on-chain, assuming the optimisation pipeline does its job. Also unlike WASM, Move&#8217;s bytecode format supports static jumps, which was one of the focal points of the Ethereum EOF conversation recently. The intent behind static jumps in the EOF was to support a more obvious control flow in the smart contracts, making static analysis easier.  There are some operations access gating mutable and immutable access to objects, which makes sense considering the access control that are needed for the coins we discussed above. The equivalent in a reduced instruction set might be a system call, or a call to a foreign function interface in WASM, which would be needed to perhaps load a specific register before an operation.</p><h4>Move conversion code</h4><p>So we&#8217;ve established here that the Rather Labs team must surely support a conversion stage that determines the location of the jumps and converts them to relative ones, one that converts some of the high level access control operations to the calling of Rather Labs written stub functions. It seems this is the case, with their pipeline looking like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dCQU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dCQU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 424w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 848w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 1272w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dCQU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png" width="525" height="955" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:955,&quot;width&quot;:525,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109322,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/167568457?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dCQU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 424w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 848w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 1272w, https://substackcdn.com/image/fetch/$s_!dCQU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25599ef4-a356-4337-8ce9-1c106d45c7fc_525x955.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This approach seems solid, since the Move bytecode could be translated literally into a series of stubs and access control methods baked directly into the contract, since it&#8217;s a simple instruction set. The Move-specific functions could be replaced with the using of local functions. This approach also lets the developers build WASM-specific optimisation code themselves, and benefit from an extra optimisation pass post WASM code creation if that&#8217;s feasible.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h4>Current status</h4><p>According to their last update, they&#8217;ve supported the basic operations and the entrypoint! A reference repository lives at <a href="https://github.com/rather-labs/move-stylus-poc">https://github.com/rather-labs/move-stylus-poc</a>.</p><p>I&#8217;ve seen from reading their code that they&#8217;ve supported local conversion of the Move types to the Ethereum ABI, so the code will be compatible with any Solidity interfaces you might want to use it with.</p><p>I&#8217;m super excited for how things are going with this project! The Rather Labs team is obviously super talented and extremely qualified to be building something like this.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://www.ratherlabs.com/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bobJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 424w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 848w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bobJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png" width="1456" height="764" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:764,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://www.ratherlabs.com/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bobJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 424w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 848w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 1272w, https://substackcdn.com/image/fetch/$s_!bobJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094814c7-56cc-4dd8-ade5-959ffc47e462_2400x1260.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To stay up to date with their progress, make sure to star their repo here:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/rather-labs/move-stylus-poc" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VdVI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VdVI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/rather-labs/move-stylus-poc&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VdVI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!VdVI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe68335e-0db3-4123-9bf2-7ddb07357b7a_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>!</p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vevk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 424w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 848w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vevk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png" width="536" height="510.5989010989011" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1387,&quot;width&quot;:1456,&quot;resizeWidth&quot;:536,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!Vevk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 424w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 848w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!Vevk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb83849c0-812d-443f-8ba8-c977b8fd3e28_2267x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Pectra/Callisto review, Stylus Cache Manager deployment, Timeboost Explanation Guest Post, Interview with Ben (new Arbitrum Devrel!)]]></title><description><![CDATA[Stylus Saturdays, 29th June]]></description><link>https://stylus-saturdays.com/p/pectracallisto-review-stylus-cache</link><guid isPermaLink="false">https://stylus-saturdays.com/p/pectracallisto-review-stylus-cache</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sun, 29 Jun 2025 13:51:47 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!mWmh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone! <a href="https://x.com/baygeeth">Bayge</a> (<strong><a href="https://farcaster.xyz/bayge">Farcaster</a></strong>) here. In this week:</p><ol><li><p><strong>&#128640; Pectra + ArbOS 40 overview: </strong>Arbitrum&#8217;s new upgrade introduced.</p></li><li><p>&#128452;&#65039; <strong>Deployment of the Cache Manager &#128184; Cache Bid for cheaper Stylus</strong>: How to deploy the cache bid contract to have cheaper Stylus contracts for your users and more fees!!</p></li><li><p>&#9201;&#65039; <strong>Timeboost explained (guest post by Erik)</strong>: An explanation of how it works to entice Stylus developers to make use of it themselves.</p></li></ol><p><strong>We&#8217;ve also included an interview with <a href="https://www.hummusonrails.com/">Ben Greenberg</a> from Arbitrum</strong>. Ben is stepping into a developer relations role at Arbitrum, which is especially relevant to us builders! He&#8217;s especially interested in Stylus, so I encourage you to get in touch if you need anything or just to say hi:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fuum!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fuum!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!fuum!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!fuum!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!fuum!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fuum!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png" width="400" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:400,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!fuum!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!fuum!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!fuum!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!fuum!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fade2eb61-c5dd-4c52-b6a0-81541023224e_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Ben is also the author of <a href="https://vectorsearchbook.com/">Vector Search with Javascript</a>, an introduction to building search systems with AI using JS. <a href="https://vectorsearchbook.com/#newsletter">Get notified when it releases using this link</a>! I&#8217;m really looking forward to this, as this is definitely an area I know mostly nothing about, and looking at this <a href="https://github.com/hummusonrails/vector-example-blog-platform">example here</a> (a fully featured Medium clone!) it seems super interesting and relevant to us builders building indexing platforms here in web3.</p><p>Read on, and as always, if you have any feedback about the newsletter, you can share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and Go. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interopability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><p>You can get started very quickly at <a href="https://stylusup.sh">https://stylusup.sh</a> or by reading the official docs at <a href="https://docs.arbitrum.io/stylus/gentle-introduction">https://docs.arbitrum.io/stylus/gentle-introduction</a>!</p><div><hr></div><h2>Review of Pectra and ArbOS 40 (Callisto)</h2><p>Pectra is a upgrade to Ethereum that was taken live on the 7th of May. The Arbitrum Callisto upgrade took live the features in Pectra. Orbit chains won&#8217;t see upgrades for a while until most Rollup-As-A-Service (RAAS) providers gauge the success of the update. The upgrade includes several changes:</p><ol><li><p><a href="https://eips.ethereum.org/EIPS/eip-7702">EOA code setting</a>. A new transaction type was added that made it possible to set the code for the sender to set their code. You may have noticed this yourself if you&#8217;ve used Lifi and been prompted by Metamask recently to upgrade mid transaction. They&#8217;ve done this for the transaction bundling features.</p></li><li><p>Several precompiles, including <a href="https://eips.ethereum.org/EIPS/eip-2537">several operations on the BLS12-381 curve</a>. This is useful for signature verification, specifically for taking advantage of BLS signatures, ZK SNARKs, and KZG commitments.</p></li><li><p>A special &#8220;history&#8221; contract is being made available which contains the last 27 hours of block hashes. In practice, this could be useful for cross-chain messaging, and the creation of stateless clients.</p></li><li><p>A change is included to not cache non-existent contracts.</p></li></ol><p>The set code EOA feature is really exciting! Being able to take custom signatures for your native transaction account unlocks a huge amount of possibilities for self custody with cold wallets and sending. Allowlists of transactions and custom sends could be supported using browser passkeys among other things without the need for users to move their assets elsewhere.</p><p>Imagine a private key that contains the authoritative access to a EOA without restrictions, but then a special key is able to be used that can only send a specific asset. The sky&#8217;s the limit! This is especially useful for us Stylus developers where a complicated signature or on-chain evaluation could be supported relatively cheaply compared to the classic EVM.</p><p>Owing to the compute advantages of Stylus, when a precompile is added to Ethereum for gas efficiency reasons, we could instead build this functionality without an upgrade using a Stylus contract that we deploy immediately. Indeed, for their Poseidon hashing, OpenZeppelin have been supporting BLS12 already in their crate for Stylus. It&#8217;s great being on the bleeding edge, and now Solidity programmers can leverage some of these benefits for themselves:</p><p><a href="https://github.com/OpenZeppelin/rust-contracts-stylus/blob/e15e5796890af819032f81aca2f7a0288642a450/lib/crypto/src/poseidon2/instance/bls12.rs#L1">https://github.com/OpenZeppelin/rust-contracts-stylus/blob/e15e5796890af819032f81aca2f7a0288642a450/lib/crypto/src/poseidon2/instance/bls12.rs#L1</a></p><div><hr></div><h2>Deploying the Stylus cache manager to your chain</h2><p>The Stylus Cache feature keeps Stylus contracts in memory to avoid the computation work of finding and loading the code on your node. We can deploy a permissionless contract frontend with a cache eviction system that lets users bid for the right to have a slot for a time, this is known as the <a href="https://github.com/OffchainLabs/nitro-contracts/blob/main/src/chain/CacheManager.sol">CacheManager contract</a>. This means cheaper contracts and more opportunities for chain owner rent extraction without being to the detriment of end users! Cobuilders are building a frontend for this as a part of their <a href="https://questbook.app/dashboard/?proposalId=67489c3d90449961f516e735&amp;chainId=10&amp;grantId=671a105a2047c84bb8a73770&amp;role=community&amp;isRenderingProposalBody=true">Stylus Sprint grant</a>, and will also be releasing a webapp soon which we&#8217;re excited about.</p><p>We actually hadn&#8217;t done this deployment, as we have a higher release cadence of 9lives features, mostly adding permissioned users right now, and have been lazy to do cache management on our side. We recently took it upon ourselves to do this on our chain Superposition. These are the steps we took:</p><ol><li><p>Grabbed a release of the nitro-contracts repository. We downloaded the latest release of the source from two weeks ago from <a href="https://github.com/OffchainLabs/nitro-contracts/archive/refs/tags/v3.1.1.zip">https://github.com/OffchainLabs/nitro-contracts/releases/tag/v3.1.1</a></p></li><li><p>Grabbed the precompiles contracts using what would normally be a submodule, after navigating inside the &#8220;precompiles&#8221; directory:</p></li></ol><pre><code>cd src
rmdir precompiles
git clone https://github.com/OffchainLabs/nitro-precompile-interfaces precompiles
cd ..
npx hardhat compile</code></pre><ol start="3"><li><p>I wanted to have the contract deployed, then to ask our RAAS to register the CacheManager contract. So I adjusted the deploymentUtils script to make it skip the stage of registering, so that I can ask our RAAS (Conduit) to do this themselves (this is scripts/deploymentUtils.ts):</p></li></ol><pre><code>310a311,341
&gt;   /// add CacheManager to ArbOwner
&gt;   const arbOwnerAccount = (
&gt;     await ArbOwnerPublic__factory.connect(
&gt;       ARB_OWNER_PUBLIC_ADDRESS,
&gt;       chainOwnerWallet
&gt;     ).getAllChainOwners()
&gt;   )[0]
&gt; 
&gt;   const arbOwnerPrecompile = ArbOwner__factory.connect(
&gt;     ARB_OWNER_ADDRESS,
&gt;     chainOwnerWallet
&gt;   )
&gt;   if ((await chainOwnerWallet.provider.getCode(arbOwnerAccount)) === '0x') {
&gt;     // arb owner is EOA, add cache manager directly
&gt;     await (
&gt;       await arbOwnerPrecompile.addWasmCacheManager(cacheManagerProxy.address)
&gt;     ).wait()
&gt;   } else {
&gt;     // assume upgrade executor is arb owner
&gt;     const upgradeExecutor = new ethers.Contract(
&gt;       arbOwnerAccount,
&gt;       UpgradeExecutorABI,
&gt;       chainOwnerWallet
&gt;     )
&gt;     const data = arbOwnerPrecompile.interface.encodeFunctionData(
&gt;       'addWasmCacheManager',
&gt;       [cacheManagerProxy.address]
&gt;     )
&gt;     await (await upgradeExecutor.executeCall(ARB_OWNER_ADDRESS, data)).wait()
&gt;   }
&gt; </code></pre><ol start="3"><li><p>For good measure, since we need a Yul-compiled contract, I also grabbed a copy of forge-std in the lib directory, then ran yarn build with the forge arguments:</p></li></ol><pre><code>cd lib
rmdir forge-std
git clone https://github.com/foundry-rs/forge-std
cd ..
yarn build:forge</code></pre><ol start="4"><li><p>This let us trigger the deployment (note that my shell doesn&#8217;t require the use of the export statement for environment variables to be available to child processes):</p></li></ol><pre><code>b % CUSTOM_CHAINID=55244
b % CHILD_CHAIN_RPC=https://rpc.superposition.so
b % CHAIN_OWNER_PRIVKEY=0xprivatekey
b % npx hardhat run --network custom src/chain/CacheManager.sol</code></pre><p>At which point, it was made available on Superposition chain at:</p><pre><code>b % npx hardhat run --network custom scripts/local-deployment/deployCacheManager.ts
* New CacheManager created at address: 0x3d2898D2a40a9b23Da4733cb08d4FdE837E6eA3f 
* New ProxyAdmin created at address: 0xd3662d66C486ef5392654C056EEe4728c2f0b21E 
* New TransparentUpgradeableProxy created at address: 0xe3092C5d44BcB222B458d9212E608E0e8fE37591 0x3d2898D2a40a9b23Da4733cb08d4FdE837E6eA3f 0xd3662d66C486ef5392654C056EEe4728c2f0b21E 0x</code></pre><ol start="5"><li><p>I wanted to verify our newly made contracts. I disabled sourcify in hardhat config by setting its flag to false, set the following:</p></li></ol><pre><code>b % CUSTOM_RPC_URL=https://rpc.superposition.so
b % CUSTOM_ETHERSCAN_API_URL=https://explorer.superposition.so/api
b % CUSTOM_ETHERSCAN_BROWSER_URL=https://explorer.superposition.so
b % npx hardhat verify --network custom 0x3d2898D2a40a9b23Da4733cb08d4FdE837E6eA3f</code></pre><p>Which verified everything for me. Now, you would need your chain owner/rollup provider to execute:</p><pre><code>cast send 0x0000000000000000000000000000000000000070 'addWasmCacheManager(address)' &lt;your cachemanager contract here&gt;</code></pre><p>This contract will act as a frontend for the cache management system, letting you extract fees from users trying to reduce costs for their contracts!</p><div><hr></div><h2>Guest post: Timeboost broken down</h2><blockquote><p>I&#8217;m excited to feature Erik from Superposition for a guest post on Timeboost! Timeboost is a new transaction ordering layer in Arbitrum that extracts extra value for the DAO by providing a short window for MEV extractors to have priority transaction sequencing. He&#8217;s written an introduction and piece below!</p><p>While Timeboost is not explicitly related to Stylus, I feel it&#8217;s important to understand as it forms a part of the broader Arbitrum execution environment and ecosystem. As dApps become more complex, the opportunities for MEV increase.</p></blockquote><p>Blockchains are collectively missing out on and losing billions of revenue every year due to Maximal Extractable Value (MEV). What if they could capture some of this value and redistribute it back to its applications and users, while also protecting them from harmful MEV? This is what Arbitrum is setting out to do with Timeboost, their novel transaction ordering policy that has just been adopted.</p><h3><strong>Introduction</strong></h3><p>Since its launch, Arbitrum has been using a First-Come, First-Serve (FCFS) transaction ordering policy, meaning that transactions are processed in the order that the Sequencer receives them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6igA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6igA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 424w, https://substackcdn.com/image/fetch/$s_!6igA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 848w, https://substackcdn.com/image/fetch/$s_!6igA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 1272w, https://substackcdn.com/image/fetch/$s_!6igA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6igA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png" width="485" height="551.7304964539007" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:802,&quot;width&quot;:705,&quot;resizeWidth&quot;:485,&quot;bytes&quot;:40051,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6igA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 424w, https://substackcdn.com/image/fetch/$s_!6igA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 848w, https://substackcdn.com/image/fetch/$s_!6igA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 1272w, https://substackcdn.com/image/fetch/$s_!6igA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa158de72-78b0-454a-a5b9-ef1843500fb6_705x802.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A classic first come first served situation.</figcaption></figure></div><p>Since there is no priority fee or way to get a transaction into a block and included in the blockchain history before everyone else, a transaction submitter seeking short-term opportunities (in regular parlance, a &#8220;searcher&#8221;) must reduce latency and invest their resources in infrastructure. This infrastructure must be located in a way that has fast and reliable access to the Arbitrum sequencer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vc45!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vc45!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 424w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 848w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 1272w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vc45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png" width="340" height="462" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:462,&quot;width&quot;:340,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28856,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vc45!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 424w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 848w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 1272w, https://substackcdn.com/image/fetch/$s_!Vc45!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fceeb4974-6b99-4e71-b5d4-54e727d0c489_340x462.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Due to this design, FCFS already protects against harmful MEV, as there is no public mempool (memory pool, where transactions are held before being committed to the blockchain) on Arbitrum that would allow searchers to view, reorder incoming transactions, or be the first in a block. This has the benefit of excluding <em>toxic order flow </em>(a type of orderflow that ..) such as frontrunning and sandwich attacks. However, the chain itself is still missing out on rent extraction from searchers, as they spam the network to win the latency races against other searchers, leading to congestion.</p><p>Timeboost offers a solution to this, allowing searchers to bid for faster transaction inclusion in the sequencer through an offchain auction. It gives them the option to access an &#8220;express lane&#8221;, with the chain offering (non-toxic) MEV-as-a-Service for arbitrage, backrunning and liquidation opportunities. If you want to be first, you have the option to pay a fee to the chain owners. It replaces the existing First-Come, First-Served system with an extra layer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!klv_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!klv_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 424w, https://substackcdn.com/image/fetch/$s_!klv_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 848w, https://substackcdn.com/image/fetch/$s_!klv_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!klv_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!klv_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png" width="1050" height="1076" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1076,&quot;width&quot;:1050,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:91932,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!klv_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 424w, https://substackcdn.com/image/fetch/$s_!klv_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 848w, https://substackcdn.com/image/fetch/$s_!klv_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!klv_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb39ae37c-91fc-4828-8a41-60952d2109a5_1050x1076.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is beneficial to both parties, as the chain is able to extract rent it otherwise would&#8217;ve missed out on, and it reduces congestion and spam on the network. Searchers won&#8217;t have to invest their resources in infrastructure to reduce latency, as they can instead purchase the rights for the express lane through a simpler UX. Timeboost preserves the many benefits of FCFS like fast block times and protection from harmful MEV, all while avoiding the latency competition and allowing chains to capture more value, effectively addressing FCFS limitations.</p><h3><strong>How does it work?</strong></h3><p>Centralised timeboost is used by a single sequencer of an Arbitrum chain. Decentralised timeboost for multiple sequencers is still currently being developed by <a href="https://www.offchainlabs.com/">Offchain Labs</a> in collaboration with <a href="https://www.espressosys.com/">Espresso Systems</a>, and we won&#8217;t highlight it here further.</p><p>Timeboost is mainly introducing three new components to Arbitrum chains:</p><p>An <strong>express lane</strong> for the sequencer, an <strong>offchain auction</strong> to determine the controller of the express lane, and an <strong>auction contract</strong> to choose the winner of the auction and collect the proceeds.</p><p>The <strong>express lane</strong> is a special endpoint on the sequencer on which transactions will be immediately sequenced whenever they have been submitted.</p><p>They need to be signed by the express lane controller, which is an address set by the auction contract as the winner of the previous off-chain auction. &#8220;Normal&#8221; Transactions that don&#8217;t get signed by the express lane controller will be sent to the sequencer with a <strong>200 ms delay on their arrival timestamp</strong>. This gives the controller of the express lane a time advantage, but it does not guarantee that their transactions will always be first.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jIZK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jIZK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 424w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 848w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 1272w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jIZK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png" width="539" height="647.4240231548481" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e19c712d-82fc-414b-82d0-8affd043954e_691x830.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:830,&quot;width&quot;:691,&quot;resizeWidth&quot;:539,&quot;bytes&quot;:56084,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jIZK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 424w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 848w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 1272w, https://substackcdn.com/image/fetch/$s_!jIZK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe19c712d-82fc-414b-82d0-8affd043954e_691x830.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>All sequencer transactions are sorted into a single stream of transactions for node operators to post to the <a href="https://celestia.org/what-is-da/">data availability layer</a> and it is for controllers and searchers to estimate the MEV they can extract and if they can secure a profit on their bid. This creates an interesting economy for bidders, as they can use it for their own MEV opportunities and extract rent from searchers on MEV that they did not predict as controllers of the express lane by reselling transaction slots.</p><p>The Timeboost auction happens offchain. Each auction round has a duration of 60 seconds to determine the express lane controller for the next round. The auction is sealed-bid and second price, which means that bids are proposed privately and the winning bidder pays the amount of the second highest bid instead of their own bid.</p><p>This is also known as a <a href="https://en.wikipedia.org/wiki/Vickrey_auction">Vickrey Auction</a> and it incentivises participants to bid their true value without strategic over or underbidding. Participants can bid with any ERC-20 token, with any minimum amount, and the bid can be collected by any address. They interact with an offchain autonomous auctioneer, who accepts and rejects the bids. The bidding period lasts for 45 seconds, with the remaining 15 seconds being used by the auctioneer to verify bids, sort them into descending order, choose the 2 highest bids, determine a winner and make a call to the on-chain auction contract to resolve the auction.</p><p>The on-chain auction contract takes the deposits for bids and sets a minimum bid value, which can be changed by the chain owner. It also resolves the auction by taking the information it receives from the autonomous auctioneer in the off-chain bidding stage, deducting the 2nd highest bid from the account of the winning bidder and transferring it to the beneficiary account. The contract then sets the address of the express lane controller for the next round, giving that address the privilege to sign transactions to be included in the express lane for the next 60 seconds. If there is no express lane controller for the next round, the transaction ordering policy will fall back to FCFS.</p><p>The parameters that can be configured by the chain owner include the round duration, the auction closing time, the beneficiary of the bids, the bidding token, the delay for non-express transactions and the minimum bid amount.</p><p>With Timeboost enabled, the default block time on Arbitrum One and Nova is still 250 ms and can be adjusted to 100 ms. Because of this, regular users will experience a latency of 450 ms for their transactions to be sequenced and included in a block. It is entirely optional to enable Timeboost for chain owners, as it will also be available to Arbitrum Orbit Chains.</p><h3><strong>Opportunities for Arbitrum</strong></h3><p>Timeboost went live on Arbitrum Mainnet on the 17th of April.</p><p>During the governance vote, there was a choice to collect winning bids either in ETH or in ARB and to burn the tokens. The DAO voted to collect fees in ETH and send them to the DAO treasury for later use. This has proven successful: In the first month alone, it generated over 300 WETH in revenue for the Arbitrum DAO<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. On most days, it is already driving over 50% of the network revenue, bringing the DAO closer to profitability. The long term effects of Timeboost remain to be seen, as it is still early days and it needs to be adopted by all searchers and traders on the chain.</p><p>There is the potential issue about a single entity monopolizing the express lane and depriving smaller arbitrageurs from MEV opportunities, which could lead to these smaller searchers leaving Arbitrum. There are no indications that this will happen at the moment though and it&#8217;s not very different from FCFS hardware latency races. The DAO is consistently monitoring and analysing the effects that different parameters have on the system, but so far Timeboost seems very promising to drive a huge portion of the future revenue of the chain.</p><p>For some more reading on Timeboost, we recommend the articles written by the OCL team attached to this footnote.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a></p><div><hr></div><h2>Interview with Ben</h2><h3><strong>Who are you, and what do you do?</strong></h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://www.hummusonrails.com/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!a-Pn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!a-Pn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png" width="468" height="468" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:468,&quot;bytes&quot;:772902,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://www.hummusonrails.com/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!a-Pn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!a-Pn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F730375df-1cab-44a8-b509-3dbb9ebffabc_1024x1024.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I'm <a href="https://www.hummusonrails.com/">Ben</a>, and I am a Senior Developer Relations Engineer at Arbitrum. I have been working in DevRel for the past seven years across both web2 and web3. My path into tech was not typical. Before I became a software developer, I spent nearly a decade working as a community organizer and educator.</p><p>My journey into web3 began where all web3 journeys begin, in a bar on the east side of Berlin, where a friend and I spent hours discussing trustless systems and how we could build a better digital common. The ethos of web3 reminded me of the early days of the internet in the late 90s and early 2000s, when people came first and data belonged to the user.</p><p>Since joining Arbitrum, I have been focused on building clear paths for developers to enter the ecosystem and for existing developers to level up. I have created workshops and talks, and we are getting ready to launch an incredible new global initiative to expand this work. DevRel sits where systems meet people, and I am grateful to be in that space.</p><h3><strong>What web3 ecosystems have you worked in?</strong></h3><p>I got started in web3 as the Lead Developer Relations Engineer at <a href="https://www.parity.io/">Parity</a>, the team behind <a href="https://polkadot.com/">Polkadot</a>. That introduced me to an engineering-first community with great tooling and infrastructure. During my time there, I attended the <a href="https://polkadot.com/blockchain-academy/">Polkadot Blockchain Academy</a> in Buenos Aires and graduated from the second cohort. We built a blockchain in Rust from scratch, studied game theory and economic principles, and explored cryptography in depth.</p><p>Since then, I have worked in both web2 and a small Ethereum-aligned rollup project. I joined Arbitrum because I have not seen another ecosystem so well suited for builders. Stylus lets developers write smart contracts using production-grade languages like Rust, without needing to adopt niche domain-specific languages or overly complex tech stacks. Developers can show up with an idea and begin building quickly, without needing to reshape their thinking just to get something running.</p><h3><strong>What are your impressions of working with Stylus, good and bad?</strong></h3><p>Stylus was the first thing that got me excited about Arbitrum. As a backend engineer, being able to write smart contracts in standard, battle-tested languages like Rust is amazing. You get the benefit of mature tooling, and it opens the door to better thinking around performance, memory management, and interoperability.</p><p>That said, Stylus is still early in its lifecycle. The Rust SDK has not reached a major 1.0 release yet, and that means occasional breaking changes and some small rough edges. Across the entire ecosystem, including within the Foundation's DevRel team, teams are working hard on creating better examples and onboarding tools for both Rust newcomers and experienced developers. These improvements will make it much easier for more people to build and ship with confidence.</p><h3><strong>What software do you use?</strong></h3><p>I keep things pretty simple. Most of my coding happens in VS Code. For vibe coding sessions, I use Windsurf. A few months ago I switched my terminal to Warp, and I have not looked back. I appreciate that it supports agentic workflows while still keeping a person in control of the process. I am not quite ready to hand everything over to AI, even though I have a book coming out in two weeks on AI and vector search: <a href="https://www.vectorsearchbook.com">https://www.vectorsearchbook.com</a>!</p><p>For visual content, I use <a href="https://www.mermaidchart.com/">Mermaid</a> for flowcharts and <a href="https://www.napkin.ai">Napkin</a> for quick diagrams. I build all my workshops in GitHub Codespaces using fully containerized environments, which means attendees can get started quickly with almost no setup.</p><h3><strong>What hardware do you use?</strong></h3><p>My main machine is a MacBook Air M4. It is more than powerful enough for everything I need, including compiling Rust projects. At home, I plug into a setup that includes one vertical monitor, a widescreen monitor, and an Elgato teleprompter display that I use for video calls and recordings. I use a Keychron keyboard and an Elgato mic for audio.</p><p>I also keep a Stream Deck on my desk to switch between apps, control my lighting, and trigger various shortcuts during demos and recordings.</p><h3><strong>How can people get in touch with you?</strong></h3><p>The easiest way is through my site, hummusonrails.com, which has links to all the platforms I use. I am also @hummusonrails on most social platforms, including X and Farcaster.</p><p>People usually reach out if they are building on Arbitrum, working with Stylus, or exploring new developer education ideas. I am always happy to chat with anyone building interesting things.</p><h3><strong>What's a piece of advice you'd give someone new to web3?</strong></h3><p>Learn how to read error messages. It sounds basic, but it's one of the most valuable skills you can develop in web3 as a builder. If you're working in Rust, you're already in good hands. Rust has some of the clearest and most helpful error messages of any language. They may be long, but they usually tell you exactly what went wrong, where it happened, and how to fix it.</p><p>The key is to start with the first error. Fix it. Then move to the next one. Do not try to solve everything at once. Most of the time, later errors vanish once the root cause is addressed.</p><p>Treat each error message like a clue. The language is trying to help you. Let it.</p><blockquote><p>You can get in touch with Ben via any of the links available at <a href="https://www.hummusonrails.com/">his website</a>. Be sure to <a href="https://x.com/hummusonrails">follow him on X</a> and <a href="https://farcaster.xyz/hummusonrails">via Farcaster</a>! Ben will be in Cannes and Berlin for the next while, so reach out if you want to have a sit-down. You can check out his book here:</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://vectorsearchbook.com/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RLOK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 424w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 848w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 1272w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RLOK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png" width="1084" height="660" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d481ad71-6515-4792-a078-95ba85154d04_1084x660.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:660,&quot;width&quot;:1084,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:225816,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://vectorsearchbook.com/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163864412?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RLOK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 424w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 848w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 1272w, https://substackcdn.com/image/fetch/$s_!RLOK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd481ad71-6515-4792-a078-95ba85154d04_1084x660.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a> and on <a href="https://farcaster.xyz/bayge">Farcaster</a>! </p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mWmh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 424w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 848w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mWmh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png" width="645" height="362.8125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:645,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Bridge&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Bridge" title="Bridge" srcset="https://substackcdn.com/image/fetch/$s_!mWmh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 424w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 848w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!mWmh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe73f6875-1404-4129-8ac3-1d043c514c26_3840x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Source: <a href="https://dune.com/entropy_advisors/arbitrum-timeboost">Entropy Advisors Dune Dashboard</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><blockquote><p><a href="https://docs.arbitrum.io/how-arbitrum-works/timeboost/gentle-introduction">https://docs.arbitrum.io/how-arbitrum-works/timeboost/gentle-introduction</a></p><p><a href="https://arbitrumfoundation.notion.site/Arbitrum-Centralized-Timeboost-FAQ-bba234acf92e476b8ca5db6855d7da45">https://arbitrumfoundation.notion.site/Arbitrum-Centralized-Timeboost-FAQ-bba234acf92e476b8ca5db6855d7da45</a></p><p><a href="https://medium.com/offchainlabs/debunking-common-misconceptions-about-timeboost-92d937568494">https://medium.com/offchainlabs/debunking-common-misconceptions-about-timeboost-92d937568494</a></p><p><a href="https://docs.arbitrum.io/how-arbitrum-works/timeboost/gentle-introduction">https://docs.arbitrum.io/how-arbitrum-works/timeboost/gentle-introduction</a></p><p><a href="https://arxiv.org/abs/2306.02179">https://arxiv.org/abs/2306.02179</a></p><p><a href="https://github.com/OffchainLabs/timeboost-design/tree/main">https://github.com/OffchainLabs/timeboost-design/tree/main</a></p><p><a href="https://arbitrumfoundation.notion.site/Arbitrum-Centralized-Timeboost-FAQ-bba234acf92e476b8ca5db6855d7da45">https://arbitrumfoundation.notion.site/Arbitrum-Centralized-Timeboost-FAQ-bba234acf92e476b8ca5db6855d7da45</a></p><p><a href="https://medium.com/offchainlabs/time-boost-a-new-transaction-ordering-policy-for-arbitrum-5b3066382d62">https://medium.com/offchainlabs/time-boost-a-new-transaction-ordering-policy-for-arbitrum-5b3066382d62</a></p><p><a href="https://medium.com/offchainlabs/timeboost-for-beginners-offchain-labs-latest-transaction-ordering-policy-protocol-10310f445c81">https://medium.com/offchainlabs/timeboost-for-beginners-offchain-labs-latest-transaction-ordering-policy-protocol-10310f445c81</a></p><p><a href="https://medium.com/offchainlabs/debunking-common-misconceptions-about-timeboost-92d937568494">https://medium.com/offchainlabs/debunking-common-misconceptions-about-timeboost-92d937568494</a></p></blockquote><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Supporting Stylus on RISC-V (part 1), Interview with Levan (blockcraft3r)]]></title><description><![CDATA[Stylus Saturdays, 17th June 2025]]></description><link>https://stylus-saturdays.com/p/supporting-stylus-on-risc-v-part</link><guid isPermaLink="false">https://stylus-saturdays.com/p/supporting-stylus-on-risc-v-part</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Mon, 16 Jun 2025 19:19:53 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c2ae896a-ad87-45a1-9eb6-26fa2c812b64_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone! <a href="https://x.com/baygeeth">Bayge</a> here. This week:</p><ol><li><p>&#128377;&#65039; <strong>Supporting</strong> <strong>Stylus on RISC-V</strong>: I&#8217;m pleased to share I&#8217;ve written a simulator for RISC-V with Ethereum environment calls, and am supporting the Stylus SDK with it for a few things! This post will share a link to the simulator without the patched SDK, which I&#8217;ll release in a part 2.</p></li><li><p>&#127858; <strong>Interview with Levan</strong>, Elite hackathon winner.</p></li></ol><p>I&#8217;m super excited to announce that we&#8217;re collaborating with <a href="https://learnweb3.io/">LearnWeb3</a> as a Stylus resource! LearnWeb3 is an educational platform to learn development. More to come soon.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Read on, and as always, if you have any feedback, you can share it here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and Go. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interopability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><p>You can get started very quickly at <a href="https://stylusup.sh">https://stylusup.sh</a></p><p>Congratulations to the team for releasing 0.9.0! 0.9.0 includes several meaningful improvements including trait based inheritance! I can&#8217;t wait to play with this.</p><div><hr></div><h2>1) Stylus on RISC-V (32IM) Part 1</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylushttps://github.com/af-afk/ocaml-riscv32im-stylus" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylushttps://github.com/af-afk/ocaml-riscv32im-stylus&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The first iteration simulator that runs offline is here!</figcaption></figure></div><p>You may have seen the news recently with Vitalik mentioning wanting to simulate RISC-V on-chain, in lieu of (and perhaps alongside or interpreting) the EVM bytecode format of today. The goal I assume is that it&#8217;s useful for completed proving with ZK tools, maybe motivated by the research of RISC Zero and the rest of the ecosystem researching proving there. I was discouraged to see that he used ChatGPT to suggest that Rust smart contracts are ugly, we know from experience here in the Stylus ecosystem that that&#8217;s not necessarily the case!</p><p>To recap how Stylus works: WASM is sent on-chain, nodes download the code, then the nodes &#8220;warm&#8221; them up (or &#8220;bake&#8221; them), and the programs are converted to native code and stored. Certain operations are unavailable, including floating points, any threading extensions, etc. I noticed that WASM&#8217;s newest spec was just ratified, and it includes operations involving scalar word and vector operations, which is quite exciting. These translate nicely into the native environment alongside the memory model, which is already familiar to most programmers outside of the Ethereum world.</p><p>I don&#8217;t believe that there is any advantage to a particular execution environment when it comes to performance between WASM and RISC-V, but the former has a storied history of execution in sandboxed and JIT&#8217;d environments (the browser), while the latter is preferred in the embedded context. With this perspective, it should be possible to build a interpreter on-chain that interprets RISC-V without any significant cost, except perhaps the storage and the loading of the executables. It should be possible to have near-native performance of execution of what you might otherwise see of a full rewrite of some node running software, since a native executable is simulating it anyway. It should be possible to reuse the existing SDK and toolchain to generate the code.</p><p>The full goal:</p><ol><li><p>Get a RISC-V interpreter interpreting RV32IM running unprivileged code code deployed on-chain without any trap handling features. Get a program loading model in somehow, perhaps involving reading from a deployed contract with a junk preamble that gets skipped. Test that it can simulate the contract, using <a href="https://github.com/fluidity-money/9lives.so/tree/main/tools/stylus-interpreter">9lives&#8217; stylus-interpreter</a> and some spooky stuff. I chose this variant because of the &#8220;riscv32im-risc0-zkvm-elf&#8221; target that Rust makes available, which is used by Risc Zero&#8217;s toolchain, which is a tweaked environment that provides some custom accelerators for some areas of cryptography. Though our end goal overtly won&#8217;t be to use their stack for proving and verifying (simply to use riscv32im on-chain), we&#8217;ll find out in this article how feasible this will be to use! This is an exploration, and this possibility could unlock some future coprocessing usecases. In this post, we&#8217;ll only be simulating it locally to see if our concept works.</p></li><li><p>Add some operations to the interpreter that use the available exports that we&#8217;ve grown accustomed to. These include storage accesses. Keep it simple for now to validate the concept works.</p></li><li><p>Release a contract somehow that transparently uses any RISC-V code when it&#8217;s called into the same way as you might a WASM contract.</p></li><li><p>Maybe even figure out how to prove what&#8217;s happened by receiving a receipt from a Stylus program? Risc Zero&#8217;s prover stack gives you a STARK that you can use to verify the execution of the contract on-chain. It might be redundant to do so, since we&#8217;re executing on-chain, but maybe there are other possibilities out there that could be expanded on if that&#8217;s possible? Maybe ZK coprocessing an off-chain Stylus contract that leverages some permissioned local offerings or something similar? Though, the focus of this will be using the Stylus SDK with the ISA and an interpreter, on-chain.</p></li></ol><p><strong>So, in this part 1, we&#8217;ll be building a OCaml-based simulator of RISC-V 32IM to experiment with our approach, and showing off how to load in the SDK for some EVM native numbers before later completing the SDK to use RISC-V fully in a later post. I have some development done there, but I don&#8217;t feel complete about it yet and want to release something since it&#8217;s been a while!</strong></p><h3>Setting up a project</h3><p>First, let&#8217;s compile a simple hello world program, but import the Stylus SDK and use a type exported from it:</p><pre><code>// src/main.rs

#![no_std]
#![no_main]

#[panic_handler]
fn panic(info: &amp;core::panic::PanicInfo) -&gt; ! {
    unimplemented!()
}

pub extern "C" fn main() -&gt; ! {
    loop {}
}</code></pre><p>Since we don&#8217;t have a way to return things, we need to hole out the return type for our exported main symbol. That&#8217;s what we do here. I set some other things:</p><pre><code>// .cargo/config.toml

[build]
target = "riscv32im-unknown-none-elf"
rustflags = ["-C","panic=abort"]</code></pre><pre><code>// Cargo.toml

[package]
name = "risc-hello-world"
version = "0.1.0"
edition = "2021"

[profile.release]
codegen-units = 1
opt-level = "z"
strip = false
lto = true
debug = false
rpath = false
debug-assertions = false
incremental = false</code></pre><p>Great. Seems familiar? Now, to use <code>stylus-sdk</code> in its basic use. I pulled emballoc off the net without thinking much about it, because I gathered from its description that it would be suitable for our target. I downloaded stylus-sdk, alloy-primitives, and disabled the default features. I went to compile and we hit our first roadblock:</p><pre><code>error[E0432]: unresolved import `alloc::sync`
   --&gt; /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-hex-1.14.0/src/traits.rs:14:5
    |
14  |     sync::Arc,
    |     ^^^^ could not find `sync` in `alloc`
    |
note: found an item that was configured out
   --&gt; /home/user/.rustup/toolchains/1.83-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/lib.rs:246:9
    |
246 | pub mod sync;
    |         ^^^^
note: the item is gated here
   --&gt; /home/user/.rustup/toolchains/1.83-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/lib.rs:245:1
    |
245 | #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</code></pre><p>What now? I wonder what the context of this dependency is? I was under the impression const-hex was simple (just for having hex strings decoded at constant time), but perhaps something else is going on here. Let&#8217;s dip deeper. I disabled the default features, which included &#8220;alloc&#8221;, since apparently that&#8217;s implicitly enabled. I was hoping that would feature flag out alloc, but I was mistaken. Ouch, it seems that alloy-primitives has a hard dependency on const-hex having alloc enabled.</p><p>Let&#8217;s try downloading alloy-core, then patching its dependency on const-hex by removing the setting of the alloc flag:</p><pre><code>error[E0425]: cannot find function `serialize` in crate `hex`
   --&gt; crates/primitives/src/bytes/serde.rs:10:18
    |
10  |               hex::serialize(self, serializer)
    |                    ^^^^^^^^^ help: a function with a similar name exists: `deserialize`
    |
   ::: /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-hex-1.14.0/src/serde.rs:63:1
    |
63  | / pub fn deserialize&lt;'de, D, T&gt;(deserializer: D) -&gt; Result&lt;T, D::Error&gt;
64  | | where
65  | |     D: Deserializer&lt;'de&gt;,
66  | |     T: FromHex,
67  | |     &lt;T as FromHex&gt;::Error: fmt::Display,
    | |________________________________________- similarly named function `deserialize` defined here
    |
note: found an item that was configured out
   --&gt; /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-hex-1.14.0/src/lib.rs:124:31</code></pre><p>Looks like we have a battle ahead of us on this. What business does const-hex have with atomic reference counting anyway? I wonder if we can find a constant time hex that does things in a no-std environment comfortably without the alloc dependency. I found https://docs.rs/const-decoder/latest/const_decoder/&#8230; Wow, this is hard basket. Maybe another approach is needed? Why does const-hex need Arc? Answer: for a trait it implements. Perhaps we can take it out of the picture somehow. It looks like <code>const-hex</code> has the <code>alloc</code> flag for the <code>Arc</code> dependency, among other things. Removing the <code>Arc FromHex</code> impl is definitely a lot easier!</p><p>Moving along, we run into similar issues. <code>dyn-clone</code>, <code>lazy-static</code>, they all have in common a <code>alloc::sync</code> dependency! It seems like the complete availability of alloc (albeit, for the rest of the variants) is a hot and ongoing topic, from a cursory search: <a href="https://github.com/rust-lang/rust/issues/140042">https://github.com/rust-lang/rust/issues/140042</a> and <a href="https://github.com/rust-lang/rust/issues/135376#issuecomment-2593558310">https://github.com/rust-lang/rust/issues/135376#issuecomment-2593558310</a>. I learned today that MIPS is also supported as a Risc0 ZKEVM target. </p><p>I soldiered on, going full hatchetman on everything involving alloc::sync, atomic, etc. I needed to set up critical-section with portable-atomic to support some libraries, and I needed to stub out the behaviour with the critical section so my simulator wouldn&#8217;t need to implement any CSRs for this functionality.</p><p>Looks like we&#8217;re in business!</p><pre><code>   Compiling stylus-core v0.8.3 (/home/user/Downloads/stylus-sdk-rs/stylus-core)
   Compiling stylus-sdk v0.8.3
   Compiling risc-hello-world v0.1.0 (/home/user/Documents/markov-geist-research/risc-hello-world)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.07s
% </code></pre><p>I had to unfortunately patch a few dependencies for this to work..</p><h4>Interpreting with Spike</h4><p>To interpret RISC-V using Spike, the preferred simulator for RISC-V I gather, aside from Qemu, I largely followed the instructions of <a href="https://github.com/rust-lang/rust/issues/135376#issuecomment-2593558310">https://riscv.epcc.ed.ac.uk/documentation/how-to/install-spike/</a>, breaking from the instructions to alias gcc/ld/etc to a higher priority with my PATH, to reuse it for compilation.</p><p>I needed to install the RISC-V ELF toolchain to get the libraries and tools needed for compilation, as we need to sidestep Rust&#8217;s standard linker. On my somewhat space challenged laptop, this was a battle, because I wanted to install the toolchain at /opt/riscv per the instructions, but I was unable to, having to settle for my home instead. The tools we&#8217;d used alluded to the idea of a RISCV location, so this is exciting, as its the first time that we&#8217;re installing the actual build toolchain with GCC!</p><blockquote><p>Warning: git clone takes around 6.65 GB of disk and download size</p></blockquote><p>Boy did I really feel this one. It&#8217;s not like I torrent (much). I should&#8217;ve bought a Framework laptop with the disk size cranked up higher than my simple El Cheapo Thinkpad. My computer spent at least a few hours compiling everything. I built the newlib version of the RISC-V toolchain (<code>./configure --with-arch=rv32imac --with-abi=ilp32 --prefix=$HOME/riscv  --host x86_64-unknown-linux-gnu</code>). I then followed the <a href="https://github.com/riscv-software-src/riscv-isa-sim">instructions</a> in the repo, and compiled and set up Spike&#8217;s simulator.</p><p>I ran Spike with <code>spike --isa=rv32im target/riscv32im-unknown-none-elf/debug/risc-hello-world</code>. Running it seems to start things without any issue, and control-c dumps me into a prompt, which I assume is the debugging experience. Running with &#8220;r&#8221; kicks us off with spam about illegal accesses, so this is the wrong approach it seems. I went back to the drawing board, and changed the linker that Rust uses to use the one that I got earlier:</p><pre><code>[build]
target = "riscv32im-unknown-none-elf"
rustflags = [
  "-C","panic=abort",
  "-C","link-arg=-march=rv32im",
  "-C","link-arg=-mabi=ilp32",
  "-C", "link-arg=--entry=_start"
]

[target.riscv32im-unknown-none-elf]
linker = "riscv64-unknown-elf-gcc"</code></pre><p>This lets us compile to ELF, instead of the GNU format that we were using. I also had to point the linker to the location of a object file it couldn&#8217;t find (I must&#8217;ve made a mistake in the past or something with the prefix argument). Success:</p><pre><code>spike --isa RV32IM target/riscv32im-unknown-none-elf/debug/risc-hello-world</code></pre><p>I couldn&#8217;t find a way to get the symbols exported that I wanted to communicate with Spike though. I think the linker or Rust must&#8217;ve been optimising it out. But for our purposes, this seems to work! I played around a little to use different operations to see the impact to verify things were running fine, and they were. I set the layout of the ELF to be the following:</p><pre><code>MEMORY {
  RAM : ORIGIN = 0x80000000, LENGTH = 128M
}

ENTRY(_start)

SECTIONS {
  .text : {
    *(.text.entry)
    *(.text .text.*)
  } &gt; RAM

  .rodata : {
    *(.rodata .rodata.*)
  } &gt; RAM

  .data : {
    *(.data .data.*)
  } &gt; RAM

  .bss : {
    *(.bss .bss.*)
  } &gt; RAM
}</code></pre><p>We define a trap handler for Spike to jump into when we have a trap situation (as is the normal behaviour with RISC-V under most circumstances), and the _start section, which we&#8217;ll use to define as the program entrypoint, as well as define some program-wide NOP mutex functions that we need to be downstream users of Alloy-dependent atomics code. At this point, I needed to rip out emballoc, since I found it was spincycling when we weren&#8217;t setting the critical region in a way that it wanted. This is a simple bump allocator we&#8217;ll be using (ignore the warning messages when you use this, I&#8217;ll fix that eventually):</p><pre><code>use core::{
    alloc::{GlobalAlloc, Layout},
    ptr::null_mut,
};

pub struct SimpleAlloc {
    heap_start: usize,
    heap_end: usize,
    next: core::cell::UnsafeCell&lt;usize&gt;,
}

unsafe impl Sync for SimpleAlloc {}

impl SimpleAlloc {
    pub const fn new() -&gt; Self {
        Self {
            heap_start: 0,
            heap_end: 0,
            next: core::cell::UnsafeCell::new(0),
        }
    }

    pub fn init(&amp;self, start: usize, size: usize) {
        unsafe {
            let self_mut = self as *const Self as *mut Self;
            (*self_mut).heap_start = start;
            (*self_mut).heap_end = start + size;
            *(*self_mut).next.get() = start;
        }
    }
}

unsafe impl GlobalAlloc for SimpleAlloc {
    unsafe fn alloc(&amp;self, layout: Layout) -&gt; *mut u8 {
        let next_ptr = self.next.get();
        let mut next = *next_ptr;
        let align = layout.align();
        next = (next + align - 1) &amp; !(align - 1);
        if next + layout.size() &gt; self.heap_end {
            return null_mut();
        }
        *next_ptr = next + layout.size();
        next as *mut u8
    }

    unsafe fn dealloc(&amp;self, _ptr: *mut u8, _layout: Layout) {}
}
</code></pre><p>At this point, our dependencies look like this from my off-screen exploration, mostly setting feature flags for our dependencies:</p><pre><code>[package]
name = "risc-hello-world"
version = "0.1.0"
edition = "2021"

[dependencies]
stylus-sdk = { version = "0.8.3", default-features = false }
stylus-core = { version = "0.8.3", default-features = false }
alloy-primitives = { version = "=0.8.20", default-features = false }
const-hex = { version = "1.14.0", default-features = false }
lazy_static = { version = "1.5.0", default-features = false, features = ["spin_no_std"] }
dyn-clone = { version = "1.0.19" }
bytes = { version = "1.10.1", default-features = false, features = ["extra-platforms"] }
portable-atomic = { version = "1.11.0", default-features = false, features = ["critical-section"] }
critical-section = { version = "1.2.0", default-features = false }
spin = { version = "0.9.8", default-features = false, features = ["portable_atomic"] }

[patch.crates-io]
const-hex = { path = "/home/user/Downloads/const-hex" }
dyn-clone = { path = "/home/user/Downloads/dyn-clone" }
stylus-core = { path = "/home/user/Downloads/stylus-sdk-rs/stylus-core" }</code></pre><p>I needed to patch these repos to remove atomic code and have them downloaded locally. I needed to also ask certain packages to use portable-atomic where it could, and then I imported critical-section, which lets us guard the program as it runs in a mutex to implement some synchronisation features without using privileged instructions (or RISC-V CSRs).</p><p>I implemented some code like below to set up the allocator:</p><pre><code>#![no_std]
#![no_main]

#[global_allocator]
static ALLOCATOR: emballoc::Allocator&lt;4096&gt; = emballoc::Allocator::new();

extern crate alloc;

use stylus_sdk::alloy_primitives::U256;

#[no_mangle]
extern "C" fn _exit(_code: i32) -&gt; ! {
    loop {}
}

#[panic_handler]
fn panic(_: &amp;core::panic::PanicInfo) -&gt; ! {
    unimplemented!()
}

struct SingleCoreCriticalSection;

critical_section::set_impl!(SingleCoreCriticalSection);

unsafe impl critical_section::Impl for SingleCoreCriticalSection {
    unsafe fn acquire() {}
    unsafe fn release(_token: ()) {}
}

#[export_name = "_start"]
pub extern "C" fn _start() -&gt; ! {
    unsafe {
        let heap_start = HEAP.as_mut_ptr() as usize;
        let heap_len = HEAP.len();
        ALLOCATOR.init(heap_start, heap_len);
    }
    let x = u32::from_le_bytes(
        (U256::from(123) + U256::from(456)).to_le_bytes::&lt;32&gt;()[..4]
            .try_into()
            .unwrap(),
    );
    unsafe {
        core::arch::asm!("mv a0, {}", in(reg) x);
    }
    loop {}
}

#[export_name = "__trap_vector"]
extern "C" fn trap_vector() -&gt; ! {
    loop {}
}</code></pre><p>This compiled and ran fine inside Spike! I could verify that the a0 register was set with the results of the 123 + 456 integer sum.</p><h3>Building the simulator</h3><p>Now that we&#8217;ve verified we can compile Rust programs and run them in Spike, it&#8217;s time to write a simulator that interprets RISC-V code of the 32-bit IM variation.</p><p>First, for this post, I&#8217;ll implement it in OCaml since I like the typing features. I&#8217;m a huge fan of OCaml for its code generation to S-expressions and recursive datatypes (including GADTs among other things), which we&#8217;ll use as our discussion and intermediate language. Always reimplement your code twice if you can, especially if the need is to blackbox your understanding, to build a weak proof of your concept and your understanding (this is why we build specs and multiple clients and teams). For the OCaml implementation we&#8217;ll be building an intermediate representation stage that will simplify development and debugging, at the expense of performance, which we&#8217;ll term the lifted stage.</p><p>All of our code will of course be supporting loading binaries using the ELF format, which I hope we can safely encode as a EVM contract on-chain without being gated by the 24kb contract deployment restriction. If we have to, we should have enough memory inside the Stylus execution environment to do multiple copies of a program which we reconstruct (imagine yourself uploading a Solana program, now reverse that). In practice on-chain, each contract will have a stub infront to prevent loading by normal EVM contracts, Vyper standard library when you use a blueprint style.</p><p>Our interpreter will of course be a single core, and will support the entirety of the IM variant. We will not be implementing any accelerators or coprocessors, though I would like to support Risc Zero&#8217;s additions in the future if this becomes a thing that becomes useful to others, or maybe my team makes some use of it as a ZK bridge for our Longtail Pro validium. I thought about this a little, and perhaps we could get there by building some application specific sequencing with this concept. When we implement the calling interface for chatting with our on-chain state with environment calls, we&#8217;ll use the calling conventions in the RISC-V SBI (Supervisor Binary Interface). Everything will run in single hardware thread from the running code&#8217;s perspective, with no multiplexing or anything similar onto the underlying OS environment, for obvious reasons. We&#8217;ll use Spike&#8217;s convention of setting the registers at the beginning of the simulation to zero. Reiterating: for now, we&#8217;ll implement EVM operations as ecalls without trap handling and mset/etc (we&#8217;ll simply write to memory for our example).</p><h4>Implementing C bindings to binutils</h4><p>ELF is of course the object loading format we use daily. ELF is made up of sections, with a few having predefined purposes, including a data, junk, and executable section. We won&#8217;t be reading from program headers since I&#8217;ve had so many issues linking to libelf (which would&#8217;ve been preferable here). Program headers are a simpler way to lay out the program in memory, and the sections are more information for linkers and development tools. In our first revision OCaml simulator, we&#8217;ll be using binutils C bindings to read sections to get these. This is due to linking issues I had with libelf on my computer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eJRT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eJRT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 424w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 848w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 1272w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eJRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png" width="977" height="782" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:782,&quot;width&quot;:977,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:193698,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eJRT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 424w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 848w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 1272w, https://substackcdn.com/image/fetch/$s_!eJRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19ac96a4-667f-4f05-8220-ff0139791f65_977x782.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Using libffi and OCaml&#8217;s Ctypes makes this simple. This code essentially binds abstract types to definitions a C parser picks up, and we even manage the memory ourselves using the garbage collector and Bigarray with the C layout later when it asks for a memory pointer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mAC9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mAC9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 424w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 848w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 1272w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mAC9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png" width="1191" height="756" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:756,&quot;width&quot;:1191,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157183,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mAC9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 424w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 848w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 1272w, https://substackcdn.com/image/fetch/$s_!mAC9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca4dd310-001c-41bd-af52-8298eb3850c8_1191x756.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Of course, you can always check this code out in the <a href="https://github.com/af-afk/ocaml-riscv32im-stylus">repository</a> yourself. Code on the left is the bindings code, and the code on the right is the user of said code.</figcaption></figure></div><p>This lets us create downstream experiences from the bindings quite easily. The lower part is a simple application that reads sections and checks if the section exists for <code>_start</code>. We can use this to process the sections and symbols for the Rust code, which we then fill the gaps of to implement code like program functionality.</p><h3>Implementing memory</h3><p>Using the bindings, we can create a list of memory. This is an approach that doesn&#8217;t scale very well under performance (perhaps a btree, contiguous allocation, or a tree structure is better), but for our purposes of measuring and understanding the eventual implementation (and the nature of perhaps needing to store each section on-chain as a contract that we search to find) it works.</p><p>The simple type looks like such:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ylgH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ylgH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 424w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 848w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 1272w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ylgH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png" width="645" height="448" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:448,&quot;width&quot;:645,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44446,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ylgH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 424w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 848w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 1272w, https://substackcdn.com/image/fetch/$s_!ylgH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2aadc4e-e9b9-4d52-8299-4fdafa4d97dc_645x448.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We need a function to construct our list of memory (and writeable, readable, and executable gaps):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8caV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8caV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 424w, https://substackcdn.com/image/fetch/$s_!8caV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 848w, https://substackcdn.com/image/fetch/$s_!8caV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 1272w, https://substackcdn.com/image/fetch/$s_!8caV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8caV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png" width="585" height="735" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a4d475a5-1625-4227-9607-ede8626d596c_585x735.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:735,&quot;width&quot;:585,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:102281,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8caV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 424w, https://substackcdn.com/image/fetch/$s_!8caV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 848w, https://substackcdn.com/image/fetch/$s_!8caV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 1272w, https://substackcdn.com/image/fetch/$s_!8caV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4d475a5-1625-4227-9607-ede8626d596c_585x735.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Our memory needs a few functions to support accesses from within it:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jKeG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jKeG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 424w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 848w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 1272w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jKeG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png" width="585" height="813" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aee57304-1a45-4423-906a-840f44819052_585x813.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:813,&quot;width&quot;:585,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:113045,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jKeG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 424w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 848w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 1272w, https://substackcdn.com/image/fetch/$s_!jKeG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faee57304-1a45-4423-906a-840f44819052_585x813.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The $$ infix operator is used by us to compose functions together in a Haskell style form. In OCaml, every function is &#8220;curryable&#8221;, where functions can be partially applied and made into new functions, as each function with multiple arguments is just a function taking one argument that&#8217;s composed to return another function with one argument, and so on.</p><p>This is the practice of partially applying a function like this simple math function that adds x, y, and z together:</p><pre><code> # let a x y z = x + y + z;;
val a : int -&gt; int -&gt; int -&gt; int = &lt;fun&gt;</code></pre><p>Returns another function that takes two arguments:</p><pre><code># a 123 456;;
- : int -&gt; int = &lt;fun&gt;</code></pre><p>Which we can apply normally later:</p><pre><code># let b = a 123 456;;
val b : int -&gt; int = &lt;fun&gt;
# b 123;;
- : int = 702</code></pre><p>First class functions are a neat tool we can use to build readable and reusable code. In our memory accesses, we scan the list to find the regions that we want to support.</p><h3>Implementing Ethereum storage operations:</h3><p>We implement some simple storage loading and storage writing operations. These are called into by the simulator when the user uses the environment calling operations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vY4H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vY4H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 424w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 848w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 1272w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vY4H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png" width="668" height="842" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:842,&quot;width&quot;:668,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:162173,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vY4H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 424w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 848w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 1272w, https://substackcdn.com/image/fetch/$s_!vY4H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538c37fa-3c7a-4b4f-b5c1-2ba6c4486a53_668x842.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Undoubtedly, a better approach is possible for this, probably using a driveby-style infix operator. We need to use the int32 type so can store this comfortably in our memory array later if needed.</p><p>We also implement a simple calldata type and a printing method:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c4ZX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c4ZX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 424w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 848w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 1272w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c4ZX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png" width="661" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:661,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36541,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c4ZX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 424w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 848w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 1272w, https://substackcdn.com/image/fetch/$s_!c4ZX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F948adaaa-4828-448a-be1f-2e41ac49cb0c_661x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p> We can be very flexible with the storage of this type since it&#8217;ll likely be immutable and just an array.</p><h3>Implementing the simulator</h3><p>We build a simulator record type that stores everything about our program.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CO-N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CO-N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 424w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 848w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 1272w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CO-N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png" width="512" height="268" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:268,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:43337,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CO-N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 424w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 848w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 1272w, https://substackcdn.com/image/fetch/$s_!CO-N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb11455ae-dd8e-48cb-b3ad-312acd02ddba_512x268.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We implement everything using a functional style, dropping into an imperative approach for our calldata and memory storage, for performance reasons. Even for our test tool we can&#8217;t support functional accesses over a bigarray quickly, and I don&#8217;t want to implement a write ahead log that we can use for this yet! Note that everything after the record field &#8220;<code>[@default</code>&#8221; is a hint for the syntax preprocessor which we use below, the &#8220;make&#8221; deriving preprocessor I use. The deriving fields include a generator some hypothesis testing and printing functions. In Rust, you might use:</p><pre><code>#[derive(</code></pre><p>We implement registers:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yu7N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yu7N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 424w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 848w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 1272w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yu7N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png" width="393" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:393,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42910,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yu7N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 424w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 848w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 1272w, https://substackcdn.com/image/fetch/$s_!yu7N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfd703-f127-48ed-9db4-08a41be0133d_393x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And some gettors and settors:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vAPy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vAPy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 424w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 848w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 1272w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vAPy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png" width="637" height="520" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cc968898-65dd-4a53-afa0-9d86183bed12_637x520.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:520,&quot;width&quot;:637,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77628,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vAPy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 424w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 848w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 1272w, https://substackcdn.com/image/fetch/$s_!vAPy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc968898-65dd-4a53-afa0-9d86183bed12_637x520.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now that we&#8217;ve implemented the basis for our machine, we must implement the higher level datatypes of the decoded words:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pP-G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pP-G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 424w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 848w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 1272w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pP-G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png" width="546" height="845" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:845,&quot;width&quot;:546,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:95492,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pP-G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 424w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 848w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 1272w, https://substackcdn.com/image/fetch/$s_!pP-G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3261b9b4-b1ed-4827-abdb-6c246dc1a115_546x845.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We need a low level decoder now!</p><h3>Implementing a decoder</h3><p>Let&#8217;s create a record for a decoded word in a semi-decoded environment:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LY6h!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LY6h!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 424w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 848w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 1272w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LY6h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png" width="630" height="522" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:522,&quot;width&quot;:630,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:68696,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LY6h!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 424w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 848w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 1272w, https://substackcdn.com/image/fetch/$s_!LY6h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcceba0d0-f447-43b9-b3d1-3e840479678a_630x522.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We implement some code to do decoding of the word to our in-between type:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ai6X!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ai6X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 424w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 848w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 1272w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ai6X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png" width="651" height="888" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:888,&quot;width&quot;:651,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:177166,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ai6X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 424w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 848w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 1272w, https://substackcdn.com/image/fetch/$s_!ai6X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c483916-c9b0-4dc5-8205-c865600f8eb3_651x888.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There&#8217;s some off-screen masking and unpacking I won&#8217;t delve into here. I used riscv-opcodes from the RISC-V organisation as a reference alongside the manual to find the masks for every field inside a RISC-V decoded word. We can build a later stage of the decoding pipeline here that works on these decoded singleton tags.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4Z-4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4Z-4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 424w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 848w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 1272w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4Z-4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png" width="539" height="894" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:894,&quot;width&quot;:539,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:107714,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4Z-4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 424w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 848w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 1272w, https://substackcdn.com/image/fetch/$s_!4Z-4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4665a743-07f8-46d7-bd25-ba9476f93055_539x894.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These convert it to the higher level type we showed off in the decoding code. Following this operation, we can develop our lifted type.</p><h3>Implementing the intermediate type</h3><p>We can take the compiler output to do some pattern matching over the decoded type to our lifted representation:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!97QH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!97QH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 424w, https://substackcdn.com/image/fetch/$s_!97QH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 848w, https://substackcdn.com/image/fetch/$s_!97QH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 1272w, https://substackcdn.com/image/fetch/$s_!97QH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!97QH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png" width="609" height="763" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:763,&quot;width&quot;:609,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:120968,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!97QH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 424w, https://substackcdn.com/image/fetch/$s_!97QH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 848w, https://substackcdn.com/image/fetch/$s_!97QH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 1272w, https://substackcdn.com/image/fetch/$s_!97QH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F407d2066-f7fe-4de6-a306-11d7e092db8b_609x763.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This code unpacks the numbers contained within the word so we can convert them to our tagged type (that we saw earlier in the registers).</p><h3>Building the simulator part 2</h3><p>Now that we have our higher level type, we can start to pattern match over it and actually execute the code!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xVhW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xVhW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 424w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 848w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 1272w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xVhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png" width="556" height="846" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:846,&quot;width&quot;:556,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:113822,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xVhW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 424w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 848w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 1272w, https://substackcdn.com/image/fetch/$s_!xVhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88d9d83-cfb4-4a3b-b248-ad374a68ed36_556x846.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This code runs operations on each higher level type:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zuaN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zuaN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 424w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 848w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 1272w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zuaN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png" width="569" height="813" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:813,&quot;width&quot;:569,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93994,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zuaN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 424w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 848w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 1272w, https://substackcdn.com/image/fetch/$s_!zuaN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ce2f5b2-8b81-4474-a2fe-6df0544f9ab8_569x813.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which actually simulates the code in an entrypoint!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Gi1d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Gi1d!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 424w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 848w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Gi1d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png" width="705" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da008f68-7a94-47f8-a6f1-5374d061a279_705x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:705,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:92524,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Gi1d!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 424w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 848w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Gi1d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda008f68-7a94-47f8-a6f1-5374d061a279_705x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As a reminder, you can try this code at <a href="https://github.com/af-afk/ocaml-riscv32im-stylus">my repo.</a> A lot of the work that went into this is being glossed over, including a rich encoding/decoding test to test the decoding (always implement twice!) and all of the generated testing code. I&#8217;m trying to focus on structure!</p><h3>Interacting with Rust</h3><p>This code lets us load and store words from the Ethereum storage:</p><pre><code>let mut x = U256::from(100);
x += U256::from(123818);
let x_arr = x.to_be_bytes::&lt;32&gt;();
unsafe {
    asm!(
        "ecall",
        in("a0") x_arr.as_ptr() as usize,
        in("a1") x_arr.as_ptr() as usize,
        in("a7") 1,
    );
}
let mut b = [0u8; 32];
unsafe {
    asm!(
        "ecall",
        in("a0") x_arr.as_ptr() as usize,
        in("a1") b.as_ptr() as usize,
        in("a7") 2,
    );
}
let s = format!("{b:?}");
let ptr = s.as_ptr() as usize;
let len = s.len();
unsafe {
    asm!(
        "ecall",
        in("a0") ptr,
        in("a1") len,
        in("a7") 0,
    );
    asm!("ebreak");
}
loop {}</code></pre><p>This silly program stores a unsigned Ethereum word (uint256) to memory, and reads it back to a separate slice, which it then prints using the logging environment call.</p><p>If we build and run it, we can see:</p><pre><code>% dune build bin &amp;&amp; ./_build/default/bin/main.exe /home/user/Documents/markov-geist-research/risc-hello-world/target/riscv32im-unknown-none-elf/debug/risc-hello-world

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 228, 14]</code></pre><p>Excellent! It seems we&#8217;re loading and storing correctly!</p><h3>What&#8217;s next?</h3><p>Stay tuned for part 2 on this, where we&#8217;ll show off how to use the contract entrypoint and storage features, and release the patched SDK. I&#8217;ll be progressively developing the devex on this project, and my hope is that we can use Stylus as the go-to environment for ALL smart contract development, especially if Ethereum begins support for RISC-V. This simulator is the first step to having simulation on Stylus WASM today, so we can build contracts everywhere tomorrow if needed.</p><p>You can start using the repo at</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/ocaml-riscv32im-stylus" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/ocaml-riscv32im-stylus&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W5fi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!W5fi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45a52d7-1605-4b41-897c-2e865cdd0d3d_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>2) Levan</h2><h3><strong>Who are you, and what do you do?</strong></h3><blockquote><p><em>I&#8217;m really happy to feature Levan, the winner of the hackathon we hosted in Romania for Stylus! Super impressive programmer.</em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/blockcraft-tech" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e_KM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 424w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 848w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e_KM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png" width="495" height="660.6882168925964" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:959,&quot;resizeWidth&quot;:495,&quot;bytes&quot;:1355917,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/blockcraft-tech&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/163347969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!e_KM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 424w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 848w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!e_KM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64935aa2-9e5e-4643-bf85-1d1a1bbc19d7_959x1280.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I am Levan, software engineer with 14+ years of experience, focused on Web3 for the last 6 years.</p><p>I started my journey in software development when I was 9 or 10, in Georgian IT center &#8216;Mziuri&#8217; - I got into the school through a local math competition. I didn&#8217;t have a PC until I was 14 and I still remember how happy I was when I had my computer classes twice a week back then. My first programming language was Pascal - which, I still think is one of the best ways to introduce a child to programming. After a couple of years, when I finished learning fundamentals - I got selected in a gifted children&#8217;s program in the same IT center and I began a 5 years of extensive journey with algorithms, data structures, international and local competitions, etc. I believe that the knowledge and training that I got during those years made a huge impact on my career success. After I got my first personal computer (which, I still keep at home, btw) - I started learning things on my own as well - e.g. got my first Delphi programs written, learnt C++, later - PHP and C#..</p><p>I got my first job as a developer after I graduated school. I applied to become an intern in a local bank - &#8216;Liberty Bank&#8217; as PHP developer and got hired. That internship and early years of my career boosted my love towards programming - I remember I was staying at the workplace for days to complete tasks and experiment with new things. After a couple of job changes I landed in one of the most interesting local jobs I had - Bureau of Troubled Assets - which was a local startup by three very experienced bankers. They trusted a 21 year old me to build their internal system from the ground up and for around 4 years I believe I did a good job. Those years were the best personal growth experience that I&#8217;ve had as a developer, as a person responsible for architecture and as a person overall - I made one of the most important decisions of my life during that period - I got married.</p><p>In 2017 I had my first interaction with crypto - I started mining Ethereum and Bitcoin. In 2017 I saw some &#8216;cloud mining&#8217; platforms and created a similar one for the Georgian market, while I was still working at the Bureau of Troubled Assets. Founders were super impressed with the idea and helped me a lot with the organizational stuff. Then the market crashed and mining was not profitable anymore, so after the expiration of contracts we stopped that project.</p><p>In 2018 there were lots of changes in the Georgian financial market and I at the same time got a very interesting offer - it was time to grow. It was my first remote job as well - for two years I was responsible for building the backend of Sense Chat (EOS based e2e encrypted chat with social features). Then the project stopped, however - the CEO kept the team for another project - Libre, which is an Antelope-based scaling solution (Layer 2) for BTC. We recently launched a Loan platform which is already gaining some traction and hopefully it will become a successful project.</p><p>I believe that expanding my knowledge into different directions is key to my development and securing my and my families future and well-being. In 2022 me and a couple of my friends launched a local crypto on-ramp/off-ramp platform, currently serving around 40k users in Georgia. Besides that - I discovered that I love hackathons, I am good at them - and now I am trying to use hackathons to make new connections (that&#8217;s how I met Alex and now I am writing these lines) build out new products and potentially launch them.</p><h2>What web3 ecosystems have you worked in?</h2><p>I have worked with BNB Chain, ICP (currently in process of launching one of the projects that I built for ecosystem during the hackathon), worked with Antelope based ecosystems (Libre chain) - and still work on it on daily basis, worked a lot with Bitcoin (including Runes / Inscriptions)</p><h2>What are your impressions of working with Stylus, good and bad?</h2><p>Definitely good. Using Stylus allows me to write more complex (and expensive) logic in smart contracts, which &#8211; in the end, make my overall products better with simpler architecture. On the &#8216;nice-to-have&#8217; side of things, I agree with Drago&#537; (we met each other at ETH Bucharest =) ) - more scaffolding tools would be nice. But hey - we can work on that ourselves and bring more value to the Stylus ecosystem.</p><h2>What software do you use?</h2><ul><li><p>MacOS since 2019.</p></li><li><p>Editor: VSCode, Cursor.</p></li><li><p>I use Clickup for my day-to-day task management.</p></li><li><p>Termius for accessing my servers</p></li><li><p>iTerm as local terminal</p></li></ul><h2>What hardware do you use?</h2><p>At the moment - Apple M3 Max with 64GB RAM. I upgraded from M1 max which I had for three years so.. next upgrade will be in 2027 (unless I break my current one)</p><h2>How can we get in touch with you?</h2><p>Say Hi, ping for potential collaborations - <a href="https://x.com/blockcraft-tech">https://x.com/blockcraft-tech</a></p><h2>What&#8217;s a piece of advice you&#8217;d give someone new to web3?</h2><p>For anyone coming to Web3 - start thinking about the product, the value that you can create to attract new users. Web3 space desperately needs proper products.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop <a href="https://superposition.so/">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G2pY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 424w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 848w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 1272w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G2pY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png" width="517" height="323.125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:910,&quot;width&quot;:1456,&quot;resizeWidth&quot;:517,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!G2pY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 424w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 848w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 1272w, https://substackcdn.com/image/fetch/$s_!G2pY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fc97b76-98c0-4fb8-a336-1f88d9337b28_3445x2154.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Introducing OrderbookKit, Stylusup, Interview with Dragoș]]></title><description><![CDATA[Stylus Saturdays, 11th May 2025]]></description><link>https://stylus-saturdays.com/p/introducing-orderbookkit-stylusup</link><guid isPermaLink="false">https://stylus-saturdays.com/p/introducing-orderbookkit-stylusup</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 10 May 2025 21:51:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone! <a href="https://x.com/baygeeth">Bayge</a> here. I&#8217;m trying a new format to keep things nice and concise for this week. Something a bit more digestible! Super excited this week to feature the following:</p><ol><li><p>&#128377;&#65039; <strong>Introducing OrderbookKit</strong>: OrderbookKit is a one click deployment of an orderbook to any Arbitrum chain, powered by Stylus.</p></li><li><p>&#129506; <strong>Introducing Stylusup</strong>: <a href="https://stylusup.sh">https://stylusup.sh</a> is a one liner creation and setup script for Arbitrum Stylus, including a new website for more info on the ecosystem.</p></li><li><p>&#127858; <strong>Interview with Drago&#537;</strong>, super powerful freelance software engineer.</p></li></ol><p>Read on, and if you have any feedback about the newletter, I&#8217;d love to have you fill out a form sharing your thoughts. It would mean a lot to me if you filled this out:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png" width="523" height="211.447265625" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1024,&quot;resizeWidth&quot;:523,&quot;bytes&quot;:657236,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://docs.google.com/forms/d/e/1FAIpQLScnaMUlB5S8qUVuklBJ4bNeP8cBGMP3uUMJQG_yYkzz0SOB-A/viewform?usp=dialog&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UEFb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 424w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 848w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1272w, https://substackcdn.com/image/fetch/$s_!UEFb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2e7aa38-8f69-484d-b095-8c2eb39b3f6d_1024x414.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>To recap, Stylus is a Arbitrum technology for building smart contracts in Rust, Zig, C, and Go. Stylus lets you build smart contracts that are 10-50x more gas effective than Solidity smart contracts, with a much broader range of expressiveness from these other languages! Contracts can be written with no loss of interopability with Solidity!</p><p>Click here to learn more: <a href="https://arbitrum.io/stylus">https://arbitrum.io/stylus</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LJlr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LJlr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LJlr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png" width="412" height="412" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:412,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;All in. The Stylus Guy has nothing left to lose.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="All in. The Stylus Guy has nothing left to lose." title="All in. The Stylus Guy has nothing left to lose." srcset="https://substackcdn.com/image/fetch/$s_!LJlr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!LJlr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97cbc44b-8a92-411e-b10a-99947d5776a0_1024x1024.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">All in: The Stylus Guy has nothing left to lose. Me in the back.</figcaption></figure></div><div><hr></div><h2>1) Introducing OrderbookKit</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://orderbookkit.xyz" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vuj-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 424w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 848w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 1272w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vuj-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png" width="1202" height="952" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:952,&quot;width&quot;:1202,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:495998,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://orderbookkit.xyz&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vuj-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 424w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 848w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 1272w, https://substackcdn.com/image/fetch/$s_!Vuj-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce0f7f93-4ccc-4384-bc6d-575aee225eff_1202x952.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m super excited to announce <a href="https://orderbookkit.xyz">OrderbookKit</a>, the second dApp funded by the Arbitrum DAO. OrderbookKit will be a one click orderbook deployment onto any chain powered by Arbitrum, implemented in Rust Stylus. The newsletter will cover the development practices of this project as it comes along! For now, you can sign up via the newsletter waitlist on the page to learn more as it approaches completion.</p><p>We&#8217;ll be publicly developing OrderbookKit! This will include sharing design decisions, how to write hooks, how to extend the code, and more. The source code will be fully audited. There will be a way to embed hooks/tools into the orderbook, and hopefully I&#8217;ll figure out a way to get liquidity and marketmaking sourced alongside the deployment of the orderbook as a service somewhere. If I don&#8217;t figure out an approach for this, maybe a simple deployment for posterity that&#8217;s a reusable tool for others is enough. The best kind of plan for something like this is to build it and to see how people react!</p><p>I&#8217;m in the process of experimenting with a custom interpreter for a special OrderbookKit S-expression-like stack-based programming language. I don&#8217;t know to what extent this will be existing in the final product, but this sort of thing excites me, so I&#8217;d love to breathe fresh air and experiment wherever possible. The few programs relevant natively to the orderbook itself built into the interpreter vehicle will be a simple AVL tree derivative, maybe adjusted to amortise the accesses somehow (a la DYDX I gather, if I can find an approach that makes sense?) on-chain.</p><p>What especially interests me is the concept of evolutionary agents that have the capacity to edit their code as they exist and trade on-chain in response to trade and liquidity depth titled &#8220;market signals&#8221;. What excites me is the possibility to open the social case for this and to allow agents to edit each others code as well, and to react to &#8220;user signals&#8221; that can be created and propogated by other agents, or by EOAs trading on the market. I hope to use this orderbook vehicle to, develop something like this! The task to build this is building these operations for this programming language additional to the orderbook itself:</p><ol><li><p>An operation for a program to breed with a specific program with its identifier stored on a stack, to produce a randomly combined derivative.</p></li><li><p>The ability to introspect the orderbook and the recipients of the last received market signal or user signal.</p></li><li><p>Branching and basic math operations.</p></li><li><p>The ability to make a ask or a bid, and to be aware of the balance of the token held by the program.</p></li><li><p>The ability to send another program or EOA some tokens.</p></li><li><p>The ability to inject code after the program counter into another program or empty program &#8220;slot&#8221; (we&#8217;ll have to cap the amount of programs trading in a market at a given time given the constraints of our runtime).</p></li><li><p>The amount of steps that each program can take per tick before needing to return, or being exited prematurely. This should be interesting to see as a primitive that the programs themselves are aware of, so I&#8217;ll also support this as a operation for them to branch on.</p></li><li><p>Random copying of the surviving programs after a iteration of a market has been concluded back up to a specific quota. The random copying will of course include randomly inserted permutations at this stage.</p></li></ol><p>It&#8217;s worth noting that since this is a Stylus program written in Rust, anyone could run the orderbook locally or in a distributed environment without touching what&#8217;s on-chain, then seed a deployment. So this OrderbookKit program is a sort of program generator in a sense (in it&#8217;s completed future vision form).</p><p>Maybe before beginning to have this exist I&#8217;ll simulate some programs locally on examples of wash trading for a fun quantitative finance example to show off Stylus. Maybe a simple game of trying to accumulate as much token as possible in a hundred thousand generations in games of 10,000. I&#8217;m very curious how it would be to have a game where only the top 30% of traders in a fake market left alone with a fake asset are allowed to survive. I&#8217;m curious how the interaction of the problem of a number of upper ticks that can be run interplay with program copying, whether programs running with a very high amount of steps have little NOP sleds inside their programs with a diluted stack to possibly interfere with sending (it could be implemented with a loop around buffer). In an environment where there are less steps for trading programs to run, it might be better for them to survive purely on a only functional basis. Who knows?</p><p>Any issue of doing this on-chain is the economics of transaction sending, as you must pay to simulate on-chain the trading environment and its agents and its onerous storage accesses (which are poorly equipped for the EVM&#8217;s tree approach to storage). There is also the power of a EOA to speculate and trade the behaviour of the agents themselves, which will have trading capabilities. Weird counterpoint to this: this isn&#8217;t a bad thing. The agents themselves are tools for consensus using a market format, and the burden of convincing a program could be on the EOA to cough up a fact that the program has learned is relevant to a trade it must make.</p><p>Imagine a wild situation where two EOAs are trading adversarily on the orderbook against each other and they must play the game of convincing the programs using signals to do things for them! You might say that the social signaling feature makes it possible to easily cheat, but I&#8217;m interested in seeing whether the programs will adopt a defensive mechanism of outsiders where they pair it with liquidity information, or, if they&#8217;re left alone (and don&#8217;t have so many iterations to learn and grow, which is more likely since who&#8217;s going to do this themselves), be abused.</p><p>To do all this, the business case must be married to the concept, which is to build a successful orderbook primitive on-chain, with an easy deployment on-ramp for any Orbit chain. Regardless of how this turns out, it&#8217;s my hope this is useful to the Stylus ecosystem.</p><div><hr></div><h2>2) Introducing Stylusup</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://stylusup.sh" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K8Wd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 424w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 848w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 1272w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K8Wd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png" width="1158" height="918" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:918,&quot;width&quot;:1158,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:617450,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://stylusup.sh&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K8Wd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 424w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 848w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 1272w, https://substackcdn.com/image/fetch/$s_!K8Wd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe3e35a37-5f73-438c-aa06-ea74a53a5ee7_1158x918.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m super pleased to share a new website to help people on-ramp into Stylus (<a href="https://stylusup.sh">https://stylusup.sh</a>) and a simple to use script that sets you up with Stylus on your computer instantly:</p><pre><code>curl -s https://stylusup.sh/install.sh | sh</code></pre><p>Which lives at <a href="https://github.com/af-afk/stylusup.sh">https://github.com/af-afk/stylusup.sh</a>. It will collect information on the language used by the local system, the processor architecture, and the operating system, which will be reported at <a href="https://popcon.stylusup.sh">https://popcon.stylusup.sh</a> (in the same vein as the Debian popularity contest). Users can fully opt out by interrupting at the stage where it asks you if you&#8217;re comfortable with the analytics collection if it can read a line from stdin, or with <code>STYLUS_POPCON_OFF</code> with no arguments.</p><p>It&#8217;ll do the following (currently it only reports the info of the host, :</p><ol><li><p>Install Rust using Rustup if it&#8217;s not installed.</p></li><li><p>Install <code>wasm32-unknown-unknown</code> using Rustup if it&#8217;s not installed.</p></li><li><p>Install the Cargo Stylus subcommand.</p></li><li><p>Ask the user if they&#8217;d like to create the example repo, giving an example of how to do so.</p></li></ol><p>My hope is this will simplify the journey of users trying Stylus! I&#8217;ve tested it on Debian, Ubuntu, and MacOS with a friend. Extra coverage is needed so far for better testing so far! If you have any issues, please direct them in the <a href="https://github.com/af-afk/stylusup.sh">repo</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2>3) Interview with Drago&#537;</h2><h3>Who are you, and what do you do?</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2_v0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2_v0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 424w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 848w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 1272w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2_v0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png" width="536" height="805.1043956043956" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2187,&quot;width&quot;:1456,&quot;resizeWidth&quot;:536,&quot;bytes&quot;:12201301,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/162316883?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2_v0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 424w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 848w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 1272w, https://substackcdn.com/image/fetch/$s_!2_v0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45b9e736-455e-42ab-9f00-a5c9ed9ede7a_2045x3072.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">(Drago&#537; is on the left)</figcaption></figure></div><p>I'm Drago&#537; Horodnic [&#712;dra&#609;o&#643; ho&#712;rodnik], a software engineer, a FOSS and web3 enthusiast.</p><p>My story starts with my first hello world written in Pascal when I was 10, coupled with early internet access during the golden era of forums and IRC where I've spent countless hours learning new things, teaming up with diverse people from across the globe, working together on projects for fun. I witnessed what everyone back then hyped as web 2.0, people actively participating and interacting on platforms, the nascent of social media, and online shopping.</p><p>I was too young and naive to understand that in the end a handful of powerful entities will essentially exploit our time and attention for profit and I should probably stop before I make everything sound like a dystopian rant, but from my point of view the state of the web has been in a decline ever since. It no longer incentivizes its users to do their own research or come up with meaningful contributions but merely to consume content trapping them in doomscrolling timesinks and walled gardens. For me, web3 is a glimmer of hope that we can restore that brighter side of the internet and treat its users with respect, not like a commodity, by giving them the freedom to express and interact without bounds hidden in uncomprehensible T&amp;Cs that they are coerced to accept. Self-governed communities through DAOs, interoperability through open standards, availability and censorship resistance through decentralization, are just a few examples of solutions towards the goal of a free space that web3 brings to the table. </p><p>For the most part I've developed web and mobile applications for startups including my own initiatives, 2020 marking the beginning of my web3 journey at Nexus Mutual which was definitely the most exciting project I've worked on. Besides freelancing, I am currently developing a permissionless web3 alternative to gig economy platforms that will offer transparent fees and competitive pricing for its users. Even though it's in a very early phase, I am exploring available layer 2 solutions which I ignored for long enough.</p><h3>What web3 ecosystems have you worked in?</h3><p>I've mainly worked on Ethereum but I had brief encounters with other chains, mostly EVM-based while working at <a href="https://nexusmutual.io/">Nexus Mutual</a> to allow users to attach a proof of loss on other chains when submitting claims. I have experimented with Cardano's <a href="https://developers.cardano.org/docs/smart-contracts/plutus/">Plutus</a> but the community traction of Ethereum and the plethora of available resources make me feel at ease.</p><p>For certain usecases like my own, frequent smaller transactions on Ethereum are not really feasible due to gas fees and I've postponed looking into layer 2s for a long while because of the sheer number of them, hoping that one day I'll just pick the winning one when needed, but the decisive day could be far ahead.</p><p>So for the past month I've started diving into Arbitrum after attending a <a href="https://stylus-saturdays.com/p/arbitrum-hackathon-concluded-updates">hackathon at ETHBucharest</a> where a particular track immediately drew my attention: a gas optimisation problem brought up by Alex from <a href="https://superposition.so">Superposition</a>, designed similarily as a CTF challenge.</p><p>Not only that I've been triggered when I heard the two words put together, gas optimisation, but the contract was written in Rust using Arbitrum's Stylus SDK. All these were new to me and I thought it would be a good opportunity to try Stylus out and later use it in my projects. I had a lot of fun and the contract itself highlighted the advantages of using stylus over Solidity really well. </p><h3>What are your impressions of working with Stylus, good and bad?</h3><p>Stylus is very promising but like every new piece of tech, there are areas worth improving. I've started sketching an on-chain MMO RPG that I want to write using Stylus. I thought it would be an enjoyable and thorough first project for learning. I'd be more than willing to share additional insights after I am happy with the end result, but so far I've noticed few things. </p><h4>The good:</h4><ul><li><p>The development tools such as LSPs for Rust are much better than what's available out there for Solidity where certain errors are only brought up at compile time.</p></li><li><p>It opens up new possibilities for expensive checks or loops that otherwise would have been implemented as offchain workers and merkle proofs.</p></li><li><p>You can mix solidity in your codebase and call Solidity contracts from stylus.</p></li></ul><h4>The would be good to have:</h4><ul><li><p>A CLI scaffolding tool to quickly setup multiple contracts in a monorepo.</p></li><li><p>More examples of advanced usecases in the documentation and project structure best practices.</p></li></ul><h3>What software do you use?</h3><p>I use <a href="https://archlinux.org/">Arch Linux</a> (btw), <a href="https://www.openbsd.org/">OpenBSD</a> and occasionally macOS. I prefer free and open source software and I like using everything in a keyboard-centric fashion because it helps me stay focused and interact faster: </p><ul><li><p>Text editor: <a href="https://neovim.io">neovim</a></p></li><li><p>Window manager: <a href="https://dwm.suckless.org">dwm</a>]</p></li><li><p>Terminal: <a href="https://st.suckless.org">st</a></p></li></ul><p>Since everyone around me can't abstain from mentioning LLMs or AI code editors every minute, I recommend <a href="https://github.com/yetone/avante.nvim">avante.nvim</a> for neovim users that feel the FOMO. I'm not a big fan of AI coding but your mileage may vary.</p><p>I also use <a href="https://www.proxmox.com/en/">Proxmox</a> to self-host services at home such as VPN, CalDAV server, DNS, OMV etc.</p><h4>What hardware do you use?</h4><p>My main driver is a <a href="https://frame.work/">Framework laptop</a> (AMD Ryzen 5 7640U, 32GB RAM, 2TB) running Arch.</p><h3>How can we get in touch with you?</h3><p>I'm always open to chat with people sharing similar interests, from dotfiles to web3.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/dragos-horodnic/">https://www.linkedin.com/in/dragos-horodnic/</a></p><p>Github: <a href="https://github.com/horodnicdragos">https://github.com/horodnicdragos</a></p><h3>What's a piece of advice you'd give someone new to web3?</h3><p>I highly recommend being able to understand what smart contracts do.</p><p>It offers you a huge advantage when interacting with web3 apps. Don't interact with unverified and unaudited smart contracts. If you want to build dapps, start playing around on a testnet and start small such as integrating with an existing contract avilable on that testnet. I also recommend going through <a href="https://www.openzeppelin.com/">OpenZeppelin's</a> libraries and understanding their purpose. Don't be afraid to dive deep into how things work. Be wary of scammers and stay safe.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; the Arbitrum DAO! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop <a href="https://superposition.so">Superposition</a>, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PfjK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 424w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 848w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 1272w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PfjK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png" width="422" height="432.3825396825397" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1291,&quot;width&quot;:1260,&quot;resizeWidth&quot;:422,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!PfjK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 424w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 848w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 1272w, https://substackcdn.com/image/fetch/$s_!PfjK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ec6f36b-4c0d-4876-963e-588357bda911_1260x1291.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Guest Post: Implementing a stablecoin using Stylus with Jack (0xjsi.eth)]]></title><description><![CDATA[26th of April, 2025]]></description><link>https://stylus-saturdays.com/p/guest-post-implementing-a-stablecoin</link><guid isPermaLink="false">https://stylus-saturdays.com/p/guest-post-implementing-a-stablecoin</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 26 Apr 2025 00:04:55 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!IwcB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IwcB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IwcB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IwcB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png" width="571" height="571" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:571,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IwcB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!IwcB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094dca75-424d-4121-9b9e-189730e7c2ef_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m excited to feature Jack (<a href="https://x.com/0xjsieth">0xjsi.eth</a>) and his stablecoin using Rust Stylus on Arbitrum! Jack is a competent Swedish dev from the Matos DAO whom we introduced to Stylus for the purposes of this article. For future posts, we&#8217;ll be introducing other people from the rest of the space to author posts themselves! Jack will also be a recurring character, hopefully with another cool project as soon as something nice comes to mind. :)</p><p>To recap: Stylus is a transformative technology for writing smart contracts. It lets you write your Arbitrum smart contracts in Rust, Zig, C, or Go, which you can interact with like you would a Solidity smart contract. For the Arbitrum node (and the perspective of your users) there is no difference between a Solidity contract, and a Stylus contract, except the execution circumstances. This nets us several advantages, the main being the costs of your code (almost 90% cheaper), and a way more expressive and secure way of writing smart contracts!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Grab the Stylus: <strong>A Solidity dev&#8217;s journey through writing modern smart contracts on Arbitrum</strong></h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/0xjsieth" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sneB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 424w, https://substackcdn.com/image/fetch/$s_!sneB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 848w, https://substackcdn.com/image/fetch/$s_!sneB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 1272w, https://substackcdn.com/image/fetch/$s_!sneB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sneB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png" width="300" height="300" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:300,&quot;width&quot;:300,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://x.com/0xjsieth&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!sneB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 424w, https://substackcdn.com/image/fetch/$s_!sneB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 848w, https://substackcdn.com/image/fetch/$s_!sneB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 1272w, https://substackcdn.com/image/fetch/$s_!sneB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1a4406b-b06a-4e4f-87d6-11eef57a1878_300x300.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This blogpost will be about the journey of developing and <a href="https://github.com/jacksmithinsulander/microstable-stylus/">deploying my first contract</a> on Arbitrum Stylus using Rust WASM, what the experience was like and what challenges I ran into.</p><h2>Intro</h2><p>First, quick intro: My name is Jack, you might see me under the pseudonym <a href="https://x.com/0xjsieth">0xjsi.eth</a> online (say Hi if you see me, I&#8217;m always down to connect). My Web3 adventure kicked off in 2020 when I dove into Ethereum accidentally right in time for DeFi Summer, chasing yields and getting hooked on the tech behind it. That passion led me to a two-year blockchain development program at a vocational college in Sweden, and now I have spent the last two years working full time as a Solidity smart contract developer, and as of recently, a Rust backend dev. When I&#8217;m not elbow&#8209;deep in work code you&#8217;ll find me anywhere around the world, grinding at a hackathon, jamming with my band on tour or shitposting on x dot com the everything app.</p><p>When my friend Alex <a href="https://x.com/baygeeth">(bayge.eth</a>) nudged me to write about Arbitrum Stylus, I&#8217;ll admit&#8212;I barely knew what it was, there is just so much cool tech within this field and only so much space in my brain. I spent a day researching, expecting Stylus to be just a WASM VM with no EVM ties. Boy, was I wrong. Stylus is a <em>dual VM</em> powerhouse, blending EVM and WASM with shared state. Keyword here being a dual VM environment, this is way cooler than e.g. a transpiler that converts Rust code to Solidity, or a compiler that compiles Rust down to EVM bytecode, for multiple reasons. One being, both languages will be executed on the most efficient VM for the code, meaning that Rust code will run way cheaper than it would straight on the EVM, secondly, since the non EVM part is a WASM VM, this means that we are not forced to use Rust, but we have the flexibility to run any programming language which could be compiled down to WASM. Stylus doesn&#8217;t replace Solidity; it supercharges it, letting Solidity and WASM contracts call each other seamlessly. This opens endless possibilities for smart contracts that were unthinkable before.</p><p>I thought for a while about what kind of project would be interesting to develop for first getting my feet wet with Stylus development. I decided on porting <a href="https://x.com/shafu0x">shafu0x</a><a href="https://github.com/shafu0x/MicroStable"> MicroStable</a> fully to Rust on Stylus, both since it seemed like a good small project, as well as a fun opportunity to hit 2 birds with one rock, since I could also make a pull request to the<a href="https://github.com/shafu0x/MicroStable-World"> MicroStable-World</a> repository.</p><h2>Building</h2><p>So, let&#8217;s get started! I set up the project<a href="https://docs.arbitrum.io/stylus/quickstart"> as instructed in the Stylus quickstart docs.</a> After resolving some minor clunkiness regarding adding the correct WASM target I am ready to get started. Coming from a Solidity + Foundry background, I can right away tell that these Rust configs + running the dev node in a Docker container feels more clunky than just using the <code>forge</code> command line tool. But anyway, now I am all setup and ready to go, <a href="https://github.com/jacksmithinsulander/microstable-stylus">git repo here!</a></p><p>So the project will essentially consist of 3 parts;</p><ol><li><p>The ERC20 token, a contract inheriting the ERC20 standard, and then extending it with public mint and burn functions, guarded by modifiers which will only let the &#8220;manager&#8221; contract interact with these functions.</p></li><li><p>The Manager, a contract that will be fully responsible of receiving collateral deposits in the form of Wrapped ETH, and based on the current price fetched from the Oracle, determine how much of our stable coin the user can mint. Will also handle possible liquidations if the users collateral is too low. </p></li><li><p>The Oracle, this is a contract we&#8217;re not writing. This is the Chainlink data feed contract, where we&#8217;ll only interact with a function named <code>latestAnswer()</code> to receive the payment.</p></li></ol><p>This led me down the first challenge! How does one do inheritance in Stylus? For me as a Solidity developer, inheritance is something I heavily use, and I don&#8217;t want to unnecessarily implement the default ERC20 implementation. I read through the stylus documentation, and it looks simple enough. Following the Solidity ethos, I find, through some googling, that OpenZeppelin supports Stylus. With very little information out there about this, I went straight to their GitHub repo to see what libs and contracts they have ported so far, which had the ERC20 package I was looking for.</p><p>But then, trouble struck: there were version conflicts between Stylus&#8217;s and OpenZeppelin&#8217;s EVM <a href="http://alloy.rs">alloy.rs</a> types that threw errors. I searched for simpler ERC20 libraries, hoping for a Solady-like gem. I found a few, but most were unmaintained or buggy. I ended up copying the least broken one into my project and manually patching it&#8212;a gritty but effective fix.</p><p>Another surprise? I got compiler errors from the SDK that warned that EVM methods like <code>msg::sender()</code> and <code>block::timestamp()</code> are obsolete, replaced by <code>self.vm().msg_sender()</code> and <code>self.vm().block_timestamp()</code>. Weirdly, Arbitrum&#8217;s docs still reference the old syntax.</p><p>Once this was all ported, the actual inheritance part was rather easy, firstly, we are instantiating a new struct, which we later use to hold the constant params of the ERC20 contract:</p><pre><code>pub struct MicroParams;


impl erc20::Erc20Params for MicroParams {
   const NAME: &amp;'static str = "Shafu USD";
   const SYMBOL: &amp;'static str = "shUSD";
   const DECIMALS: u8 = 18;
}</code></pre><p>Afterwards, we&#8217;re using alloy.rs package to spin up solidity Storage, which is used to actually hold our <code>MicroParams</code> struct, and whatever else data we need to keep in the constant space. In our case, we need the manager address too to guard the <code>mint()</code> and <code>burn()</code> functions to only be accessible to this address.</p><pre><code>sol_storage! {
   #[cfg_attr(any(feature = "sh-usd"), stylus_sdk::prelude::entrypoint)]
   pub struct ShUSD {
       #[borrow]
       erc20::Erc20&lt;MicroParams&gt; erc20;
       address manager;
   }
}</code></pre><p>Also, for some better error handling, and since the Arbitrum docs covered this topic good, I decided to throw in some Solidity errors to show the user if they try to wrongfully call any of these methods(nothing to do with the inheritance, but figured I might as well show it):</p><pre><code>sol! {
    error OnlyManagerCanCall();
    error ERC20MintError();
    error ERC20BurnError();
}

#[derive(SolidityError)]
pub enum ShUSDErrors {
    OnlyManagerCanCall(OnlyManagerCanCall),
    ERC20MintErr(ERC20MintError),
    ERC20BurnErr(ERC20BurnError)
}</code></pre><p>Now that we have everything prepared, lets show the actual contract part and where the inheritance is made:</p><pre><code>#[cfg_attr(feature = "sh-usd", stylus_sdk::prelude::public, inherit(erc20::Erc20::&lt;MicroParams&gt;))]
impl ShUSD {
    pub fn init(&amp;mut self, manager_address: Address) {
        self.manager.set(manager_address);
    }

    pub fn mint(&amp;mut self, to: Address, amount: U256) -&gt; Result&lt;(), ShUSDErrors&gt; {
        if self.vm().msg_sender() != self.manager.get() {
            return Err(ShUSDErrors::OnlyManagerCanCall(OnlyManagerCanCall {}));
        }
        self.erc20
            .mint(to, amount)
            .map_err(|_| ShUSDErrors::ERC20MintErr(ERC20MintError{}))?;
        Ok(())
    }

    pub fn burn(&amp;mut self, from: Address, amount: U256) -&gt; Result&lt;(), ShUSDErrors&gt; {
        if self.vm().msg_sender() != self.manager.get() {
            return Err(ShUSDErrors::OnlyManagerCanCall(OnlyManagerCanCall {}));
        }
        self.erc20
            .burn(from, amount)
            .map_err(|_| ShUSDErrors::ERC20BurnErr(ERC20BurnError{}))?;
        Ok(())
    }
}</code></pre><p>Notice the specific part in the decorator: <code>[cfg_attr(... , inherit(erc20::Erc20::&lt;MicroParams&gt;))]</code> . This is where we do the actual inheritance. Very simple and straight forward logic. You might be confused by my <code>cfg_attr()</code> and see in the arbitrum docs that the suggested way looks more like:</p><pre><code>#[public]
#[inherit(Erc20)]
impl ShUSD {</code></pre><p>The reason mine looks different leads us down to the next issue I ran into working with Stylus. When working with a cargo Stylus project, there is no simple integrated way to keep more than one different contracts in the same project, due to it only being possible to have one <code>#[entrypoint]</code> decorator. A few hours of hair pulling and head scratching, led me to asking Alex regarding this seemingly weird issue. He showed me his <a href="https://github.com/fluidity-money/9lives.so">very impressive repo for 9lives</a> which I found way more useful than existing Stylus docs and example codebases. Reading through the codebase, I got a feel for the true value prop of Stylus, and seeing how this wild codebase seamlessly mixes Solidity, Rust and even Huff gave me a good idea of how Stylus could enhance the smart contract experience I already know into new interesting territory.</p><p>Anyways, the solution he showed me, to be able to use multiple entrypoints, was to use <a href="https://doc.rust-lang.org/cargo/reference/features.html">Rust feature flags</a> to conditionally compile the contract that you wanna compile, then deploy it using the raw WASM files. This throws a bit of the simplicity of using the cargo stylus commands out the window, and gives you a bit more hands on experience, but it&#8217;s a clever workaround. The alternative would be for my github repository to host multiple cargo projects with each having a Cargo.toml. While this method works, to me it feels very clunky, and I&#8217;d much rather just have one project containing everything. When talking to the Arbitrum Stylus team I&#8217;ve been told that easier multi-contract workflow is something they plan on releasing soon (it might even be out by the time you read this).</p><h2>Calling other contracts</h2><p>Now once the ShUSD contract is fully implemented, let&#8217;s have a look at the manager. From the <a href="https://github.com/shafu0x/MicroStable/blob/95685925f75c502cc93a4d3aa040782d57d2df96/src/MicroStable.sol#L22-L75">Shafu repo</a>, everything is probably simple enough to follow here, but let&#8217;s check how this is made in Rust! Firstly, in order to call the other contracts, lets set up Solidity interfaces using alloy.rs: </p><pre><code><code>sol_interface! {
    interface IOracle {
        function latest_answer() external view returns (uint);
    }

    interface IErc20 {
        function transfer_from(address from, address to, uint256 value) external returns (bool);
        function transfer(address to, uint256 value) external returns (bool);
        function burn(address from, uint256 amount) external;
        function mint(address from, uint256 amount) external;
    }
}</code></code></pre><p>Pretty straightforward this far, lets set up our global variables and constants:</p><pre><code>const MIN_COLLAT_RATIO: u128 = 1_500_000_000_000_000_000; // 1.5e18

#[cfg_attr(feature = "manager", stylus_sdk::prelude::entrypoint)]
#[storage]
pub struct Manager {
    sh_usd: StorageAddress,
    weth: StorageAddress,
    oracle: StorageAddress,
    address_2deposit: StorageMap&lt;Address, StorageU256&gt;,
    address_2minted: StorageMap&lt;Address, StorageU256&gt;,
    is_initialized: StorageBool
}</code></pre><p>Notice we set the <code>MIN_COLLAT_RATIO</code> as a regular rust const here, then setting dedicated storage types that we can get from the Stylus SDK. I believe in the actual contract, most notable is my <code>init()</code> <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/24fd9eb98b5cd3d86235a799f713cae348675a22/src/contracts/manager.rs#L36-L44">workaround</a> for the fact that Stylus don&#8217;t support constructors:</p><pre><code>pub fn init(&amp;mut self, weth_address: Address, oracle_address: Address, sh_usd_address: Address) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    assert_or!(!self.is_initialized.get(), ManagerErrors::AlreadyInitialized(AlreadyInitialized {}));
    self.weth.set(weth_address);
    self.oracle.set(oracle_address);
    self.sh_usd.set(sh_usd_address);
    self.is_initialized.set(true);
    Ok(())
}</code></pre><p>Besides this, I found most of the syntax and logic implementing this manager contract very straightforward, given that I am reasonably comfortable in writing Rust already.</p><p>So calling another contract looked something like (This code won&#8217;t work properly for reasons I am covering right after): </p><pre><code>pub fn deposit(&amp;mut self, amount: U256) {
    let weth_instance = IErc20::new(self.weth.get());
    let sender = self.vm().msg_sender();
    let this = self.vm().contract_address();
    weth_instance.transfer_from(&amp;mut *self, sender, this, amount)?;
    let previus_balance = self.address_2deposit.get(sender);
    self.address_2deposit.insert(sender, previus_balance + amount);
 }</code></pre><h2>Issue and solution</h2><p>Above method is <a href="https://youtu.be/HsuI1TOyMs4?t=1685">the method recommended by Arbitrum Stylus team</a> , however, in our special context, this method for calling other contracts lacks flexibility. Since in our contract doesn&#8217;t implement the <code>TopLevelStorage</code> trait, passing self into the external contract calls doesn&#8217;t really do anything, and therefore these calls will revert. This took me a lot of head scratching and yapping with Alex to fully wrap my head around, so what I did for more rapid testing was that I wrote this <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/main/test.sh">little shell script</a> . After some reading into the 9lives codebase I found out that they seem to use <a href="https://github.com/fluidity-money/9lives.so/blob/main/src/wasm_erc20_call.rs">this method</a> instead, where you setup one file for calls and import these into your contract. I scanned through these contracts for a while, and then decided to give it a go in my project. I first setup my <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/main/src/contracts/calls.rs">calls.rs file:</a></p><pre><code>use alloc::vec::Vec;
use alloy_primitives::Address;
use stylus_sdk::{prelude::*, alloy_primitives::{I256, U256}, call::RawCall, alloy_sol_types::{sol, SolCall}};

sol! {
    error CouldNotCall();
    error CouldNotUnpackBool();
}

#[derive(SolidityError)]
pub enum CallErrors {
    CouldNotCall(CouldNotCall),
    CouldNotUnpackBool(CouldNotUnpackBool)
}

sol! {
    function latestAnswer() external view returns (int);
    function transferFrom(address from, address to, uint256 value) external returns (bool);
    function transfer(address to, uint256 value) external returns (bool);
    function burn(address from, uint256 amount) external;
    function mint(address to, uint256 amount) external;
}

pub fn latest_answer_call(oracle: Address) -&gt; Result&lt;I256, Vec&lt;u8&gt;&gt; {
    I256::try_from_be_slice(unsafe { &amp;RawCall::new().call(oracle, &amp;latestAnswerCall {}.abi_encode()).unwrap()}).ok_or(CallErrors::CouldNotCall(CouldNotCall {}).into())
}

pub fn transfer_from_call(token: Address, from: Address, to: Address, value: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    unpack_bool_safe(unsafe { &amp;RawCall::new().call(token, &amp;transferFromCall {
        from,
        to,
        value,
    }.abi_encode()).unwrap()})
}

pub fn transfer_call(token: Address, to: Address, value: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    unpack_bool_safe(unsafe { &amp;RawCall::new().call(token, &amp;transferCall {
        to,
        value,
    }.abi_encode()).unwrap()})
}

pub fn mint_call(token: Address, to: Address, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    unpack_bool_safe(unsafe { &amp;RawCall::new().call(token, &amp;mintCall {
        to,
        amount,
    }.abi_encode()).unwrap()})
}

pub fn burn_call(token: Address, from: Address, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    unpack_bool_safe(unsafe { &amp;RawCall::new().call(token, &amp;burnCall {
        from,
        amount,
    }.abi_encode()).unwrap()})
}

pub fn unpack_bool_safe(data: &amp;[u8]) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
    match data.get(31) {
        None | Some(1) =&gt; Ok(()),
        _ =&gt; Err(CallErrors::CouldNotUnpackBool(CouldNotUnpackBool {}).into()),
    }
}</code></pre><p>So now, instead of natively trying to call these functions and send the full contract context like before, we will instead only do <code>RawCalls </code>to the contract address of the other contract. After this, I implemented these calls into my contract, so final contract ended up looking like: </p><pre><code>use alloc::vec;
use alloc::vec::Vec;
use core::str::FromStr;
use alloy_sol_types::sol;
use crate::contracts::calls;
use alloy_primitives::Address;
use crate::alloc::string::ToString;
use stylus_sdk::{alloy_primitives::U256, prelude::*};
use stylus_sdk::storage::{StorageAddress, StorageMap, StorageU256, StorageBool};

const MIN_COLLAT_RATIO: u128 = 1_500_000_000_000_000_000; // 1.5e18

sol! {
    error Undercollateralized();
    error AlreadyInitialized();
    error CouldNotAdd();
    error CouldNotSub();
    error CouldNotMul();
    error CouldNotDiv();
    error ConversionFailure();
}

#[derive(SolidityError)]
pub enum ManagerErrors {
    Undercollateralized(Undercollateralized),
    AlreadyInitialized(AlreadyInitialized),
    CouldNotAdd(CouldNotAdd),
    CouldNotSub(CouldNotSub),
    CouldNotMul(CouldNotMul),
    CouldNotDiv(CouldNotDiv),
    ConversionFailure(ConversionFailure)
}

#[macro_export]
macro_rules! assert_or {
    ($cond:expr, $err:expr) =&gt; {
        if !($cond) {
            Err($err)?;
        }
    };
}

#[cfg_attr(feature = "manager", stylus_sdk::prelude::entrypoint)]
#[storage]
pub struct Manager {
    sh_usd: StorageAddress,
    weth: StorageAddress,
    oracle: StorageAddress,
    address_2deposit: StorageMap&lt;Address, StorageU256&gt;,
    address_2minted: StorageMap&lt;Address, StorageU256&gt;,
    is_initialized: StorageBool
}

#[cfg_attr(feature = "manager", stylus_sdk::prelude::public)]
#[cfg(feature = "manager")]
impl Manager {
    pub fn init(&amp;mut self, weth_address: Address, oracle_address: Address, sh_usd_address: Address) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        assert_or!(!self.is_initialized.get(), ManagerErrors::AlreadyInitialized(AlreadyInitialized {}));
        self.weth.set(weth_address);
        self.oracle.set(oracle_address);
        self.sh_usd.set(sh_usd_address);
        self.is_initialized.set(true);
        Ok(())
    }

    pub fn deposit(&amp;mut self, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        let sender = self.vm().msg_sender();
        let this = self.vm().contract_address();
        calls::transfer_from_call(self.weth.get(), sender, this, amount)?;
        let previus_balance = self.address_2deposit.get(sender);
        self.address_2deposit.insert(sender, previus_balance.checked_add(amount)
            .ok_or(ManagerErrors::CouldNotAdd(CouldNotAdd {}))?);
        Ok(())
    }

    pub fn burn(&amp;mut self, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        let sender = self.vm().msg_sender();
        let previous_balance = self.address_2minted.get(sender);
        self.address_2minted.insert(sender, previous_balance.checked_sub(amount)
            .ok_or(ManagerErrors::CouldNotSub(CouldNotSub {}))?);
        calls::burn_call(self.sh_usd.get(), sender, amount)?;
        Ok(())
    }

    pub fn mint(&amp;mut self, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        let sender = self.vm().msg_sender();
        let previous_balance = self.address_2minted.get(sender);
        self.address_2minted.insert(sender, previous_balance.checked_add(amount)
            .ok_or(ManagerErrors::CouldNotAdd(CouldNotAdd {}))?);
        let ratio = self.collat_ratio(sender)?;
        assert_or!(ratio &gt; U256::from(MIN_COLLAT_RATIO), ManagerErrors::Undercollateralized(Undercollateralized {}));
        calls::mint_call(self.sh_usd.get(), sender, amount)?;
        Ok(())
    }

    pub fn withdraw(&amp;mut self, amount: U256) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        let sender = self.vm().msg_sender();
        let previous_deposit = self.address_2deposit.get(sender);
        self.address_2deposit.insert(sender, previous_deposit.checked_sub(amount)
            .ok_or(ManagerErrors::CouldNotSub(CouldNotSub {}))?);
        let ratio = self.collat_ratio(sender)?;
        assert_or!(ratio &gt; U256::from(MIN_COLLAT_RATIO), ManagerErrors::Undercollateralized(Undercollateralized {}));
        calls::transfer_call(self.weth.get(), sender, amount)?;
        Ok(())
    }

    pub fn liquidate(&amp;mut self, user: Address) -&gt; Result&lt;(), Vec&lt;u8&gt;&gt; {
        let result = self.collat_ratio(user)?;
        assert_or!(result &lt;= U256::from(MIN_COLLAT_RATIO), ManagerErrors::Undercollateralized(Undercollateralized {}));
        let sender = self.vm().msg_sender();
        let amount_minted = self.address_2minted.get(user);
        calls::burn_call(self.sh_usd.get(), user, amount_minted)?;
        let amount_deposited = self.address_2deposit.get(user);
        calls::transfer_call(self.weth.get(), sender, amount_deposited)?;
        self.address_2deposit.insert(user, U256::ZERO);
        self.address_2minted.insert(user, U256::ZERO);
        Ok(())
    }

    pub fn collat_ratio(&amp;self, user: Address) -&gt; Result&lt;U256, Vec&lt;u8&gt;&gt; {
        let minted = self.address_2minted.get(user);
        if minted.is_zero() { return Ok(U256::MAX); }
        let deposited = self.address_2deposit.get(user);
        let price = calls::latest_answer_call(self.oracle.get())?;
        let value = deposited.checked_mul(U256::from_str(&amp;price.to_string()).unwrap()
            .checked_mul(U256::from(1e10 as u64))
            .ok_or(ManagerErrors::CouldNotMul(CouldNotMul {}))?)
        .ok_or(ManagerErrors::CouldNotMul(CouldNotMul {}))?;
        let value_scaled = value.checked_div(U256::from(1e18 as u64)).ok_or(ManagerErrors::CouldNotDiv(CouldNotDiv {}))?;
        Ok(value_scaled.checked_div(minted).ok_or(ManagerErrors::CouldNotDiv(CouldNotDiv {}))?)
    }
}</code></pre><p>Finally, it&#8217;s working as intended, all of my tests were passing!</p><h2>Scaling tangent</h2><p>In my tests, I made a <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/main/src/test/test_oracle.rs">mock oracle</a> that was <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/22571b6aa62aa2032e011366b37a5cedcae93f49/src/test/test_oracle.rs#L6">returning what the actual oracle was returning that day</a> . In my shell script, I was <a href="https://github.com/jacksmithinsulander/microstable-stylus/blob/22571b6aa62aa2032e011366b37a5cedcae93f49/test.sh#L167">depositing .1 weth</a> into the contract, thinking this would approximately let me borrow 117,177 ShUSD, given that 175.76555 / 1.5 = 117,177. However, it would of course need to mint me 117,177 *10^18 in order for me to actually have the correct amount, since ShUSD have 18 decimals. But this was not the case, I could only mint 117 of the smallest denominator, equivalent to wei, of my token, leading me to believe that my scaling implementation was wrong. I rescanned the 0xShafu repo to see if my logic was mapping it 1 to 1:</p><pre><code>function collatRatio(address user) public view returns (uint) {
    uint minted = address2minted[user];
    if (minted == 0) return type(uint256).max;
    uint256 totalValue = address2deposit[user] * (oracle.latestAnswer() * 1e10) / 1e18;
    return totalValue / minted;
} </code></pre><p>and my version being:</p><pre><code>pub fn collat_ratio(&amp;self, user: Address) -&gt; Result&lt;U256, Vec&lt;u8&gt;&gt; {
    let minted = self.address_2minted.get(user);
    if minted.is_zero() { return Ok(U256::MAX); }
    let deposited = self.address_2deposit.get(user);
    let price = calls::latest_answer_call(self.oracle.get())?;
    let value = deposited.checked_mul(U256::from_str(&amp;price.to_string()).unwrap()
        .checked_mul(U256::from(1e10 as u64))
        .ok_or(ManagerErrors::CouldNotMul(CouldNotMul {}))?)
    .ok_or(ManagerErrors::CouldNotMul(CouldNotMul {}))?;
    let value_scaled = value.checked_div(U256::from(1e18 as u64)).ok_or(ManagerErrors::CouldNotDiv(CouldNotDiv {}))?;
   Ok(value_scaled.checked_div(minted).ok_or(ManagerErrors::CouldNotDiv(CouldNotDiv {}))?)
}</code></pre><p>I reread his and my code probably 100 times and couldn&#8217;t for the life of me see the potential error I was doing. As a last resort, I set up the same type of mock testing for his contract in <a href="https://remix.ethereum.org/#lang=en&amp;optimize=false&amp;runs=200&amp;evmVersion=null&amp;version=soljson-v0.8.26+commit.8a97fa7a.js">the remix ide</a>. To my confusion, and relief, his contract behaved the exact same way like mine: </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hJ6E!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hJ6E!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 424w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 848w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 1272w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hJ6E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png" width="1456" height="531" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:531,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:341466,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/161697566?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hJ6E!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 424w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 848w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 1272w, https://substackcdn.com/image/fetch/$s_!hJ6E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fdc6aa3-ba5c-4eed-937e-126261ad086d_2780x1014.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>and:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wFdc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wFdc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 424w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 848w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wFdc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png" width="1456" height="565" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:565,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:365195,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/161697566?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wFdc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 424w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 848w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 1272w, https://substackcdn.com/image/fetch/$s_!wFdc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e403baf-ac78-40c4-9869-358fe4c7f8c7_2774x1076.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which was enough for me to conclude my contract working as intended, at least mapping the original.</p><h2>Final Words</h2><p>Verdict time! My thoughts on Arbitrum Stylus is that it feels like a newborn fawn finding its legs. I am very excited about how it can enhance the EVM space, and I can really <em>see</em> the vision, even though as of now it&#8217;s still rough around the edges. I&#8217;m looking forward to experimenting with stylus more on this blog, and push the boundaries further, anything from trying out other WASM compatible languages, to making a more fully fledged project where Solidity and Rust both are utilized. I am also excited to see the tooling come to a more mature state. Until then, I encourage everyone reading this to try out building a small project using Stylus and please reach out to me and/or Alex and share your experiences while doing so &#128526;</p><p>Please follow me <a href="https://x.com/0xjsieth">on x</a> and/or <a href="https://github.com/jacksmithinsulander">on GitHub!</a></p><p>The repository lives here: <a href="https://github.com/jacksmithinsulander/microstable-stylus/">https://github.com/jacksmithinsulander/microstable-stylus</a></p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oLrE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 424w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 848w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 1272w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oLrE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png" width="472" height="556.557032890133" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1685,&quot;width&quot;:1429,&quot;resizeWidth&quot;:472,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!oLrE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 424w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 848w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 1272w, https://substackcdn.com/image/fetch/$s_!oLrE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a6b693-bde3-48b3-b1a4-4d95d5e69e5b_1429x1685.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Arbitrum Hackathon Concluded! Updates to the Stylus space, Walnut Stylus Debugger, interview with Ryan Soury from Usher Labs]]></title><description><![CDATA[20th April, 2025]]></description><link>https://stylus-saturdays.com/p/arbitrum-hackathon-concluded-updates</link><guid isPermaLink="false">https://stylus-saturdays.com/p/arbitrum-hackathon-concluded-updates</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 19 Apr 2025 19:30:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Jagg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Jagg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Jagg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Jagg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Jagg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Jagg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6aca9470-1495-407c-a884-f56bec0def60_1536x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">AI is amazing! BRB, considering a career change. Just kidding. Last headline image AI generated.</figcaption></figure></div><h4><strong>BEFORE WE CONTINUE FURTHER, MAKE SURE TO UPGRADE YOUR CONTRACTS TO FIX A BUG INVOLVING EXTERNAL CALLS AND REENTRANCY! All versions of the Stylus SDK prior to 0.8.4 are vulnerable.</strong> INFORMATION BELOW with the header &#8220;Upgrade Info&#8221;.</h4><div><hr></div><p>Welcome back everyone!</p><p>We&#8217;ve had a super eventful month so far, taking part in organising a hackathon alongside the Arbitrum DAO for a track titled the Gas Redux Challenge. For the site, Superposition graciously sponsored several keyboards, and the Arbitrum Foundation provided a prize pool to the tune of $5,400!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>PS: we&#8217;ll wrap up the Chainlink example, maybe even on the very near horizon ;) featuring an addition from a guest contributor.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!khfO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!khfO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 424w, https://substackcdn.com/image/fetch/$s_!khfO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 848w, https://substackcdn.com/image/fetch/$s_!khfO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!khfO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!khfO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg" width="492" height="327.4368131868132" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:969,&quot;width&quot;:1456,&quot;resizeWidth&quot;:492,&quot;bytes&quot;:1107554,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!khfO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 424w, https://substackcdn.com/image/fetch/$s_!khfO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 848w, https://substackcdn.com/image/fetch/$s_!khfO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!khfO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae83c1e1-26cf-4ed9-be3d-b59d42f82708_2560x1703.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">An audience member coming to terms with the prospect of winning a custom mechanical keyboard.</figcaption></figure></div><p>I&#8217;m pleased to share we had a number of participants and submitters (a total of more than six highly skilled devs at least that I&#8217;m aware of) from different backgrounds, and we were were able to take a contract initially costing around 600,000, all the way down to 25,000 with more than 12 submissions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V76z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V76z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 424w, https://substackcdn.com/image/fetch/$s_!V76z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 848w, https://substackcdn.com/image/fetch/$s_!V76z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!V76z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V76z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg" width="306" height="460.0508241758242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2189,&quot;width&quot;:1456,&quot;resizeWidth&quot;:306,&quot;bytes&quot;:624035,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V76z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 424w, https://substackcdn.com/image/fetch/$s_!V76z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 848w, https://substackcdn.com/image/fetch/$s_!V76z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!V76z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86a63ab1-5b55-4025-bea3-2cd4391fbd3d_1703x2560.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Yours truly on stage explaining the concept to a very patient audience.</figcaption></figure></div><p>Over a bloody (seriously intense) two days of the submitters leapfrogging off each other constantly (a dev would submit a solution alongside source code, a dev would see what they did then optimise it further), a few devs were able to identify a problem with the proving algorithm and figure out ways to eliminate several unnecessary checks bringing the contract down to its lowest amount. In the end, a solution made its way into becoming the winning submission. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dbwQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dbwQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 424w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 848w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dbwQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg" width="495" height="329.4333791208791" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:969,&quot;width&quot;:1456,&quot;resizeWidth&quot;:495,&quot;bytes&quot;:865477,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dbwQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 424w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 848w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!dbwQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff775e285-181b-40c9-8aad-ac79aa8982a4_2560x1703.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Mysteriously, I couldn&#8217;t find any photos of our group of hackers hacking away at their solutions in the wild. This is one of the mentors supporting a developer.</figcaption></figure></div><p>To remind everyone, <a href="https://superposition.so">Superposition</a> (my team outside this newsletter) manufactured five custom mechanical keyboards based on the Le Chiffre design with custom cases featuring the Superposition branding:</p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/86554f46-07ff-4251-bbe2-ff5c82f54ef4_1280x960.jpeg&quot;},{&quot;type&quot;:&quot;image/jpeg&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05444fac-d721-475f-a8ae-ad19b14b9688_1280x960.jpeg&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/406b71c5-a00b-4d13-a336-45463a11f0a0_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p>It was a great pleasure to introduce so many different people to Stylus. Congratulations to <a href="https://x.com/blockcraft_tech">Levin</a> for coming in first place here! Definitely a phenomenal dev.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3seV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3seV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 424w, https://substackcdn.com/image/fetch/$s_!3seV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 848w, https://substackcdn.com/image/fetch/$s_!3seV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!3seV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3seV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg" width="1456" height="1092" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1092,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2519488,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3seV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 424w, https://substackcdn.com/image/fetch/$s_!3seV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 848w, https://substackcdn.com/image/fetch/$s_!3seV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!3seV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18b32975-f454-445c-aab7-1664fd8d63a2_4080x3060.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">We picked five winners to receive Superposition branded keyboards. These guys were really impressive devs!</figcaption></figure></div><p>Throughout the competition, I was blown away by the quality of the talent in Romania and some of the nearby attending countries. The people that attended the hackathon are some of the most humble and talented developers I&#8217;ve ever seen.</p><p>Special shoutout to Tolga from <a href="https://thewizard.app/">The Wizard on Stylus</a> for collaborating closely with me to get a reference contract supplied as a template:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XqSg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XqSg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 424w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 848w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XqSg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png" width="1456" height="817" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:817,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:238237,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XqSg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 424w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 848w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!XqSg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8040be6-3666-4761-82ad-ef0f200b5b52_1932x1084.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We had so many solutions to the Arbitrum Stylus hackathon track and the Gas Redux Competition through his platform! Be sure to follow Tolga and The Wizard <a href="https://x.com/WizardOnStylus">here</a>. The Wizard is a really great platform to quickly develop and deploy smart contracts. He&#8217;s been so kind to support Superposition Testnet as an option for deployment via his platform. As a team, we&#8217;re looking forward to deepening our connection to him and his team. It&#8217;s a super fantastic product!</p><p>I&#8217;m super thankful to <a href="https://x.com/srinjoycal">Srinjoy</a> from Offchain Labs for introducing us to <a href="https://x.com/paulofonseca__">Paulo Fonseca</a>, DAO Delegate, who was so supportive in facilitating this as a hackathon track, and for being a great and supportive character. We worked closely with him to define the scope of the competition, and he was directly responsible for organising large parts of the entire conference in general. He also gave a banger talk! We&#8217;re thankful he saw fit alongside the eponymous <a href="https://x.com/ChrisCo512/">Chris</a> (also from Offchain Labs, also thankful as he was our partner in crime at this event) to allocate a part of the prize pool for our competition.</p><p>Side note: Paulo and his cofounder <a href="https://x.com/andreivtweets">Andrei</a> launched <a href="https://arbitrum.proposals.app/">Proposals.app</a> on Friday of the conference!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://arbitrum.proposals.app/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NbEe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 424w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 848w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NbEe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png" width="1456" height="817" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:817,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:329675,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://arbitrum.proposals.app/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NbEe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 424w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 848w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 1272w, https://substackcdn.com/image/fetch/$s_!NbEe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fced8c880-c359-48ac-9b45-abd584d86dd5_1932x1084.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">WOW! I would consider proposals.app a DAO &#8220;operating system&#8221; of sorts, owing to how it aggregates information from so many places and distills it to be simple to interact with.</figcaption></figure></div><p>I hope you <a href="https://arbitrum.proposals.app/">check it out</a>. I&#8217;ll be using it to stay abreast of every development in the Arbitrum DAO space.</p><p>If you&#8217;re so inclined, you can learn more about the contest problem at <a href="https://github.com/af-afk/ethbucharest.bayge.xyz">https://github.com/af-afk/ethbucharest.bayge.xyz</a>! You can see a reference implementation at <a href="https://github.com/af-afk/example.ethbucharest.bayge.xyz">https://github.com/af-afk/example.ethbucharest.bayge.xyz</a>!</p><div><hr></div><p>To recap: Arbitrum Stylus is a new technology for writing your Arbitrum smart contracts in Rust, C, Zig, AssemblyScript, and Go! With Stylus, you have full 1-to-1 composability with the EVM, with your code being converted to WASM and run on the node as native code. That means no distinction from a caller&#8217;s perspective of a Stylus and Solidity contract, but with Stylus, things are way cheaper and way more expressive with the type of code that can be implemented.</p><h2>Upgrade info</h2><p>As you may have read, Stylus SDK versions 0.8.3 and below are affected by a bug involving reentrancy and improper cache flushing:</p><blockquote><p>1. Cache Invalidation: <strong>The cache was not being invalidated correctly</strong> if storage types were read before making an external call that modified those storage cells. Subsequent reads would not reflect the updated storage values, returning stale data from before the external call.</p><p>2. Reentrancy: Occurs when using Solidity and Stylus contracts together. <strong>There is a possibility of reentrancy not being properly detected</strong> if a combination of reentrant and non-reentrant contracts are used and call into each other. To mitigate the risks of this, we have changed the behavior of external calls from stylus to always flush its cache. The msg::reentrant() hostio also may be unreliable, so relying on it for safety should be avoided.</p></blockquote><p>It&#8217;s very important you upgrade as soon as you can! Besides this, the newest version of the SDK has some great tools to facilitate testing and more.</p><h2>Updates to the Stylus ecosystem</h2><p>Wow, have we had several updates to the ecosystem that should be mentioned at length. Here are a few I&#8217;m super excited about, and what they&#8217;re up to based on their updates:</p><ol><li><p>OpenZeppelin have added to their wizard a quick contract builder for ERC20, ERC721, and ERC1155! Cool! You can check it out <a href="https://wizard.openzeppelin.com/stylus">here</a>.</p></li><li><p>Thirdweb are racing to support Stylus with their tools. You can quickly build and debug your contracts using their CLI and SDK!</p></li><li><p>Syndicate MintVM is a virtual machine specifically intended for ERC20, ERC721, and ERC1155 development and minting. Syndicate are building some pretty cool rollup as a smart contract tools, I had the pleasure of meeting one of their team members once.</p></li><li><p>Grug Capital and crew are working on <a href="https://github.com/warlock-labs/sylow">Sylow</a>, a Rust library for working with elliptic curve cryptography. They&#8217;re expanding this to the Rust Stylus ecosystem. In their last update, they stripped the standard library from their crate and reimplemented Vec (instead of using core I gather?).</p></li><li><p>CodeTracer are adopting their Noir time travelling debugger to Stylus! This is a <a href="https://www.youtube.com/watch?v=xZsJ55JVqmU">video they posted</a> in the past showing off what they&#8217;re up to.</p></li><li><p>Nuffle Labs are extending EigenLayer restaking to Arbitrum, reimplementing the technology Nuffle using Stylus.</p></li><li><p>Ember are working on LP optimisation using contracts implemented with Stylus!</p></li><li><p>Duoro Labs are working on a Move to Stylus compiler! Move is the programming language powering dApps deployed for Sui and Aptos (and Movement, lol). Move is notable in its concept of ownership of assets for access, which is good in that in the Sui/Aptos (Move chain) context, it translates very nicely to UTXO-based parallelism for transactions. In their last update, they identified a technical approach to begin transpiling Move bytecode. Their plan is to translate directly to WASM. This approach sounds good to this author! What I&#8217;m curious about is whether they intend to translate literally the ownership model using perhaps some gadget contracts (or something?), or to replace it with internal contract accounting. This wasn&#8217;t obvious to me reading the update post, but this team is obviously super technically competent so whatever they&#8217;ll decide on (or perhaps my view of this problem is mistaken) will be fine.</p></li><li><p>Pyth are translating their oracle code to Stylus, alongside a SDK that empowers developers to use Pyth with Stylus simply and seamlessly.</p></li><li><p>Trail of Bits is working to build a compiler for Solang to Stylus. Trail of Bits is obviously a leader in the open source space, so this is very exciting!</p></li><li><p>Superposition are working on using Stylus to facilitate AI agents for their 9lives prediction market. They&#8217;re in the middle of a pivot to use a AMM model alongside their existing Dynamic Pari-Mutuel Market (DPM) model, which struggled with adoption due to the model shining mainly when supported with an orderbook. They worked with an auditor to curate a specific implementation which is currently in internal testing! The upcoming feature release also earns you yield from a lending protocol while you participate in a market, and it also has free creation of markets, alongside selling.</p></li><li><p>Runtime Verification are making inroads with their Stylus Fuzzer. </p></li><li><p>Cobuilders have concluded their first milestone! They&#8217;re building a GUI for the Stylus cache manager, which is an optional space that can be bid into to be cached on the Arbitrum nodes, resulting in a cheaper gas profile.</p></li></ol><h2>Expressions of interest in a Formal Verification Engine</h2><p><a href="https://twitter.com/trebienxyz">Trebien</a> and <a href="https://www.certora.com/">Certora</a> are talking to teams to gauge interest in a formal verification tool for Stylus! If you&#8217;re interested, I encourage you to reach out via Telegram:</p><p><a href="https://t.me/trebienxyz">https://t.me/trebienxyz</a></p><h2>Trying (and failing) to use Walnut Debugger and the tracing CLI features</h2><p>Those of us working with Stylus know that at times, debugging can be a challenge. Walnut have released something pretty cool, an in-depth trace of interactions with contracts that lets you you quickly diagnose what went wrong with something that you wrote if you want. It&#8217;s a fork of some LLVM code (I gather) that you could use to inspect your contract&#8217;s interaction with calldata using their take on LLDB.</p><p>The following is a tutorial on how to get up and running with this tool. In the process of writing this, I actually failed to get this working. I had to spend some time with their engineer understanding things, and wasn&#8217;t able to find a way through. But this should be useful for developers working with Stylus and toolchain moments that need diagnosis, so I&#8217;ll leave this up for posterity reasons, and to understand my thought process. For a large part of this tutorial I suspect I was mistaken about key things, but time will tell as the Walnut team adds Linux support. Their tool is still relatively early days, but they report it works quite well on MacOS.</p><h3>Installation and setup</h3><p>Step one, let&#8217;s install some tools to get going. I&#8217;m on Debian, so I&#8217;ll follow the following process:</p><pre><code>git clone https://github.com/walnuthq/walnut-dbg</code></pre><p>First, I&#8217;ll clone the <a href="https://github.com/walnuthq/walnut-dbg">repo</a>. This contains some instructions for MacOS and installation, so I did some work on my own to get this done. I installed the following dependencies (again, this is for Debian, so instructions may vary):</p><pre><code>sudo apt-get install lldb-dev cmake ninja-build llvm-19-dev</code></pre><p>After cloning, I changed the location of the installation to my home directory. I did so by using <code>sed</code> to edit <code>CMakeLists.txt</code>. This is still pretty new software, so the best of my (limited) understanding, we&#8217;re not able to change the installation directory:</p><pre><code>cd walnut-dbg
sed -i 's@/usr/local@$HOME/.local@g' ../CMakeLists.txt</code></pre><p>Make sure that you have <code>~/.local/bin</code> in your PATH, and existing! A reminder that you can always create the directory with <code>mkdir -p $HOME/.local/bin</code>. There may be other directories needed, but to my (already having this location available) perspective, this is all that&#8217;s needed.</p><p>Following this, I created a new terminal and:</p><pre><code>apt source llvm-19</code></pre><p>This installed the source directory for LLVM. The tool installed it to <code>/home/user/llvm-toolchain-19-19.1.7</code> for me at the time.</p><p>Following this, I did the following inside the repository we downloaded in the existing terminal emulator:</p><pre><code>mkdir build
cd build

cmake -GNinja .. \
  -DLLVM_TABLEGEN_EXE=/usr/lib/llvm-19/bin/llvm-tblgen \
  -DLLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm \
  -DLLVM_SRC=/home/user/llvm-toolchain-19-19.1.7 \
  -DCMAKE_CXX_FLAGS='-Wno-deprecated-declarations' \
  -DLLVM_LIB_PATH=/usr/lib/llvm-19/lib/libLLVM.so

ninja</code></pre><p>The flags to cmake were needed to tell the toolchain where my files are. This is based on the README they provide, but suitable for Debian. Ninja followed the generated installation script. I&#8217;ve noticed that if you don&#8217;t provide these flags in their entirety, you will encounter a runtime issue once it begins the mostly LLVM-derived code.</p><p>Following this, at the root of the directory, the following files were added:</p><pre><code>build/bin
build/bin/walnut-dbg</code></pre><p>So inside the build directory, we can invoke <code>walnut-dbg</code>. We can take this a step further by installing it like so:</p><pre><code>./bin/walnut-dbg</code></pre><p>Which drops us into an interactive prompt for debugging a file. But we want to test this on something of our own.</p><h3>Using OpenZeppelin Wizard to test Walnut</h3><p>Following our installation, we need something to test this on! We can do so by using OpenZeppelin&#8217;s Wizard tool:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lDG7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lDG7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 424w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 848w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lDG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png" width="964" height="1184" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1184,&quot;width&quot;:964,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:383411,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lDG7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 424w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 848w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!lDG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ef52a1-b689-411f-a7d8-3d94eafe818d_964x1184.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Indeed, this lets us quickly create a ERC20 to play with.</p><p>Let&#8217;s create a quick repo to use the OpenZeppelin Wizard with:</p><pre><code>cargo stylus new openzeppelin-wizard-test</code></pre><p>Let&#8217;s make some changes to be compatible with the format that I prefer (no std explicitly across the board). This is due to codesize reasons, and I like to overload the panic handler to make it more informative:</p><p>Changing <code>Cargo.toml</code>:</p><pre><code>alloy-primitives = { version = "=0.8.20", default-features = false, features = ["native-keccak"] }
alloy-sol-types = { version = "=0.8.20", default-features = false }</code></pre><p>Now for some changes to Cargo.toml that I don&#8217;t just want, we <em>need</em>. Let&#8217;s add it to our dependencies:</p><pre><code>openzeppelin-stylus = "=0.2.0-alpha.4"</code></pre><p>Which should result in your Cargo.toml looking like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HZGM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HZGM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 424w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 848w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HZGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png" width="964" height="1184" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1184,&quot;width&quot;:964,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:224028,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HZGM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 424w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 848w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!HZGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ddc6627-890b-4c8c-9512-952a0be7de1d_964x1184.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Following this, we must replace the content of src/lib.rs with the contents of OpenZeppelin&#8217;s suggested ERC20:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IDCy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IDCy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 424w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 848w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IDCy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png" width="868" height="1184" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1184,&quot;width&quot;:868,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:194300,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IDCy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 424w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 848w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 1272w, https://substackcdn.com/image/fetch/$s_!IDCy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd0ca4039-9e4e-46c3-b307-2208e240a648_868x1184.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As a reminder, we just saw this in the page they have.</p><p>Now, inside our newly created contract repository, we can build this with <code>cargo build --target wasm32-unknown-unknown</code>, which will build a debug executable for us of the contract.</p><p>&#8230; At which point I hit a issue with OpenZeppelin&#8217;s SDK not building. It seems at some point, the deferencing pattern they were using became impossible to use with the SDK. Maybe a downgraded version would make this possible. I switched the approach to use their newest version of the SDK. Unfortunately, they&#8217;re only supporting 0.8.3, not 0.8.4, which you may remember as being vulnerable to a newly discovered issue!</p><p>So for the purposes of this article, we will be proceeding with Stylus SDK 0.8.3. To use the latest cutting edge before release to Cargo version of the OpenZeppelin contracts, you can amend your Cargo to be like so:</p><pre><code>[dependencies.openzeppelin-stylus]
version = "=0.2.0-alpha.5"
git = "https://github.com/OpenZeppelin/rust-contracts-stylus"
branch = "build/v0.2.0-alpha.5"</code></pre><p>And unfortunately downgrade the SDK. I want to emphasise that we should do this only for our testing purposes, and we should wait until OpenZeppelin upgrade their contracts before using this in a real-world scenario. This is what our Cargo.toml looks like now:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!W47I!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W47I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 424w, https://substackcdn.com/image/fetch/$s_!W47I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 848w, https://substackcdn.com/image/fetch/$s_!W47I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 1272w, https://substackcdn.com/image/fetch/$s_!W47I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W47I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png" width="731" height="494" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:731,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110358,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W47I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 424w, https://substackcdn.com/image/fetch/$s_!W47I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 848w, https://substackcdn.com/image/fetch/$s_!W47I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 1272w, https://substackcdn.com/image/fetch/$s_!W47I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b00fc04-f606-4bd4-952d-a8c201a05e25_731x494.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Following this, by repeating <code>cargo build --target wasm32-unknown-unknown</code>, success! We can see that the file <code>target/wasm32-unknown-unknown/debug/stylus_hello_world.wasm</code>. We will not be deploying this contract, we will simply use this this to run the Walnut debugger on its own now!</p><p>Let&#8217;s try to attach our debugger to our debug mode contract:</p><pre><code>walnut-dbg ./target/wasm32-unknown-unknown/debug/deps/stylus_hello_world.wasm
(walnut-dbg) target create "./target/wasm32-unknown-unknown/debug/deps/stylus_hello_world.wasm"
Current executable set to '/home/user/Downloads/openzeppelin-wizard-test/target/wasm32-unknown-unknown/debug/deps/stylus_hello_world.wasm' (wasm32).
(walnut-dbg) b user_entrypoint</code></pre><p>This creates a breakpoint at the user_entrypoint function, which is what will be called the moment your contract receives anyone calling it. I don&#8217;t know how to orchestrate this on its own. From here, we need another tool! We need something that can run this program for us until we understand things better. We need&#8230; <a href="https://github.com/walnuthq/cargo-stylus-walnut">https://github.com/walnuthq/cargo-stylus-walnut</a>.</p><p>This is another tool by the same team that has some features builtin to do things like break down a transaction that took place on a network somewhere. Installing it is relatively straight forward (assuming you have all the Stylus-related tools at your disposal already):</p><pre><code>git clone https://github.com/walnuthq/cargo-stylus-walnut
cd cargo-stylus-walnut/main
cargo install --path . --debug</code></pre><p>I installed this in debug mode since I&#8217;m lazy. This will install the executable<code> walnutdbg</code>, which we can use to get deep insights into our contract&#8217;s execution. It mirrors Cargo Stylus, so in their documentation they have some extra steps to replace the executable. For our cases, we&#8217;ll leave it alone here. Note that unless you replace cargo-stylus per their instructions, you must invoke their executable like <code>walnutdbg walnutdbg</code> to deceive it into thinking its being called like its would-be aliased namesake.</p><p>Returning to our example Stylus ERC20 contract, let&#8217;s deploy it! We can deploy it to the <a href="https://superposition.so">Superposition Testnet</a> using:</p><pre><code>cargo stylus deploy --endpoint https://testnet-rpc.superposition.so --private-key &lt;TESTNET PRIVATE KEY HERE&gt; --no-verify</code></pre><p>This will simply deploy your contract to the Superposition Testnet, which you can get funds for at <a href="https://faucet.superposition.so">https://faucet.superposition.so</a>. I promise it&#8217;s always funded and ready for you to use. Alternatively, you could deploy this anywhere you want, including Arbitrum Sepolia.</p><p>It&#8217;ll spit out some info. For me, it deployed to <code>0x62a87650ba04f77545cfa29ab5a516649bfc3f55</code>. Great! Let&#8217;s try to call it:</p><pre><code>cast call --rpc-url https://testnet-rpc.superposition.so 0x62a87650ba04f77545cfa29ab5a516649bfc3f55 'balanceOf(address)(uint256)' 0xfeb6034fc7df27df18a3a6bad5fb94c0d3dcb6d5</code></pre><p><code>0xfeb6034fc7df27df18a3a6bad5fb94c0d3dcb6d5</code> is a dev account that just deployed this contract. We can see that unfortunately our balance is ZERO based on this call. As a reminder, you can get the cast tools from <a href="https://book.getfoundry.sh/cast/">Foundry</a>. There&#8217;s a helpful installer there titled <code>foundryup</code> that should set you up quickly.</p><p>But what if things were different? Using Walnut, we could find out why. Let&#8217;s commit our transaction questioning our balance to the chain by signing it and submitting it (a redundant action under normal circumstances):</p><pre><code>cast send --private-key &lt;private key here&gt; --rpc-url https://testnet-rpc.superposition.so 0x62a87650ba04f77545cfa29ab5a516649bfc3f55 'balanceOf(address)(uint256)' 0xfeb6034fc7df27df18a3a6bad5fb94c0d3dcb6d5</code></pre><p>This created the transaction <code>0xe249739d9e0705064630bc7261a3aaeb44fa0d001c2bbd7575ac809764254b4b</code>. Cool! Now we can simulate it with Walnut:</p><pre><code>cargo-walnutdbg walnutdbg usertrace --tx 0xe249739d9e0705064630bc7261a3aaeb44fa0d001c2bbd7575ac809764254b4b --endpoint https://testnet-rpc.superposition.so</code></pre><p>I was surprised to see it rebuild my contract in debug mode. Following this, I had another issue! It was not able to find my <code>walnut-dbg</code> executable, despite it being in my PATH! It seems that for it to be found, it must be renamed to <code>rust-walnut-dbg</code>. I created a stub script:</p><pre><code>cat $HOME/.bin/rust-walnut-dbg &lt;&lt;EOF
#!/bin/sh

walnut-dbg $@
EOF
chmod +x $HOME/.bin/rust-walnut-dbg</code></pre><p>This creates a file in <code>~/.bin</code>, which I assume is available to you. With this, I was able to get past this block. Following this, I was unable to proceed with the program failing to find my contract! This was due to the program making assumptions about <code>pretty-print-trace</code> being accessible at <code>/usr/local/bin/pretty-print-trace.</code></p><p>I took the <code>pretty-print-trace.py</code> program, which is located in <code>walnut-dbg</code>, and symlinked it to my user directory like so:</p><pre><code>ln -s $(pwd)/scripts/pretty_trace.py $HOME/.bin/pretty-print-trace</code></pre><p>I then adjusted the source code to not explicitly make assumptions about the location of this program. Hopefully by the time you read this, my patch has been accepted to make this change to the repo itself. At this point, I had another frustration to our plans!</p><p>The program expects the location <code>/tmp/lldb_function_trace.json</code>. I tweaked the source a little to uncover this expectation. It turns out that the debugger was not running correctly, and was not propagating up to a point where it was visible for me. Thankfully, at this point, Walnut themselves were sharing me advice on having things running.</p><p>It seems that even under normal circumstances (using the default Cargo Stylus replay subcommand), we&#8217;re missing a symbol, <code>read_return_data</code>.</p><p>Djordje from the Walnut team tells me this is due to a bug in upstream tools. I brought out <code>nm</code> and started to look at any missing symbols in the native binary, which is located as <code>./target/x86_64-unknown-linux-gnu/debug/libstylus_hello_world.so</code> (this is the native compiled library). I noticed that the toolchain we&#8217;re using with Walnut interrogates Rust&#8217;s rlib format, but I started with the so to understand things. Then I stubbed out every function that&#8217;s missing. Success with the builtin tools!</p><p>So after succeeding with cargo replay, I went ahead with trying again to no avail with Cargo Walnutdbg:</p><pre><code>% cargo-walnutdbg usertrace usertrace --tx 0xe249739d9e0705064630bc7261a3aaeb44fa0d001c2bbd7575ac809764254b4b --endpoint https://testnet-rpc.superposition.so  --enable-walnutdbg-output
warning: unused import: `IErc20`
 --&gt; src/lib.rs:9:48
  |
9 | use openzeppelin_stylus::token::erc20::{Erc20, IErc20};
  |                                                ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `stylus-hello-world` (lib) generated 1 warning (run `cargo fix --lib -p stylus-hello-world` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
(walnut-dbg) target create "user_entrypoint"
error: 'user_entrypoint' does not exist
(walnut-dbg)</code></pre><p>Unfortunately, I still had issues! Noting that it compiled the rlib if it didn&#8217;t see it made already, I wondered what I could do to ensure that the symbol <code>user_entrypoint</code> is being made available to the program.</p><p>I used <code>strace</code> to look at which file was being invoked, then I started to question it using <code>cargo-nm</code>:</p><pre><code>% cargo nm | grep user_entrypoint
(nothing here)</code></pre><p>We can see from this table that the function we want, <code>user_entrypoint</code>, is not being exported. Adding to the credibility of my nuisance is that the Walnut team hadn&#8217;t previously encountered this (I&#8217;m presuming), and that their tool is explicitly for Mac users currently, and as a Linux user, I&#8217;m likely using a different configuration for this part of the toolchain. I&#8217;m sure some compiler engineer is curling their nose reading this.</p><p>I tried to explicitly export the function by making the compiler think it&#8217;s in use:</p><pre><code>#[used]
#[no_mangle]
static KEEP_USER_ENTRY: extern "C" fn(usize)-&gt;usize = user_entrypoint;</code></pre><p>Unfortunately that didn&#8217;t matter. At this point, I started to supply RUSTFLAGS special arguments for the build configuration. I added:</p><pre><code>[target.x86_64-unknown-linux-gnu]
rustflags = [
    "-C","link-arg=-Wl,--export-dynamic",
    "-C","link-arg=-Wl,--allow-shlib-undefined",
]</code></pre><p>To <code>.cargo.config.toml</code>, which funnily enough, contained similar flags for MacOS already existing. This exports our symbols in a dynamic environment (we&#8217;re gunning to export <code>user_entrypoint</code>) and lets the environment define certain symbols we need to emulate the EVM (<code>collect*</code>, <code>read_return_args</code>, etc) by allowing it to not be there during linking. In doing this though, I give up the ability to build and run native executables without branching for main-created code to link it all in. I could configure build.rs to only do this on the creation of the library however, to still run my tests.</p><p>Still no success. At this point, I explicitly disabled the dead code elimination:</p><pre><code>[target.x86_64-unknown-linux-gnu]
rustflags = [
    "-C", "link-arg=-Wl,--export-dynamic",
    "-C", "link-arg=-Wl,--allow-shlib-undefined",
    "-C", "link-dead-code"
]</code></pre><p>That didn&#8217;t seem to change anything. Chatting with the generated code, we can indeed see that <code>user_entrypoint</code> is indeed present:</p><pre><code>nm ./target/x86_64-unknown-linux-gnu/debug/libstylus_hello_world.rlib | grep user_entrypoint</code></pre><p>So it seems that LLDB (which this code is based on) is having issues finding my symbol with the stream of operations we give it when we call it. When cargo-walnutdbg does its thing, it calls rust-walnut-dbg with these arguments:</p><pre><code><code>rust-walnut-dbg -o b user_entrypoint -o r -o "calltrace start '^(stylus_hello_world)::'" -o c -o -o q -- cargo-walnutdbg usertrace usertrace --tx "0xe249739d9e0705064630bc7261a3aaeb44fa0d001c2bbd7575ac809764254b4b" --endpoint https://testnet-rpc.superposition.so --enabled-walnet-dbg-output --child</code></code></pre><p>This instructs the debugger to:</p><ol><li><p>Breakpoint user_entrypoint.</p></li><li><p>Run the program <code>cargo-walnutdbg</code> with usertrace and some arguments.</p></li><li><p>Begin running the executable, but breakpointing user_entrypoint.</p></li><li><p>Begin calltracing every function that is preceded by &#8220;stylus_hello_world&#8221;, presumably everything we define ourselves.</p></li><li><p>Continues through the program.</p></li><li><p>Then exits.</p></li></ol><p>I spent some more time on this, and deleted some content I&#8217;d written up for this blog that reflected a preconception I had at the time about the chain of invocations. At this point, I felt the need to cut my losses on this article. I&#8217;ll revisit this at a future date, and leave this up for posterity so people can follow some of the techniques you might deploy to reproduce what&#8217;s happening with a program like this.</p><h3>What did we learn from this?</h3><p>Some areas of the toolchain are being worked on and seeing improvement. Like any relatively new technology, building things can be a complex task, and to Walnut (and the Stylus team&#8217;s) credit, these features are still in development. I even had to build my own EVM-related functions during this program&#8217;s life to have the default CLI work with them properly. Users of 0.8.3 would be familiar with this experience, you had to define <code>native_keccak256</code> yourself, just like every version pre 0.8.0.</p><p>The Walnut team are working hard! You can learn more about their product roadmap at <a href="https://walnutlabs.notion.site/Debugging-on-Arbitrum-Stylus-Deep-Dive-by-Walnut-1183cefbe64b807e9066d93014111db5">this link</a>. I&#8217;m super excited about this one! I&#8217;ve had the pleasure of speaking with Djordje at length (and many thanks for holding my hand through some questions about their stack), and though their tool is MacOS specific for now, I can tell once it&#8217;s more compatible with Linux, that it&#8217;ll be super useful for developers to get that Tenderly-like experience in their command line. As a religious Acme user (as many of you know), it&#8217;s important for me not to break my flow state and leave my development environment.</p><p>As soon as I have another opportunity, we&#8217;ll be revisiting this one! Until then, we&#8217;ll feature another team building with Stylus next time.</p><div><hr></div><p>I had the pleasure of meeting Ryan while abroad in Romania. We had a great chat and we drove go-karts around Buchraest together! Ryan is a great guy, and I&#8217;m impressed by him, his team, and what he&#8217;s building. He was even kind enough to share some ideas for 9lives (as anyone would know who&#8217;s close to the team) that we&#8217;ve been working on for some time.</p><h2>Interview with Ryan from Usher Labs</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/ryan_soury" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!99h6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 424w, https://substackcdn.com/image/fetch/$s_!99h6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 848w, https://substackcdn.com/image/fetch/$s_!99h6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 1272w, https://substackcdn.com/image/fetch/$s_!99h6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!99h6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png" width="574" height="574" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1017,&quot;width&quot;:1017,&quot;resizeWidth&quot;:574,&quot;bytes&quot;:1054117,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/ryan_soury&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/160501491?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!99h6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 424w, https://substackcdn.com/image/fetch/$s_!99h6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 848w, https://substackcdn.com/image/fetch/$s_!99h6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 1272w, https://substackcdn.com/image/fetch/$s_!99h6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffca6ee07-56fd-4b87-9d69-b7883f55a30f_1017x1017.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Who are you, and what do you do?</h3><p>Hello, my name is Ryan. I'm the Founder and director at Usher Labs. </p><p>I mostly lead technical solutions architecture, and business development. I also review code. I come from a payments and fintech background, having developed code and managed developer resources for BNPL companies in Australia. Web3 and cryptocurrencies have always interested - whether for store of value, sovereign capital management, fast CBPs, or access to novel financial products.</p><p>I began developing Smart Contracts, specifically an NFT project, as a hobby project. This turned into the journey that is Usher Labs. Usher Labs provides B2B data security infrastructure and services tailored for Web3 projects, with a focus on zkTLS-driven verifiable data pipelines.</p><p>In addition to supporting businesses like Rooch Network, and Truflation, Usher Labs is extending its zkTLS solution to power a novel liquidity platform: Fiet Protocol. Fiet amplifies capital efficiency by enabling intents for off-chain liquidity to securely supply DeFi markets. This means earning crypto yield on fiat in your bank account, borrowing against your reserves, and much more.</p><h3>What web3 ecosystems have you worked in?</h3><p>At Usher Labs, we're building across a various chains and technologies to adopt their core value propositions.</p><p>Currently, we develop on the Internet Computer for replicated compute and succinct proof of compute. IC supports our zkTLS-driven verifiable data pipelines technology.</p><p>Fiet Protocol is a cross-chain app developed on Stylus. Arbitrum is the primary chain. IC is involved for ingesting real-world data for Fiet.</p><p>Other chains may be integrated in a hub-spoke model to facilitate integration with various DeFi protocols, and ecosystems. I submit transactions to Arbitrum and have had good experience, and also Stylus merges access to liquidity with complex applications which makes it a good fit.</p><h3>What are your impressions of working with Stylus, good and bad?</h3><p>Development has been quite smooth. It's new tech, so supporting libraries are nascent, specifically in testing (unit + integration tests).</p><h3>What software do you use?</h3><p>Cursor for IDE, Notion for Docs, Todoist for TODOs, Linear for team issues.</p><h3>What hardware do you use?</h3><p>MacOS for Personal and Linux/Ubuntu on the server.</p><h3>How can we get in touch with you?</h3><p>Follow the team on <a href="https://x.com/usher_web3">X / Twitter @usher_web3</a>, send me a <a href="https://x.com/ryan_soury">DM on X @ryan_soury</a>, and join us on Discord <a href="https://go.usher.so/discord">https://go.usher.so/discord</a> - I'm available.</p><h3>What&#8217;s a piece of advice you&#8217;d give someone new to web3?</h3><p>You're on your own with crypto, get secure. Learn about phishing scams, do not trust any random messages, and protect your keys and crypto signatures.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check our ecosystem of dapps out at <a href="https://superposition.so">https://superposition.so</a>!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 424w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 848w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 1272w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png" width="531" height="480.6717032967033" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1318,&quot;width&quot;:1456,&quot;resizeWidth&quot;:531,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 424w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 848w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 1272w, https://substackcdn.com/image/fetch/$s_!Y3Bw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F721d18a5-3e26-4f0e-b19b-1120119f70f7_2470x2236.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Bucharest Proof of Work introduction, Superposition Passport first look, interview with Hamza from Enclave]]></title><description><![CDATA[29th March, 2025]]></description><link>https://stylus-saturdays.com/p/bucharest-proof-of-work-introduction</link><guid isPermaLink="false">https://stylus-saturdays.com/p/bucharest-proof-of-work-introduction</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 29 Mar 2025 13:00:47 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!A8x-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!A8x-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A8x-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!A8x-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:474862,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/159344476?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A8x-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!A8x-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72f36c1b-1037-4dc6-829b-0f7227d1fe1d_1456x1048.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello again! I&#8217;m excited to share in this update details of the Gas Redux Challenge at ETH Bucharest, and to feature Hamza from Enclave/Gnosis Guild. I&#8217;m also excited to share details of Superposition Passport, an on-chain solving dApp basis built using custom calldata with compression for ed25519 signatures and calldata. We&#8217;ll recap the Chainlink price feed example next time.</p><p>To recap: Stylus Saturdays is a (mostly) biweekly newsletter examining the Arbitrum Stylus ecosystem. Stylus is a WASM frontend to the EVM stack available on Arbitrum. Write your contracts in virtually any programming language, and deploy them with full composability with Solidity and Vyper smart contracts.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribing would mean the world to me.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Introducing Bucharest PoW</h2><p>In the final stage of the Stylus Saturdays Gas Redux ETH Bucharest challenge, contestants must submit gas efficient solutions for Bucharest PoW puzzles. Bucharest Proof of Work (PoW) is type of Proof of Work algorithm invented for our gas competition.</p><p>Refreshing everyone: what&#8217;s Proof of Work? Proof of Work in the traditional sense with Bitcoin, is the process of taking the hash of the block header (the combined transactions with the fee receiving address and more set), then hashing with a randomly chosen nonce, and repeating this process until discovering the amount of zeroes in the hash string for the difficulty level. This type of algorithm is known as Hashcash.</p><p>There are other Proof of Work algorithms, some &#8220;memory latency bound&#8221; like Cuckoo Cycle Proof of Work, which is used in the blockchains Grin and Mimblewimble. This Proof of Work algorithm is limited by memory latency, since it&#8217;s solution is dependent on traversing large sparse blocks of memory for finding a graph of a specific combination.</p><p>Cuckoo Cycle work is the process of taking the block header hash, then combining it with a nonce (a number) which is sequentially chosen, and using a hashing function called a keyed hashing function. From the results of the keyed hash function, a pair of edges are created in a bipartite graph. This algorithm repeats itself, until a cycle in the graph is found between the nonces given of a specific length chosen for the difficulty. This type of algorithm is possible to parallelise, but not at the cost of contention, which causes memory latency to be the main bottleneck.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2DQS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2DQS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 424w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 848w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 1272w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2DQS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png" width="1172" height="234" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:234,&quot;width&quot;:1172,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Cuckoo Cycle - Grin Documentation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Cuckoo Cycle - Grin Documentation" title="Cuckoo Cycle - Grin Documentation" srcset="https://substackcdn.com/image/fetch/$s_!2DQS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 424w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 848w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 1272w, https://substackcdn.com/image/fetch/$s_!2DQS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c4cb8e3-93f2-44df-bad7-e78c8e148058_1172x234.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">A bipartite graph created with Cuckoo Cycles.</figcaption></figure></div><p>Keyed hash functions are a type of hash function where instead of taking a single argument then taking a preimage (like SHA256 or Keccak256/SHA3), instead a second argument is supplied with a randomly chosen seed. The digest the keyed hashing function generates is instead created with the seed and the hashing argument. An example of this in the Cuckoo Cycle context is Siphash. Imagine that instead of database hashing in the traditional sense (having a project wide &#8220;salt&#8221;), each individual row has a seed, which is the argument to the hashing function. Siphash performs better for smaller arguments, hence its usecase. This is useful in a hashtable context, imagining that a routing table is built this way, and an attacker could try to abuse the hashing function to get packets routed the wrong way.</p><p>Cuckoo Cycle hashing is unique in the broader context for a few reasons: the main being the lack of substantial environmental impact like Hashcash. With SHA256 repeated hashing, CPUs run hot working hard to find the solution, and there is an incentive for large scale mining operations to spin up with a substantial energy impact to maximise the parallelism for solutions and to design better ASICs. Cuckoo Cycles are better for the environment by equalising the efficient opportunities for the problem. It&#8217;s not possible to spin up a superpowered dirty energy consuming farm that mines Cuckoo Cycles in its traditional form, this is due to memory latency being largely impossible to optimise for at scale, thanks to restrictions of the speed of light. In networking, throughput isn&#8217;t getting better. Our CAPACITY is, which might make people think that speed is, but this is due to the opportunities of a good connection being made more available. We&#8217;re not pushing this better thanks to problems involving the speed of light and the density of transistors, and Moore&#8217;s Law hasn&#8217;t been accurate for some time.</p><p>This isn&#8217;t to say that ASICs can&#8217;t be used with Cuckoo Cycles. Any kind of software solution could be lifted to an optimal hardware form, and with the future of LLVM IR fabbing bespoke chips for algorithms staring down the barrel at us, this is a future we should simply acknowledge and adapt to, as in our problem space it simply distorts the economics if we externalise the social impact.</p><p>You know who benefits from memory latency optimsations like a server cluster? Laptop workstations and phones. Eagle eyed readers of our silly little newsletter would be aware that Apple&#8217;s CPUs are lower on the clock rate, but still perform excellently from a user&#8217;s perspective. This is due to a mixture of optimisations in compilers and interpreters, and you might even notice that ARM itself even has a operation that Javascript interpreters use (among other things). Software developers push the hardware by tightening the distance between software and hardware, as more complex instructions do micro parallelism on the chip to solve problems faster, including the famous speculative execution bug of a few years ago (SPECTRE).</p><p>So with Cuckoo Cycle hashing, a small phone could go toe to toe with a ASIC farm, unlike a Hashcash &#8220;dirty energy&#8221; farm operating out of Mongolia hacking away with a large-scale Hydraulic energy plant. Until we solve foundational physics problems, ASICs are not a genre-defining class with this type of algorithm.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DBU-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DBU-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 424w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 848w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 1272w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DBU-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png" width="466" height="465.307063197026" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1343,&quot;width&quot;:1345,&quot;resizeWidth&quot;:466,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A Complete Tutorial On The Bongcloud Opening - Chess.com&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A Complete Tutorial On The Bongcloud Opening - Chess.com" title="A Complete Tutorial On The Bongcloud Opening - Chess.com" srcset="https://substackcdn.com/image/fetch/$s_!DBU-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 424w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 848w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 1272w, https://substackcdn.com/image/fetch/$s_!DBU-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc920e84-c309-4db4-b81d-809e99603db0_1345x1343.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A photo of the &#8220;Bongcloud&#8221; opening in chess.</figcaption></figure></div><p>In Bucharest PoW, like Cuckoo Cycles, discoverers discover a range of nonce numbers to combine with a block header to prove they discovered the solution to produce the next block. Unlike Cuckoo Cycles, nonces are used to derive a board position for a large chess board, and a piece type. The nonce is increased until the first check is discovered of the latest placed king.</p><p>A proving function then retrospectively examines the nonces until it finds the earliest nonce used to place a piece on the board that affected the king&#8217;s checkmate. Like the Cuckoo Cycle, where a proof is simply the lowest and highest nonce that was used to construct the graph, the lowest nonce is chosen for the first piece that placed the king into check, and the highest piece. This is then transmitted as proof of finding the solution.</p><p>In our game at ETH Bucharest, submitters strive to find the most gas efficient solution for ETH Bucharest Proof of Work. There should be plenty of opportunities for optimisations with board representation, and the proving function! A submitter registers their contract with the scoring contract, which then causes an off-chain worker to randomly create several hashes, which it then simulates the contract with at the node. The median gas performance is chosen and then the transaction is committed on-chain.</p><p>Registrations to the scoring contract must be submitted with a link to a Git repository, and the hash of the revision of the repo. The repository must be made available to other participants. The code will be inspected by the judging team to disqualify bad participants. The most optimal solution at the time receives &#8220;tenancy&#8221; of the yield generated on a curve:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-ONx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-ONx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 424w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 848w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 1272w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-ONx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png" width="609" height="449.85523385300667" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:995,&quot;width&quot;:1347,&quot;resizeWidth&quot;:609,&quot;bytes&quot;:77223,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/159344476?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-ONx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 424w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 848w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 1272w, https://substackcdn.com/image/fetch/$s_!-ONx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ad9aea9-bc3a-4da7-9a5e-91fc4174519a_1347x995.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, your winning solution will earn you a certain amount of revenue per second, which someone could potentially take from you by looking at your submission, identifying an optimisation, then resubmitting! The contract won&#8217;t accept revisions except those that are 5% more effective than the past submission. The submitter with the most points at the end of the game is the winner!</p><p>One of Stylus&#8217; strengths lies in the large pages of memory you could be allocating and using relatively cheaply. I&#8217;m excited to see how people perform with this problem! </p><h2>Introducing Superposition Passport</h2><p>Superposition Passport is Superposition&#8217;s smart account for on-chain solving of off-chain matched trades with Longtail Pro. Superposition Passport is unique in that it&#8217;s a fully non-custodial matching and solving engine: unlike competing DEXes where amounts must be on-ramped or deposited to be used, Superposition Passport enables traders to simply sign an approval message to a smart account, which has its trades signed in the browser using ed25519 blobs generated with WebCrypto. From a user&#8217;s perspective, they simply sign once, and they can trade without any popups or notifications just like a CEX, but their money never left their wallet.</p><p>Superposition Passport is also unique in its calldata and on-chain compression: Borsh is leveraged with generated deserialisation code. Borsh is notable for its use in Solana and NEAR as the default encoding format. Borsh is a low overhead encoding format, and if used with little endian encoded blobs, massively reduces the visible size of calldata. EVM-compatible nodes price calldata with discounts for recurring zeroes, which muddles the optimisation advantages of using custom encoding formats. Owing to cheaper computation gas with Stylus (this is titled ink), we can decompress calldata generated with LZSS, a cheap encoding scheme however, and we can benefit from some gas savings. This is useful if we must aggregate signatures (which we do). Superposition Passport also facilitates backstopping liquidity with smart contracts, perhaps useful for stubbing out missing liquidity with a AMM. This compression approach is useful for optimising the calldata that includes the request leaving to the contract.</p><p>The most optimal EVM compression is often simply interpreting a bespoke stack machine with a custom calldata package. With a Borsh-heavy approach, we could do something similar, by having a recursive datatype that&#8217;s matched easily.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MIJW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MIJW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 424w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 848w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 1272w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MIJW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png" width="651" height="619" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e36108cc-bfa0-4122-8064-984614db2f35_651x619.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:619,&quot;width&quot;:651,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:90077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/159344476?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MIJW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 424w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 848w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 1272w, https://substackcdn.com/image/fetch/$s_!MIJW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe36108cc-bfa0-4122-8064-984614db2f35_651x619.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Acme&#8217;s back this time!</figcaption></figure></div><p>This code uses lzss to decompress a Borsh-encoded structure (<code>Op</code> below), then it matches on the enumerator type that was used. Following this, it does dispatch to the function we want. The storage type used implements storage fully. Following this, the contract returns the error type if things happened correctly. Despite the matching, we retain some EVM composability by having a error type we created using Solidity, which is encoded to something Ethereum tooling would know how to work with.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aJtY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aJtY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 424w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 848w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 1272w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aJtY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png" width="572" height="702" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:702,&quot;width&quot;:572,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:106257,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/159344476?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aJtY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 424w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 848w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 1272w, https://substackcdn.com/image/fetch/$s_!aJtY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2c825645-ef26-42b9-a744-d6ce5d8babf0_572x702.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">We&#8217;ll likely generate a sizeable dictionary in the future of common operations to get things even lower. The engine for that functionality could then be delegatecall&#8217;d into, like a library.</figcaption></figure></div><p>It&#8217;s very early days here with this contract, but we&#8217;re excited to share it with the community MIT licensed (like usual), and to integrate it directly with 9lives and the upcoming Superposition Pro release.</p><h2>Interview with Hamza from Enclave/Gnosis Guild</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ESdj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ESdj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 424w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 848w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 1272w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ESdj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif" width="560" height="700" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1000,&quot;width&quot;:800,&quot;resizeWidth&quot;:560,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Mad Lads #6145&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Mad Lads #6145" title="Mad Lads #6145" srcset="https://substackcdn.com/image/fetch/$s_!ESdj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 424w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 848w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 1272w, https://substackcdn.com/image/fetch/$s_!ESdj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0dc244a3-c749-493e-8135-e7e0d7bfda8b_800x1000.avif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p>I&#8217;m super lucky to have had the chance to feature a seasoned cryptographer like Hamza!</p></blockquote><h3><strong>Who are you, and what do you do?</strong></h3><p>I'm Hamza Khalid, an Applied Cryptographer and Protocol Engineer at <a href="https://www.gnosisguild.org/">Gnosis Guild</a>, the initial development team building Enclave. I got into web3 pretty early on when I used to lurk around Bitcoin forums since I was 14. I used to offer web dev services in exchange for bitcoin at the time, as you can imagine, since as a 14-year-old I did not have access to a bank account, so bitcoin was a game-changer for me. That early experience not only introduced me to the power of decentralized money but also set me on the path toward exploring cryptography, distributed systems, and the broader implications of web3.</p><p>Now I work on Enclave, an open-source protocol that makes secure, encrypted computation possible using fully homomorphic encryption (FHE), zero-knowledge proofs (ZKPs), and distributed threshold cryptography (DTC). It&#8217;s a mouthful, but basically, we&#8217;re making it possible to compute on private data without ever decrypting it, leveraging Encrypted Execution Environments (E3s) for verifiable, privacy-preserving computation.</p><p>I've been all over the tech map, from full-stack web development/devops/cybersecurity to cryptography, from AI to blockchain development across multiple ecosystems. I've built cross-chain bridges, NFT platforms, written ZKP circuits for identity verification, and developed federated learning ML models with FHE on the blockchain.</p><h3><strong>What web3 ecosystems have you worked in?</strong></h3><p>Before working at Gnosis Guild, I was a web3 lead at<a href="http://permission.io/"> permission.io</a> and the lead blockchain developer at 0xAuth (now <a href="https://david.inc">David.inc</a>). I've worked across a bunch of different chains. I started with Solana and got really into Rust-based smart contracts there. After that, I picked up Ethereum, which honestly took me a while to get used to because my brain was so wired for how Solana worked.</p><p>Since then, I've worked with Polygon, Arbitrum, Base, and even some private blockchains. I've used Soroban (another Rust-based smart contract framework) to write smart contracts for the Stellar blockchain.</p><p>Working across these platforms has given me a well-rounded perspective on the strengths and trade-offs of each ecosystem, and how they can complement each other in the broader web3 landscape.</p><h3><strong>What are your impressions of working with Stylus?</strong></h3><p>At Gnosis Guild, we are working on integrating Stylus as a compute provider for Enclave. A compute provider is essentially a service that takes encrypted or raw input data, performs specific computations securely, and outputs verifiable results that can be trusted on-chain. Currently, our process relies on zkVMs; specifically, we perform all the heavy computations off-chain inside a zero-knowledge virtual machine (like Risc0). This method involves generating a zk proof that attests to the correctness of the computation before it&#8217;s finally verified on-chain.</p><p>Working with zkVMs has given us strong security guarantees, ensuring that even though computations are done off-chain, they are still verified rigorously on-chain. However, this approach comes with additional complexity and latency due to the extra steps required to generate and verify zk proofs, and they are pretty slow as well.</p><p>By contrast, Stylus introduces an on&#8209;chain compute provider that operates using a WASM environment. This allows us to write our smart contracts in Rust while retaining full EVM interoperability. With Stylus, computations are executed directly on-chain, meaning that the verification is inherent to the consensus mechanism, simplifying the architecture and reducing overhead. So Stylus will not only boost performance and lower gas costs but also streamline development by eliminating the need for a separate zk proof step.</p><p>Overall, my impressions of working with Stylus are very positive. Having tried a bunch of smart contract languages in Rust, Stylus has been the most fun and easiest to work with by far.</p><p>My experience with Solana and Stellar smart contracts was quite different since they're not EVM chains; the whole development flow feels different. But with Stylus, it was really easy to get started immediately.</p><h3><strong>What software do you use?</strong></h3><p>I keep it really simple with Windows + WSL Ubuntu + VSCode/Cursor AI. I've tried setting up Neovim and used it for a bit, but I always end up going back to VSCode. Neovim is awesome, but the time it takes to set things up and fix stuff when it breaks just isn't worth it for me.</p><p>I also don't bother with custom Linux distros. I've watched my coworkers struggle with dependencies, updates, and broken kernels, and decided that's not for me. I love customizing things to make them look pretty, but I always end up reverting to plain old Windows for simplicity.</p><p>One of my absolute favorite tools on Windows is PowerToys; it lets me stick to my keyboard and avoid using the mousepad as much as possible.</p><p>I also play around with a ton of AI tools &#8212; Claude, Cursor, ChatGPT, Gemini, different architectures, RAG systems, you name it. I love jailbreaking LLMs and getting them to do stuff they're not supposed to do, probably because I've always been into CTFs and see it as a fun challenge.</p><h3><strong>What hardware do you use?</strong></h3><p>My daily driver is an ASUS Strix G17 with 32GB RAM and an RTX 3070TI. It's a "Gaming Laptop," but my main use for it is to train ML models and handle Rust compilations and cryptographic experiments without melting down.</p><p>I also experiment a lot with hardware, like Arduino and ESP32 microcontrollers, courtesy of my work in embedded systems programming in Rust.</p><p>I&#8217;m also into gaming, and I&#8217;ve put more hours into Dota 2 than I&#8217;d like to admit, though these days, I'm gravitating towards single-player games like Prey, A Plague Tale, and revisiting classics like Max Payne. Multiplayer used to be my thing until I realized I preferred trolling teammates over actually winning &#8212; fun for me, maybe less so for them.</p><h3><strong>What's a piece of advice you'd give someone new to Web3?</strong></h3><p>If you&#8217;re new, it can feel overwhelming, this is a wide-open, rapidly evolving space. You&#8217;re stepping into a frontier where you can build and reimagine systems that traditional web platforms simply can&#8217;t support. Ask dumb questions, they&#8217;re often the smartest ones. Dive into communities, tinker with protocols, and embrace the cringe PFPs. Don&#8217;t be afraid to get your hands dirty; you&#8217;ll need to dive deep to uncover where your energy fits best. Experiment a lot, stay curious, stay skeptical, and remember to have fun.</p><h3><strong>How can we get in touch with you?</strong></h3><p>I&#8217;m always eager to connect with fellow developers, researchers, or anyone interested in the evolving world of web3 and secure computation. You can reach me via:</p><ul><li><p><strong>Email:</strong> me@hmzakhalid</p></li><li><p><strong>GitHub:</strong><a href="https://github.com/hmzakhalid"> github.com/hmzakhalid</a></p></li></ul><p>For Enclave, you can follow on<a href="https://x.com/EnclaveE3?ref=blog.enclave.gg">*X</a> and subscribe to <a href="https://blog.enclave.gg/">the blog</a>. For partnerships, business opportunities, and more, join <a href="https://t.me/+aQ4RgAWgvY01Yjk5?ref=blog.enclave.gg">the Enclave Telegram group</a>.</p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check our dapps out at <a href="https://superposition.so">https://superposition.so</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4W6P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4W6P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 424w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 848w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4W6P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png" width="418" height="418" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:418,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!4W6P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 424w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 848w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!4W6P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe83338e-205b-43ff-8b49-84394804e78c_2160x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Bucharest Stylus competition with prizes, Zig on Stylus, On-chain randomness and price oracle/randomness using Chainlink with Stylus (part 2), interview with Tolga]]></title><description><![CDATA[Stylus Saturdays, 19th March 2025]]></description><link>https://stylus-saturdays.com/p/bucharest-stylus-competition-with</link><guid isPermaLink="false">https://stylus-saturdays.com/p/bucharest-stylus-competition-with</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Wed, 19 Mar 2025 12:54:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!7oyq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7oyq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7oyq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7oyq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:523725,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7oyq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!7oyq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34d2cc06-34d1-4af9-b0a1-363623144cc0_1456x1048.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Welcome back! To recap: Stylus is a technology to build smart contracts with using WASM on Arbitrum. The code you write is 1-to-1 compatible with the EVM, including calling and storage.</p><p><strong>Before we continue, Cyclone Alfred has left 16,000 homes without power, several people injured, and one person dead. Our thoughts are with the community of Brisbane and Queensland who were affected.</strong></p><p>I&#8217;m excited to announce that at <a href="https://ethbucharest.ro/">ETH Bucharest</a>, the Arbitrum Foundation is going to be hosting a hackathon! Stylus Saturdays will be hosting a series of challenges similar to Advent of Code in one of the tracks, concluding with a competition to design the most gas efficient Stylus program for a fun problem! Yours truly will be judging and mentoring, so say hi if you&#8217;re there and you enjoy the newsletter.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>There will be prizes, with the USD prize being provided by the <a href="https://arbitrum.io">Arbitrum Foundation</a>, and special one-of-a-kind keyboards and (optional) testnet infrastructure sponsored by <a href="https://superposition.so">Superposition</a>! <a href="https://thewizard.app/">The Wizard on Stylus</a> will graciously be supporting custom templates for the competition.</p><p>Visit <a href="https://ethbucharest.superposition.so">https://ethbucharest.superposition.so</a> for more. Early days, so we&#8217;ll be updating things gradually to have more info.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://ethbucharest.superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!phlA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 424w, https://substackcdn.com/image/fetch/$s_!phlA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 848w, https://substackcdn.com/image/fetch/$s_!phlA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 1272w, https://substackcdn.com/image/fetch/$s_!phlA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!phlA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png" width="539" height="791.8413461538462" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2139,&quot;width&quot;:1456,&quot;resizeWidth&quot;:539,&quot;bytes&quot;:7107436,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://ethbucharest.superposition.so&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!phlA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 424w, https://substackcdn.com/image/fetch/$s_!phlA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 848w, https://substackcdn.com/image/fetch/$s_!phlA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 1272w, https://substackcdn.com/image/fetch/$s_!phlA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a899f5-a069-4812-82f3-4ef3520d9452_3496x5135.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A fun comic <a href="https://x.com/l1t3rallym3">Marko</a> made :)</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://ethbucharest.superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6ELX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6ELX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg" width="1456" height="1092" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1092,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Unknown&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://ethbucharest.superposition.so&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Unknown" title="Unknown" srcset="https://substackcdn.com/image/fetch/$s_!6ELX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6ELX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F484c42fe-f032-4f83-ac5e-4a6685c87a7a_4000x3000.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Who wants a Superkeyboard? Limited release by the Superposition team, alongside a cash prize.</figcaption></figure></div><p>Recently, Chrisco (<a href="https://x.com/ChrisCo512">@ChrisCo512</a>) of Offchain Labs was able to support Zig with Arbitrum Stylus. His repo lives at <a href="https://github.com/chrisco512/wax">https://github.com/chrisco512/wax</a>. He gave a talk on the topic at ETH Denver, which you can watch on X here:</p><p><a href="https://x.com/EthereumDenver/status/1895577797416087708">https://x.com/EthereumDenver/status/1895577797416087708</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/EthereumDenver/status/1895577797416087708" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O_q_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 424w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 848w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 1272w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O_q_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png" width="1280" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:834060,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/EthereumDenver/status/1895577797416087708&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O_q_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 424w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 848w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 1272w, https://substackcdn.com/image/fetch/$s_!O_q_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bcabf0c-4803-44f6-ab9b-f585d97192f6_1280x720.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A photo of Zig on Stylus in action.</figcaption></figure></div><p>Being able to do this goes to show how relatively easy it is for a developer to add programming languages to Arbitrum, provided there&#8217;s a decent WASM compiler backend. Zig is a programming language known for its simplicity and safety, and a huge perk is that the codesize it outputs is way smaller than the Rust equivalent!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/chrisco512/wax" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OMUu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 424w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 848w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 1272w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OMUu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png" width="414" height="687" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5daddd52-e274-487c-9a94-384c856aa1be_414x687.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:687,&quot;width&quot;:414,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:76345,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://github.com/chrisco512/wax&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OMUu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 424w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 848w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 1272w, https://substackcdn.com/image/fetch/$s_!OMUu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5daddd52-e274-487c-9a94-384c856aa1be_414x687.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">An example of Zig on Stylus, the counter application. Note the routing!</figcaption></figure></div><p>This <a href="https://lobste.rs/s/itcqle/good_memory_allocator_200_lines_code">recent post</a> on <a href="https://lobste.rs">Lobsters</a> is a good example of how simple Zig can be. This is a allocator implemented in less than 200 lines of code, and I found it simple to understand.</p><p>Perhaps your next project will be in Zig?</p><div><hr></div><p>Continuing from our previous post:</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;65b8f64b-d6b0-4fe9-81d6-57a1cbaaf7c4&quot;,&quot;caption&quot;:&quot;Hello again! A bit of a delayed post, being at ETH Denver threw my schedule off a little.&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Rust for smart contracts book, on-chain randomness and price oracle using Chainlink with Stylus (part 1), Alisander from OpenZeppelin&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:258941827,&quot;name&quot;:&quot;Stylus Saturdays&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a99cbcb8-2755-4696-b78e-c9421575fe75_387x387.png&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-03-03T18:35:15.643Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://stylus-saturdays.com/p/rust-for-smart-contracts-book-on&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:157244356,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Stylus Saturdays&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8586ee73-2f17-4dad-a892-09059adf7dce_387x387.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><a href="https://github.com/af-afk/vendingmachine.com">Repo here</a></p><p>Now that we&#8217;ve established our storage initial attempt, and our entrypoint function to store the requests, we need to build our first attempt at a function to handle the callback from Chainlink with the VRF word that we use to seed our vending machine interaction. In the post after this, we&#8217;ll test all of this more rigorously to ensure it actually works.</p><p>Before we continue, in the process of writing this function, I tweaked our storage to add more toplevel storage so we can prune our storage vectors comfortably when NFTs are consumed:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7OoV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7OoV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 424w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 848w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 1272w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7OoV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png" width="807" height="843" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:843,&quot;width&quot;:807,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:186267,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7OoV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 424w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 848w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 1272w, https://substackcdn.com/image/fetch/$s_!7OoV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95479316-a7b6-40d8-94fd-03aee1a07a60_807x843.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">By popular demand, I&#8217;m using gedit to visualise my code, instead of acme. Maybe I missed the point by using a serif font to visualise the code.</figcaption></figure></div><p>The change is that there is an extra field called <code>nft_ids_to_send</code>, which is simply a vector of ids that can be sent per nft address. Simultaneously, each level also includes a vector of the nft addresses. We&#8217;ll be pruning these if we run out of NFTs to distribute during this callback&#8217;s life.</p><p>The callback function that we need to use with Chainlink has the following user story:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8zSX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8zSX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 424w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 848w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 1272w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8zSX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png" width="1456" height="416" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:416,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62510,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8zSX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 424w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 848w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 1272w, https://substackcdn.com/image/fetch/$s_!8zSX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83643773-19b2-4128-9d0c-e714ec54f05f_1887x539.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It first (this is not included in the above diagram), takes the USD value of ETH at the time, then normalises it, using Chainlink. This follows a similar process as the previous post&#8217;s example with Chainlink (making a call), and you can read more <a href="https://github.com/af-afk/vendingmachine.com/blob/trunk/src/chainlink_price_call.rs">here</a> if you&#8217;re so inclined. The code then begins to go through each item in the queue, normalising the ETH amount in the queue item. It compares each minimum ask for the queue items in the queue to the amount asked by the user. After finding the first NFT price point that could be reasonably spent this way, it starts seeking backwards to find a NFT.</p><p>For this next part, we implement some testing affordances in the form of the Default trait for our storage:</p><pre><code>// Default for testing purposes.
#[cfg(not(target_arch = "wasm32"))]
impl Default for StorageVendingMachine {
    fn default() -&gt; Self {
        use stylus_sdk::testing::vm::TestVM;
        StorageVendingMachine::from(&amp;TestVM::new())
    }
}</code></pre><p>This simply sets up the VM for us. In the next post, we&#8217;ll be testing everything, and amending our code based on how things go.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-2vq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-2vq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 424w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 848w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 1272w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-2vq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png" width="778" height="1077" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1077,&quot;width&quot;:778,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:243814,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-2vq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 424w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 848w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 1272w, https://substackcdn.com/image/fetch/$s_!-2vq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feac13bf8-ab88-42d0-ab71-6ac27e23c94e_778x1077.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We implement our first stab at the callback function Chainlink will use. Chainlink VRF will call a function called <code>rawFulfillRandomWords</code>, and Stylus&#8217;s code generator will replace snake case with camel case.</p><p>It first checks if the caller is Chainlink, and if it isn&#8217;t, it breaks. It&#8217;s important we do this to avoid providing users with a vehicle for abuse. Following this, we take the word we requested (the previous lockup function called this for us), and we seed local randomness. We use the ChaCha8 PRNG function for this, which is suitable in that we don&#8217;t need a high quality of randomness, and a simple XOR-shift strategy could suffice, but it&#8217;s a nice show of what&#8217;s achievable using Rust with Stylus (we can use virtually any Rust crate!) in this setting to do this this way.</p><p>We do a lookup to get the price of ETH at the time using Chainlink. We do this to get the USD price of ETH. We then begin going through the queue of accumulated requests and processing them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vII-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vII-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 424w, https://substackcdn.com/image/fetch/$s_!vII-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 848w, https://substackcdn.com/image/fetch/$s_!vII-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 1272w, https://substackcdn.com/image/fetch/$s_!vII-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vII-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png" width="654" height="388" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:388,&quot;width&quot;:654,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:102241,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vII-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 424w, https://substackcdn.com/image/fetch/$s_!vII-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 848w, https://substackcdn.com/image/fetch/$s_!vII-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 1272w, https://substackcdn.com/image/fetch/$s_!vII-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6179baac-44a0-4ed0-a5b1-8a9544f4112d_654x388.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For each element in the queue, we begin to unpack the word we created earlier as the concatenation of the address and the amount. We calculate the USD amount invested for the user by multiplying the price we got from Chainlink with the amount the user deposited. We do a local helper function to convert the type from a uint96 to a uint256.</p><p>We enter a function that helps us do a lookup to find the appropriate NFT to distribute. It does so using a binary search strategy:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MJTv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MJTv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 424w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 848w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 1272w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MJTv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png" width="709" height="620" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:620,&quot;width&quot;:709,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114732,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MJTv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 424w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 848w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 1272w, https://substackcdn.com/image/fetch/$s_!MJTv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae45cd0-da5c-4fa4-abca-08ec94217ad9_709x620.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We use the core library to do the search. This will search the vector in storage, looking for an instance of a NFT level that costs less than the amount of USD the user was willing to offer for it. It only selects the NFT where the next item in the storage vector is greater than or does not exist for the price point they chose. A flag is provided to only search for NFTs with liquidity, by checking the associated storage of NFTs for the level. The function searches backwards for NFTs that have liquidity this way.</p><p>In a normal setting, developers might normalise the price to a system of buckets with special numbers, like a system of sqrt price X96 numbers a la Uniswap. That approach would allow a developer to normalise the price based on a tick, which would enable them to select the price that&#8217;s appropriate for the NFT in one go, skipping the complicated series of SLOAD storage lookups. I chose this strategy to show off what&#8217;s achievable with Stylus, writing a binary search function over storage is trivial. Perhaps a developer could implement something simple like ERC20Votes of OpenZeppelin fame, which is where this approach would be more suitable.</p><p>After we discover the level we want to offer the user, we first check if we owe the user a refund. A refund is taking the fee rebate, which is the fee that was paid by every user, and adding it to the amount of ETH that the user deposited when they went to purchase a NFT.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V-w9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V-w9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 424w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 848w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 1272w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V-w9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png" width="663" height="146" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:146,&quot;width&quot;:663,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V-w9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 424w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 848w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 1272w, https://substackcdn.com/image/fetch/$s_!V-w9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3564cfb8-7d43-425d-8883-6ce9718f2249_663x146.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2NiX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2NiX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 424w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 848w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 1272w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2NiX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png" width="642" height="402" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:402,&quot;width&quot;:642,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65655,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2NiX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 424w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 848w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 1272w, https://substackcdn.com/image/fetch/$s_!2NiX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b6984fb-951f-46bb-bb87-6264a05e2d71_642x402.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We use this function internally here:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nbGW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nbGW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 424w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 848w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 1272w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nbGW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png" width="741" height="141" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b561134-9f43-495c-bd26-bda3520e5133_741x141.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:141,&quot;width&quot;:741,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29069,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nbGW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 424w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 848w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 1272w, https://substackcdn.com/image/fetch/$s_!nbGW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b561134-9f43-495c-bd26-bda3520e5133_741x141.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>It might be smart for a developer of a real world application to, instead of using Chainlink and doing this calculation in the callback, have it instead store the words in storage. This way the gas costs are more understandable, since many users could submit in a short amount of time with a small amount of ETH for example, and break the entire system. This applies to the search for the NFT, since fragmentation could be so bad that the entire storage range could be cached. This code will check if the level was found, and if not, refund the user.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uHFB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uHFB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 424w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 848w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 1272w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uHFB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png" width="697" height="636" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:636,&quot;width&quot;:697,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:112972,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uHFB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 424w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 848w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 1272w, https://substackcdn.com/image/fetch/$s_!uHFB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa80a4bc9-7913-43aa-a13c-365d6a40b7fb_697x636.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>After picking the level, we start to pick a NFT. We use the PRNG from before (ChaCha8) to generate a u32, the native word of the wasm environment we&#8217;re in, which translates to a usize. We pick the NFT from a multidimensional array of the NFT address and the level we&#8217;re at. Once we&#8217;ve picked a NFT, we also randomly pick the ID we want to distribute.</p><p>At this point we try to send them their NFT. If we can&#8217;t (maybe they&#8217;re a contract that doesn&#8217;t implement the ERC721 callback), we then initiate a refund. Refunding can fail (maybe for similar reasons as before), so we allow that to happen to prevent griefing.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!czTy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!czTy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 424w, https://substackcdn.com/image/fetch/$s_!czTy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 848w, https://substackcdn.com/image/fetch/$s_!czTy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 1272w, https://substackcdn.com/image/fetch/$s_!czTy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!czTy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png" width="715" height="424" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:424,&quot;width&quot;:715,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88956,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!czTy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 424w, https://substackcdn.com/image/fetch/$s_!czTy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 848w, https://substackcdn.com/image/fetch/$s_!czTy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 1272w, https://substackcdn.com/image/fetch/$s_!czTy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09927b29-4d02-4cf4-bf7c-71dab7206816_715x424.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We try to send the user a rebate for the amount they sent us. This function is simple:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NImA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NImA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 424w, https://substackcdn.com/image/fetch/$s_!NImA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 848w, https://substackcdn.com/image/fetch/$s_!NImA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 1272w, https://substackcdn.com/image/fetch/$s_!NImA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NImA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png" width="427" height="140" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:140,&quot;width&quot;:427,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18320,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NImA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 424w, https://substackcdn.com/image/fetch/$s_!NImA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 848w, https://substackcdn.com/image/fetch/$s_!NImA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 1272w, https://substackcdn.com/image/fetch/$s_!NImA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb6cf6b5-316f-4bbc-8350-bc9c20ed47e1_427x140.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We op the consumed ID from the storage vector by doing a &#8220;swap and pop&#8221;.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eJZ_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eJZ_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 424w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 848w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 1272w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eJZ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png" width="711" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:711,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:100269,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eJZ_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 424w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 848w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 1272w, https://substackcdn.com/image/fetch/$s_!eJZ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f7431f5-5c06-404e-8765-ae5aee13216e_711x576.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We do the same as the ID, but we do this to check if this is the last NFT we distributed from the NFTs at that level. We use the same approach for this! Then we check in that we&#8217;ve distributed a NFT using a event.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!p-It!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p-It!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 424w, https://substackcdn.com/image/fetch/$s_!p-It!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 848w, https://substackcdn.com/image/fetch/$s_!p-It!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 1272w, https://substackcdn.com/image/fetch/$s_!p-It!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!p-It!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png" width="562" height="224" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:224,&quot;width&quot;:562,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35483,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!p-It!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 424w, https://substackcdn.com/image/fetch/$s_!p-It!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 848w, https://substackcdn.com/image/fetch/$s_!p-It!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 1272w, https://substackcdn.com/image/fetch/$s_!p-It!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab88f4ea-c653-42e1-9119-a6a9f0bc95fa_562x224.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We finally close things out by logging that we resolved the outstanding request for randomness from Chainlink.</p><p>So to recap: this function is a callback for Chainlink that receives a random word using VRF, which it then uses to seed a local random number generator (of the complex kind). It looks up the price of ETH, which it then remembers. It goes through the queue of submitted requests for NFTs, and starts to select the level to distribute the NFTs with. It uses randomness to select each. It then goes to send the user what they won!</p><p>In the next post, we&#8217;ll be testing this code at length using end to end tests of the online kind, and of the offline kind. We&#8217;ll be doing this testing using property and mutation testing. All of the code is in the repo: <a href="https://github.com/af-afk/vendingmachine.com">https://github.com/af-afk/vendingmachine.com</a></p><div><hr></div><h2>Interview with Tolga from Stylus Wizard</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/tolgayayci" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W7H8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 424w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 848w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W7H8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png" width="960" height="1280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1618306,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/tolgayayci&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W7H8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 424w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 848w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!W7H8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57fc9306-3515-46c0-97fd-716f2fd5e614_960x1280.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><em>I had the time to catch up with Tolga, the founder of The Wizard on Stylus. I really recommend everyone to check this out! Great platform.</em></p></blockquote><h3>Who are you, and what do you do?</h3><p>I&#8217;m <a href="https://x.com/tolgayayci">Tolga</a>, a computer engineer based in Ankara, T&#252;rkiye. I got into tech during university, doing part-time jobs in web development and internships in software testing, creative solutions, and even early metaverse projects. I discovered Web3 in my final year at university through a side project. What started as a fun experiment quickly turned into a full-time job when my classmate and I decided to go all in. Over the past three years, we&#8217;ve built a range of solutions, from Telegram bots to full-fledged products, and worked with some of the biggest blockchain protocols.</p><p>One of our favorite projects is <a href="https://thewizard.app/">Wizard</a>, an online playground for building and testing Rust-based smart contracts on <a href="https://arbitrum.io/stylus">Arbitrum Stylus</a>. The idea came from my struggles trying to set up Stylus locally. The whole process installing Rust, Cargo Stylus, setting up a local node, dealing with RPCs &#8212; was way too much hassle just to write a few lines of code. We figured there had to be a better way. That&#8217;s how Wizard was born &#8212; so developers could try Stylus instantly in their browser with zero setup.</p><p>The response from the community has been amazing. In just the first month, Wizard gained a lot of traction, and people love how easy it makes experimenting with Stylus. Even <a href="https://x.com/ChrisCo512">Chris</a>, an Engineer @<a href="https://www.offchainlabs.com/">Offchain Labs</a>, showcased a demo:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/chrisco512/status/1889004455309590804?s=46" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9j0T!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 424w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 848w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9j0T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png" width="1456" height="755" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:755,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:826413,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/chrisco512/status/1889004455309590804?s=46&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/158312546?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9j0T!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 424w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 848w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 1272w, https://substackcdn.com/image/fetch/$s_!9j0T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F140709bd-fd17-4e33-a30b-36ec435de87e_1932x1002.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">That same Chris from earlier. Prolific guy :)</figcaption></figure></div><p>What makes Wizard awesome?</p><ul><li><p>&#128221; Pro Code Editor: Built on VS Code's Monaco Editor with full support for Rust &amp; Stylus.</p></li><li><p>&#9881;&#65039; Secure Remote Compilation: Compile contracts in a safe, isolated environment.</p></li><li><p>&#128640; One-Click Deployments: No need for setup&#8212;just deploy instantly with pre-funded wallets.</p></li><li><p>&#128260; Interactive Testing: Run smart contract tests right in your browser.</p></li><li><p>&#128279; Shareable Contracts: Create public links and share your work with the community.</p></li><li><p>&#10024; No setup, no headaches&#8212;just start coding!</p></li></ul><p>Try Wizard now: <a href="https://thewizard.app/">https://thewizard.app/</a></p><p>Check out the docs: <a href="https://docs.thewizard.app">https://docs.thewizard.app</a></p><h3>What web3 ecosystems have you worked in?</h3><p>We&#8217;ve worked across multiple Web3 ecosystems, including Ethereum, Arbitrum, Stellar, Internet Computer, and Polkadot, plus many others. In the last three years, we&#8217;ve successfully built 30+ projects across 10+ major blockchain ecosystems.</p><p>Right now, we&#8217;re focusing on Arbitrum Stylus because it&#8217;s pushing smart contract development forward in a big way. By enabling Rust-based smart contracts, Stylus makes it possible for a whole new wave of developers to enter the space without needing to learn Solidity. Rust&#8217;s speed, safety, and efficiency make it an incredible choice, and we want to make Stylus development as smooth as possible with Wizard.</p><h3>What are your impressions of working with Stylus, good and bad?</h3><h4>The Good</h4><p>Rust Support: Stylus lets you write smart contracts in Rust, which is huge for developers who prefer it over Solidity.</p><p>Better Performance: Rust&#8217;s efficiency means contracts can be more optimized and cost-effective.</p><p>More Devs Can Join In: Stylus makes Web3 more accessible for Rust developers, bringing in fresh talent.</p><p>Great Community &amp; Support: The Arbitrum team and community have been really engaged and helpful.</p><h4>The Challenges</h4><p>Difficult Setup: Getting Stylus running locally requires a bunch of installations and configurations, which is why we created Wizard.</p><p>Still Growing: Stylus is new, so its tooling and ecosystem aren&#8217;t as mature as Solidity&#8217;s yet.</p><p>Adoption Hurdles: Solidity still dominates Web3. Getting developers to switch to Rust will take time and good incentives.</p><p>Even with these challenges, we believe Stylus has massive potential, and tools like Wizard will help speed up adoption!</p><h3>What software do you use?</h3><ul><li><p><a href="https://codeium.com/windsurf">Windsurf</a> + <a href="https://claude.ai/">Claude Sonnet</a> (IDE)</p></li><li><p><a href="https://www.warp.dev/">Warp</a> (Terminal)</p></li><li><p>Firefox (Browser)</p></li></ul><h3>What hardware do you use?</h3><ul><li><p>Macbook Pro (M1 Pro)</p></li></ul><h3>How can we get in touch with you?</h3><ul><li><p>Telegram: <a href="https://t.me/tolga0x">tolga0x</a></p></li><li><p>LinkedIn: <a href="https://www.linkedin.com/in/tolgayayci/">https://www.linkedin.com/in/tolgayayci/</a></p></li><li><p>GitHub: <a href="https://github.com/tolgayayci/">https://github.com/tolgayayci/</a></p></li></ul><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check our dapps out at <a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-CIu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 424w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 848w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-CIu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png" width="583" height="596.614010989011" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1490,&quot;width&quot;:1456,&quot;resizeWidth&quot;:583,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!-CIu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 424w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 848w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!-CIu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9fa6fd2-898b-4d58-bd37-a458912e8b24_2111x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Rust for smart contracts book, on-chain randomness and price oracle using Chainlink with Stylus (part 1), Alisander from OpenZeppelin]]></title><description><![CDATA[Stylus Saturdays, 3rd March 2023]]></description><link>https://stylus-saturdays.com/p/rust-for-smart-contracts-book-on</link><guid isPermaLink="false">https://stylus-saturdays.com/p/rust-for-smart-contracts-book-on</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Mon, 03 Mar 2025 18:35:15 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Gj46!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Gj46!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Gj46!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Gj46!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:576745,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Gj46!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 424w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 848w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 1272w, https://substackcdn.com/image/fetch/$s_!Gj46!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73f9bdb8-5430-4648-a673-d6f4c58e5e35_1456x1048.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello again! A bit of a delayed post, being at ETH Denver threw my schedule off a little.</p><p>Welcome to another Stylus Saturdays post! To recap: Stylus lets you build smart contracts on Arbitrum using any programming language that compiles to WASM. Your contracts are one-to-one compatible with the EVM, even down to the storage backend.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Stylus Saturdays! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In today&#8217;s episode, we&#8217;ll discuss how to build a vending machine with Arbitrum Rust Stylus and Chainlink VRF and price feeds, and feature Alisander Qoshqosh from OpenZeppelin&#8217;s Stylus team. I&#8217;m excited to share that I&#8217;ve been writing a book on developing Rust-powered smart contracts:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://rust-for-smart-contracts.com" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m5uN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 424w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 848w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 1272w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!m5uN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:967700,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://rust-for-smart-contracts.com&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylussaturdays.substack.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!m5uN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 424w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 848w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 1272w, https://substackcdn.com/image/fetch/$s_!m5uN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46e4fa65-1414-4474-9d65-2956b66c1c71_1200x630.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can find it at <a href="https://rust-for-smart-contracts.com">https://rust-for-smart-contracts.com</a>! Please help me out a lot, and if you&#8217;re interested, sign up for the waitlist at:</p><p><a href="https://getwaitlist.com/waitlist/25549">https://getwaitlist.com/waitlist/25549</a></p><p>It introduces how blockchains work from an end developer point of view (beginning with some foundational distributed thinking and cryptography skills), how a smart contract works and then finally how to build and test one from the ground up for Arbitrum, Solana, and NEAR.</p><p>It&#8217;s also a work in progress, with only the first chapter mostly written up (and needing review), but I enjoy building in public, so please interact with it by providing suggestions if you&#8217;d like. I&#8217;ll also send everyone who waitlists the book a special Superposition NFT as thanks.</p><p>I&#8217;m also pleased to share that our new domain <a href="https://stylus-saturdays.com">https://stylus-saturdays.com</a> will help with our search presence, and will afford me the chance to host a subdomain of resources.</p><div><hr></div><h2>Using Chainlink Price Feeds and Chainlink VRF with Rust Arbitrum Stylus (part 1)</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://github.com/af-afk/vendingmachine.com" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6DJV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6DJV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png" width="590" height="295" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be6f222e-b250-4584-8946-67d0baf7032e_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:590,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://github.com/af-afk/vendingmachine.com&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6DJV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!6DJV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe6f222e-b250-4584-8946-67d0baf7032e_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Using Chainlink&#8217;s VRF with Arbitrum Stylus is super easy! Being unable to implement an interface may be confusing for some, but fear not: it&#8217;s as simple as exporting a specific function in your entrypoint code.</p><p>For part 1 of this post, we&#8217;re going to implement the entrypoint for users to call, then conclude with the callback in the next post, including some approaches for testing code which includes hard to mock behaviour with a manual gas estimation. Since this is a development journey (in contrast to our completed posts of a similar nature in the past), this code is largely untested.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5hVa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5hVa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 424w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 848w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 1272w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5hVa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png" width="472" height="629.3333333333334" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:472,&quot;bytes&quot;:4350520,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5hVa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 424w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 848w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 1272w, https://substackcdn.com/image/fetch/$s_!5hVa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd55fa2ed-e435-4b89-9fb8-287bc4f2efae_1200x1600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A crazy vending machine I saw recently. I took a lot of photos of vending machines.</figcaption></figure></div><p>I visited Japan recently (for the second time), and since middle school, I&#8217;ve had an interest that comes to life when I&#8217;m abroad looking at vending machines. Not the kind that overrides my personality and makes me a stereotype, but the kind where I take photos if I see one. I wrote a lengthy school essay that really opened my eyes at the time, there&#8217;re lots of different vending machines! Wikipedia was only just becoming a thing and we were learning how to do primary and secondary research.</p><p>Together, let&#8217;s implement a NFT vending machine contract that uses a Chainlink Verifiable Random Function (VRF) to get a random word to seed a random number generator. We&#8217;ll use the random word to pick a NFT for a requesting user after using a Chainlink Price Feed to convert the ETH supplied to USD for selecting a NFT tranche to send.</p><p>The NFTs are stored in a vector that goes one way, with no pricing from the contract itself in the form of buckets that you might see in a concentrated AMM-like structure.</p><p>We&#8217;ll take a flat fee from users who participate in this system to power our VRF using Chainlink&#8217;s 2.5 direct funding model. This lets us avoid having to set up a subscription elsewhere, and we can focus on taking a fee from users to service the requests instead. We&#8217;ll refund every user based on the share of asks and the flat fee.</p><p>The user (and technical) story is like this for funding:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uspT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uspT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 424w, https://substackcdn.com/image/fetch/$s_!uspT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 848w, https://substackcdn.com/image/fetch/$s_!uspT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 1272w, https://substackcdn.com/image/fetch/$s_!uspT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uspT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png" width="747" height="1029" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1029,&quot;width&quot;:747,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:94130,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylussaturdays.substack.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uspT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 424w, https://substackcdn.com/image/fetch/$s_!uspT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 848w, https://substackcdn.com/image/fetch/$s_!uspT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 1272w, https://substackcdn.com/image/fetch/$s_!uspT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47bc64b8-9977-40df-936a-aa76636ef4a5_747x1029.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Shoutout to Github&#8217;s Mermaid viewer. Now, if only they were able to render C4 diagrams decently&#8230;</figcaption></figure></div><p>So, a user goes to spend their ETH, paying a flat fee for doing so. The funds are locked up until a Chainlink VRF request is fulfilled with a callback, at which point Chainlink&#8217;s price feeds are accessed to get the value of ETH at that time. At that point, the NFT tier is chosen from the vector that was established earlier, and we send the user their NFT, or a refund. We assume that Chainlink will absolutely call this function (and that in doing so we&#8217;ve accurately predicted the uppermost ETH to spend for the callback).</p><h3>Implementing some code</h3><p>First, let&#8217;s establish some storage. In a production-facing application, you might prefer to use a special number pattern (think sqrt price x96 if you&#8217;re like Uniswap) based on some configuration local to the contract to bucket price ranges which you then store with a mapping, but in our usecase, we&#8217;re going to be taking a very simple view of this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_e6N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_e6N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 424w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 848w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 1272w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_e6N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png" width="618" height="938" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:938,&quot;width&quot;:618,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132563,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_e6N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 424w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 848w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 1272w, https://substackcdn.com/image/fetch/$s_!_e6N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cad1197-ed03-4a5b-9466-67a7d06c0b65_618x938.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This code is a series of stored structures, loaded by a vector and map combination. Why don&#8217;t we storage tag the StorageQueue? The address and u96 combination is storeable in a EVM word. This affords us the efficiency of unpacking a word to access the amount a user has deposited, as opposed to a pair of SLOADs.</p><p>For the other fields inside this storage structure, we&#8217;re not going to attempt to pack them, as these accesses are virtual anyway. When you have a recursively stored keyed storage value (ie, a map or a vector), Stylus will keccak256 to find the location of the offset for the lookup so it won&#8217;t be implicitly loaded when you load a storage slot, only on demand.</p><p>Making requests of Chainlink is simply calling a method, which then triggers a callback. To do so, first we define a entrypoint function for users to call.</p><p>In the new version of Stylus, errorneous returns from function calls in the new Call functions return a enum type. This type is either the return data from the call, or a type that indicates a decoding failed.</p><p>We first define a macro to simplify unpacking this, and we use the sol! macro to load several error types from a Solidity file:</p><pre><code>use stylus_sdk::{alloy_sol_types::sol, stylus_core::calls::errors::Error};

pub(crate) fn unpack_err(x: Error) -&gt; Vec&lt;u8&gt; {
    match x {
        Error::Revert(x) =&gt; x,
        _ =&gt; unimplemented!()
    }
}

#[macro_export]
macro_rules! unpack_on_err {
    ($rd:expr, $conv:ident) =&gt; {{
        use stylus_sdk::alloy_sol_types::SolError;
        $rd.map_err(|x| $conv{_0: $crate::errors::unpack_err(x).into()}.abi_encode())
    }};
}

#[macro_export]
macro_rules! revert {
    ($err:ident) =&gt; { return Err($err{}.abi_encode()); }
}

sol!("./src/IErrors.sol");

pub use IErrors::*;</code></pre><p>The sol macro lets us use:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Zxv3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Zxv3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 424w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 848w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 1272w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Zxv3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png" width="498" height="621" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af800423-a16a-4572-b26b-2cda47e52e69_498x621.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:621,&quot;width&quot;:498,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65126,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Zxv3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 424w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 848w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 1272w, https://substackcdn.com/image/fetch/$s_!Zxv3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf800423-a16a-4572-b26b-2cda47e52e69_498x621.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which we&#8217;ll bring into scope as we use this code.</p><p>With that macro sorted, we can start to write some code like:</p><pre><code>use crate::errors::*;

sol!("./src/IVRFV2PlusWrapper.sol");

// Calls "calculateRequestPrice" from Chainlink's IVRFV2PlusWrapper.
pub fn calculate_request_price_native(
    access: &amp;dyn CallAccess,
    addr: Address,
    callback_gas_limit: u32,
    num_words: u32,
) -&gt; Result&lt;U256, Vec&lt;u8&gt;&gt; {
    Ok(U256::from_le_slice(&amp;unpack_on_err!(
        access.static_call(
            &amp;Call::new(),
            addr,
            &amp;IVRFV2PlusWrapper::calculateRequestPriceNativeCall {
                _callbackGasLimit: callback_gas_limit,
                _numWords: num_words,
            }
            .abi_encode()
        ),
        ErrChainlinkVRF
    )?))
}</code></pre><p>This code neatly makes a request using the calling context in the new Stylus release, then unpacks it to a vector containing bytes if something goes wrong. Before we precede any request to Chainlink&#8217;s VRF, we must estimate using their code the fee cost in the native asset. This is due to us using their native payment path, which you can read more about here: <a href="https://docs.chain.link/vrf/v2-5/overview/direct-funding">https://docs.chain.link/vrf/v2-5/overview/direct-funding</a></p><p>The sol macro lets us seamlessly interleave Solidity code with our Rust. This makes accessing events simple, as we don&#8217;t need to define them ourselves, and it facilitates classical EVM tooling (think Alloy). With a function that estimates the cost, we can start to request the random word itself with a function like this:</p><pre><code>pub fn request_random_words_in_native(
    access: &amp;dyn CallAccess,
    addr: Address,
    value: U256,
    callback_gas_limit: u32,
    request_confirmations: u16,
    num_words: u32,
    extra_args: Bytes,
) -&gt; Result&lt;U256, Vec&lt;u8&gt;&gt; {
    Ok(U256::from_le_slice(&amp;unpack_on_err!(
        access.call(
            &amp;Call::new().value(value),
            addr,
            &amp;IVRFV2PlusWrapper::requestRandomWordsInNativeCall {
                _callbackGasLimit: callback_gas_limit,
                _requestConfirmations: request_confirmations,
                _numWords: num_words,
                extraArgs: extra_args,
            }
            .abi_encode()
        ),
        ErrChainlinkVRF
    )?))
}</code></pre><p>This unpacks the function requestRandomWordsInNativeCall.</p><p>We can start to finally build our entrypoint code for locking up users:</p><pre><code>#[payable]
pub fn lockup(&amp;mut self, recipient: Address) -&gt; Result&lt;U256, Vec&lt;u8&gt;&gt; {
    require!(!self.version.is_zero(), ErrNotSetup {});
    require!(
        !recipient.is_zero(),
        ErrInvalidRecipient {
            sender: self.vm().msg_sender()
        }
    );
    let value = self.vm().msg_value();
    require!(value &gt; U256::ZERO, ErrNoValue {});
    require!(value &lt;= MAX_U256_VALUE, ErrTooMuchValue {});
    // Prevent people from using this if there aren't any NFTs to distribute.
    let has_nfts = (0..self.levels.len())
        .find(|i| self.levels.get(*i).unwrap().nfts_distributeable.len() &gt; 0)
        .is_some();
    require!(has_nfts, ErrNoNfts {});
    if !self.chainlink_vrf_pending.get() {
        let fee = self.estimate_fee()?;
        self.chainlink_vrf_fee.set(fee);
        let ticket_no = chainlink_vrf_call::request_random_words_in_native(
            self.vm(),
            CHAINLINK_VRF_ADDR,
            fee,
            ESTIMATED_CALLBACK_LIMIT,
            CHAINLINK_VRF_CONFIRMATIONS,
            CHAINLINK_NUM_WORDS,
            Bytes::new(),
        )?;
        stylus_core::log(
            self.vm(),
            RandomnessRequested {
                ticketNo: ticket_no,
            },
        );
        self.chainlink_vrf_pending.set(true);
    }
    let value = value
        .checked_sub(self.chainlink_vrf_fee.get())
        .ok_or(ErrCheckedSub {}.abi_encode())?;
    // Push the user's request for the NFT into the queue.
    let ticket_no = U256::from(self.queue.len());
    stylus_core::log(
        self.vm(),
        LockedUpTokens {
            recipient,
            amount: value,
        },
    );
    self.queue.grow().set(pack_queue_item(value, recipient));
    Ok(ticket_no)
}</code></pre><p>This payable function takes ETH, checks that we have NFTs to distribute, checks if we have a Chainlink reply pending, and if we don&#8217;t, makes the call out to Chainlink using the function we introduced earlier. It uses a hardcoded value in immutables for some of the gas fields, which we&#8217;ll expand on in the next post properly. Following that, it adds the fee to the value, breaking explicitly if a user supplied too little!</p><p>It then grows out the storage internally of the queue with a packed word and returns the location in the internal storage to the user. And that&#8217;s it for now! Completion (and perhaps some live coding) in the next post on this topic.</p><div><hr></div><h2>Interview with Alisander Qoshqosh from OpenZeppelin</h2><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8679!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8679!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 424w, https://substackcdn.com/image/fetch/$s_!8679!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 848w, https://substackcdn.com/image/fetch/$s_!8679!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 1272w, https://substackcdn.com/image/fetch/$s_!8679!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8679!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png" width="1042" height="187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:187,&quot;width&quot;:1042,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11602,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylussaturdays.substack.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8679!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 424w, https://substackcdn.com/image/fetch/$s_!8679!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 848w, https://substackcdn.com/image/fetch/$s_!8679!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 1272w, https://substackcdn.com/image/fetch/$s_!8679!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb40595fc-ad1a-4319-9e79-6a2dc717095a_1042x187.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-oQ0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-oQ0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 424w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 848w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 1272w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-oQ0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png" width="257" height="354.2432432432432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:867,&quot;width&quot;:629,&quot;resizeWidth&quot;:257,&quot;bytes&quot;:777817,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://stylus-saturdays.com/i/157244356?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-oQ0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 424w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 848w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 1272w, https://substackcdn.com/image/fetch/$s_!-oQ0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dfbd3af-c914-459d-80aa-3ebd3ab2fd19_629x867.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m lucky to have had the opportunity to spotlight Alisander from OpenZeppelin! Alisander is an open source developer at OpenZeppelin, working on openzeppelin-stylus.</p><h3>Who are you?</h3><blockquote><p>I&#8217;m Alisander Qoshqosh, Open Source Developer at OpenZeppelin.</p></blockquote><h3>What&#8217;s your project?</h3><blockquote><p>Currently I work on&nbsp;<a href="https://crates.io/crates/openzeppelin-stylus">openzeppelin-stylus</a>,&nbsp;<a href="https://crates.io/crates/openzeppelin-crypto">openzeppelin-crypto</a>&nbsp;and&nbsp;<a href="https://crates.io/crates/motsu">motsu</a>&nbsp;crates.</p></blockquote><p>OpenZeppelin&#8217;s Stylus projects are super useful for developers in the ecosystem. Their code at <a href="https://github.com/OpenZeppelin/rust-contracts-stylus">https://github.com/OpenZeppelin/rust-contracts-stylus</a> supports developers in quickly bringing up standard patterns, including working with ERC20 contracts. Their contracts are fully audited, which takes the edge off developing with Stylus for the first time.</p><p>OpenZeppelin recently found that Poseidon hashing with Stylus is 90x cheaper than with the ordinary EVM environment: <a href="https://blog.openzeppelin.com/poseidon-go-brr-with-stylus-cryptographic-functions-are-18x-more-gas-efficient-via-rust-on-arbitrum">https://blog.openzeppelin.com/poseidon-go-brr-with-stylus-cryptographic-functions-are-18x-more-gas-efficient-via-rust-on-arbitrum</a></p><p>Their <a href="https://github.com/OpenZeppelin/rust-contracts-stylus/tree/main/lib/crypto">openzeppelin-crypto</a> crate simplifies the process of using cryptography on-chain with the same level of security and reusability that you might benefit from with the rest of their code. I couldn&#8217;t see whether their crypto package includes the aforementioned Poseidon hashing, but it definitely supports merkle tree proving.</p><h3>Could you tell us more about your background before web3?</h3><blockquote><p>Before web3 I was a backend developer (mostly C#, Rust and Java) for large enterprise projects in telecommunications industry.</p></blockquote><h3>Have you worked in other ecosystems aside from the EVM?</h3><blockquote><p>I haven&#8217;t worked professionally in other ecosystems aside Ethereum.</p></blockquote><h3>What were the opportunities for OZ with Stylus?</h3><blockquote><p>We want to replicate the success of our Solidity library and make sure Stylus developers have access to secure, efficient and easy to use primitives to build their applications.</p></blockquote><h3>What were the joys of working with Stylus?</h3><blockquote><p>It is always a joy to write code on Rust. And Stylus brings rust to EVM. Like it.</p></blockquote><h3>How do you see the Stylus ecosystem evolving?</h3><blockquote><p>Before Stylus, it was actually hard to work with the inheritance problem, the lack of constructors, and a lack of testing framework. But good to see, that the last issue is already addressed. And other features are coming soon in the&nbsp;stylus-sdk 0.9.0. So yeah, I see a big leap forward!</p></blockquote><h3>How can we get in touch with you?</h3><p>Telegram: <a href="https://t.me/qalisander">https://t.me/qalisander</a></p><div><hr></div><p>Stylus Saturdays is brought to you by&#8230; Arbitrum! Thanks to a special grant from the foundation. </p><p>This post is powered by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Join the Stylus Devs DAO: <a href="https://discord.gg/eTRt3r3F">https://discord.gg/eTRt3r3F</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check our dapps out at <a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MK2m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 424w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 848w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MK2m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png" width="448" height="252" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:448,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Badum tisk&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Badum tisk" title="Badum tisk" srcset="https://substackcdn.com/image/fetch/$s_!MK2m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 424w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 848w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 1272w, https://substackcdn.com/image/fetch/$s_!MK2m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F07d1f274-a1df-47dd-bae9-4629241c74d1_3840x2160.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Stylus Saturdays! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Go on Stylus, interview with Lit Protocol's Howard]]></title><description><![CDATA[Stylus Saturdays Part 6, Feb 8th, 2025]]></description><link>https://stylus-saturdays.com/p/go-on-stylus-interview-with-lit-protocols</link><guid isPermaLink="false">https://stylus-saturdays.com/p/go-on-stylus-interview-with-lit-protocols</guid><dc:creator><![CDATA[Stylus Saturdays]]></dc:creator><pubDate>Sat, 08 Feb 2025 10:33:35 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!cq0j!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cq0j!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cq0j!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 424w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 848w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cq0j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg" width="1456" height="1048" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1048,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:118525,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cq0j!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 424w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 848w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!cq0j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde4e457b-b1d4-4ee0-8f32-c18b68b7cfcb_1456x1048.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello again! Welcome back to another Stylus Saturdays post!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Stylus Saturdays! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>I&#8217;m pleased to announce we&#8217;ve been graciously funded by the Arbitrum grants committee! I&#8217;m super thankful to everyone advocated for this little newsletter, we love building on Stylus, and with this support we&#8217;re able to do the following:</p><h3>Launch three major dApps</h3><p>With this support, we will develop three major dApps: A fully on-chain orderbook with hooks, a gas golfing competition for an on-chain optimisation problem, and a fully on-chain NFT platform (again, with hooks)!</p><p>These three projects will be fully audited and MIT licensed, ready for any would-be developers to jump in and fork! The emphasis will be on extensibility to bootstrap projects developing with Stylus. We intend to actively support the Stylus developer experience with these projects, and having the audit component sorted will mean it&#8217;s possible for others to safely enjoy the benefits!</p><p>The gas competition will be run (mostly) on-chain, with a cash prize for finding the most efficient Stylus solution for an optimisation problem! Stay tuned for more.</p><h3>Kickstart the Stylus Developers DAO</h3><p>I have created an unofficial Stylus developers community hosted on Discord, with an eye for hands-on advice specific to individual projects based on mine and my team&#8217;s experience. Ask questions about anything, and hopefully get some personalised advice to your codebase! This will also be a vehicle to organise community events about alternative programming on Arbitrum.</p><p><a href="https://discord.gg/eTRt3r3F">https://discord.gg/eTRt3r3F</a></p><h3>Release a ton of posts</h3><p>Thanks to Arbitrum&#8217;s generous support, I will be releasing posts on a regular cadence and of a broader range than was possible previously!</p><h3>CALL FOR STYLUS BUILDERS</h3><p>Anyone, anywhere, if you&#8217;re building on Stylus, I want to know! Please drop me a line at <a href="https://t.me/doggish">@doggish</a> on Telegram. I&#8217;d love to hear more about what you&#8217;re up to, and maybe feature you here! I&#8217;ll be reaching out to projects I&#8217;m aware of this week to get you included.</p><div><hr></div><h2>Using Go with Arbitrum Stylus</h2><p>Stylus = WASM. This means you can use most programming languages that generate WASM (though there&#8217;s no support for WASI so be mindful)! This includes Go with Tinygo as the backend.</p><p>In a simple Go contract, we&#8217;ll define a simple counter app that lets you add and subtract from a storage variable:</p><pre><code>package main

//go:generate stylus-go

import (
&#9;"math/big"

&#9;"github.com/af-afk/stylus"
)

//stylus entrypoint
type Storage struct {
&#9;Counter stylus.StorageUint256
}

//stylus uint256
func (s Storage) Add(x *big.Int) ([]byte, error) {
&#9;y := s.Counter.Get()
&#9;y.Add(y, x)
&#9;s.Counter.Set(y)
&#9;var b [32]byte
&#9;x.FillBytes(b[:])
&#9;return b[:], nil
}

func (s Storage) Sub(x *big.Int) ([]byte, error) {
&#9;y := s.Counter.Get()
&#9;y.Sub(y, x)
&#9;s.Counter.Set(y)
&#9;var b [32]byte
&#9;x.FillBytes(b[:])
&#9;return b[:], nil
}</code></pre><p>Reflection is difficult in the Tinygo environment, so we&#8217;ll be using code generation to generate the entrypoint/code for this to make it actually work. This is similar to Rust functionally speaking, which makes things comparatively similar and simple.</p><p>The repo where this lives is at <a href="https://github.com/af-afk/stylus">https://github.com/af-afk/stylus</a>. The devex needs some work, though I expect with time, this should become easier!</p><h3>How to implement this yourself: writing some primitives</h3><p>First, to reproduce the SDK and code generator I&#8217;ve mentioned here, we need to implement some basic primitives to do things like convert byte arrays to *big.Int and storage accesses. For all of the code below, we have some functions for hostio access using Tinygo stubs.</p><p>We implement an internal uint256 number and conversion methods:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RD_b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RD_b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 424w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 848w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 1272w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RD_b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png" width="492" height="887" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:887,&quot;width&quot;:492,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109516,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RD_b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 424w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 848w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 1272w, https://substackcdn.com/image/fetch/$s_!RD_b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb89aeed1-abc0-4521-b46f-fb947b0cde09_492x887.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Which we later use to implement some storage:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rQqh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rQqh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 424w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 848w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 1272w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rQqh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png" width="519" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/beeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:519,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86061,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rQqh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 424w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 848w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 1272w, https://substackcdn.com/image/fetch/$s_!rQqh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbeeafd07-e211-436d-9e11-2f2d9bd9f303_519x637.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A simple approach to storage in this case is to have an internal counter and to simply bump it every time someone asks for a storage pointer at runtime. This is the approach implemented above.</p><p>Lastly, we implement a pair of conversion functions:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gE5N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gE5N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 424w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 848w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 1272w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gE5N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png" width="357" height="368" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:368,&quot;width&quot;:357,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29596,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gE5N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 424w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 848w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 1272w, https://substackcdn.com/image/fetch/$s_!gE5N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fddb2df0f-7af9-4741-b318-e5a0645d96d6_357x368.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These will come in handy as we implement our code generator.</p><h3>Implementing the code generator</h3><p>Second, we need to implement some code that&#8217;s able to parse a pattern similar to Rust. *big.Int is a good experience (much to my researcher&#8217;s despair when he reads Go) in my opinion, so for a simple counter app, we should allow users to optionally declare the type of the arguments for their functions using a comment. For this example, we&#8217;re simply supporting uint256 and int256, as addresses could be implemented trivially at a later time.</p><p>We&#8217;re forcing the user of this Go code to return a byte slice and error, with the former being sent directly as returndata, and the latter tested to be non-nil to know whether to return an erroneous contract state (triggering a revert by the runtime). This is obviously not great devex, but it should be trivial to implement another feature later that also converts the return type in the code generator the same way we do for arguments.</p><p>Writing a code generator a la gqlgen (which we use extensively at Fluidity Labs for our backend code) is as simple as reading a number of Go files in a directory, then parsing the Go. We can do so beginning with the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M6VO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M6VO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 424w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 848w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 1272w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M6VO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png" width="588" height="242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:242,&quot;width&quot;:588,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:43973,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!M6VO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 424w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 848w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 1272w, https://substackcdn.com/image/fetch/$s_!M6VO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2acda45a-2fd4-4087-b276-2ce6b847c3fd_588x242.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The fully implemented form of all of the code here lives at <a href="https://github.com/af-afk/stylus/blob/trunk/cmd/stylus-go/main.go#L45-L69">https://github.com/af-afk/stylus/blob/trunk/cmd/stylus-go/main.go#L45-L69</a>.</p><p>This code gives us a map with the AST for the various Go files in the current directory. Our goal is to find a struct that&#8217;s been marked as the entrypoint for the contract, then to start to read its associated functions, to check what the preferred types are, then to spit out a symbol exported entrypoint function.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SEnD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SEnD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 424w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 848w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 1272w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SEnD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png" width="649" height="396" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:396,&quot;width&quot;:649,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62714,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SEnD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 424w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 848w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 1272w, https://substackcdn.com/image/fetch/$s_!SEnD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F578f6af5-a7f4-40d3-a801-254acd08d2a0_649x396.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The above code does some work to find a comment that&#8217;s like:</p><pre><code>//stylus entrypoint</code></pre><p>This clues the code in for its first pass as to which functions we&#8217;re searching for. Some more work is done to confirm that the type is, in fact, a struct, but we&#8217;re going to omit this for now for brevity reasons.</p><p>After some boring work involving confirming the struct, we&#8217;re going to emit our first bit of generated code:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3NDq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3NDq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 424w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 848w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 1272w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3NDq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png" width="612" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:612,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73445,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3NDq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 424w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 848w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 1272w, https://substackcdn.com/image/fetch/$s_!3NDq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c8fa11d-375b-4d92-ba86-c6eda3448612_612x487.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This uses this function to generate code like this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TADi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TADi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 424w, https://substackcdn.com/image/fetch/$s_!TADi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 848w, https://substackcdn.com/image/fetch/$s_!TADi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 1272w, https://substackcdn.com/image/fetch/$s_!TADi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TADi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png" width="601" height="138" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:138,&quot;width&quot;:601,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20032,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TADi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 424w, https://substackcdn.com/image/fetch/$s_!TADi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 848w, https://substackcdn.com/image/fetch/$s_!TADi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 1272w, https://substackcdn.com/image/fetch/$s_!TADi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F793a98c2-4008-4711-82b6-34cfc65fb394_601x138.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In practice resulting with the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ax_w!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ax_w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 424w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 848w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 1272w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ax_w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png" width="438" height="357" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c5a421d9-4fca-42e9-9051-57904a58be69_438x357.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:357,&quot;width&quot;:438,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41308,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ax_w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 424w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 848w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 1272w, https://substackcdn.com/image/fetch/$s_!Ax_w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5a421d9-4fca-42e9-9051-57904a58be69_438x357.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For each storage unit in the struct, we bump an internal counter, and we generate code that knows how to read from the storage slot at that position.</p><p>After confirming that we&#8217;ve found the struct, we&#8217;re going to search for each function in each file with a second pass:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7f9w!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7f9w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 424w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 848w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 1272w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7f9w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png" width="610" height="609" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:609,&quot;width&quot;:610,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:92876,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7f9w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 424w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 848w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 1272w, https://substackcdn.com/image/fetch/$s_!7f9w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F761b6ad5-b4c0-401f-ae3c-bc9c756edc18_610x609.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We&#8217;re going to confirm the following:</p><ol><li><p>This is titled (so as to be exported under normal circumstances by Go).</p></li><li><p>This might have a hint as to what the types should be. Hinting the types with a comment like <code>//stylus uint256</code> empowers the developer to specify specifically what the type should be for the functions.</p></li><li><p>That this function is associated with the struct from before that&#8217;s been marked as the entrypoint. If this isn&#8217;t the case, we need to ignore this function.</p></li></ol><p>After confirming these things about the function, we&#8217;re going to begin to spit out templated code with the meat of our entrypoint.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q43_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q43_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 424w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 848w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 1272w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q43_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png" width="582" height="332" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:332,&quot;width&quot;:582,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:57473,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Q43_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 424w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 848w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 1272w, https://substackcdn.com/image/fetch/$s_!Q43_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb944bb58-47ac-4571-bf19-8ccc2ddbf8ed_582x332.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The code explainArgs does some unpacking to determine the internal and external-facing types for users:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T2N-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T2N-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 424w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 848w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 1272w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!T2N-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png" width="780" height="725" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:725,&quot;width&quot;:780,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:118158,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T2N-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 424w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 848w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 1272w, https://substackcdn.com/image/fetch/$s_!T2N-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf277c32-3111-4bb6-a5a7-1778fb4a7574_780x725.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The type guessing takes place with the <code>//stylus</code> comment. There are some functions below to convert the AST human readable name to the external type, which we&#8217;ll skip for now.</p><p>The templating code spits out functions to follow the first print that takes place in the structure checking code:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zprp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zprp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 424w, https://substackcdn.com/image/fetch/$s_!zprp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 848w, https://substackcdn.com/image/fetch/$s_!zprp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 1272w, https://substackcdn.com/image/fetch/$s_!zprp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zprp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png" width="720" height="651" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:651,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:76986,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zprp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 424w, https://substackcdn.com/image/fetch/$s_!zprp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 848w, https://substackcdn.com/image/fetch/$s_!zprp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 1272w, https://substackcdn.com/image/fetch/$s_!zprp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe034efa5-17b6-4ab2-8480-42bceea5eea6_720x651.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This results in code like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rPti!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rPti!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 424w, https://substackcdn.com/image/fetch/$s_!rPti!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 848w, https://substackcdn.com/image/fetch/$s_!rPti!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 1272w, https://substackcdn.com/image/fetch/$s_!rPti!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rPti!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png" width="539" height="582" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/76494bca-4066-467f-9463-04eae4e391bd_539x582.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:582,&quot;width&quot;:539,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60477,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rPti!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 424w, https://substackcdn.com/image/fetch/$s_!rPti!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 848w, https://substackcdn.com/image/fetch/$s_!rPti!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 1272w, https://substackcdn.com/image/fetch/$s_!rPti!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76494bca-4066-467f-9463-04eae4e391bd_539x582.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Much like the generated code for the Rust SDK I imagine. This code can then be compiled with Tinygo (see <a href="https://github.com/af-afk/stylus/blob/trunk/cmd/counter/Makefile#L9-L23">here</a>) for a good Tinygo build profile and stripping with <code>wasm-opt</code>. For our simple example this all results in 13 kilobytes.</p><p>I will be developing this SDK to improve its user experience in the coming few months, hopefully eventually being possible to be used at scale by individual users alongside my regular (dApp-focused) programming!</p><p>The repo lives here: <a href="https://github.com/af-afk/stylus">https://github.com/af-afk/stylus</a>, including the TODO list. The flexibility of WASM means we can develop smart contracts in most programming languages!</p><div><hr></div><h2>Interview with Howard from Lit Protocol</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ru5r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ru5r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ru5r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png" width="1200" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;https://litprotocol-com-v2-1r9a66dc3-lit-protocol.vercel.app/twitter-image.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="https://litprotocol-com-v2-1r9a66dc3-lit-protocol.vercel.app/twitter-image.png" title="https://litprotocol-com-v2-1r9a66dc3-lit-protocol.vercel.app/twitter-image.png" srcset="https://substackcdn.com/image/fetch/$s_!Ru5r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 424w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 848w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 1272w, https://substackcdn.com/image/fetch/$s_!Ru5r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa072f9b1-0bc5-4ad0-9d55-8b1950d7b2d0_1200x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I had the opportunity to interview Howard from <a href="https://www.litprotocol.com/">Lit Protocol</a>. We&#8217;ve previously covered them <a href="https://stylussaturdays.substack.com/i/154187220/lit-protocol">here</a>, and I&#8217;m super excited to discuss their product again! Lit Protocol is building a decentralised signing network.</p><h4>Could you tell us some more about your background before web3?</h4><p><em>I got into web3 pretty early on in my career, pretty much right after college. After obtaining my Master of Engineering at University of Oxford, I joined a startup foundry in Vancouver called Axiom Zen as a Frontend Engineer Intern. Around six months after joining, CryptoKitties, the project that was created by the same folks who were sitting by my side in the office, was really taking off, and I seized the opportunity to work on that project. That project changed my life.</em></p><p><em>I transitioned into backend engineering on the job, learning Golang, NodeJS, Solidity, which culminated to my first major achievement on that team - I wrote the set of contracts for the Offers feature and at one point in time it had held more than $3.5MM USD in escrow on chain. It was truly some wild stuff. Then, I went on to lead a team of 7 engineers to develop the Dapper Wallet and Payment Rails for the NBA TopShot project with Dapper Labs.</em></p><h4>Have you worked in other ecosystems aside from the EVM?</h4><p><em>Yes, I worked in the Flow blockchain ecosystem back when I was at Dapper Labs.</em></p><h4>How did you learn about Stylus?</h4><p><em>At Lit Protocol, we need a base chain that is cheap and fast for processing transactions, as well as one that would help us move fast as a team. We use the chain as a public consensus and data layer allows us to keep the Lit nodes stateless except for key material, which is a significantly simpler architecture than otherwise. Alternatives are not impossible but rather long winded.</em></p><p><em>A long time ago, we were on Celo. Then, we moved to the OP stack because, at the time, they had decent devX for building in the necessary precompiles we needed for our PKPs. At some point, we had reached the limits of the OP rollup and needed an even better solution, so we started to look into Arbitrum.</em></p><p><em>While OP has 2s block times, Arbitrum has almost instantaneous confirmations - this was great first signs. We also noticed that Arbitrum was even cheaper than on OP stack, another great sign. When we were using OP stack, every time we needed to add or change the precompile code, we needed to coordinate with Caldera - our OP rollup provider - for shipping the build and upgrading the chain, which was a very lengthy process especially since it involves communicating across teams and timezones.</em></p><p><em>This was also a rather involved process when developing in non-production environments, too. Every precompile code change resulted in needing to update a fork of Anvil (Foundry) before we can run our CI tests. With Stylus, we can simply deploy the contract after changing the Rust code, and we no longer need to maintain a fork of Foundry for this particular purpose. Lit dev team work in Rust, and OP stack is built upon geth and the larger Golang ecosystem - at the time, we had to spend costly cycles switching contexts from Rust to Golang to write our precompiles</em></p><p><em> With Stylus, we can just write in Rust like we normally do, and deploy that as a smart contract using the security benefits of Rust, as opposed to Golang.</em></p><h4>What were the opportunities for Lit Protocol with Stylus?</h4><p><em>Lit uses smart contracts to manage programmable keys (PKPs) and their permissions. Each Lit PKP has a unique public key in order to use them, and this public key is derived using Rust code that is deployed as a Stylus contract - this allows us to model the necessary logic as simply contract-contract interactions.</em></p><h4>What were the joys of working with Stylus?</h4><p><em>These were the benefits that I had experienced working with Stylus:</em></p><p><em>1. Interoperability between Solidity and Stylus smart contracts meant we can write simpler code.</em></p><p><em>2. Cheaper and faster execution of the WASM VM compared to the EVM (geth).</em></p><p><em>3. Good documentation and hands-on support resulting in good devX! Easy to run a dev node locally for POC and testing.</em></p><p><em>It was also easy to get started with a basic POC, there was a good amount of examples to reference, and I got as far as setting up a local Nitro testnode where I could deploy and interact with my Stylus contracts, which was sufficient to complete the development cycle.</em></p><p><em>Being able to write in Rust opens up the opportunity for us to write all kinds of precompiles in the future, and the guides for most basic operations are pretty accessible.</em></p><h4>How do you see the Stylus ecosystem evolving?</h4><p><em>Generally speaking, Stylus as a product will be great for helping convert more developers to develop on rollups, and for the people who prefer to work with the safety of the Rust language itself, this tool offers that option for them to deploy a smart contract without needing to learn the intricacies of Solidity.</em></p><p><em>I expect to see all verticals to grow within the Stylus ecosystem because it just makes it that much easier to work with smart contracts across the board now.</em></p><h4>How can we get in touch with you?</h4><p>LinkedIn: https://www.linkedin.com/in/itshowardtam/</p><p>X: https://x.com/itshwrdtm</p><p>Lit Protocol Discord: https://discord.com/invite/zBw5hDZve8</p><div><hr></div><p>This post is powered by&#8230; Arbitrum! With a grant from the Fund the Stylus Sprint program. You can learn more about Arbitrum grants here: <a href="https://arbitrum.foundation/grants">https://arbitrum.foundation/grants</a></p><p>Join the Stylus Devs DAO: <a href="https://discord.gg/eTRt3r3F">https://discord.gg/eTRt3r3F</a></p><p>Follow me on X: <a href="https://x.com/baygeeth">@baygeeth</a></p><p>Side note: I develop Superposition, a defi-first chain that pays you to use it. You can check more out at <a href="https://superposition.so">https://superposition.so</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://superposition.so" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-TC2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 424w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 848w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 1272w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-TC2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png" width="463" height="464.93723849372384" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:717,&quot;resizeWidth&quot;:463,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Testnet!&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://superposition.so&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Testnet!" title="Testnet!" srcset="https://substackcdn.com/image/fetch/$s_!-TC2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 424w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 848w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 1272w, https://substackcdn.com/image/fetch/$s_!-TC2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22a6af54-2ae7-416d-8872-dc16094f08bd_717x720.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://stylus-saturdays.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Stylus Saturdays! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>