<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Exo Monk on Medium]]></title>
        <description><![CDATA[Stories by Exo Monk on Medium]]></description>
        <link>https://medium.com/@0xexomonk?source=rss-c9b735421d64------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qKhXqr1PUy6URdPYFF39Ew.jpeg</url>
            <title>Stories by Exo Monk on Medium</title>
            <link>https://medium.com/@0xexomonk?source=rss-c9b735421d64------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 22 May 2026 06:59:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xexomonk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Indexing Hyperliquid’s Prediction Markets Before Everyone Else]]></title>
            <link>https://medium.com/@0xexomonk/indexing-hyperliquids-prediction-markets-before-everyone-else-f85cf55f81f0?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/f85cf55f81f0</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[prediction-markets]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 18:44:10 GMT</pubDate>
            <atom:updated>2026-03-22T18:44:10.485Z</atom:updated>
            <content:encoded><![CDATA[<p>HIP4 is coming to mainnet on <a href="https://x.com/@HyperliquidX">@HyperliquidX</a>. Binary prediction markets, native to Hyperliquid, trading on the same order book as perps. When it launches, every DeFi team will want the same thing: leaderboards, copy-trade signals, analytics dashboards.</p><p>To build any of that, you need the data. And the data you actually need (every trade fill, both sides, every user’s PnL) lives exclusively on S3 in a binary format no existing indexer can read.</p><p>I built <a href="https://github.com/ExoMonk/hypercore-indexer"><strong>hypercore-indexer</strong></a>, open source, 450 blocks/sec from S3, HIP4-ready on day one. Contribute !</p><h3>The HIP4 Data Problem</h3><p>HIP4 is a dual-layer system. M</p><ul><li>Markets trade as `#`-prefixed coins on HyperCore L1 (`#90` for “Hypurr wins the 100m dash”).</li><li>Deposits, claims, and settlements happen on a <strong>HyperEVM</strong> contest contract.</li><li>The contest events are standard EVM logs; any indexer with RPC access can get them.</li></ul><p>The hard part is the trade data. Every prediction market fill (buyer, seller, price, size, PnL) lives in Hyperliquid’s `node_fills_by_block` S3 dataset. No RPC exposes it. The public `recentTrades` API returns only the last 10 fills with no pagination. This is the data that powers leaderboards. Who’s profitable on HIP4, who’s providing liquidity, who’s the biggest trader: all locked behind S3 in a custom binary format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7P8zJ_zARpGB8KGs" /></figure><h3>What hypercore-indexer Captures</h3><p><strong>From S3 EVM blocks</strong> (also available via RPC, but 200x faster via S3):</p><ol><li>Contest deposits: who bet on which side, how much</li><li>Contest claims: settlement payouts</li><li>Contest creations, refunds, sweeps</li></ol><p><strong>From HyperCore API</strong> (polled in background):</p><ol><li>Market metadata: outcome names, sides, descriptions</li><li>Price snapshots: implied probability every 5 seconds</li></ol><p><strong>From S3 node_fills (exclusive, no other path):</strong></p><ol><li>Every trade fill: both sides, price, size, PnL, fees</li><li>Per-user realized PnL: the leaderboard dataset</li></ol><p>HIP4 is live on testnet now. When mainnet launches, one config change enables everything.</p><h3>What You Can Build</h3><p><strong>HIP4 deposits, who bet on what:</strong></p><pre>SELECT contest_id, side_id, COUNT(*) AS bets,<br>       SUM(amount_wei) / 1e18 AS total_eth<br>FROM hip4_deposits<br>GROUP BY contest_id, side_id<br>ORDER BY total_eth DESC;</pre><p><strong>Top traders by realized PnL</strong> (from the S3-exclusive fill data):</p><pre>SELECT user_address,<br>       COUNT(*) AS trades,<br>       SUM(CAST(closed_pnl AS NUMERIC)) AS total_pnl,<br>       SUM(CAST(size AS NUMERIC) * CAST(price AS NUMERIC)) AS volume<br>FROM fills<br>WHERE coin LIKE &#39;#%&#39;<br>GROUP BY user_address<br>ORDER BY total_pnl DESC<br>LIMIT 10;</pre><p>This query is impossible without the S3 `node_fills_by_block` data. No RPC, no API, no other indexer gives you both sides of every HIP4 trade with PnL.</p><h3>Why S3 Instead of RPC or Nodes?</h3><p><strong>RPC (self-hosted or managed):</strong> ~2 blocks/sec. $200–500/month. You run a Reth fork or pay a provider. Rate limits apply.</p><p><strong>Vendors:</strong> Managed, but EVM events only (no L1 trade data)</p><p><strong>S3 native:</strong> 450 blocks/sec. ~$2/month. No node, no subscription, no rate limits. Stateless (the bucket is there, you pay per request).</p><p>A full 30M block backfill costs ~$11. S3 is 200x faster and 100x cheaper than running a node. And the `node_fills_by_block` dataset; every trade fill; is S3-exclusive. No RPC serves it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pciTBuCJBQqwZIms" /></figure><h3>Two Commands to Start</h3><pre>hypercore-indexer init<br>hypercore-indexer live</pre><p>Discovers the chain tip via RPC, starts indexing, follows new blocks with adaptive polling. No config to write, no node to run.</p><p>Stop the indexer, restart it later: it picks up exactly where it left off. If it falls behind (e.g., laptop sleeps for an hour), it auto-detects the gap and switches to parallel backfill to catch up, then seamlessly returns to tip-following.</p><p><strong>Three storage backends:</strong> start with SQLite (zero setup, single file), move to PostgreSQL for production, use ClickHouse when you need sub-second aggregation over millions of rows. Switch by changing one URL in the config.</p><p>Or the full HIP4 stack with Docker:</p><pre>cd examples/live-hip4-clickhouse &amp;&amp; docker compose up</pre><p>ClickHouse + live indexing + HIP4 API poller: all prediction markets with live implied probabilities, updating every 5 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*uU89kx3B4Ki8u6Kn" /></figure><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_CvoxnS-d6F2eD51" /></figure><ul><li><strong>Crash recovery</strong>: cursor and data commit atomically in the same transaction. Restart = resume from last committed block. Idempotent inserts make re-processing safe across all backends.</li><li><strong>Adaptive live mode</strong>: polls S3 every ~1 second, matching Hyperliquid’s block time. Backs off when no new block, parallel-backfills when it falls behind. HIP4 event decoding runs after block storage; if it fails, the block is still indexed (fire-and-forget, never blocks core indexing).</li></ul><p><strong>Limitations</strong></p><ul><li><strong>No API layer yet:</strong> Query the database directly. REST/WebSocket API is next on the roadmap.</li><li><strong>HIP4 positions not indexed: </strong>User positions are L1 state, only available via per-user API polling.</li></ul><h3>What’s Next</h3><p><strong>API layer</strong> (next): Axum REST/WebSocket for leaderboards, position tracking, OHLC candles. The database has the data; the API makes it accessible without SQL. This is the priority.</p><p><strong>Real-time streaming:</strong> Hyperliquid WebSocket at ~100ms, or QuickNode/Dwellir gRPC at ~20–80ms. Webhooks that fire on every `#`-prefixed trade: whale entry, market settlement, price dislocation. S3 stays the source of truth; real-time adds sub-second detection.</p><h3>Get Started</h3><pre># Docker<br>docker pull ghcr.io/exomonk/hypercore-indexer<br>docker run --rm -v ~/.aws:/root/.aws:ro ghcr.io/exomonk/hypercore-indexer live</pre><pre># From source<br>git clone https://github.com/ExoMonk/hypercore-indexer &amp;&amp; cd hypercore-indexer<br>cargo install --path . &amp;&amp; hypercore-indexer init &amp;&amp; hypercore-indexer live</pre><p>Open source PRs welcome, especially for the API layer and real-time streaming</p><p>GitHub Repo:</p><p><a href="https://github.com/ExoMonk/hypercore-indexer"><strong>hypercore-indexer</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f85cf55f81f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned indexing a chain with no gas token]]></title>
            <link>https://medium.com/@0xexomonk/indexing-blockchain-no-gas-token-tempo-bd47a33bc313?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd47a33bc313</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Sat, 14 Mar 2026 23:58:40 GMT</pubDate>
            <atom:updated>2026-03-14T23:58:40.467Z</atom:updated>
            <content:encoded><![CDATA[<p>I kept hearing about Tempo’s unusual architecture, no gas token, native account abstraction, dual gas lanes, an on-chain CLOB for stablecoins, and I wanted to see what the data actually looked like. Not the whitepaper version. The real version: block by block, transaction by transaction.</p><p>The best way to understand a chain is to index it. So I pointed my existing EVM tooling at Tempo’s RPC, wrote a custom CDC pipeline for the parts that broke, and built a dashboard on top. The whole thing from CDC worker, API, to real-time frontend took less than a week. Eight million blocks later, I have some opinions.</p><p>A note on how this was built: I leaned heavily on LLMs throughout as a force multiplier, architecture discussions, debugging ClickHouse type mismatches at 2am, drafting schemas, iterating on pipeline design. The workflow was human-driven and agentic: I brought the blockchain engineering knowledge and system design instincts, the LLM brought speed. Every architectural decision, every debugging session, every “wait, this data shape is wrong” moment was mine but I got there 5x faster than I would have alone. This is what building looks like now.</p><p>The result is live at <a href="https://sandglasses.xyz">sandglasses.xyz</a>. This post is about what broke, what I built, and what the data revealed.</p><p>One caveat upfront: Tempo is still on testnet. The absolute numbers, volume, transaction counts, fill rates are testnet numbers, not production metrics. What’s interesting isn’t the scale but the patterns: how the architecture behaves, what the data shape looks like, and what primitives are actually being used.</p><h4>The first thing that broke: transaction decoding</h4><p>The event layer was easy. Tempo exposes 35 event signatures across 10 precompiles, TIP-20 tokens, a stablecoin DEX, a fee manager, payment streams, a keychain for session keys and they all emit standard EVM logs. I wrote a rindexer YAML config with topic-only filters, pointed it at ClickHouse, and had raw event data flowing within an hour. Standard EVM indexing, nothing surprising.</p><p>Then I tried to understand the transactions themselves.</p><p>Tempo’s native transaction type is 0x76, an account abstraction envelope that looks nothing like any EIP-2718 type I’ve worked with. Where a normal EVM transaction has a single “to” and “data” field, a 0x76 transaction carries a calls array (batched operations), two separate signatures (user and optional fee payer), 2D nonces, and an optional feeToken field for paying gas in stablecoins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*RffesqkvjLiNVpe3XqQU0g.png" /></figure><p>Here’s what one looks like from the RPC:</p><pre>    {<br>      &quot;type&quot;: &quot;0x76&quot;,<br>      &quot;calls&quot;: [<br>        {&quot;to&quot;: &quot;0x20c0...&quot;, &quot;value&quot;: &quot;0x0&quot;, &quot;input&quot;: &quot;0x095ea7b3...&quot;},<br>        {&quot;to&quot;: &quot;0xDEc0...&quot;, &quot;value&quot;: &quot;0x0&quot;, &quot;input&quot;: &quot;0xa694fc3a...&quot;}<br>      ],<br>      &quot;nonceKey&quot;: &quot;0x0&quot;,<br>      &quot;nonce&quot;: &quot;0x7&quot;,<br>      &quot;feeToken&quot;: null,<br>      &quot;feePayerSignature&quot;: null,<br>      &quot;from&quot;: &quot;0xa10d...&quot;,<br>      &quot;signature&quot;: {<br>        &quot;type&quot;: &quot;secp256k1&quot;,<br>        &quot;r&quot;: &quot;0x...&quot;, &quot;s&quot;: &quot;0x...&quot;, &quot;yParity&quot;: &quot;0x1&quot;<br>      }<br>    }</pre><p>My first instinct was to decode the raw RLP bytes, as you would for any custom transaction type. I spent some time trying to make alloy’s Decodable trait work on the 0x76 wire format before realizing the shortcut: Tempo’s eth_getBlockByNumber returns these transactions fully deserialized as JSON. The RPC does the decoding for you. No raw byte parsing needed — just serde structs.</p><p>The decision then was whether to use reqwest + hand-rolled serde types, or the tempo-alloy crate that extends alloy’s type system with native Tempo support. I went with tempo-alloy. It plugs into alloy’s provider system so I get typed access to the full envelope:</p><pre>    match rpc_tx.inner.inner() {<br>        TempoTxEnvelope::AA(aa_signed) =&gt; {<br>            let tx = aa_signed.tx();<br>            let fee_token = tx.fee_token.map(|a| format!(&quot;{a:#x}&quot;));<br>            let fee_payer = tx.recover_fee_payer(from).unwrap_or(from);<br>            for (i, call) in tx.calls.iter().enumerate() {<br>                // each call becomes its own row<br>            }<br>        }<br>        envelope =&gt; { /* legacy/EIP-1559/EIP-2930 */ }<br>    }</pre><p>Proper signature recovery matters here. When a transaction is sponsored, the fee payer is a different address than the sender, and you need to recover it from a separate signature field. tempo-alloy handles that. The cost is coupling to their release cadence, but for a chain-specific indexer that trade-off is fine.</p><h4>Building the CDC pipeline</h4><p>With events handled by rindexer and transaction decoding sorted, I needed to bridge the gap: poll blocks, decode the Tempo-specific fields that rindexer can’t see, and write structured data to ClickHouse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*_j-6vZLlmqRGkevrabn3Hw.png" /></figure><p>The architecture is a straightforward CDC (Change Data Capture) pattern. A single Rust binary runs a poll loop: read the cursor, fetch blocks from the RPC in parallel batches, decode, write to ClickHouse, advance the cursor.</p><p>The key design choice was flattening batched transactions. Each call inside a 0x76 transaction gets its own row in ClickHouse. A single transaction with three calls produces three rows, each linking back to the parent tx_hash via a call_index. This makes it trivial to query “show me all calls to the DEX contract” without parsing nested JSON. The flattening costs some storage but makes every downstream query simpler.</p><p>The block cursor lives in ClickHouse itself, a ReplacingMergeTree table that the worker updates after each batch. On startup, it checks the cursor first, falls back to max(block_number) from the blocks table, then defaults to block 0 (backfill) or chain tip (live mode). Three-tier resolution means I can blow away the cursor table without losing progress.</p><p>Fetching happens in parallel with bounded concurrency, 10 concurrent RPC calls per batch, each getting a block plus its receipts. Results are sorted by block number and processed in order, stopping at the first gap. If block 1005 fails but 1004 and 1006 succeed, I write up to 1004 and retry from there. ReplacingMergeTree makes partial writes safe, duplicates get deduplicated at merge time.</p><p>The satisfying moment was watching the worker catch up from block 0 across 8.4 million blocks. Batch logs ticking over, the “behind” count dropping, then settling into a steady poll rhythm at 200ms intervals against 500ms block times.</p><h4>The token discovery puzzle</h4><p>This one was my favorite problem. TIP-20 tokens on Tempo are precompiles at 0x20C0… addresses; they have no deployment bytecode and no creation transaction. You can’t watch for contract deployments to discover them.</p><p>First attempt: hardcode the known tokens. Works for a demo. Breaks the moment someone creates a new token.</p><p>Second attempt: the TIP20Factory precompile emits TokenCreated events, which rindexer already indexes into ClickHouse. Query that table, get token addresses with names and symbols. This covers every factory-created token.</p><p>Third: I noticed tokens appearing in RebalanceSwap and OrderPlaced events that had no corresponding TokenCreated entry. Some tokens predate the factory, or were created through a different path. So I wrote a discovery query that scans all the rindexer event tables for token addresses not yet in the map.</p><p>Fourth: for every unknown address, make raw eth_call requests with the symbol() and name() selectors, decode the ABI-encoded string response, and persist the result back to ClickHouse. This way I never hit the RPC for the same token twice across restarts.</p><p>The runtime keeps an in-memory HashMap behind an RwLock, refreshed every 60 seconds. The three-layer resolution: factory events, persisted RPC-resolved metadata, live RPC fallback, handles every token I’ve seen so far without a single hardcoded address.</p><p>I should have built this before hardcoding anything. The three-layer approach is simple enough that it could have been the first implementation, and I would have avoided the “why is this token showing as 0x20C0…” phase entirely.</p><h4>The dual gas lane surprise</h4><p>When I first visualized gas utilization, I showed a single percentage. It was meaningless.</p><p>Tempo blocks have four gas fields: general_gas_limit, shared_gas_limit, general_gas_used, and payment_gas_used. The general lane handles computation-heavy transactions (DEX orders, contract calls). The payment lane handles stablecoin transfers. Each has its own limit, with shared overflow capacity between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pPJgB6cmetapAg6qgwZ0qQ.png" /></figure><p>A single “38.7% gas utilization” number hides the entire story. The payment lane carries disproportionate value relative to gas consumed; stablecoin transfers are cheap in gas terms but represent the bulk of economic activity. To show the real picture, I had to split the computation per lane.</p><p>This is the kind of insight you only get by building the visualization yourself. The raw data was correct from the start, the story it told depended entirely on how you rendered it.</p><h4>What the data told me</h4><p>After indexing 8.4 million blocks of testnet data, here’s what I actually learned about Tempo. The numbers are testnet-scale, what matters is the patterns, not the absolutes.</p><p><strong>**Fee sponsorship is real and heavily used — even on testnet.**</strong> Over 200,000 transactions have a fee payer that’s different from the sender. On a testnet. This isn’t a theoretical feature, someone is actively building sponsorship infrastructure. The keychain precompile (session keys with spending limits) enables this without custody risk — the sponsor authorizes a key with constraints, not a blank check. The indexer caught this by recovering both signatures from every 0x76 transaction and comparing them.</p><p><strong>**The Fee AMM is a genuinely novel primitive.**</strong> Instead of EIP-1559’s base fee mechanism, Tempo prices gas conversion through an AMM. When you pay fees in a stablecoin, the conversion rate is determined by a liquidity pool, not a protocol formula. I’m seeing roughly 1,000 Fee AMM swaps per day, enough activity to maintain price discovery, not enough to suggest gaming. Whether this produces more stable or more volatile gas pricing than EIP-1559 is the question I’ll be watching.</p><p><strong>**500ms block times, no reorgs.**</strong> Block times are deterministic, which makes the CDC pipeline dramatically simpler; no confirmation depth, no reorg handling, no orphan blocks. For an indexer builder, this is luxury. On Ethereum or Polygon, I’d need at least 12-block confirmation depth and a reorg reconciliation layer. On Tempo, I write data the moment I see a block and never look back.</p><p><strong>**Stablecoin volume will be the real economic indicator.**</strong> On a chain with no gas token, market cap and TVL are the wrong metrics. What matters is payment flow. The testnet volume is obviously not meaningful in dollar terms, but the infrastructure is already there and the dual gas lane design ensures that payment activity can never be crowded out by DEX speculation, which is a guarantee no other chain makes at the protocol level.</p><p><strong>**DEX fill rate patterns are worth watching.**</strong> The on-chain CLOB shows roughly 19K orders per day with a 27% fill rate on testnet. The absolute numbers will change on mainnet, but the ratio is interesting; most orders don’t fill, which is what you’d expect from a functioning limit order book with real spread dynamics rather than wash trading (which produces fill rates near 100%).</p><h4>What I’d do differently</h4><p>I should have started with reqwest + serde structs for the initial prototype instead of immediately reaching for tempo-alloy. The alloy integration is the right long-term choice, but it added friction during the exploration phase when I was still figuring out what the data looked like. Prototype with the simplest tool, migrate once you know the shape.</p><p>One thing I got right from day one: the WebSocket fan-out architecture. Broadcast channels per topic (swaps, transfers, fees, lanes, sponsors, streams) with a registry that routes webhook events to the right channel. Clients subscribe to what they care about, get snapshot replay on connect, and backpressure is handled per-channel. This pattern scaled cleanly from one dashboard client to many without touching any query logic.</p><h4>Try it</h4><p>The dashboard is live at <a href="https://sandglasses.xyz">sandglasses.xyz</a> real-time analytics on a payment-native chain.</p><p>If you’re curious about what this architecture looks like from the inside (dual gas lanes, sponsored transactions, an on-chain CLOB for stablecoins, gas priced through an AMM) the data is there. Point your own tools at Tempo’s RPC and see what you find.</p><p>Building this changed how I think about chain design. Most chains optimize for DeFi composability. Tempo optimized for payments, and then built DeFi on top of a payments-first architecture. The data suggests that’s a more interesting trade-off than it sounds.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd47a33bc313" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build your own StarkNet Token Faucet with Cairo]]></title>
            <link>https://medium.com/@0xexomonk/build-your-own-starknet-token-faucet-with-cairo-159d7755cb74?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/159d7755cb74</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[starknet]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Thu, 25 Aug 2022 20:07:35 GMT</pubDate>
            <atom:updated>2022-09-12T07:45:55.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Cairo : SmartContract Language on StarkNet" src="https://cdn-images-1.medium.com/max/1024/0*Jdnu3ZG8cd6sK0VQ.png" /><figcaption>Cairo : SmartContract Language on StarkNet</figcaption></figure><p>✨ This quick article is here for you to build your <strong>Cairo skills</strong>. We will cover different subjects through a simple project: Build your first <strong>ERC20</strong> token and deploy a <strong>custom Faucet </strong>💧 linked to this token. This will strongly increase your <strong>knowledge</strong> of <strong>Cairo</strong> and give you a first idea of what you can simply achieve with <strong>Cairo</strong> !</p><p>A faucet is a service that provides tests tokens to users, generally on a Testnet network. While these tokens have no ‘real world’ value, they enable users to experiment with <strong>Blockchain</strong> features, without having to spend real money on the mainnet.</p><figure><img alt="Crypto Faucet Free tokens" src="https://cdn-images-1.medium.com/max/580/0*MhpB5S0oxVly4GTJ.jpg" /></figure><p>First of all, I’ll summarize the Tech tools we will manipulate through this cool project :</p><ol><li>Timestamp manipulation on Cairo</li><li>Cairo Logic</li><li>ERC20 Standard: we will implement a simple ERC20 token</li><li>Testnet deployment script using <a href="https://github.com/software-mansion/starknet.py">Starknet.py</a></li></ol><h4>Project Setup</h4><p>If you’re new to Cairo, I am providing some simple command lines to get you a dedicated Coding environment for StarkNet :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26f311c71000df7132081ac73d5722a3/href">https://medium.com/media/26f311c71000df7132081ac73d5722a3/href</a></iframe><h3>A — Creating our Faucet 💧</h3><p>Let’s create a new Cairo contract under contracts/SimpleFaucet.cairo and add the declaration and imports on the first lines :</p><pre>// contracts/SimpleFaucet.cairo</pre><pre>%lang starknet</pre><pre>from starkware.cairo.common.cairo_builtins import HashBuiltin<br>from starkware.cairo.common.math_cmp import is_le<br>from starkware.cairo.common.bool import TRUE, FALSE<br>from starkware.cairo.common.uint256 import Uint256<br>from starkware.starknet.common.syscalls import get_caller_address, get_block_timestamp<br>from openzeppelin.access.ownable.library import Ownable</pre><pre>from openzeppelin.token.erc20.IERC20 import IERC20</pre><p>This <strong>SmartContract</strong> has the purpose of allowing anyone to mint new tokens given a specific ERC20 token.</p><p>First of all, let’s think about what we need as Storage for our faucet :</p><ul><li>The <strong>ERC20 token address</strong> we want to Faucet on</li><li>The <strong>amount of token </strong>a user is allowed to mint per transaction</li><li>The <strong>limitation time</strong> between each mint</li><li>User’s <strong>next unlock time,</strong> will map user’s wallet to his next allowed faucet time. Works the same as a map in Solidity</li></ul><p>We will therefore use the @storage_var possibility of Cairo for that. Let’s see this in practice :</p><pre>//<br>// Storage<br>//</pre><pre># ERC20 token address<br>@storage_var<br>func token_address() -&gt; (address : felt){<br>}</pre><pre># Allowed Amount per mint<br>@storage_var<br><em>func</em> allowed_amount() -&gt; (withdraw_value : Uint256){<br>}</pre><pre># Timedelta between each mint<br>@storage_var<br><em>func</em> waiter() -&gt; (wait_time : felt){<br>}</pre><pre># Next unlock time per user<br>@storage_var<br><em>func</em> user_unlock_time(address : felt) -&gt; (unlock_time : felt){<br>}</pre><p>Nice ! You can still compile at this time using nile to check you are not doing anything wrong -&gt; nile compile contracts/SimpleFaucet.cairo</p><p>To <strong>initialize</strong> a Contract, we also need a constructor, which will provide the initial state of the SmartContract. The constructor here needs several attributes :</p><ul><li>owner : The owner address that can manage the SmartContract</li><li>_token_address : the ERC20 address we will create later on</li><li>_allowed_amount : the amount of token allowed per mint</li><li>_time : UNIX time we want to set between each mint</li></ul><pre>@constructor<br><em>func</em> constructor{<br>        syscall_ptr : felt*, <br>        pedersen_ptr : HashBuiltin*, <br>        range_check_ptr<br>    }(<br>    owner : felt, <br>    _token_address : felt, <br>    _allowed_amount : Uint256, <br>    _time : felt<br>){<br>    Ownable.initializer(owner);<br>    token_address.write(_token_address);<br>    allowed_amount.write(_allowed_amount);<br>    waiter.write(_time);<br>    return ();<br>}</pre><p>Our contract has now its constructor ! Great job.</p><p>Let’s go into more detail now and implement the core functions. The main utility of a <strong>faucet</strong> will be to check whether a user is allowed to mint or not. We therefore need to create this dedicated function that will read our user_unlock_time variable and check if it’s <strong>unlock_time</strong> has past the current block timestamp : user_unlock_time &lt;= timestamp. We’ve imported such a utility at the <strong>beginning</strong> of this file!</p><ul><li>get_block_timestamp()</li></ul><pre>@view<br><em>func</em> isAllowedForTransaction{<br>        syscall_ptr : felt*, <br>        pedersen_ptr : HashBuiltin*, <br>        range_check_ptr<br>    }(address : felt) -&gt; (success : felt){<br>    alloc_locals;<br>    let (unlock_time : felt) = user_unlock_time.read(address);<br>    if (unlock_time == 0){<br>        return (TRUE,);<br>    }<br>    let (timestamp : felt) = get_block_timestamp();<br>    let (unlock_time : felt) = user_unlock_time.read(address);<br>    let (_is_valid : felt) = is_le(unlock_time, timestamp);<br>    if (_is_valid == TRUE){<br>        return (TRUE,);<br>    }<br>    return (FALSE,);<br>}</pre><p>Tada ! We are <em>fancy</em> and adding a @view <strong>decorator</strong> here in order to be able to use it through the <strong>ABI</strong> later on for example !</p><p>This is now our final step for this simple faucet SmartContract, you’re almost there ! Indeed, we now need an external function that can also be used through the ABI in order for a user to mint their tokens. For sure we will use the previously created function and deal with the <strong>ERC20</strong> token.<br>We will go through an important concept of Cairo : <strong>Interface manipulation</strong>.</p><p>To put it in simple words, we’re going to manipulate a “ghost” contract that only have declared functions, and is <strong>morphing</strong> its behavior given a ERC20 token address (that’s why we needed the storage var !)</p><p>For that, we imported the OpenZeppelin Interface for an ERC20 contract : IERC20</p><pre>@external<br><em>func</em> faucet_mint{<br>        syscall_ptr : felt*, <br>        pedersen_ptr : HashBuiltin*, <br>        range_check_ptr<br>    }() -&gt; (success : felt){<br>    alloc_locals;</pre><pre>    let (caller_address : felt) = get_caller_address();<br>    let (_allowed_amount : Uint256) = allowed_amount.read();<br>    let (_is_allowed : felt) =<br>isAllowedForTransaction(caller_address);<br>    if (_is_allowed == TRUE){<br>        let (timestamp : felt) = get_block_timestamp();<br>        let (_time_to_wait : felt) = waiter.read();<br>        user_unlock_time.write(caller_address, timestamp + _time_to_wait);<br>        let (token : felt) = token_address.read();<br>        let (success : felt) = IERC20.transfer(<br>contract_address=token, recipient=caller_address, amount=_allowed_amount<br>);<br>        with_attr error_message(&quot;Faucet Mint Failed&quot;){<br>            assert success = TRUE;<br>        }<br>        return (TRUE,);<br>    }<br>    return (FALSE,);<br>}</pre><p>Let’s notice the Interface utilization : the IERC20 Interface, as any interface, will always take the contract_address argument to morph the used function to this address, and finally, we pass arguments as usual.</p><p>Magnificent, we manage to finish our Faucet Contract, and he’s now ready to be deployed. First of all, ensure it’s compiling using nile compile contracts/SimpleFaucet.cairo</p><h3>B —Simple ERC20 Token</h3><p>Building an ERC20 is quite a fast task if we don’t want to focus on specific use cases. Let’s use a simple ERC20 implementation that uses basic functions from the standard :</p><p><a href="https://github.com/ExoMonk/cairo-timestamp-scheduler/blob/main/contracts/SimpleERC20.cairo">cairo-timestamp-scheduler/SimpleERC20.cairo at main · ExoMonk/cairo-timestamp-scheduler</a></p><p>Don’t forget to compile !</p><h3>C— Deployment</h3><p>This is the final stage of the project. You have done really cool stuff here ! Now it’s time to go live on the Testnet ! ✨</p><p>There’s plenty of tools on the StarkNet ecosystem to deploy contract, today we’ll use Starknet.py one with Python !</p><p>pip install starknet.py</p><p>Here is our Deployment Script : (Make sure you update to your needs, especially the OWNER constant that must be one of your wallet addresses (ArgentX/Braavos)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4df5c77026ddca103ca3972d5974fc5c/href">https://medium.com/media/4df5c77026ddca103ca3972d5974fc5c/href</a></iframe><p>Once you’re ready to deploy, run python scripts/deploy.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WT30tigvYyOIv02knE4p6w.png" /></figure><p>You’ve been able to deploy both Contracts to the TestNet and they’re ready to be used ! Bravo</p><p>Head to <a href="https://goerli.voyager.online/">Voyager Testnet </a>website and check your contracts ! You’lle be able to easily interact with them using readContract and writeContract page.</p><ol><li>Step 1 : Fund the Faucet by transferring tokens from your wallet to the Faucet using the transfer functions</li><li>Step 2 : Use the Faucet contract to mint your tokens from a different wallet !</li></ol><p>And voilà !</p><p>Thanks for reading, I hope you’ve been able to reproduce it easily and learned about Interface, ERC20, Timestamp and Faucet on Cairo !</p><p>I am providing you with the complete GitHub repository right here :</p><p><a href="https://github.com/ExoMonk/cairo-timestamp-scheduler">GitHub - ExoMonk/cairo-timestamp-scheduler: Cairo StarkNet : Limit user&#39;s actions by time</a></p><p>Thanks for reading,</p><p>Exo</p><p><a href="https://twitter.com/0xExoMonk">https://twitter.com/0xExoMonk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=159d7755cb74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Account Abstraction on Zk Rollups & Ethereum: Tech guy PoV]]></title>
            <link>https://medium.com/@0xexomonk/blockchains-demystifying-account-abstraction-on-zk-rollups-ethereum-smart-contracts-c7ae864bc542?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7ae864bc542</guid>
            <category><![CDATA[starknet]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 15:38:08 GMT</pubDate>
            <atom:updated>2022-07-29T16:15:40.830Z</atom:updated>
            <content:encoded><![CDATA[<p>While today our crypto wallet are (only) used to access and manage our Cryptocurrencies, NFTs, integrate some staking options, I think there’s so much more things to do as an Account point of view. <a href="https://starkware.co/starknet/"><strong>StarkNet</strong></a> &amp; <a href="https://zksync.io/"><strong>ZkSync</strong></a> introduced a long-term feature that followed Vitalik’s vision : <strong>Abstraction of Account.</strong></p><figure><img alt="Crypto wallet on blockchain transfer money with tokens" src="https://cdn-images-1.medium.com/max/1024/0*HXLCIfgBTnywvsP6.jpg" /></figure><p><strong>Sir, What’s Abstraction ?</strong></p><p>The abstraction process is the practice of hiding information. This increases the ability of a computer system to be used at a higher level with less knowledge of the processes going on underneath.</p><p><strong>In a programmer PoV, let’s say he hides all but the relevant data about an object in order to reduce complexity and increase efficiency</strong>.</p><figure><img alt="Developer : Abstraction theme" src="https://cdn-images-1.medium.com/max/780/0*xdq5UY7yhidrluO9.jpg" /></figure><h3>Account Abstraction definition</h3><figure><img alt="Ethereum Account Abstraction Blockchain" src="https://cdn-images-1.medium.com/max/1024/1*FLdaSUoGvzHCJb7QhiphUA.jpeg" /></figure><p>On the Ethereum network there are currently two types of accounts.</p><ul><li><strong>EOA</strong> : External Owned Accounts are wallets from which cryptocurrency is transacted in send and receive functions that exist outside of the EVM (Ethereum Virtual Machine) : Cold Wallets as Ledger, MetaMask, Phantom, …</li></ul><figure><img alt="Metamask crypto wallet" src="https://cdn-images-1.medium.com/max/936/0*wtGy4qSHYCobKkbS.jpg" /></figure><ul><li>Contract accounts are “<strong>Smart Contracts</strong>” that exist in the EVM. For example pools on <a href="https://app.uniswap.org/">Uniswap</a> are basically Smart Contracts.</li></ul><p><a href="https://eips.ethereum.org/EIPS/eip-2938"><strong>Ethereum account abstraction</strong></a> has the goal of reducing from two account types down to one, a <strong>Contract Account</strong>. The single account type will have the functionality to transact both tokens and contract. Developer and user will no longer need to make a distinction between account type since transacting will be moved fully into the EVM and off of the blockchain protocol.</p><h4>External Owned Account precision</h4><p>EOAs have three properties:</p><ul><li>A balance to represent the amount of ETH available to the account</li><li>A nonce to ensure that every transaction is unique</li><li>An address to uniquely identify the account on the network</li></ul><p>It’s important to mention that on <strong>Ethereum</strong>, every transaction <strong>must</strong> be initiated from an <strong>EOA</strong>. That means that when a transaction is executed by the <a href="https://medium.com/mycrypto/the-ethereum-virtual-machine-how-does-it-work-9abac2b7c9e">Ethereum Virtual Machine (EVM)</a> , the first account being touched must be an EOA and the corresponding account must pay a fee to the miner for the execution of the entire transaction.</p><p>Every account on Ethereum is associated with a cryptographic object called the <strong>Keypair</strong> :</p><ul><li><strong>Private Key : </strong>used to sign digital messages</li><li><strong>Public Key : </strong>allows anyone to verify that a given signature was signed by its corresponding private key</li></ul><h3>Account Abstraction on StarkNet and ZkSync</h3><p>As of today, <strong>StarkNet</strong> and <strong>ZkSync 2.0</strong> are the most advanced in terms of Account Abstraction and they both manage to implement it in a way.</p><p>AA holds two main goals :</p><ul><li>Signature abstraction: allow different account contracts to use different signature validation schemes.</li><li>Payment abstraction : Allow different models of payment for transactions. For example, payment by another party/contract or pay in another token than ETH</li></ul><p>The model of <strong>StarkNet Account</strong> are still represented by contracts, so-called “<strong>account contracts</strong>”. To put it in simple word : <strong>Any Cairo Smart Contract</strong> deployed on StarkNet can be an Account, the <strong>only</strong> requirement is that they comply with a specific interface with methods to <strong>validate</strong> and <strong>execute</strong> transactions.</p><figure><img alt="Cairo Starknet developer code" src="https://cdn-images-1.medium.com/max/894/1*Il08oCL594cXRB3gyq7ExA.png" /></figure><p>On ZkSync side, an account has also 2 functions to implement : validateTransaction &amp; isValidSignature</p><figure><img alt="ZkSync Solidity developer code" src="https://cdn-images-1.medium.com/max/1024/1*nrethS1WLRGF_tZV2QJSUw.png" /></figure><p>With this abstraction, we directly see opportunity :</p><ul><li>Using Multiple keypairs to validate a transaction (simply put multi-sig all-in-one)</li><li>Changing the Keypair of you Account (like rotating keys)</li><li>Using a different signing scheme than ECDSA</li></ul><h3><strong>What could it bring ?</strong></h3><p>This could be the most important part of this story : let’s go more deeply on the <strong>use cases</strong> of Account Abstraction. We can split these use case in two different domain :</p><ul><li>User Simplification</li><li>Technical Use Cases</li></ul><h4>User Simplification : Session Keys</h4><p>Let’s say you are playing an On-Chain game : currently you need to sign every single transaction by your own. It means each time you have to make an action, you need to sign a transaction :</p><p>Collect rewards, move your character, send a message, …</p><figure><img alt="NFT game blockchain" src="https://cdn-images-1.medium.com/max/1000/0*pNI2Xm32sNA1IUtM.png" /></figure><p><strong>Session Key</strong> is basically the idea to authorized to play games for a certain period of time. We <strong>generated</strong> a session key held in the browser’s local storage and only authorized to sign transactions for 10 minutes. After these 10 minutes, the key will be revoked and you will need to create a new one and authorize it again.</p><p>In that extend, you can also imagine creating <strong>batch transactions</strong> : the same abstraction as you would be in a Supermarket, choosing product, and paying only one time at the end.</p><h4><strong>User Simplification : Transaction automation and splitting rights</strong></h4><p>With Abstracted Account, you could implement a function which changes the main signing key of a given wallet, or even manage multiple signing keys. You could have your admin key in a cold wallet and other keys held on less secure devices and only authorized to perform certain actions.</p><p>A cool example :</p><p>My most secured key, that I don’t use much, would be the only key that can <strong>transfer or send</strong> more than 1k$ to another Account, however, I can also have those less secure key on my computer to perform actions such as <strong>claiming rewards</strong> on some specific decided dApps (AAVE, …) or another one to perform any transaction on an On Chain game.</p><p>Now let’s say those key are held in a server that performs automated transactions / running your own bot : you can ensure that these key can only be used to perform actions you decided and improve security.</p><p>One last utility could be a protocol built that DCA on your behalf certains token as a recurring transaction.</p><h4><strong>Technical Use Case : Paying fees for someone else</strong></h4><p>This is one of the most interesting thing you can do with Account Abstraction. basically imagine that an account can pay the fees of another account, how genuine is that ? I can only imagine how powerful it could be for a protocol to onboard their users by paying their fees.</p><h3>Final thoughts</h3><p>We have seen how Account Abstraction can be a game changer in blockchain future. I am personally deeply convinced that a new era of use cases will come with Abstracted account, especially regarding the video game industry on-chain. I hope you understood everything about Account Abstraction, and that I gave you some reflexion area around the subject !</p><p>Later I will propose you a story on how you can customize a Cairo Account Smart Contract on StarkNet and build a real use-case together.</p><p><strong>@</strong><a href="https://twitter.com/0xExoMonk"><strong>ExoMonk</strong></a></p><h3>Ressources</h3><ul><li><a href="https://docs.ethhub.io/ethereum-roadmap/ethereum-2.0/account-abstraction/">https://docs.ethhub.io/ethereum-roadmap/ethereum-2.0/account-abstraction/</a> — Account Abstraction, EthHub</li><li><a href="https://www.argent.xyz/blog/wtf-is-account-abstraction/">https://www.argent.xyz/blog/wtf-is-account-abstraction/</a></li><li><a href="https://github.com/argentlabs/argent-contracts-starknet">https://github.com/argentlabs/argent-contracts-starknet</a> — Cairo ArgentX Account implementation</li><li><a href="https://github.com/sambarnes/cairo-multisig">https://github.com/sambarnes/cairo-multisig</a> — Cairo MultiSig Account Contract</li><li><a href="https://matterlabs.medium.com/introducing-account-abstraction-l2-l1-messaging-and-more-760282cb31a7">https://matterlabs.medium.com/introducing-account-abstraction-l2-l1-messaging-and-more-760282cb31a7</a> — ZkSync2.0 Account Abstraction</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7ae864bc542" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starknet and Cairo developer Ultimate intro guide]]></title>
            <link>https://medium.com/@0xexomonk/starknet-and-cairo-developer-ultimate-intro-guide-b97f2d08a1e5?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/b97f2d08a1e5</guid>
            <category><![CDATA[stakrnet]]></category>
            <category><![CDATA[cairo]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[web3]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Fri, 03 Jun 2022 19:02:40 GMT</pubDate>
            <atom:updated>2022-07-29T07:54:53.547Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Starknet, Hello Cairo" src="https://cdn-images-1.medium.com/max/1024/1*7Yjbn0X7ipERsSoGbvgDPg.png" /></figure><p>If you are not familiar with <strong>StarkNet</strong>, a recent <strong>Zk</strong>-Rollup, you may read this presentation before : <a href="https://medium.com/@0xexomonk/starkware-x-starknet-x-layer-3-the-ultra-scalable-ecosystem-71d6a46a811d">StarkNet Overview</a></p><p><strong>Cairo </strong>is one of the most interesting <strong>languages </strong>I’ve used, It is a language that includes a simple syntax that is a beautiful mix between <strong>Python &amp; Rust</strong>. Cairo is in fact the <strong>Smart Contract</strong> Langage for StarkNet. However, beyond its syntax, the language embeds much more complex notions, <strong>memory </strong>optimisation and allocation with pointers &amp; syscalls, <strong>powerful computation</strong> on chain, and so much more. You could even imagine building a Neural Network in Cairo, compile it and execute it<strong> on chain</strong> !</p><p>✨ It feels like a <strong>polyvalent </strong>langage right ?</p><p>It’s been now few months I have been involved into facing the <strong>Cairo learning curve</strong>. This read will overtake my Cairo developer point of view to accelerate your path for starting your <strong>StarkNet </strong>Journey.</p><h3>Your developer environment</h3><p>Let’s start with the basics : this will be assuming you are a first time Cairo user, and we will go through the process to easily setup your development environment.</p><p>First of all, you’ll need to get you either a <strong>Mac </strong>or <strong>Linux </strong>distribution. If you are on Windows, I suggest creating you a dedicated <strong>Docker </strong>environment where you’ll be able to setup.</p><p>Let’s deep dive onto the dependencies first : make sure you have python3 installed &amp; virtualenv ready and then run :</p><pre>sudo apt install -y libgmp3-dev  </pre><p>On mac :</p><pre>CFLAGS=-I`brew --prefix gmp`/include LDFLAGS=-L`brew --prefix gmp`/lib pip install ecdsa fastecdsa sympy</pre><p>Now you are ready to create your first project. We will be creating our working folder project : starknet-project<strong><em> </em></strong>and configure Starknet &amp; Cairo :</p><pre>mkdir starknet-project <br>cd starknet-project<br>python3 -m venv cairo-env <br>source cairo-env/bin/activate <br>pip install cairo-nile <br>pip install openzeppelin-cairo-contracts<br>nile install </pre><pre>...</pre><pre>✨  Cairo successfully installed!</pre><p>Good job ! Cairo is now installed on your environment and is ready to be used. We have been installing a simplifier tool called “nile” in order to ease our development process : <a href="https://github.com/OpenZeppelin/nile">https://github.com/OpenZeppelin/nile</a></p><p>Nile is basically a python development environment for developing <a href="https://www.cairo-lang.org/docs/hello_starknet/index.html">StarkNet</a> contracts, for additionnal resource, you can find a summary of mine <a href="https://bit.ly/3xhBem2"><strong>Right Here</strong></a> !</p><p>We have also installed the OpenZeppelin python library to import Cairo Smart Contract template : <a href="https://github.com/OpenZeppelin/cairo-contracts">Cairo-Contracts</a>.</p><p>Our projects is now fully setup and will be composed of 3 folders :</p><ul><li>contracts: Folder containing our .cairo Smart Contract</li><li>tests: Our testing folder to run while developping those Smart Contracts</li><li>artifacts: Folder that will be created once we will be compiling our Smart Contracts.</li></ul><h3>Testing our Installation</h3><p>To test our installation we are going to compile a <strong>Starknet </strong>Account Smart Contract and deploying it using <strong>Nile</strong>, and then <a href="https://github.com/0xs34n/starknet.js"><strong>StarknetJS</strong></a></p><p>Create a file under the contracts folder name ArgentAccount.cairo with this content :</p><pre># contracts/OZAccount.cairo  </pre><pre>%lang starknet  </pre><pre>from openzeppelin.account.Account import constructor</pre><p>This will simply use the OpenZeppelin template to deploy our Account Smart Contract.</p><p>Let’s deploy our Account on the Goerli network of Starknet, using our nile tool !</p><pre>nile compile contracts/OZAccount.cairo --account_contract</pre><pre>...</pre><pre>🔨 Compiling contracts/OZAccount.cairo<br>✅ Done</pre><p>The Smart Contract is now <strong>compiled </strong>under the artifacts folder and is ready to be <strong>deployed</strong>. We now have two schools : using <strong>CLI </strong>(nile way), or using a web3 intergation <strong>framework</strong>, that would act as EthersJS or Web3JS : <a href="https://github.com/0xs34n/starknet.js"><strong>Starknet.JS</strong></a></p><h4>Using Nile</h4><p>The Account constructor takes one argument : a Hex address you are going to pass to the nile deploy commande. You can easily generate a random one on the internet (For example <a href="https://randommer.io/bitcoin-address-generator">here</a>)</p><p>As you may have seen in the nile commande, we are going to use the deploy one :</p><pre>nile deploy OZAccount &lt;YOUR_GENERATED_ETH_ADDRESS&gt; --alias OzAcc --network goerli</pre><pre>...</pre><pre>🚀 Deploying OZAccount<br>⏳ ️Deployment of OZAccount successfully sent at XXX<br>🧾 Transaction hash: XXX<br>📦 Registering deployment as OzAcc in goerli.deployments.txt</pre><h4>Using StarknetJS</h4><p>We need to install starknet js using the following :</p><pre>npm install -g yarn<br>yarn init <br>yarn add starknet@next <br>touch index.js</pre><p>and add to package.json, the line :</p><pre>&quot;type&quot;: &quot;module&quot;</pre><p>Let’s build our file index.js now :</p><pre>import fs from &quot;fs&quot;;<br>import {<br>    Contract,<br>    defaultProvider,<br>    ec,<br>    json,<br>    stark,<br>} from &quot;starknet&quot;;</pre><pre>console.log(&quot;Reading Argent Account Contract...&quot;);<br>const compiledArgentAccount = json.parse(<br>    fs.readFileSync(&quot;./artifacts/OZAccount.json&quot;).toString(&quot;ascii&quot;)<br>);<br></pre><pre>// Generate public and private key pair.<br>const privateKey = stark.randomAddress();<br>const starkKeyPair = ec.genKeyPair(privateKey);<br>const starkKeyPub = ec.getStarkKey(starkKeyPair);<br></pre><pre>// Deploy the Account contract and wait for it to be verified on StarkNet.<br>console.log(&quot;Deployment Tx - Account Contract to StarkNet...&quot;);</pre><pre>const accountResponse = await defaultProvider.deployContract({<br>    contract: compiledArgentAccount,<br>    constructorCalldata: [starkKeyPub],<br>    addressSalt: starkKeyPub,<br>});</pre><pre>// Wait for the deployment transaction to be accepted on StarkNet<br>console.log(&quot;Waiting for Tx &quot;+ accountResponse.transaction_hash +&quot; to be Accepted on Starknet - Argent Account Deployment...&quot;)<br>await defaultProvider.waitForTransaction(accountResponse.transaction_hash);</pre><pre>console.log(&quot;✨ Account Deployed at &quot;+ starkKeyPub +&quot; !!&quot;)<br>console.log(accountResponse.address)</pre><pre>//Ready to be used !!!<br>const accountContract = new Contract(<br>    compiledArgentAccount.abi,<br>    accountResponse.address<br>);</pre><p>This file is pretty simple to understand :</p><ul><li>Part 1 : Reading our Compiling Smart Contracts with starknetJS</li><li>Part 2 : Generating a random Private and Public key</li><li>Part 3 : Deploy our Contract</li><li>Part 4 : Our contract is now deployed and ready to be used for further manipulations !</li></ul><p>We can now run and deploy our Account :</p><pre>node index.js</pre><pre>...</pre><pre>Reading Argent Account Contract...<br>Deployment Tx - Account Contract to StarkNet...<br>Waiting for Tx XXX<br>to be Accepted on Starknet - Argent Account Deployment...<br>✨ Account Deployed at XXX !!</pre><p>Perfect ! You are now fully operational for starting your Cairo Journey.<br>To finish with, I can only encourage you learning this langage, and we have such amazing resource I am sharing with you : some must have for your pathing on your Cairo Learning Curve.</p><h3>Ressources</h3><p><a href="https://github.com/l-henri/starknet-erc20">https://github.com/l-henri/starknet-erc20</a> — <strong>Build your own ICO in Cairo</strong></p><p><a href="https://bit.ly/3zgsde3">https://bit.ly/3zgsde3</a> — <strong>Nile + StarknetJS Tutorial</strong></p><p><a href="https://bit.ly/3xhBem2">https://bit.ly/3xhBem2</a> — <strong>Nile Cheat Sheet</strong></p><p><a href="https://t.co/hiOqeA7Yix">https://t.co/hiOqeA7Yix</a> — <strong>Starknet interactive tutorial</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b97f2d08a1e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cutting edge setup a Web3 development environment]]></title>
            <link>https://medium.com/@0xexomonk/cutting-edge-setup-a-web3-development-environment-3025bf7bf05?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/3025bf7bf05</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Mon, 09 May 2022 16:01:04 GMT</pubDate>
            <atom:updated>2022-05-09T16:11:16.903Z</atom:updated>
            <content:encoded><![CDATA[<p>This post will overtake one of the main root cause of today’s flea regarding software development, coding and building applications : your<strong> development environment</strong>. While you are building any kind of application, one of the biggest issue is the way you start the development and how you configuring your environment. How many time have you <strong>failed </strong>forking a project because of your environment or the project’s configuration flaws?</p><figure><img alt="HardHat EtherJS and Waffle presentation : Building on Ethereum" src="https://cdn-images-1.medium.com/max/1024/1*MdL0dt85HXPbx9sjmygNCA.png" /></figure><p>When building <strong>Web3 applications</strong>, our ultimate goal is to deploy our Smart Contract on the mainnet of EVM-enabled blockchains (Ethereum, Layer2, …) where it can be used by the everyone. But smart contracts are <strong>immutable </strong>and deploying on the mainnet is expensive. We don’t want to deploy on the mainnet until our code is tested and our data structures are finalized. While our dApp is in development, we want to be able to experiment and evolve our data structures and simulate transactions using test accounts.</p><p>In this post, I will cover :</p><ul><li>Global Setup</li><li>Project Setup</li><li>Smart Contract deployment configuration and tests</li><li>Introduction on how to configure a ReactJS Web3 dApp</li></ul><h3>Backbone of your setup</h3><p>At first, you need the <strong>backbone </strong>of a specific setup configuration for a project. Most of them will be using a specific <strong><em>node </em></strong>and <strong><em>npm </em></strong>configuration and packages. Therefore we will need to check that we have all the card in our hands to handle it.</p><p><a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">Downloading and installing Node.js and npm | npm Docs</a></p><pre>node -v<br>v16.14.0<br>npm -v<br>8.3.1</pre><p>Once you’re sure about your NodeJS installation, we will need to install 2 main packages for all of our projects : <strong><em>yarn </em></strong>&amp; <strong>npx</strong>.</p><pre>npm install -g npx <br>npm install -g yarn <br>mkdir template_project<br>cd template_project</pre><h3>Installing hardhat and web3 packages</h3><h4>Harhdat</h4><p><a href="http://hardhat.org/"><strong>Hardhat</strong></a><strong> </strong>is a “task runner for Ethereum smart contract developers”. In practice, Hardhat helps you <strong>bootstrap your Solidity project</strong> with a template and give you all the scaffolding needed to test out your smart contracts and ultimately deploy onto an EVM-enabled Blockchain.</p><p>Some of you may know Truffle instead, it was standard procedure to use Truffle’s init, compile, test, and migrate features to bootstrap your Solidity projects. Some killer features Hardhat touts are stack traces when your Solidity contracts revert and logging system ! I can only encourage you to try it out.</p><h4>Waffle</h4><p>Hardhat is to be used with<strong> </strong><a href="https://ethereum-waffle.readthedocs.io/en/latest/index.html"><strong>Ethereum Waffle</strong></a>, a lightweight test runner for Ethereum smart contracts. It has some really nice testing utils built in like Chai matchers for Ethereum addresses, hashes, and BigNumbers, it’s Typescript native, and plays really nicely with EthersJS.</p><h4>Ethers</h4><p><a href="https://docs.ethers.io/ethers.js/html/index.html">Ethers.js</a> si the SDK for interacting with the Ethereum blockchain. Also really similar to web3JS, yet it is really easy to get set up. I ask anyone who is used to working with Web3.js to give Ethers a try.</p><pre>yarn add --dev hardhat <br>yarn add dotenv ethers @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers</pre><h3>Project Configuration</h3><p>We will start the last part of our setup : configure precisely your project and use testnet to check your project’s health.</p><p>Hardhat is here to help you, let’s run our first command:</p><pre>npx hardhat</pre><pre>888    888                      888 888               888<br>888    888                      888 888               888<br>888    888                      888 888               888<br>8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888<br>888    888     &quot;88b 888P&quot;  d88&quot; 888 888 &quot;88b     &quot;88b 888<br>888    888 .d888888 888    888  888 888  888 .d888888 888<br>888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.<br>888    888 &quot;Y888888 888     &quot;Y88888 888  888 &quot;Y888888  &quot;Y888</pre><pre>Welcome to Hardhat v2.9.3</pre><pre>? What do you want to do? ...<br>&gt; Create a basic sample project<br>  Create an advanced sample project<br>  Create an advanced sample project that uses TypeScript<br>  Create an empty hardhat.config.js<br>  Quit</pre><pre>√ What do you want to do? · Create a basic sample project</pre><p>This will install a few more dependencies for development and testing. You should now see a few more files and folders in your project:</p><ul><li><strong>test</strong>: This folder contains a test script written in Chai and it is used to test our smart contract</li><li><strong>hardhat.config.js</strong>: This file contains the configuration for Hardhat</li><li><strong>scripts</strong>: This folder contains a sample script to show to deploy a smart contract</li><li><strong>contracts</strong>: This is the folder, which includes the files, in which we write our smart contract code.</li></ul><p>An object is exported from hardhat.config.js to set up your project. This object can have entities like <em>defaultNetwork, networks, solidity, paths and mocha.</em></p><p>In order to ease your move between local, testnet and mainnet, we added the dotenv package, in order to set environment variable through a .env file :</p><pre>touch .env<br>//Windows<br>echo &gt; .env</pre><p>and add your testnet / mainnet private key and RPC :</p><pre>RINKEBY_ALCHEMY_API_KEY = &quot;&quot;</pre><pre>GOERLI_ALCHEMY_API_KEY = &quot;&quot;</pre><pre>MAINNET_ALCHEMY_API_KEY = &quot;&quot;</pre><pre>PRIVATE_KEY = &quot;&quot;</pre><p><strong>Network Configuration:</strong></p><p>There are two kinds of networks in Hardhat: JSON-RPC based networks, and built-in Hardhat Network.</p><p>The default network is “<strong><em>hardhat</em></strong>” but you can customize which network to be used as default while running Hardhat by setting <em>defaultNetwork </em>field on your hardhat.config.js file. It will somehow look something like this :</p><pre>require(&quot;@nomiclabs/hardhat-waffle&quot;);<br>require(&quot;dotenv&quot;).config();</pre><pre>module.exports = {<br>    defaultNetwork: &quot;hardhat&quot;,<br>    networks: {<br>        hardhat: {},<br>        rinkeby: {<br>            url: &quot;https://eth-rinkeby.alchemyapi.io/v2/&quot;+process.env.RINKEBY_ALCHEMY_API_KEY,<br>            accounts: [process.env.PRIVATE_KEY]<br>        },<br>        goerli: {<br>            url: &quot;<a href="https://eth-goerli.alchemyapi.io/v2/">https://eth-rinkeby.alchemyapi.io/v2/</a>&quot;+process.env.RINKEBY_ALCHEMY_API_KEY,<br>            accounts: [process.env.PRIVATE_KEY]<br>        },<br>    },<br>    solidity: {<br>        version: &quot;0.8.7&quot;,<br>        settings: {<br>            optimizer: {<br>                enabled: true,<br>                runs: 200<br>            }<br>       }<br>    },<br>    paths: {<br>        sources: &quot;./contracts&quot;,<br>        tests: &quot;./test&quot;,<br>        cache: &quot;./cache&quot;,<br>        artifacts: &quot;./artifacts&quot;<br>    },<br>    mocha: {<br>        timeout: 40000<br>    }<br>};</pre><h3>Hardhat command and testing</h3><p>This is the last part before you can really start building on your project : Testing. You will need to become familiar with hardhat commands in order to be comfortable with testing, debugging and deploying Smart Contracts :</p><ul><li>npx hardhat node — Run the node task to start a JSON-RPC server on top of Hardhat Network (your local ethereum blockchain)</li><li>npx hardhat test — To run tests stored in the test folder</li><li>npx hardhat compile — To compile the entire project, building your smart contracts</li><li>npx hardhat clean — To clean the cache and delete compiled smart contracts</li><li>npx hardhat run —-network &lt;network&gt; script/path — To run a specific script in a specific network</li></ul><p>For basic development on a local environment, you will need to run in a separate shell :</p><pre>npx hardhat node</pre><p>and</p><pre>npx hardhat run scripts/sample-script.js<br>//If you want to run it on a testnet <br>npx hardhat run --network rinkeby scripts/sample-script.js</pre><p>And voilà !</p><h3>Configure a web3 dApp</h3><p>To finish with, I will show you how to quickly setup a web3 dApp given all you have been able to read.</p><h4>Connect Metamask to localhost</h4><p>Copy any private key from the account that was logged into your shell when you run the npx hardhat node command and import it to Metamask.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d0yfRSpuEwcOo9D-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*boeYpvnTeyXS0EGr" /></figure><h4>Web App to connect Metamask</h4><ol><li>Create a React.JS application</li></ol><pre>npm install -g create-react-app<br>mkdir template_dapp_project<br>cd template_dapp_project<br>npx create-react-app ./<br>rm README.md</pre><p>2. Install dependencies and configure hardhat</p><pre>yarn add --dev hardhat<br>yarn add dotenv ethers @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers<br>npx hardhat</pre><pre>√ What do you want to do? · Create a basic sample project</pre><p>Run your node (npx hardhat node) and deploy you contract :</p><pre>npx hardhat run scripts/sample-script.js</pre><p>3. Configure setup files</p><p>.env</p><pre>RINKEBY_ALCHEMY_API_KEY = &quot;&quot;<br>GOERLI_ALCHEMY_API_KEY = &quot;&quot;<br>MAINNET_ALCHEMY_API_KEY = &quot;&quot;<br>PRIVATE_KEY = &quot;&quot;</pre><p>hardhat.config.json</p><pre>require(&quot;@nomiclabs/hardhat-waffle&quot;);<br>require(&quot;dotenv&quot;).config();</pre><pre>module.exports = {<br>    defaultNetwork: &quot;hardhat&quot;,<br>    networks: {<br>        hardhat: {},<br>        rinkeby: {<br>            url: &quot;https://eth-rinkeby.alchemyapi.io/v2/&quot;+process.env.RINKEBY_ALCHEMY_API_KEY,<br>            accounts: [process.env.PRIVATE_KEY]<br>        },<br>        goerli: {<br>            url: &quot;<a href="https://eth-goerli.alchemyapi.io/v2/">https://eth-rinkeby.alchemyapi.io/v2/</a>&quot;+process.env.RINKEBY_ALCHEMY_API_KEY,<br>            accounts: [process.env.PRIVATE_KEY]<br>        },<br>    },<br>    solidity: {<br>        version: &quot;0.8.7&quot;,<br>        settings: {<br>            optimizer: {<br>                enabled: true,<br>                runs: 200<br>            }<br>       }<br>    },<br>    paths: {<br>        sources: &quot;./contracts&quot;,<br>        tests: &quot;./test&quot;,<br>        cache: &quot;./cache&quot;,<br>        artifacts: &quot;./src/artifacts&quot;<br>    },<br>    mocha: {<br>        timeout: 40000<br>    }<br>};</pre><p>3. Update your App.js file and run your app !</p><pre>import React, { useEffect } from &quot;react&quot;; <br>import Greeter from &quot;./artifacts/contracts/Greeter.sol/Greeter.json&quot;; <br>import { ethers } from &quot;ethers&quot;;   </pre><pre>function App() {   <br>  const connectWallet = async () =&gt; {     <br>    try {       <br>      const { ethereum } = window;        <br>      if (!ethereum) {         <br>        alert(&quot;Please install MetaMask!&quot;);         <br>        return;       <br>      }        <br>      const accounts = await ethereum.request({         <br>        method: &quot;eth_requestAccounts&quot;,       <br>      });        <br>      console.log(&quot;Connected&quot;, accounts[0]);       <br>      fetchGreetings();     <br>    } catch (error) {console.log(error);}<br>  };    </pre><pre>  const fetchGreetings = async () =&gt; {     <br>    let contractAddress = &quot;DEPLOYED_ADDRESS&quot;;     <br>    const { ethereum } = window;      <br>    if (!ethereum) {         <br>      alert(&quot;Please install MetaMask!&quot;);         <br>      return;       <br>    }        <br>    const provider = new ethers.providers.Web3Provider(ethereum);           <br>    const signer = provider.getSigner();     <br>    const contract = new ethers.Contract(       <br>      contractAddress,       <br>      Greeter.abi,       <br>      provider     <br>    );      <br>    const greeting = await contract.greet();     <br>    console.log(greeting);   <br>  };    </pre><pre>  useEffect(() =&gt; {     <br>    connectWallet();   <br>  }, []);    </pre><pre>  return &lt;div&gt;&lt;/div&gt;; <br>}</pre><pre>export default App;</pre><p>Run :</p><pre>yarn start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*Ji8ip1XyyYzjX4iB1aYEkA.png" /></figure><p>You have now all the keys in your hands to start working on a clean environment !</p><p><a href="https://twitter.com/0xExoMonk">https://twitter.com/0xExoMonk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3025bf7bf05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StarkWare x StarkNet x Layer 3+ : The Ultra Scalable ecosystem]]></title>
            <link>https://medium.com/@0xexomonk/starkware-x-starknet-x-layer-3-the-ultra-scalable-ecosystem-71d6a46a811d?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/71d6a46a811d</guid>
            <category><![CDATA[starknet]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Thu, 21 Apr 2022 16:32:36 GMT</pubDate>
            <atom:updated>2022-04-21T16:32:36.358Z</atom:updated>
            <content:encoded><![CDATA[<h3>StarkWare x StarkNet x Layer 3+ : The Ultra Scalable ecosystem</h3><p>The emergence of new blockchains &amp; the technical improvements they bring are more and more felt. We see the interest of Layer 2 growing and their development accelerating because of the need to increase the scalability of solutions.</p><p>In the continuation of this reflection, I propose a complete analysis of the StarkNet environment, which brings many innovations in the possibilities that a Layer2 can offer.</p><p>The article will cover to begin with all the essential notions to understand the topics discussed (Zero Knowledge, ZkRollup, …). I think that anyone interested in cryptocurrencies and blockchain technology must assimilate this knowledge.</p><p>In a second time, I will present the parent company <a href="https://medium.com/u/373f5878a0c6">StarkWare</a> which develops StarkNet/StarkEx through the solutions that are built and will be built. This article will be technical but at the same time affordable. This will be done through an introduction to the Smart Contract language of StarkNet: Cairo and its specificities compared to Solidity in particular, and some atypical and innovative subtleties.</p><p>To finish with, I shall share with you a small list of projects under construction &amp; to be followed on the environment which will certainly play an important role in the explosion of the ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*HXQ8Veg8RA_-JsPjoUQwtQ.png" /></figure><p>Glossary :</p><ul><li>ZKP = Zero Knowlegde Proof</li><li>ZKSTARK = Zero-Knowledge Scalable Transparent ARguments of Knowledge</li><li>Rollup = Off-chain aggregation of transactions from a Smart Contract ETH</li><li>ZK-Rollup = Rollup using ZKP</li><li>Scalabilité = <a href="https://medium.com/starkware/redefining-scalability-5aa11ffc5880">https://medium.com/starkware/redefining-scalability-5aa11ffc5880</a></li><li>SHARP = Shared Prover</li></ul><h3>Zero Knowledge, ZKSTARK &amp; Rollup</h3><p>Let’s start with the basics of vocabulary, you will see that the terms may seem barbaric, but in the end they are as soft as cotton.</p><h4>Zero Knowledge Proof</h4><p>While blockchain has brought us great benefits such as transparency, immutability &amp; decentralization, the notion of privacy is rarely discussed. This is where Zero Knowledge Proof (<strong>ZKP</strong>) comes in: a juicy mix of composability, privacy &amp; immutability.</p><p><strong>ZKP </strong>is an encryption scheme by which one party (the PROVIDER, which we will call PR) can prove the veracity of specific information to another party (the VERIFIER, which we will call VER) without disclosing any additional information.</p><p>In a concrete example, VER wants to collect a reward from a vault. In ZK, this gives:</p><ul><li>PR confidentially produces a key (K)</li><li>VER verifies that the key (K) allows to obtain the reward</li><li>The <strong>ZKP </strong>is verified, CQFD</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*hyzK_7w4C3dZEZBGdEKdbA.png" /></figure><p>In a same way, ZKP can also resolve:</p><ul><li>PR produces a key (K) and retrieves the reward from the vault confidentially</li><li>VER verifies that the reward corresponds to a reward that is only available in this same vault</li><li>The <strong>ZKP </strong>is verified, CQFD</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJpde_mk-zQ5fYCipdxlwQ.png" /></figure><p>In summary, the VER verifier will not know any information other than the boolean statement. The details of the other parties’ information and personal data remain anonymous.</p><p>As you can see, <strong>ZKP </strong>allows for privacy. But what is interesting with this method is that it is extremely simple, secure &amp; allows an incredible scalability, it is chosen by many blockchain applications for these virtues.</p><h4>Rollup &amp; Zk-Rollup</h4><p>An Ethereum Rollup is an off-chain aggregation of transactions within an ETH smart contract, which reduces fees and congestion by increasing throughput from its current 15 tps to over 1000 tps. It’s like having blockchains in the shadows that aggregate ETH blocks. (→ <a href="https://twitter.com/0xExoMonk/status/1486729691243298819">https://twitter.com/0xExoMonk/status/1486729691243298819</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmgWypJXKCrZV8T36j-PJQ.png" /></figure><p><strong>ZK-Rollups</strong> are one of the options under development for building Layer 2 that increase scalability by processing mass transfers in a single transaction. Where Plasma creates one transaction per transfer, <strong>ZK-Rollups</strong> aggregate hundreds of transfers into a single transaction. The Smart Contract will deconstruct and verify all transfers held in a single transaction: another proof of scalability.</p><p>A <strong>ZKP </strong>approach is used to publicly present and record the validity of the block on the Ethereum blockchain. ZK reduces the computational and storage resources to validate the block by reducing the amount of data held in a transaction; no knowledge of the dataset is required.</p><h4>ZKSNARK — ZKSTARK</h4><p>I will introduce the last keys of this article: <strong>ZKSNARK </strong>&amp; <strong>ZKSTARK</strong>, which are in fact two different types of Zero Knowledge proofs. A little background.</p><p>The <strong>ZK-Rollup</strong> scheme consists of two types of users: <strong>Relayers </strong>&amp; <strong>Transactors</strong>.</p><ol><li>Transactors create their transfer and broadcast the transfer over the network. The Smart Contract stores the data in two Merkle Trees (<a href="https://fr.wikipedia.org/wiki/Arbre_de_Merkle">https://fr.wikipedia.org/wiki/Arbre_de_Merkle</a>):</li></ol><ul><li>The addresses in one Merkle Tree</li><li>The transfers of the amounts in another one.</li></ul><p>2. The Relayers collect a large amount of transfers to create an aggregate. It is the job of the relays to generate the SNARK proof: <strong>ZKSNARK</strong></p><p>The SNARK proof is a hash that represents the delta of the blockchain state. The SNARK proof compares a snapshot of the blockchain before the transfers to another snapshot of the blockchain after the transfers and reports only changes in a provable hash to the main network.(<a href="https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/">https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*flnmBKGEiGXkcgxno_xRuQ.png" /></figure><p>Prior to <strong>ZK-STARK</strong>, <strong>ZK-SNARK</strong> was used to create ZK proof systems, but required a trusted party or parties to initially configure the ZK proof system, which introduced the vulnerability of those trusted parties compromising the confidentiality of the entire system. <strong>ZK-STARK</strong> improves on this technology by removing the need for a trusted configuration.</p><p>As you can see, this new proof solves one of the biggest flaws of the old SNARK proof. This proof has been proposed by the <a href="https://medium.com/u/373f5878a0c6">StarkWare</a> team in its Starknet environment that I will present later.</p><p>STARKs improve two of the problems of permissionless blockchains: scalability and privacy.</p><p>STARKs improve scalability by allowing developers to move computation and storage off-chain. Off-chain services will be able to generate STARK proofs attesting to the integrity of off-chain computations. These proofs are then delivered back to the chain for any interested party to validate the computation. Moving the bulk of the off-chain computation work using STARK allows the existing blockchain infrastructure to scale exponentially while confidently maintaining the integrity of the computations: it’s a game-changer asset.</p><p>Good! You now have all the keys in hand to enter the <a href="https://medium.com/u/373f5878a0c6">StarkWare</a>: StarkNet ecosystem.</p><h3>Starware x StarkNet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*zA9PQRwll9MNuIgEw7RLtg.png" /></figure><p>StarkNet is a decentralized, permissionless ZK-Rollup (ZKP-based) and uses ZKSTARK technology to scale exponentially without compromising privacy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRW-nDVlT7ZmTcGjfcmUeg.png" /></figure><p>StarkNet Alpha was released on public testnet in June and on Mainnet in November of 2021. At the time of the Mainnet deployment, StarkNet was already providing general purpose computing in an Ethereum-like state.</p><p>Throughout development, the StarkWare team chose an approach that focused on releasing the most important features first, essentially sharing the evolution process with the community.</p><p>StarkNet is far from complete, but even now, developers can already create meaningful and complex applications. Today, there are hundreds of developers who rely on StarkNet, lot of dApps, and some external teams developing tools and infrastructure for the StarkNet ecosystem (which we will see in the last section).</p><p>A series of updates has provided many important features. Several caught my eye:</p><ul><li>L1 &lt;-&gt; L2 messaging,</li><li>On-chain data and composability support</li><li>Events support</li><li>Basic pricing mechanism, Contract upgrade</li><li>Wallet abstraction (which are now Smart Contracts)</li><li>Testing framework, development tools, rapid confirmation</li></ul><p>Since the beginning of the year, the ecosystem has reached its usability threshold: it is possible to build complete and amazing dApps. The team will now focus on the performance of the system: in its current state, it is capable of supporting a limited transaction flow. The goal is to achieve a TPS at least an order of magnitude higher than Ethereum’s by the beginning of the second half of 2022, at a cost at least two orders of magnitude lower than Ethereum’s.</p><p><strong>StarkNet </strong>must be a fully decentralized permissionless network with mechanisms for leadership election and governance. Achieving this goal will become the primary objective once throughput skyrockets and costs drop.</p><p><strong>StarkEx </strong>is the scaling engine for some of the most successful dApps using L2: dYdX(perpetual contracts), DeversiFi (trading and cash payments), and for <a href="https://medium.com/u/6225bbf30978">Immutable X</a> (IMX) and <a href="https://medium.com/u/432b4901df74">Sorare</a> (NFT typing and trading) now.</p><h4>Let’s talk about Fractal Scaling : Layer 3 &amp; more</h4><p>The exorbitant cost of transactions on Ethereum asymptomatically pushes L2s to meet those same costs. StarkWare’s paradigm is that, end users will conduct the majority of their business on L2s due to the dramatically reduced transaction costs, growing support for DeFi tools, and the increased liquidity provided by them. L2s increase scalability with reduced gas cost per transaction and improved transaction rates. At the same time, L2s retain the benefits of decentralization, general purpose logic and composability. However, some applications require specific customization that can be better served by a separate new layer: Let’s talk about Layer 3.</p><p>An L3 relates to an L2 as an L2 relates to an L1. L3s can be realized using validity proofs as long as the linked L2 is capable of supporting a Smart Contract Verifier (see Part 1). When L2s also use validity proofs submitted to an L1, as StarkNet does, it becomes a demented recursive structure where the compression benefit of L2 proofs is multiplied by the compression benefit of L3 proofs.</p><p>In other words, if each layer achieves, for example, a cost reduction of ratio 1000, the L3s in question can achieve a reduction of ratio 1M compared to the L1, while maintaining the same security. One could then imagine a transaction fee that would cost a fraction of the usual gas fee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UptxLQzjo8PhL1d9Ek2xBw.png" /></figure><p>StarkWare explains the advantages of having a Layer 3:</p><ul><li><strong>Hyper-scalability</strong>: taking advantage of the multiplicative effect of the recursive proof.</li><li>Better control by the application designer of the technology stack:</li></ul><p>More deterministic performance and cost<br>Customized data availability models (e.g., Validium-based or application-specific compression of chained data),</p><p>Faster functionality and technology speed (e.g., introducing new features that are not yet ready for general availability).</p><ul><li><strong>Confidentiality</strong>: ZKP applied to privacy-preserving transactions on a public L2.</li><li><strong>Interoperability</strong>: independent L3s will interact via the L2, not the L1. L2 should obviously be cheaper than its L1.</li><li><strong>L3 </strong>as a “canary” network à la Kusama for <a href="https://medium.com/u/3e5a7d431699">Polkadot</a> for the L2: new innovations can be tested on the L3 before being made available to the general public.</li></ul><p>In the same way, we are kindly offered an example proposed by <a href="https://medium.com/u/373f5878a0c6">StarkWare</a> to expose this theory of a Layer 3:</p><ul><li>A StarkNet with Validium data availability, for example, for general use by extremely price sensitive applications.</li><li>Application-specific StarkNet systems customized for better application performance, for example, using designated storage structures or data availability compression.</li><li>StarkEx systems (such as those serving dYdX, Sorare, Immutable, and DeversiFi) with Validium or Rollup data availability immediately bring combat-proven scalability benefits to StarkNet.</li><li>Privacy StarkNet instances (in this example also as L4) to enable privacy-preserving transactions without including them in public StarkNets.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o_99HhougPj_m_RSrLHfMg.png" /></figure><p><a href="https://medium.com/starkware/fractal-scaling-from-l2-to-l3-7fe238ecfb4f">Fractal Scaling: From L2 to L3</a></p><h4>Smart Contract on Starknet : Cairo</h4><p>StarkNet is built on the Cairo programming language, the first production-level full von-Neumann Turing checker on Ethereum. It is in fact the language for Smart Contracts on the ecosystem. Cairo allows developers to use the power of <strong>ZKSTARK </strong>to create fully scalable applications. Let’s take a closer look.</p><h3>Cairo : Smart Contracts</h3><p><strong>Cairo </strong>is a language for writing provable programs: the execution of a Cairo program produces a trace that can then be sent to a prover, which generates a STARK proof of the validity of the instruction or calculation represented by the Cairo program. The proof can then be checked with a verifier.</p><p>Today, most dApps are built around Smart Contracts Solidity implementing some kind of logic &amp; interface, and a backend. These dApps, when successful, inevitably face the problem of scalability.</p><p>Increasingly, we see dApps solving their scalability problems by turning to evidence-based L2 scalable solutions (like DeversiFi with StarkEx). An off-chain component supports some of the more complex parts of the business logic and communicates with on-chain smart contracts, without giving up security, as all changes to the system state are certified by evidence (<strong>ZKP</strong>). Scalability improves because verifying an on-chain proof is exponentially cheaper than executing the business logic entirely on-chain.</p><p>With Cairo, the barriers to using proofs to achieve scalability are much lower: you write logic in Cairo, then the code has to be proven off-chain, and once that proof is validated on-chain, you end up with a dApp that can use the result with confidence — just as if it had run it on-chain.</p><p>Three points are expensive on Ethereum: computation, transmission and storage.</p><p>Cairo solves all three. To understand how it does this, we need to introduce a new concept — The Shared Prover (or <strong>SHARP</strong>).</p><p>The <strong>SHARP</strong> is the link between your Cairo code and your Smart Contract Solidity. It has three main components: a prover (off-chain), a smart contract verifier (on-chain) and a fact logger contract (on-chain).</p><p>The prover takes the execution trace of your program, proves that it is valid and sends this proof to the verifier. After verifying the proof, the on-chain verifier takes one more important step: it writes a fact attesting to the validity of the proof in the fact register. This fact is like a seal of approval without trust, certifying that the Cairo program was calculated correctly. Now all that is left for the dApp’s smart contract is to verify that this fact exists, in order to rely on the computation that was performed off-chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67WficgXpZEsOFlTLe8rhQ.png" /></figure><p>To go further into this development environment, I leave you with this notion :</p><p><a href="https://seen-joke-82c.notion.site/StarkWare-Development-965f54711eb84dc79f3b61f22df9e383">https://seen-joke-82c.notion.site/StarkWare-Development-965f54711eb84dc79f3b61f22df9e383</a></p><h3>Must Follow Projects on StarkNet</h3><p>But now that you have understood everything about <strong>ZKP</strong>, <strong>StarkNet </strong>&amp; <strong>Cairo</strong>, what to do?</p><h4>StarkNet Wallet : ArgentX</h4><p>The first step will be to configure your wallet. We will use ArgentX:</p><ul><li><a href="https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb/">download the chrome extension</a> or <a href="https://github.com/argentlabs/argent-x">check their repo</a></li></ul><p>Unlike Ethereum L1 where private keys and accounts are generally the same thing (think EOA wallets), StarkNet supports account abstraction, meaning that each account is actually a Smart Contract that must be deployed before it can interact with the network. This is both a fantastic opportunity and an added complexity for a normal user.</p><p>The ArgentX wallet is used here to abstract away the complexity: it creates and secures private keys, deploys key-controlled account contracts, connects to decentralized applications and sends transactions to the StarkNet network.</p><p>Using a Smart Contract as a wallet is, in my opinion, a big step forward in security. ArgentX offers the same way to create Vaults as a wallet (thus automated multi-sig). All transactions with untrusted addresses are automatically blocked, unless you use guardians. This security covers all assets &amp; transactions with trusted addresses are transparent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHlyEgFLewULJs7DGkh4cA.png" /></figure><p>—</p><p>Currently, the available applications are mainly on the testnet of StarkNet, &amp; to use them, you will have to get test tokens: <a href="https://faucet.goerli.starknet.io/">https://faucet.goerli.starknet.io/</a></p><h4>StarkNet Bridge</h4><p>The 2nd most important thing to know: how to transfer funds from an L1 (Ethereum) to the L2 Starknet. The answer is in the <strong>StarGate </strong>bridge:</p><p><a href="https://medium.com/starkware/starkgate-alpha-35d01d21e3af">StarkGate Alpha</a></p><p>We will remain cautious though as this is again an Alpha, not yet audited.</p><h4>StarkNet DEX — AMM</h4><p>We shall start with what we are all looking for when entering a new ecosystem : DEX, Trading &amp; AMMs.</p><p>As of today, several dApps stand out from the crowd:</p><ul><li><a href="https://medium.com/u/da43c4dee804">ZigZag Exchange</a> : DEX</li></ul><p><a href="https://info.zigzag.exchange/">https://info.zigzag.exchange/</a></p><p>A decentralized exchange built around ZKP, with an OrderBook.</p><ul><li><a href="https://medium.com/u/abf9ac24e569">ZKX</a>: Perpetual Trading</li></ul><p><a href="https://twitter.com/zkxprotocol">https://twitter.com/zkxprotocol</a></p><ul><li><a href="https://medium.com/u/b5a38578535f">Starkswap</a>: DEX AMM</li></ul><p><a href="https://medium.com/starkswap/the-starkswap-vision-6c73f8e66aab">https://medium.com/starkswap/the-starkswap-vision-6c73f8e66aab</a></p><p>A decentralized exchange with an Automated Market Maker</p><h4>StarkNet Lending</h4><ul><li><a href="https://medium.com/u/38363843bc6a">zkLend</a></li></ul><p><a href="https://linktr.ee/zkLend">https://linktr.ee/zkLend</a></p><p>zkLend is a money market protocol based on StarkNet. ZkLend offers a dual authorization suite of compliance-oriented solutions for institutional clients (“Apollo”) and an authorization-free service for DeFi retails users (“Artemis”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*iy7QV356kb0Vf--HuIFmPA.png" /></figure><h4>StarkNet Launchpad</h4><ul><li><a href="https://medium.com/u/bae1ff516d11">Zkpad</a></li></ul><p><a href="https://zkpad.io/">ZkPad</a></p><p>As usual, in my opinion one of the focal points of a new ecosystem: the launchpad. The goal of the ZkPad gas pedal is to provide founders with strategic and operational support, including co-marketing on Twitter/Discord, partnership and ecosystem intros, access to a database of selected talent, including Cairo developers, UX/UI designers and marketers. The platform is specifically designed to open up investment opportunities, previously reserved for investment funds, to individuals.</p><h4>StarkNet DeFi</h4><ul><li><a href="https://medium.com/u/5733051a1f51">Magnety</a></li></ul><p><a href="https://twitter.com/magnetyfi">https://twitter.com/magnetyfi</a></p><p>Magnety is an asset management protocol allowing anyone, such as investment groups, DAOs or individuals to create and manage a hedge fund via the Starknet &amp; L1 DeFi ecosystem. The protocol allows you to create a highly customizable vault based on an investment strategy that you can choose. In my opinion a DeFi product to follow, highly secure thanks to ZKP.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>You will find a non-exhaustive list of projects under construction on StarkNet: <a href="https://starkware.notion.site/Projects-Building-on-StarkNet-a33dee55778a4515a9be9bdae02ee682">https://starkware.notion.site/Projects-Building-on-StarkNet-a33dee55778a4515a9be9bdae02ee682</a></p><p>Follow More content :</p><p><a href="https://twitter.com/0xExoMonk">https://twitter.com/0xExoMonk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71d6a46a811d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[StarkWare x StarkNet x Layer 3+ : une Scalabilité à toute épreuve]]></title>
            <link>https://medium.com/@0xexomonk/starkware-x-starknet-x-layer-3-une-scalabilit%C3%A9-%C3%A0-toute-%C3%A9preuve-868a362c5ba3?source=rss-c9b735421d64------2</link>
            <guid isPermaLink="false">https://medium.com/p/868a362c5ba3</guid>
            <category><![CDATA[starknet]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Exo Monk]]></dc:creator>
            <pubDate>Thu, 21 Apr 2022 16:32:21 GMT</pubDate>
            <atom:updated>2022-04-21T16:32:21.631Z</atom:updated>
            <content:encoded><![CDATA[<h3>StarkWare x StarkNet x Layer 3+ : l’écosystème Ultra Scalable</h3><p>L’émergence de nouvelles blockchains &amp; l’amélioration techniques qu’elles apportent se font de plus en plus ressentir. On voit donc l’intérêt des Layer 2 s’agrandir et leur développement s’accélérer de part un besoin d’augmenter la scalabilité des solutions.</p><p>Dans la suite de cette réflexion, je vous propose une analyse complète de l’environnement StarkNet, qui apporte beaucoup d’innovations dans les possibilités que peut offrir une Layer2.</p><p>L’article couvrira pour commencer l’ensemble des notions essentielles pour comprendre les sujets abordés (Zero Knowledge, ZkRollup, …). Je pense que quiconque s’intéressant aux cryptomonnaies et tech blockchains se doit d’assimiler ces connaissances.</p><p>Dans un second temps, je présenterai la société mère <a href="https://medium.com/u/373f5878a0c6">StarkWare</a> qui développe StarkNet/StarkEx à travers les solutions qui s’y construisent et construiront. Cet article sera technique mais à la fois abordable. Ceci se fera à travers une introduction au langage de Smart Contract de StarkNet : Cairo ainsi que ses spécificités par rapport à Solidity notamment, et quelques subtilités atypiques et innovantes.</p><p>Pour finir en beauté, je vous partage une petite liste des projets en construction &amp; à suivre sur l’environnement qui certainement jouera un rôle important dans l’explosion de l’écosystème.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*HXQ8Veg8RA_-JsPjoUQwtQ.png" /></figure><p>Lexique :</p><ul><li>ZKP = Zero Knowlegde Proof</li><li>ZKSTARK = Zero-Knowledge Scalable Transparent ARguments of Knowledge</li><li>Rollup = Aggrégation hors chain de transactions d’un Smart Contract ETH</li><li>ZK-Rollup = Rollup qui utilise la ZKP</li><li>Scalabilité = <a href="https://medium.com/starkware/redefining-scalability-5aa11ffc5880">https://medium.com/starkware/redefining-scalability-5aa11ffc5880</a></li><li>SHARP = Shared Prover</li></ul><h3>Zero Knowledge, ZKSTARK &amp; Rollup</h3><p>Posons les bases de vocabulaire pour commencer, vous le verrez les termes peuvent paraître barbares, mais finalement ils sont aussi doux que du coton.</p><h4>Zero Knowledge Proof (ZKP)</h4><p>Bien que la blockchain nous ait apporté de grands avantages tels que la transparence, l’immuabilité et la décentralisation, on aborde rarement la notion de confidentialité. C’est là qu’intervient la Zero Knowledge Proof (<strong>ZKP</strong>): un mélange juteux de composabilité, de confidentialité &amp; d’immuabilité.</p><p>La ZKP est un schéma de chiffrement par lequel une partie (celle qui PROUVE que nous appellerons PR) peut certifier la véracité d’informations spécifiques à une autre partie (celle qui VERIFIE que nous appellerons VER) sans divulguer d’informations supplémentaires.</p><p>Sur un exemple concret, VER veut récupérer une récompense. En ZK, cela donne :</p><ul><li>PR produit de manière confidentielle une clé (K)</li><li>VER vérifie que la clé K permet bien d’obtenir la récompense</li><li>La ZKP est vérifiée, CQFD</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*hyzK_7w4C3dZEZBGdEKdbA.png" /></figure><p>De la même façon, la ZKP peut aussi se résoudre ainsi :</p><ul><li>PR produit une clé (K) et récupère la récompense du coffre de manière confidentielle</li><li>VER vérifie que la récompense correspond bien à une récompense qui est uniquement disponible dans ce même coffre</li><li>La ZKP est vérifiée, CQFD</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJpde_mk-zQ5fYCipdxlwQ.png" /></figure><p>Pour résumer, le vérificateur VER ne pourra connaître aucune information autre que la déclaration vraie ou fausse. Les détails des informations et des données personnelles des autres parties restent anonymes.</p><p>Vous l’aurez compris, le ZKP permet la confidentialité (privacy). Mais ce qui est intéressant avec cette méthode, c’est qu’elle est extrêmement simple, sécurisée &amp; permet une scalabilité incroyable, elle est choisie par de nombreuses applications blockchains pour ces vertues. Le dernier en vue : Sorare, qui choisi de se tourner vers StarkNet comme solution de Scaling.</p><p><a href="https://www.playtoearn.online/2021/05/19/sorare-embraces-zero-knowledge-proof-as-scaling-solution/">https://www.playtoearn.online/2021/05/19/sorare-embraces-zero-knowledge-proof-as-scaling-solution/</a></p><h4>Rollup &amp; Zk-Rollup</h4><p>Un <strong>Rollup</strong> d’Ethereum est une agrégation hors chaîne de transactions au sein d’un smart contract ETH, qui réduit les fees et la congestion en augmentant le débit de ses 15 tps actuels à plus de 1000 tps. C’est comme si on avait des blockchains dans l’ombre qui agrègent les blocs d’ETH. (→ <a href="https://twitter.com/0xExoMonk/status/1486729691243298819">https://twitter.com/0xExoMonk/status/1486729691243298819</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmgWypJXKCrZV8T36j-PJQ.png" /></figure><p>Les <strong>ZK-Rollups</strong> sont l’une des options en cours de développement pour la construction de la couche 2 qui augmentent l’évolutivité grâce au traitement des transferts de masse en une seule transaction. Là où Plasma crée une transaction par transfert, ZK-Rollups regroupe des centaines de transferts en une seule transaction. Le Smart Contract déconstruira et vérifiera tous les transferts détenus en une seule transaction : encore une preuve de scalabilité.</p><p>Une approche <strong>ZKP</strong> est utilisée pour présenter et enregistrer publiquement la validité du bloc sur la blockchain Ethereum. ZK réduit les ressources de calcul et de stockage pour valider le bloc en réduisant la quantité de données détenues dans une transaction ; aucune connaissance de l’ensemble des données n’est nécessaire.</p><h4>ZKSNARK — ZKSTARK</h4><p>Je vais présenter les dernières clés de cet article : <strong>ZKSNARK</strong> &amp; <strong>ZKSTARK</strong>, qui sont en fait deux différents types de preuves Zero Knowledge. Un peu de contexte.</p><p>Le schéma ZK-Rollup se compose de deux types d’utilisateurs : Relayers &amp; Transactors.</p><ol><li>Les Transactors créent leur transfert et diffusent le transfert sur le réseau. Le Smart Contract enregistre les données dans deux Merkle Trees (<a href="https://fr.wikipedia.org/wiki/Arbre_de_Merkle">https://fr.wikipedia.org/wiki/Arbre_de_Merkle</a>) :</li></ol><ul><li>Les adresses dans un arbre Merkle</li><li>Les transfers des montants dans un autre.</li></ul><p>2. Les Relayers collectent une grande quantité de transferts pour créer un cumul. C’est le travail des relais de générer la preuve SNARK : <strong>ZKSNARK</strong></p><p>La preuve SNARK est un hachage qui représente le delta de l’état de la blockchain. La preuve SNARK compare un snapshot de la blockchain avant transferts à un autre snapshot de la blockchain après transferts et ne signale que les modifications d’un hachage vérifiable au réseau principal :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*flnmBKGEiGXkcgxno_xRuQ.png" /></figure><p>(<a href="https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/">https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/</a>)</p><p>Avant la création des <strong>ZK-STARK</strong>, les ZK-SNARK étaient utilisés pour créer des systèmes de preuve ZK, mais nécessitaient qu’une partie ou des parties de confiance configurent initialement le système de preuve ZK.</p><p>Ce point introduisait la vulnérabilité de ces parties de confiance <strong><em>compromettant</em></strong> la confidentialité de l’ensemble du système. Les <strong>ZK-STARK</strong> améliorent cette technologie en supprimant le besoin d’une configuration de confiance.</p><p>On l’aura compris, cette nouvelle preuve résout une des plus grandes failles de l’ancienne preuve SNARK. Cette preuve a été proposée par l’équipe de StarkWare dans son environnement Starknet que je présenterai par la suite.</p><p>Les STARK améliorent deux des problèmes des blockchains sans autorisation : la scalabilité et la confidentialité.</p><p>Les STARK améliorent la scalabilité en permettant aux développeurs de déplacer les calculs et le stockage hors chaîne. Les services hors chaîne pourront générer des preuves STARK attestant de l’intégrité des calculs hors chaîne. Ces preuves sont ensuite remises en chaîne pour que toute partie intéressée valide le calcul. Déplacer l’essentiel du travail de calcul hors chaîne à l’aide de STARK permet à l’infrastructure de blockchain existante d’évoluer de manière exponentielle tout en maintenant en toute confiance l’intégrité des calculs : c’est selon moi un gros atout pour le future.</p><p>Bien ! Vous avez maintenant toutes les clés en main pour rentrer dans l’ecosystème de <a href="https://medium.com/u/373f5878a0c6">StarkWare</a>: StarkNet.</p><h3>Starware x StarkNet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*zA9PQRwll9MNuIgEw7RLtg.png" /></figure><p>StarkNet est un ZK-Rollup décentralisé sans autorisation (basé ZKP) et utilise la technologie ZKSTARK pour se scaler de manière exponentielle sans compromettre la confidentialité.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRW-nDVlT7ZmTcGjfcmUeg.png" /></figure><p>StarkNet Alpha a été publié sur testnet public en juin et sur Mainnet en novembre de l’année 2021. Au moment du déploiement de Mainnet, StarkNet fournissait déjà un calcul général dans un état semblable à Ethereum.</p><p>Tout au long du développement, l’équipe de StarkWare a choisi une approche qui s’est d’abord concentrée sur la mise à disposition des fonctionnalités les plus importantes, partageant essentiellement le processus d’évolution avec la communauté.</p><p>StarkNet est loin d’être complet, mais même maintenant, les développeurs peuvent déjà créer des applications significatives et complexes. Aujourd’hui, il y a des centaines de développeurs qui s’appuient sur StarkNet, des dizaines de dApps et plus d’une douzaine d’équipes externes développant des outils et une infrastructure pour l’écosystème StarkNet (que nous verrons dans la dernière partie).</p><p>Une série de mises à jours a fourni de nombreuses fonctionnalités importantes. Plusieurs ont attiré mon attention :</p><ul><li>La messagerie L1 &lt;-&gt; L2,</li><li>Les données on-chain et la prise en charge de la composabilité,</li><li>La prise en charge des Events,</li><li>Le mécanisme de tarification de base, la mise à niveau des contrats</li><li>L’abstraction de wallet (qui sont désormais des Smart Contracts</li><li>Le cadre de test, les outils de développement, la confirmation rapide</li></ul><p>Depuis le début d’année, l’écosystème a atteint son seuil d’utilisabilité : il est possible de construire des dApps complètes et incroyables. L’équipe se concentrera désormais sur les performances du système : dans son état actuel, il est capable de supporter un débit limité de transactions. L’objectif est d’atteindre, d’ici le début du second semestre 2022, un TPS supérieur d’au moins un ordre de grandeur à celui d’Ethereum, à un coût inférieur d’au moins deux ordres de grandeur à celui d’Ethereum.</p><p>StarkNet doit être un réseau sans autorisation entièrement décentralisé, avec des mécanismes d’élection et de gouvernance des dirigeants. Atteindre cet objectif deviendra l’objectif principal une fois que le débit montera en flèche et que les coûts baisseront.</p><p><strong>StarkEx</strong> est le moteur de mise à l’échelle de certaines des dApps les plus performantes utilisant L2 : <strong>dYdX</strong>(contrats perpétuels), <strong>DeversiFi</strong> (négociation et paiements au comptant), ainsi que pour <a href="https://medium.com/u/6225bbf30978">Immutable X</a>(IMX) et <a href="https://medium.com/u/432b4901df74">Sorare</a> (NFTs) désormais.</p><h4>Abordons maintenant la notion de Fractal Scaling : Layer 3 &amp; plus</h4><p>Le coût exorbitant des transactions sur Ethereum pousse de manière asymptomatique à laisser les L2 atteindre ces mêmes coûts. Le paradigme de StarkWare est que, les utilisateurs finaux mèneront la majorité de leur activité sur les L2 en raison des coûts de transaction considérablement réduits, du support croissant des outils DeFi et de la liquidité accrue fournie par ces dernières. Les L2 augmentent la scalabilité avec un coût de gaz réduit par transaction et des taux de transaction améliorés. Dans le même temps, les L2 conservent les avantages de la décentralisation, de la logique à usage général et de la composabilité. Cependant, certaines applications nécessitent une personnalisation spécifique qui peut être mieux servie par une nouvelle couche distincte : Parlons de Layer 3.</p><p>Un L3 se rapporte à un L2 comme un L2 se rapporte à un L1. Les L3 peuvent être réalisés à l’aide de preuves de validité tant que le L2 lié est capable de prendre en charge un Smart Contract Verifier (cf Partie 1). Lorsque les L2 utilisent également des preuves de validité soumises à un L1, comme le fait StarkNet, cela devient une structure récursive démentielle où le bénéfice de compression des preuves L2 est multiplié par le bénéfice de compression des preuves L3.</p><p>En d’autres termes, si chaque couche atteint, par exemple, une réduction des coûts de ratio 1000, les L3 en question peuvent atteindre une réduction de ratio 1M par rapport au L1, tout en conservant la même sécurité. On pourrait alors imaginer des frais de transactions qui coûterait une fraction du gas fee habituel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UptxLQzjo8PhL1d9Ek2xBw.png" /></figure><p>StarkWare nous explique d’ailleurs les avantages d’avoir une Layer 3 :</p><ul><li>Hyper-scalabilité : tirer parti de l’effet multiplicatif de la preuve récursive.</li><li>Meilleur contrôle par le concepteur de l’application de la pile technologique :</li></ul><p>Performance et coût plus déterministes</p><p>Modèles de disponibilité des données personnalisés (par exemple, compression basée sur Validium ou spécifique à l’application des données en chaîne),</p><p>Fonctionnalité et vitesse technologique plus rapides (par exemple, introduction de nouvelles fonctionnalités qui ne sont pas encore prêtes pour la disponibilité générale).</p><ul><li>Confidentialité : <strong>ZKP</strong> appliqué aux transactions préservant la confidentialité sur une L2 publique.</li><li>Interopérabilité : les L3 indépendants interagiront via le L2, et non le L1. Le L2 devrait évidemment être moins cher que son L1.</li><li>L3 en tant que réseau “canari” à la<strong> Kusama pour </strong><a href="https://medium.com/u/3e5a7d431699"><strong>Polkadot</strong></a><strong> </strong>pour le L2 : de nouvelles innovations peuvent être testées sur les L3 avant d’être mises à la disposition du grand public.</li></ul><p>De la même manière, on nous propose gentiment un exemple proposé par StarkWare pour exposer cette théorie d’un Layer 3 :</p><ul><li>Un StarkNet avec disponibilité des données Validium, par exemple, pour une utilisation générale par des applications extrêmement sensibles aux prix.</li><li>Systèmes StarkNet spécifiques aux applications personnalisés pour de meilleures performances des applications, par exemple en utilisant des structures de stockage désignées ou une compression de la disponibilité des données.</li><li>Les systèmes StarkEx (tels que ceux desservant dYdX, Sorare, Immutable et DeversiFi) avec la disponibilité des données Validium ou Rollup, apportent immédiatement à StarkNet des avantages d’évolutivité éprouvés au combat.</li><li>Instances StarkNet de confidentialité (dans cet exemple également en tant que L4) pour permettre des transactions préservant la confidentialité sans les inclure dans les StarkNets publics.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o_99HhougPj_m_RSrLHfMg.png" /></figure><p>Pour en savoir plus :</p><p><a href="https://medium.com/starkware/fractal-scaling-from-l2-to-l3-7fe238ecfb4f">https://medium.com/starkware/fractal-scaling-from-l2-to-l3-7fe238ecfb4f</a></p><h4>Smart Contract sur Starknet : Cairo</h4><p>StarkNet est construit sur le langage de programmation Cairo, le premier vérificateur von-Neumann complet Turing de niveau production sur Ethereum. C’est en fait le langage des Smart Contracts sur l’écosystème. Cairo permet aux développeurs d’utiliser la puissance des <strong>ZKSTARK</strong> pour créer des applications scalables. Voyons ça de plus près.</p><h3>Cairo : Smart Contracts</h3><p>Cairo est un langage d’écriture de programmes prouvables : l’exécution d’un programme Cairo produit une trace qui peut ensuite être envoyée à un prouveur, qui génère une preuve STARK de la validité de l’instruction ou du calcul représenté par le programme Cairo. La preuve peut ensuite être vérifiée à l’aide d’un vérificateur.</p><p>Aujourd’hui, la plupart des dApps sont construites autour de Smart Contracts Solidity mettant en œuvre une sorte de logique &amp; une interface, et un backend. Ces dApps, lorsqu’elles rencontrent du succès, sont inévitablement confrontées au problème de scalabilité.</p><p>De plus en plus, nous voyons des dApps qui résolvent leurs problèmes de scalabilité en se tournant vers des solutions évolutives L2 basées sur des preuves (comme DeversiFi avec StarkEx). Un composant hors chaîne prend en charge certaines des parties les plus complexes de la logique métier et communique avec les smart contracts on-chain, sans renoncer à la sécurité, car toutes les modifications de l’état du système sont certifiées par des preuves (<strong>ZKP</strong>). La scalabilité s’améliore car la vérification d’une preuve on-chain est exponentiellement moins chère que l’exécution de la logique métier entièrement on-chain.</p><p>Avec Cairo, les obstacles à l’utilisation de preuves pour atteindre la scalabilité sont beaucoup plus faibles : on écrit une logique en Cairo, puis le code doit être prouvé hors chaîne, et une fois cette preuve validée on-chain, on se retrouve avec une dApp qui peut utiliser le résultat en toute confiance — comme si elle l’avait exécuté on-chain.</p><p>Trois points coûtent cher sur Ethereum : le calcul, la transmission et le stockage. Cairo les résout tous les trois. Pour comprendre comment il fait cela, nous devons introduire un nouveau concept — The Shared Prover (ou <strong>SHARP</strong>).</p><p>Le SHARP est le lien entre votre code Cairo et votre Smart Contract Solidity. Il comporte trois composants principaux : un prouveur (hors chaîne), un smart contract de vérificateur (on-chain) et un contract de registres de faits (on-chain).</p><p>Le prouveur prend la trace d’exécution de votre programme Cairo, prouve qu’il est valide et envoie cette preuve au vérificateur. Après avoir vérifié la preuve, le vérificateur en chaîne franchit une étape supplémentaire importante : il écrit un fait attestant de la validité de la preuve dans le registre des faits. Ce fait est comme un sceau d’approbation sans confiance, certifiant que le programme Cairo a été calculé correctement. Maintenant, tout ce qui reste au contrat intelligent de la dApp est de vérifier que ce fait existe, afin de s’appuyer sur le calcul qui a été exécuté hors chaîne.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67WficgXpZEsOFlTLe8rhQ.png" /></figure><p>Pour rentrer plus loin dans cet environnement de développement, je vous laisse avec ce notion : <a href="https://seen-joke-82c.notion.site/StarkWare-Development-965f54711eb84dc79f3b61f22df9e383">https://seen-joke-82c.notion.site/StarkWare-Development-965f54711eb84dc79f3b61f22df9e383</a></p><h3>Projets en construction sur Starknet : Must Follow</h3><p>Mais alors, maintenant que vous avez tout compris sur le <strong>ZKP</strong>, <strong>StarkNet</strong> &amp; <strong>Cairo</strong>, que faire ?</p><h4>StarkNet Wallet : ArgentX</h4><p>La première étape va être de configurer votre wallet. On utilisera ArgentX :</p><ul><li><a href="https://chrome.google.com/webstore/detail/argent-x-starknet-wallet/dlcobpjiigpikoobohmabehhmhfoodbb/">download the chrome extension</a> ou <a href="https://github.com/argentlabs/argent-x">check their repo</a></li></ul><p>Contrairement à Ethereum L1 où les clés privées et les comptes sont généralement la même chose (pensez aux portefeuilles EOA), StarkNet prend en charge l’abstraction de compte, ce qui signifie que chaque compte est en fait un Smart Contract qui doit être déployé avant de pouvoir interagir avec le réseau. C’est à la fois une opportunité fantastique et une complexité supplémentaire pour un utilisateur normal.</p><p>On utilise ici le wallet ArgentX pour s’abstraire de la complexité : il crée et sécurise des clés privées, déploie des contrats de compte contrôlés par des clés, se connecte à des applications décentralisées et envoie des transactions au réseau StarkNet.</p><p>Le fait d’utiliser un Smart Contract comme wallet est selon moi une grande avancée vers la sécurité. ArgentX propose de la même manière de créer des Vaults en temps que wallet (donc multisig automatisé). Toutes les transactions avec des adresses non fiables sont automatiquement bloquées, sauf si vous utilisez des tuteurs. Cette sécurité couvre tous les actifs &amp; les transactions avec des adresses de confiance sont transparentes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHlyEgFLewULJs7DGkh4cA.png" /></figure><p>—</p><p>Actuellement, les applications disponibles sont principalement sur la testnet de StarkNet, &amp; pour les utiliser, il vous faudra récupérer des tokens de tests : <a href="https://faucet.goerli.starknet.io/">https://faucet.goerli.starknet.io/</a></p><h4>StarkNet Bridge</h4><p>La 2ème chose la plus importante à savoir : comment transférer des fonds depuis un L1 (Ethereum) sur la L2 Starknet. La réponse se trouve dans le bridge <strong>StarGate</strong> :</p><p><a href="https://medium.com/starkware/starkgate-alpha-35d01d21e3af">https://medium.com/starkware/starkgate-alpha-35d01d21e3af</a></p><p>Nous resterons prudent cependant puisqu’il s’agit encore une fois d’une Alpha, pas encore auditée.</p><h4>StarkNet DEX — AMM</h4><p>On commence avec ce que tout le monde recherche lorsqu’on entre dans un nouvel écosystème / L2 : un DEX.</p><p>Actuellement, il y a plusieurs dApps qui se démarquent du lot :</p><ul><li><a href="https://medium.com/u/da43c4dee804">ZigZag Exchange</a> : DEX</li></ul><p><a href="https://info.zigzag.exchange/">https://info.zigzag.exchange/</a></p><p>Un échange décentralisé construit autour du <strong>ZKP</strong>, avec un OrderBook.</p><ul><li><a href="https://medium.com/u/abf9ac24e569">ZKX</a>: Perpetual Trading</li></ul><p><a href="https://twitter.com/zkxprotocol">https://twitter.com/zkxprotocol</a></p><ul><li><a href="https://medium.com/u/b5a38578535f">Starkswap</a>: DEX AMM</li></ul><p><a href="https://www.starkswap.co/">https://www.starkswap.co/</a> — <a href="https://medium.com/starkswap/the-starkswap-vision-6c73f8e66aab">https://medium.com/starkswap/the-starkswap-vision-6c73f8e66aab</a></p><p>Un échange décentralisé avec un Automated Market Maker</p><h4>StarkNet Lending</h4><ul><li><a href="https://medium.com/u/38363843bc6a">zkLend</a></li></ul><p><a href="https://linktr.ee/zkLend">https://linktr.ee/zkLend</a></p><p>zkLend est un protocole de marché monétaire basé sur StarkNet. ZkLend offrant une double suite d’autorisations des solutions axées sur la conformité pour les clients institutionnels (“Apollo”) et un service sans autorisation pour les utilisateurs retails DeFi (“Artémis”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*iy7QV356kb0Vf--HuIFmPA.png" /></figure><h4>StarkNet Launchpad</h4><ul><li><a href="https://medium.com/u/bae1ff516d11">Zkpad</a></li></ul><p><a href="https://zkpad.io/">https://zkpad.io/</a></p><p>Comme d’habitude, selon moi l’un des points centraux d’un nouvel ecosystème : le launchpad. L’objectif de l’accélérateur ZkPad est de fournir aux fondateurs un soutien stratégique et opérationnel, y compris le co-marketing sur Twitter/Discord, les intros de partenariat et d’écosystème, l’accès à une base de données de talents sélectionnés, y compris les développeurs Cairo, les concepteurs UX/UI et les spécialistes du marketing. La plateforme est spécifiquement conçue pour ouvrir des opportunités d’investissement, autrefois réservées aux fonds d’investissement, aux particuliers.</p><h4>StarkNet DeFi</h4><ul><li><a href="https://medium.com/u/5733051a1f51">Magnety</a></li></ul><p><a href="https://twitter.com/magnetyfi">https://twitter.com/magnetyfi</a></p><p>Magnety est un protocole de gestion d’actifs permettant à quiconque, tels que des groupes d’investissement, des DAOs ou individus de créer et gérer un fonds spéculatifs via l’écosystème Starknet &amp; L1 DeFi. Le protocole permet de créer un coffre-fort hautement personnalisable basé sur sur une stratégie d’investissement que vous pouvez choisir. Selon moi un produit DeFi à suivre, hautement sécurisé grâce aux <strong>ZKP</strong>.</p><p>Vous retrouverez une liste non exhaustive de projets en construction sur StarkNet : <a href="https://starkware.notion.site/Projects-Building-on-StarkNet-a33dee55778a4515a9be9bdae02ee682">https://starkware.notion.site/Projects-Building-on-StarkNet-a33dee55778a4515a9be9bdae02ee682</a></p><p>— — — — —</p><p>Pour plus me suivre &amp; discuter avec moi :</p><p><a href="https://twitter.com/0xExoMonk">https://twitter.com/0xExoMonk</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=868a362c5ba3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>