<?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[RicMoo - Medium]]></title>
        <description><![CDATA[Mostly harmless. Slippery when wet. - Medium]]></description>
        <link>https://medium.com/ricmoo?source=rss----7ea1b543a2b9---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>RicMoo - Medium</title>
            <link>https://medium.com/ricmoo?source=rss----7ea1b543a2b9---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:36:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ricmoo" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Highlights ethers.js: August 2023]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-august-2023-fb68354c576c?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/fb68354c576c</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Thu, 10 Aug 2023 05:23:21 GMT</pubDate>
            <atom:updated>2023-08-10T05:23:21.116Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 6.7.0.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*Y6nrCihtwyUpnjIa6HYBTA.jpeg" /><figcaption>Roadtripping around – Quidi Vidi, St. Johns</figcaption></figure><p>Ahoy!</p><p>It’s been a while since I’ve posted a <em>Highlights</em> article, so there is a bit to catch up on.</p><p>The biggest news is that v6 has been out for 6 months and gaining more traction each day. Many of the features of v6 have been around using more standard tooling, modern JavaScript features and a simplified package structure.</p><h3>At a glance…</h3><p>Over the last 6 months there have been <a href="https://github.com/ethers-io/ethers.js/blob/main/CHANGELOG.md">plenty of updates</a> but in the last couple weeks a few come to mind:</p><ul><li>Polygon now supports the official Polygon Gas Station, so <strong>transactions are fast</strong>, never stuck and not ignored by the network</li><li>Custom priority fees, which significantly <strong>reduce the cost</strong> of Optimism transactions</li><li>Enabled whitelist-only backends in the default provider to restrict to desired services</li></ul><h3>Extension Packages</h3><p>An important goal of v6 is that of delegation. By breaking extension packages out of the core package, external contributions are much easier to review and accept and allows for <strong>domain experts</strong> to manage official extensions.</p><h4>LedgerSigner</h4><p>The <strong>LedgerSigner</strong> class provides seamless integration with <a href="https://www.ledger.com/">Ledger</a> Hardware Wallets as a standard Ethers signer. Several of the write-contributors of the extension repo are actual members of the Ledger team, so the library can be more intimately updated in-step with the Ledger libraries.</p><h4>GanacheProvider</h4><p>The <strong>GanacheProvider</strong> class provides quick and easy access to an in-memory node for testing purposes, backed by <a href="https://trufflesuite.com/docs/ganache/">Ganache</a> with extra configuration to improve its performance as well as some extras that the Ganache API provides to make testing certain situations simpler (like snapshots).</p><h4>MulticoinProviderPlugin</h4><p>Ethers has from the beginning supported many of the powerful features of <a href="https://ens.domains/">ENS</a>, but one feature has always been a bit nerfed; multi-coin support. All EVM-compatible chains available using <a href="https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution">ENSIP-11</a> are supported, since the required code is fairly minimal, however to support the full breadth of coins, such as Bitcoin, ZCash, Filecoin, et al. additional hashing and encoding libraries are required which would quickly bloat Ethers (which aims to remain slim). So, the <strong>MulticoinProviderPlugin</strong> is provided to extend a Provider, adding all coins supported by the ENS team, who are also write-contributor members of the extension repo.</p><h4>Upcoming Extensions</h4><ul><li>Account Abstraction</li><li>Common Contracts (including lots of built-in futzing for not-entirely-standard ERC-20 contracts)</li><li>Typed Contracts (an experimental package, that will be ported into core once everyone is happy with it ;))</li></ul><h3>Conclusion</h3><p>A huge thanks for dropping by! If you have any comments or suggestions, ping me on <a href="https://twitter.com/ricmoo">Formerly-known-as-Twitter</a> or <a href="https://discord.gg/qYtSscGYYc">Discord</a>. &lt;3</p><blockquote>“Another visitor. Stay a while… Stay forever!”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb68354c576c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-august-2023-fb68354c576c">Highlights ethers.js: August 2023</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: September 2022]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-september-2022-d7bda0fc37ed?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/d7bda0fc37ed</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ethersjs]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 04:20:25 GMT</pubDate>
            <atom:updated>2022-09-10T00:25:54.157Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.7.0.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*lthQEYhjHtFZTJJfoP1P3w.jpeg" /></figure><p>Hey all!</p><p>Another three months has just flown by, so it’s time for another quick update on ethers.</p><p>A <strong>new v6 branch</strong> has been made available too, ethers@beta-exports, which uses pkg.exports to sub-categorize functionality, rather than sub-packages managed by reticulate. It drastically improves the development cycle and makes it much easier to clone, modify and build ethers. Try it out and let me know what you think.</p><p>Also, the latest <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">round of Gitcoin</a> is about to kick off, and as usual I highly encourage everyone to spend some time and poke around. There are lots of interesting and worthwhile projects to discover and with the quadratic matching, a little goes a long way to help out some open source projects we all depend on, or new projects we may one day come to depend on. Or just some projects that let us have some fun and enjoyment. Each donation is like a little pat on the back of encouragement, and motivates us to keep on swimming. ❤</p><p>And now onwards, to some of the <a href="https://github.com/ethers-io/ethers.js/blob/01b5badbb616b29fd8b69ef7c3cc3833062da3d7/CHANGELOG.md">recent additions</a> since the last article.</p><h4>The Merge</h4><p>The Merge has already happened on all the testnets, with Görli being the latest to that party, and with that a <strong>few minor changes</strong> have been added to ethers to accommodate this historic event.</p><p>For nearly all apps there is <strong>no code change required</strong> at all, as the launch has been very carefully organized around not breaking things.</p><p>The one thing people might care about though are the <strong>new tags added</strong>, &quot;safe&quot; and &quot;finalized&quot;, which can be used anywhere a block tag can normally be used, on post-merge networks.</p><p>For a much more in-depth explanation of these new block tags, please check out the <em>“Safe Head &amp; Finalized Blocks”</em> section in <a href="https://blog.ethereum.org/2021/11/29/how-the-merge-impacts-app-layer">this article.</a></p><h4>Unicode for you and for me</h4><p>The oldest ticket on ethers for quite some time, has finally <a href="https://github.com/ethers-io/ethers.js/issues/42">been closed</a>; <strong>Unicode for ENS names</strong>, which now allows for wider usage of emojis in ENS names.</p><p>An absolutely <strong>huge thanks</strong> to <a href="https://twitter.com/adraffy">Raffy</a> for his work on standardizing the normalization for ENS names and creating a <a href="https://github.com/adraffy/ensip-norm/blob/main/draft.md">specification</a>, including producing several implementations, a <a href="https://github.com/adraffy/ens-norm-ref-impl.js">reference implementation</a> and a highly <a href="https://github.com/adraffy/ens-normalize.js">compact implementation</a>.</p><h4>ACTION_REJECTED</h4><p>Another better-late-than-never addition in v5.7 is the addition of a ACTION_REJECTED error code, to coalesce the situation where the user (for example, in MetaMask) <strong>rejects sending a transaction</strong> or signing a message.</p><pre>try {<br>  const tx = await <strong>signer.sendTransaction</strong>(txProps);<br>  console.log(tx);<br>} catch (<strong>error</strong>) {<br>  if (<strong>error.code</strong> === &quot;<strong>ACTION_REJECTED</strong>&quot;) {<br>    console.log(&quot;The user rejected sending the tx&quot;);<br>  }<br>}</pre><h4>Old Events Bug</h4><p>A bug, introduced when adding support for non-consistent networks (like BSC and Polygon) was <strong>finally squished</strong>!</p><p>When subscribing to events, in certain situations, the <strong>replay counter age</strong> wasn’t being clamped to the beginning time of subscription, so in some circumstances a newly subscribed event handler would begin emitting old events from the near past, resulting in logs from up to 10 blocks in the past being emitted.</p><p>It was a frustrating-at-times bug to hunt down and took quite some time to even reproduce it reliably, but it was <strong>rewarding to finally find</strong> and fix. A huge thanks to everyone that helped provide support and for your patience.</p><h4>Odds and sods…</h4><ul><li>Added baseFee to the FeeData object, for those that wish to re-compute maxFeePerGas when using a custom maxPriorityFeePerGas</li><li>Updated lots of URLs and endpoint configurations for the various backends</li><li>A couple of Typing changes for quality-of-life improvements</li><li>Web3 secret storage format compatibility fix</li><li>Fixed NodeJS 18 support; they dropped support for RIPEMD-160, so a library has been added to pick up the slack</li><li>Enabled overriding fetch properties as you wish</li></ul><h4>…thanks for all the fish.</h4><p>Thanks for reading! If you have any suggestions or comments, please reach out. And if you want to keep up to date on my random meanderings, follow <a href="https://twitter.com/ricmoo">me on twitter</a>.</p><p>Hack the planet! ❤</p><blockquote>“Well… That was traumatic. But such is the life of an adventurer.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7bda0fc37ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-september-2022-d7bda0fc37ed">Highlights ethers.js: September 2022</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: June 2022]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-june-2022-f5328932e35d?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/f5328932e35d</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Wed, 08 Jun 2022 17:35:51 GMT</pubDate>
            <atom:updated>2022-06-08T17:41:05.096Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.6.8.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*MsL0USyuOknyw97aiZUbMw.jpeg" /><figcaption>A bright yellow couch, beneath a tree in a park, someone left about…</figcaption></figure><p>Ahoy!</p><p>It’s been another quarter, so it’s time for another update on ethers and what&#39;s been going on.</p><p>I also wanted to remind everyone the latest <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">GitCoin GR14 grant</a> round is about to start and to extend a <strong>huge thanks to everyone</strong> who has contributed to ethers in previous rounds. You are double-plus awesome!</p><p>I also highly recommend you wander around the numerous GitCoin grants a bit; it’s a great way to <strong>discover new and exciting projects</strong> that you might find fascinating, endearing or that solves a problem you didn’t realize you had. Even a couple dollars can go a long way with the CLR matching and it makes a project feel truly appreciated, that some random stranger out there was thinking about them.</p><h4>Critical BigNumber Fix</h4><p>The biggest news to ethers this quarter, is the discovery of a <strong>critical</strong> <a href="https://github.com/indutny/bn.js/pull/295">string serialization <strong>bug</strong></a> in the <a href="https://github.com/indutny/bn.js/">BN.js</a> library, identified by <a href="https://github.com/alexdupre">Alex Dupre</a> who also provided the necessary patch.</p><p><strong><em>TL;DR:</em></strong><em> it is not as big a problem as you might think and likely </em><strong><em>did not affect anyone</em></strong><em>, but please update ethers anyways. </em><em>:)</em></p><p>The v5 ethers library uses BN.js because Ethereum operations require a Very Large Integer (VLI) library, since JavaScript [historically] only offered <a href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format">IEEE 754 floating-point</a> numbers. Since BN.js is required by <a href="https://github.com/indutny/elliptic/">elliptic</a>, the Elliptic Curve Cryptography (ECC) library used by ethers, re-using it for both secp256k1 and BigNumber means <strong>only a single VLI library</strong> is needed, reducing the size.</p><p>Further, since all objects in ethers aim to be immutable, the BigNumber object store all values as hex strings, since they are <strong>fast and simple immutable objects</strong> that are also efficient to convert back to big numbers for maths.</p><p>However, as it turns out, the bug fortunately only manifested itself on incredibly large values, well outside the range for most Ethereum-purposes. All values in Ethereum are 256-bit, and the bug only became a problem when <strong>values exceeded 337-bits</strong>.</p><p>This can still pose a problem in rare instances, since multiplying a 256-bit number by another 256-bit number yields a 512-bit number, which could be affected, or if a large number of values were added together (for example, when calculating an average) the size of the numerator could exceed 337-bits.</p><p>But even though the EVM is a 256-bit word machine, most values are <strong>no where near 256-bits</strong>. For example, 1 ether (10 ^ 18 wei) is only a 60-bit value (in the EVM, the top 196 bits are 0).</p><p>Regardless of the unlikely possibility of this bug being an issue, <strong>I still highly recommend</strong> everyone update their version of ethers.</p><p>While the elliptic library and BN.js library <strong>have been absolutely wonderful</strong> and critical to ethers since day 0 and the maintainer has always been attentive and prompt to address any issue, the <strong>ES2020 BigInt support</strong> in JavaScript has come a long way. Now that native VLI is a viable option in most JavaScript environments, along with modern ECC libraries which use them, v6 uses the <a href="https://paulmillr.com/noble/">noble libraries</a> by <a href="https://github.com/paulmillr">Paul Miller</a>, which are awesome, fast and have been fully <a href="https://cure53.de/pentest-report_noble-lib.pdf">audited</a>.</p><p>If you’d like to try it out the <strong>v6 beta</strong>: npm install ethers@beta.</p><h4>Odds and ends…</h4><p>This is a just a quick summary of some of the v5 updates that have been added. For anyone that’s curious, the <a href="https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md">changelog</a> is among your best friends.</p><ul><li>WebWorker ESM Support</li><li>Skynet and IPNS Content Hash Support</li><li>Default L2 support; matic, optimism, et al</li><li>Hardhat compatibility and quality-of-life changes</li><li>Sub-class support for legacy environments</li><li>More robust error and call exception coalescence</li><li>Added <a href="https://www.ankr.com/">Ankr</a> to the family of default provider backends</li></ul><h4>Doc, Doc, Goose…</h4><p>A lot of my recent time has been spent working on the new documentation for v6 using <a href="https://jsdoc.app/">JSDoc</a>, which inlines documentation with the source code.</p><p>The current v5 documentation links most ethers functions and classes to the relevant TypeScript source, but still requires flipping back and forth between the source and documentation, and there are many places where the docs are either out of sync or only fully described in either the source or the documentation.</p><p>By adding JSDoc extraction to <a href="https://github.com/ricmoo/flatworm">Flatworm</a>, the documentation will be kept in sync, provide documentation for all features and issue warnings at build-time if there are undocumented operations or missing exports.</p><h4>Firefly in the sky, I can fly twice as high…</h4><p>As a quick side note, I just wanted to provide an update on another spare-time project that I recently set aside some time to catch up on and am hoping to stir up <strong>some excitement</strong> over.</p><p>I put about 240–300 hours a month into ethers, so I took a week off at the beginning of May to <strong>decompress and relax</strong> a bit… By writing some intense and fun C code and reverse-engineering low-level BLE protocol craziness for Firefly, the <a href="https://firefly.city/">$5 DIY Open-Source Hardware Wallet</a>.</p><p>I’ve had an idea I’ve been experimenting with, but without success. But every time I have to use a Ledger to sign a transaction, I’ve felt more and more motivation to get it working; and I’m happy to tease that the <strong>proof-of-concept now works</strong>!</p><p>It is a technique that allows <strong>direct and trustless communication</strong> between a hardware device with any Website or Dapp, with no software to install, no browser plugins needed and no scary pop-ups.</p><p>For now, I’ll leave it intentionally vague, but once the next round of v5 features is out and the updated v6 beta docs have been released, I plan to put another week into getting a <strong>demo-ready</strong> hardware/firmware/software repo up on the <a href="https://github.com/firefly">Firefly GitHub</a>.</p><h4>Good night moon…</h4><p>Thanks for reading! If you have any suggestions or feedback, <strong>please reach out</strong> and if you’re interested in keeping up with my random endeavours, follow <a href="https://twitter.com/ricmoo">me on Twitter</a>.</p><p>Thanks! Keep on hacking. ❤</p><blockquote>“Birds scream at the top of their lungs in horrified hellish rage every morning at daybreak to warn us all of the truth, but sadly we don’t speak bird.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5328932e35d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-june-2022-f5328932e35d">Highlights ethers.js: June 2022</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: March 2022]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-march-2022-f511fe1e88a1?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/f511fe1e88a1</guid>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 17:51:04 GMT</pubDate>
            <atom:updated>2022-03-10T17:51:04.823Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.6.0.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*2cEEoGvyIso_mMD7yRCZLg.jpeg" /><figcaption>Graffiti Alley, Toronto, Canada</figcaption></figure><p>Ahoy! Welcome to the latest quarterly update for Ethers.</p><p>The latest minor version has just been released with some <strong>exciting new features</strong> along with some bug fixes and quality of life improvements.</p><p>Also, a quick reminder that the latest <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">GitCoin GR13 grant</a> is now in full swing, and I wanted to make sure to thank everyone who has contributed to Ethers in the past and also encourage everyone to poke around a bit; there are <strong>a lot of other worthwhile projects</strong> too, and even a dollar goes a long way against the CLR. Each contribution is also a little warm-fuzzy to the author, letting them know they are appreciated.</p><p>Thanks! You are all rock stars!</p><h3>Off-chain Lookups for the L2 in you (via CCIP)</h3><p>A major emphasis that both Ethers and the entire blockchain space is focused on is L2 support, which <strong>improves the entire experience</strong>, from reducing gas fees, increasing transaction capacity and allowing much faster interactions.</p><p>With the newly finalized <a href="https://eips.ethereum.org/EIPS/eip-3668">CCIP Read</a> (formerly Durin) standard, view and pure contract methods can defer their response to off-chain services, where <strong>storage and data processing is cheap</strong>, and then have the response verified by the contract by whatever security mechanism the author has decided is acceptable.</p><p>All high-level ENS-related calls now support CCIP Read, which makes it available to resolve addresses (including multicoin, like BTC), avatars, content-hashes and any other feature that the built-in ENS resolver handles.</p><p>To use CCIP Read for your own dapps and contracts, <strong>CCIP Read must be explicitly enabled</strong> in any call by setting the ccipReadEnabled property, otherwise any CCIP Off-chain lookup request will be throw like any normal CALL_EXCEPTION.</p><pre><strong><em>// To make a CCIP Read call, you must explicitly enable it, but<br>// then the rest of the magic just happens :)<br></em>await provider.call(</strong>{<br>  to: contractAddress,<br>  data: &quot;0x6352211e&quot; <br>  <strong>ccipReadEnabled: true</strong><br>})</pre><p>The following is a short example contract (off the top of my head, it likely won’t compile) to help illustrate the overall idea. <strong>Most people can skip over this</strong>, but I know some people will crave an example.</p><pre><strong><em>// Example Solidity Contract</em></strong></pre><pre><strong><em>// All ownership is kept off-chain, with a single merkle-root<br>// within the contract encoding ownership on-chain.<br>// How this merkle-root is updated is left as an exercise<br>// to the reader; batched updates, signed messages or<br>// zk-snarks are all splendid ideas. :)</em></strong></pre><pre><strong>contract MyCcipTest {</strong></pre><pre><strong>  bytes32 _merkleRoot;</strong></pre><pre>  <strong>error OffchainLookup</strong>(address, string[], bytes, bytes4, bytes);</pre><pre><strong>  function ownerOf(uint token) public view returns (address) {</strong></pre><pre><strong><em>    // This URL will provide the merkle proof; we allow<br>    // fallback urls in case one is down</em><br></strong>    string[] memory <strong>urls</strong> = new string[](2);<br>    urls[0] = <strong>&quot;</strong><a href="https://ethers.ricmoo.workers.dev/test-ccip-read/%7Bsender%7D/%7Bdata"><strong>https://api.sprinkles.gallery/{sender}/{data</strong></a><strong>}&quot;</strong>;<br>    urls[1] = <strong>&quot;</strong><a href="https://ethers.ricmoo.workers.dev/test-ccip-read/%7Bsender%7D/%7Bdata"><strong>https://api-2.sprinkles.gallery/{sender}/{data</strong></a><strong>}&quot;</strong>;</pre><pre><strong><em>    // Remember the token ID for later in verifyOwner</em><br></strong>    bytes memory <strong>extraData</strong> = abi.encode(token);</pre><pre><strong><em>    // Defer to the interwebs</em></strong><br>    <strong>revert OffchainLookup</strong>(<br>      address(this), urls, callData,<br>      this.verifyOwner.selector, extraData);<br>  }</pre><pre><strong>  function verifyOwner(bytes calldata result,<br>    bytes calldata extraData) public view returns (address) {</strong></pre><pre><strong><em>    // Get the original contract.ownerOf details</em></strong>    <br>    uint <strong>token</strong> = abi.decode(<strong>extraData</strong>, (uint));</pre><pre><strong><em>    // Parse the server response</em></strong><br>    (address <strong>owner</strong>, bytes32 memory <strong>proof</strong>[]) =<br>      abi.decode(<strong>result</strong>, (address, bytes[]));</pre><pre><strong><em>    // Compute this entry in the merkle tree</em></strong><br>    bytes32 <strong>leaf</strong> = keccak256(abi.encodePacked(<strong>owner</strong>, <strong>token</strong>));</pre><pre><strong><em>    // Throws if the merkle proof fails; otherwise owner is correct</em></strong><br>    verifyMerkleProof(<strong>_merkleRoot</strong>, <strong>leaf</strong>, <strong>proof</strong>);</pre><pre><strong><em>    // Fetched off-chain, verified on-chain! Huzzah!</em></strong><br>    return <strong>owner</strong>;<br>  }<br>}</pre><h4>Security</h4><p>There are possible security issues with the introduction of CCIP Read, which is why it is required to be explicitly enabled per call.</p><p>Since an external web resource is fetched as directed by a contract, which is potentially controlled by an untrusted actor, automatic calls (without user interaction) to untrusted contracts should be carefully thought through as it can <strong>leak the IP address</strong> of users or used to coordinate a DDoS attack.</p><p>For these reasons, the Provider also exposes a new method, <strong>which a sub-class can override</strong>, for example to proxy requests through an anonymizing service or to reject untrusted URLs or contracts.</p><pre><strong><em>// Example Customer Provider which rejects urls based on<br>// some method `isSafeUrl`. It could extend any BaseProvider.</em><br>class MyCustomProvider</strong> extends JsonRpcProvider {</pre><pre>  <strong>ccipReadFetch(tx, calldata, urls)</strong> {<br>    urls = urls.filter(u =&gt; <strong>isSafeUrl</strong>(u));<br>    return <strong>super.ccipReadFetch(tx, calldata, urls)</strong>;<br>  }</pre><pre>}</pre><p>For those curious about further consequences about allowing contracts to trigger unsolicited web fetches, <a href="https://www.vice.com/en/article/xgdvaz/nft-steal-ip-address-opensea">here is a worthwhile read</a> about an exploit that affected Wallets and Websites which automatically fetched NFT images.</p><p>As for those who wish to fully and <strong>explicitly disable any and all CCIP Read</strong> functionality for now and kick any issues down the road, there is a disableCcipRead property on Providers.</p><pre><strong><em>// Fully disable CCIP Read functionality in your project,<br>// including ENS resolution</em></strong><em><br></em>provider.<strong>disableCcipRead</strong> = true</pre><h3>ENS Wildcard Support (EIP-2544)</h3><p>This is another feature near and dear to my heart, and something I’ve been overly excited about since I began badgering people about it during the second ENS workshop. And it’s <a href="https://eips.ethereum.org/EIPS/eip-2544">finally here</a>!</p><p>ENS Wildcards requires an entire article of its own, but in a nutshell it allows a single resolver to respond and resolve unlimited number of sub-names, which may not sound too impressive at first but this also has <strong>significant implications for L2 adoption</strong>.</p><p>For example, a toy project I’ve thrown together (currently only <a href="https://ropsten.etherscan.io/address/0x8fc4C380c5d539aE631daF3Ca9182b40FB21D1ae">deployed to Ropsten</a>), hatch.eth resolves all *.hatch.eth ENS names.</p><p>For any given ENS name, like ricmoo.eth the owner of that name has exclusive access to a <a href="https://blog.ricmoo.com/wisps-the-magical-world-of-create2-5c2177027604">Wisp</a> Proxy Wallet that can be deployed to ricmoo.hatch.eth. Sending ether or tokens to ricmoo.hatch.eth sends them in such a way that only the owner of ricmoo.eth can access them.</p><p>There was never a need for that owner to perform any operation. Infinite active and useful ENS sub-names were <strong>instantly available without any user interaction</strong> required.</p><p>In fact, you can send assets to <strong>any ENS name</strong>, even if the owner has not configured it.</p><p>Even stranger, you can actually send assets to an ENS name that has <strong>never been registered</strong>, although, this would be unwise, as whoever successfully registers that name first can then claim the assets.</p><p>So, TL;DR, ENS wildcards enable lots of crazy awesome ideas, the likes of which I am beyond excited to see what <strong>hackathon hackers dream up</strong>.</p><h3>Cloudflare Workers</h3><p>I’m quite happy someone pointed out the <a href="https://github.com/ethers-io/ethers.js/issues/1886">problem with ethers</a> in the <a href="https://workers.cloudflare.com/">Cloudflare Worker</a> environment, as it is quickly becoming one of my favourite services.</p><p>The issue came down to a limitation in the server-side implementation of the fetch function within the Cloudflare Worker API, which is incompatible with some of the internal setup that ethers performs to improve compatibility between node.js and browsers.</p><p>So, there is now a skipFetchSetup property that can be set on a Connection object, which <strong>enables Cloudflare Workers</strong> to work without a hitch!</p><pre><em>// Create your provider, specifying to skip fetch setup</em><strong><br></strong>const<strong> provider</strong> = new <strong>StaticJsonRpcProvider</strong>({<br> url: URL,<br> <strong>skipFetchSetup: true</strong><br>});</pre><h3>Bits ‘n Bytes</h3><ul><li>Now that we have more data in a post-EIP-1559 world, we have some updated numbers on approximate uncle and MEV risk, so the default maxPriorityFeePerGas has been <strong>changed from 2.5 gwei to 1.5 gwei</strong></li><li>The WebSocketProvider, in addition to a websocket URL, can now <strong>accept an existing WebSocket</strong> object, which allows for custom configuration, such as custom headers, certificates, or anything else your heart desires</li><li>Errors now include a URL, which <strong>links to more details</strong> about the problem, causes and possible solutions, which will be updated over time to include even more help when debugging unexpected problems</li><li>All functions and methods which accept a signature can now also accept a <strong>compact signature</strong>, as <a href="https://eips.ethereum.org/EIPS/eip-2098">EIP-2098 has become final</a></li><li>This has been a pain point for many people, for quite some time and I apologize for taking so long to get to it, but pending blocks are now fully supported by provider.getBlock</li><li>Somewhat of a white whale, after a lot of experimentation and research, the issue on fast-block-time networks (e.g. Polygon and BSC) for events should be resolved, using a more robust algorithm to efficiently handle polling events when a network’s getLogs is not always reliable</li></ul><h3>That’s all folks…</h3><p>Thanks for reading! Any and all feedback is welcome, and to keep up with my meanderings, follow <a href="https://twitter.com/ricmoo">me on Twitter</a>.</p><p>Thanks! And remember to hack the planet!</p><blockquote>“Lettuce and shells, cheese and meat. It’s raining tacos, yum yum yum yum, yummidy, yum. It’s like a dream.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f511fe1e88a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-march-2022-f511fe1e88a1">Highlights ethers.js: March 2022</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: December 2021]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-december-2021-dc1adb779d1a?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/dc1adb779d1a</guid>
            <category><![CDATA[ethersjs]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 21:05:21 GMT</pubDate>
            <atom:updated>2021-12-06T21:05:21.483Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.5.2.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*wTrIMvDz-NXg9M-rwHZ9Yg.jpeg" /><figcaption>Season’s greetings from my home to yours…</figcaption></figure><p>The release of a beta for v6 is just around the corner, and I thought I’d spend most of this highlights article outlining some of the upcoming changes and features.</p><h4>A Picture is worth 1,000 words (ENS Avatars in v5)</h4><p>But there is <em>one new feature</em> in v5 I’d like to highlight though, which has become quite useful.</p><p>The recent release of the <a href="https://docs.ens.domains/v/governance/">ENS token</a> has created a large influx of people fully configuring their ENS names, so the new provider.getAvatar(&quot;ricmoo.eth&quot;) returns a URL which can be used to <strong>display an avatar</strong> in your User Interfaces next to an address or ENS name.</p><p>This is an important step towards a pleasant and unified web3 experience, including the new <em>“login with Ethereum”</em> standard the ENS team has been working on. It will be wonderful to log into websites with an account I own and control and not some random backend database of usernames and passwords the website will <a href="https://haveibeenpwned.com/">invariably leak</a>. Keep an eye on it. :)</p><p>And now onto v6…</p><h4>It’s a Modern JavaScript World</h4><p>Previous versions of ethers provided backwards compatibility for a large variety of browsers, node.js environments and tools, which are now quite outdated.</p><p>In v6, all code <strong>assumes an ES2016</strong> or newer environment, which means all generated code is provided as <strong>ES modules</strong>, simplifying the ethers build process and making it more compatible with modern tools such as bundlers and linters.</p><p>It also means more concise and easy-to-understand code, a <strong>smaller library</strong> and better encapsulation through features like private fields.</p><h4>TypeScript</h4><p>A lot of TypeScript changes are coming.</p><p>First of all, the library is now strictNullCheck enabled, so all methods are very explicit about whether null is a valid return type or not, which improves type-safety both within ethers and for libraries which depend on ethers which also have <strong>strict null checking</strong>.</p><p>There is a also a much stronger emphasis on using <strong>generics</strong> to create tighter interfaces, which allows many objects and types to be safer while also more flexible when necessary.</p><p>For example, in many situations, such as using a TransactionRequest or contract method, a Signer objet should be allowed for the to field or as an address type parameter.</p><p>Contracts are also designed to be much more <strong>TypeScript friendly</strong>, so that a typed interface is all that is needed to get full type-safety.</p><h4>New Crypto Libs on the Block</h4><p>Along with using modern JavaScript, comes the ability to use newer libraries which did not work in ES3 environments.</p><p>The <a href="https://www.npmjs.com/package/@noble/secp256k1">secp256k1</a> and <a href="https://www.npmjs.com/package/@noble/hashes">hashes</a> library by <a href="https://twitter.com/paulmillr">Paul Miller</a> are <strong>awesome</strong>, and help <strong>shrink the size</strong> of ethers, improve the ESM compatibility and provide a <strong>fully typed</strong> dependency for all the signing, hashing and password derivation functions needed by ethers.</p><p>This <strong>replaces ten dependencies</strong> by five different authors <strong>with two</strong> by the same author, who has made a significant effort to make a compact, audited set of libraries. Honestly, they are just so spot on.</p><h4>Dynamic and Typed Contract Methods</h4><p>The modern JavaScript feature I’m most excited about using is the Proxy object, which makes the Contract object much more straight forward.</p><p>In previous versions of ethers, a load-time warning was logged when a method was ambiguous and the method names for lookup had to be statically determined when the ABI was first used.</p><p>With the modern <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">JavaScript Proxy</a> object, this can be <strong>evaluated at run-time</strong>, reducing superfluous warnings for ambiguous methods that are never used, and method names can also be normalized on lookup, so contract[&quot;foo(uint256)&quot;] and contract[&quot;foo(uint bar)&quot;] both access the same methods (in v5 the latter would fail).</p><p>Along the same lines, methods with an ambiguous set of parameters also get a better way to be specified. The new Typed object, allows an otherwise ambiguous input (e.g. &quot;0x1234&quot;; should it be a uint16, bytes2, bytes, or string?) to be <strong>explicitly cast to its type</strong> using Typed.uint256(&quot;0x1234&quot;).</p><pre>const <strong>ABI</strong> = [<br>    &quot;function foo(bytes bar)&quot;,<br>    &quot;function foo(uint bar)&quot;,<br>    &quot;function foo(address bar)&quot;,<br>];<br>const <strong>contract</strong> = new Contract(address, ABI, signer);</pre><pre>const <strong>value</strong> = <strong>&quot;0xb1966861d47d2f2a1279fa46d9da0fecaf3071a4&quot;</strong>;</pre><pre><strong><em>// Throws an error, as the method to call is ambiguous</em></strong><br>//contract.foo(value)</pre><pre><strong><em>// Calls foo(bytes); same as `contract[&quot;foo(bytes)&quot;](value)`</em></strong><br>contract.foo(Typed.bytes(value))</pre><pre><strong><em>// Calls foo(uint256); same as `contract[&quot;foo(uint)&quot;](value) </em></strong><br>contract.foo(Typed.uint(value))</pre><pre><strong><em>// Calls foo(address); same as `contract[&quot;foo(address)&quot;](value)</em></strong><br>contract.foo(Typed.address(value))</pre><h4>Network Flexing</h4><p>The Network object is now a proper object, and can override a lot of network-specific functionality within the Provider. In most cases, non-Ethereum networks should be able to <strong>do away with their custom providers</strong>, and just roll all the necessary changes into their respective Network object.</p><p>The Network object also provides a plug-in system, which makes it much easier for provider-specific changes, and makes <strong>L2 providers</strong> much easier and flexible to create and use.</p><p>By swapping out methods on the Formatter object in a Network, low-level changes to the input and output values can be made.</p><pre><strong><em>// Network for Tendermint-based chains, which are mostly compatible<br>// with Ethereum, but differ in transaction hash calculation</em></strong></pre><pre><strong>class TendermintFormatter extends Formatter</strong> {<br>  transaction(value: any): any {<br>    const tx = super.transaction(value);<br>    tx.hash = <strong>tendermintHashFunction</strong>(tx);<br>    return tx;<br>  }<br>}</pre><pre><strong>class TendermintNetwork extends Network</strong> {<br>  constructor(name: string, chainId: string) {<br>    super(name, chainId, new <strong>CustomFormatter</strong>());<br>  }<br>}</pre><pre><strong><em>// We register a plugin, to ensure a new copy each time</em></strong><br>const <strong>createExchain</strong> = () =&gt; { new <strong>TendermintNetwork</strong>(&quot;enchain&quot;, 65);</pre><pre>Network.register(<strong>&quot;enchain&quot;</strong>, <strong>createExchain</strong>);</pre><pre><strong><em>// This could be added into its own ancillary package, but<br>// can now be used like any other network</em><br></strong>const<strong> provider = </strong>new<strong> JsonRpcProvider(&quot;exchain&quot;);</strong></pre><p>Or by adding plug-ins to a Provider, consumers of a provider (including sub-classes) can be extended seemlessly.</p><pre><strong><em>// Network for BSC which is compatible with Ethereum, but has<br>// alternate URLs for Etherscan</em></strong></pre><pre>const <strong>bscscanUrl</strong> = &quot;https://api.bscscan.com&quot;;<strong><br>class BscNetwork extends Network</strong> {<br>  constructor() {<br>    super(&quot;bsc-mainnet&quot;, 56);<br>    this.<strong>addPlugin</strong>(new <strong>EtherscanPlugin</strong>(bscscanUrl));<br>  }<br>}</pre><pre>Network.<strong>register</strong>(<strong>&quot;bsc-mainnet&quot;</strong>, () =&gt; (new <strong>BscNetwork</strong>()));</pre><pre><strong><em>// This can now be used directly by the EtherscanProvider</em><br></strong>const <strong>provider = </strong>new<strong> EtherscanProvider(&quot;bsc-mainnet&quot;);</strong></pre><h3>Conclusion</h3><p>Thanks for reading! This was just a quick article to whet your appetites, but the beta should be out soon for you to try. Follow <a href="https://twitter.com/ricmoo">me on Twitter</a> for my random thoughts and my imminent release announcements.</p><p>Thanks! And a Very Happy Holidays to all!</p><blockquote>“I’m from outer space! It’s not clear to me why you have to cook bread twice.” ~Korvo</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc1adb779d1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-december-2021-dc1adb779d1a">Highlights ethers.js: December 2021</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unstoppable and the Infinite Sadness]]></title>
            <link>https://medium.com/ricmoo/unstoppable-and-the-infinite-sadness-203f13e86488?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/203f13e86488</guid>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Tue, 26 Oct 2021 23:45:50 GMT</pubDate>
            <atom:updated>2021-10-27T00:31:10.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*Zdf4qLoBCEpu4w62ztYSWA.jpeg" /></figure><p>This began as a venting post as writing out my thoughts often helps me evaluate my feelings, calm down and respond with <em>some</em> decorum. I usually delete these once I’ve come to a rational and appropriate response, which then becomes a tweet or a short comment. But after refining this article, I believe it serves the purpose of an appropriate response itself. :)</p><p><strong><em>TL;DR:</em></strong><em> I’ve always had serious reservations adding UD to ethers, they were fully aware of my concerns and have since made the problem worse by adding more TLDs; me participating a few ENS meetings and doing code reviews (at this point, pro bono) is because I believe it is important to the future of blockchain and does not constitute a conflict of interest, subject to disclosure or otherwise.</em></p><p>For those unfamiliar with me, I’m the sole author of <a href="https://github.com/ethers-io/ethers.js">ethers.js</a>, which is a JavaScript library to simplify Web3 development. It has since become a quite popular library, and something I spend the vast majority of my time on. I now receive a salary from the <a href="https://ethereum.org/en/">EF</a> to work on it, and occasionally get a <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">grant</a> here or sponsor there; enough to dedicate full time effort to it and I love the freedom working on a project I created that others also love and choosing its direction.</p><p>I was recently <a href="https://twitter.com/matthewegould/status/1452128355235483654?s=12">attacked in a Tweet</a> by Unstoppable Domains (UD) which <strong>accused me of anti-competitively</strong> and inappropriately closing a PR involving their service and not disclosing any conflict of interest. I feel the <a href="https://github.com/ethers-io/ethers.js/pull/765">PR explains my reasons</a>, but I will go into more details.</p><p>I was approached by UD and had a meeting with them in January 2021. They wanted to be integrated into ethers; for which I had concerns as their system was using the TLD .crypto, a gTLD which I explained would almost certainly be under high demand during the next gTLD auction, <strong>especially by well-funded actors</strong>.</p><p>For some background, the issue I was concerned with is that ENS had released an awesome DNSSEC registrar on Ropsten for .xyz and would be releasing a similar registrar for all supported TLDs. <a href="https://youtu.be/aMs0wAFIu7I?t=15407">Nick gave a great demo at DevCon 3</a> in 2017 and it was epic; this would allow <strong>traditional web domains</strong> to interoperate seemlessly on the blockchain, a clear win for the Web3 universe! (FYI: it has since been launched on mainnet and supports over 1,300 DNS TLDs, such as .com and .org)</p><p>Once .crypto becomes a gTLD (through an ICANN auction), this would cause a <strong>name collision</strong>, since if someone tries to resolve ricmoo.crypto, should it resolve against the ENS registry (which resolves against the DNS system) or the UD registry? They would almost certainly disagree and it is likely that whoever buys the .crypto gTLD is intending for it to work correctly within the blockchain ecosystem.</p><p>Since then, they have been expanding the collection of TLDs being issued (e.g. .wallet and .nft) which <strong>exacerbates the problem</strong>, especially since these names will very likely be highly sought after by the well-funded.</p><p>This then becomes not just a nuisance, but a <strong>security concern</strong>. A malicious actor could purchase an intentionally-conflicting name, in hopes that some services rely on the service they registered on allowing them to receive ether, tokens or NFT’s intended for someone else.</p><p>After a few DMs and e-mails from them, pestering me and escalating (at this point, it was quite fair) to get their PR looked at, I explained my concerns and tried to tactfully explain that while I did not consider them necessarily <em>“bad actors”</em>, I did consider much of their activity to be <strong>not in the best interest</strong> of the ecosystem.</p><p>They messaged back, explaining they were sorry I felt that way and that they would like a chance to <strong>chat on Zoom</strong> to explain their side of the story, so we scheduled a meeting in January 2021. I would much rather discover I had misunderstood the situation and everyone wanted to march towards a better future. :)</p><p>During the chat, UD assured me that they had <strong>contingencies</strong> in the event they lost the gTLD auction; since, if this happened their registry would diverge from the .crypto namespace in ENS, as the ENS entries would mirror the values from DNS for people who purchased ricmoo.crypto through services like Namecheap.</p><p>Their worst-case contingency, if they lost or were unable to amicably cooperate with the winner of the gTLD auction, was to revoke all the .crypto names that were issued on UD, over some grace period, and <strong>migrate</strong> people onto <em>“something else”</em>.</p><p>I’ve also been thinking about and developing a process to migrate wallets and applications off of UD, but <strong>hopefully they will win</strong> .crypto and all this will be moot (I told them I would add them in a heartbeat if they owned the .crypto gTLD). I would love to see them win it and then ENS can just set a <a href="https://eips.ethereum.org/EIPS/eip-2544">wildcard resolver</a> for the .crypto TLD, which uses the UD registry, at which time they would automatically begin working in any existing ethers-based software.</p><p>At the time, I began writing an article explaining that <strong>they had quelled</strong> most of my concerns and that I would probably adopt UD into ethers, how there were contingencies they were working on and their reasons for believing they would successfully acquire the gTLD when it came time for the next ICANN auction.</p><p>During the call with UD, I also explained that I would be <strong>reaching out</strong> to the various wallets, services, etc. which had already integrated them to get more feedback on their confidence in their various solutions and contingencies.</p><p>The feedback was pretty unanimous across the board and did not leave me feeling as comfortable as I felt after the Zoom call with UD.</p><p>When I met with each project, most shared my same concerns, some hadn’t thought of it but after chatting became concerned. When asked why they decided to include support for .crypto, it was because UD had already done most of the work (as they did in the case of ethers, with a PR) and because UD <strong>offered them grants</strong> to merge it. They also offered me a “significant grant”, but never disclosed an amount; I told them I would want to further contemplate the ramifications first before discussing any grant.</p><p>So, I put the article explaining why I would adopt UD on hold and pretty much just ghosted them (which was quite inconsiderate on my behalf, I agree and do regret) until a week ago when I <strong>closed the outstanding PR</strong> (unmerged) in preparation for v6, which prompted the <a href="https://twitter.com/matthewegould/status/1452128355235483654?s=12">Tweet that “inspired” this article</a>.</p><p>I may not always agree with actors in the space, and sometimes we butt heads, but my emphasis is always on what I <em>personally</em> believe will benefit the <strong>health of the eco-system</strong> and do not appreciate being accused of working against its best interests, which is what I wanted to explain in this article and share a more detailed background on my decision.</p><p>Thanks. RicMoo.</p><h4>Notes</h4><ul><li>ENS uses .eth which is an <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3">ISO 3166–1 alpha-3</a> which ICANN at the time and currently has no future plans to release; making it a safe TLD.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=203f13e86488" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/unstoppable-and-the-infinite-sadness-203f13e86488">Unstoppable and the Infinite Sadness</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: September 2021]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-september-2021-1bf7cb47d348?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/1bf7cb47d348</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Wed, 08 Sep 2021 20:05:26 GMT</pubDate>
            <atom:updated>2021-09-08T20:05:26.148Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.4.6.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*dtlhZojhM9ZPMYZEzqxAeQ.jpeg" /><figcaption>“Drunken Lampposts” in Halifax, N.S.</figcaption></figure><p>Heya!</p><p>Time flies by too fast, but it’s been a few months, so it’s time for yet another quarterly-ish update on ethers and how I’m enjoying my time working on it.</p><p>I appreciate the pressure of <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny">GitCoin Grants</a>, which helps force me to keep up with these articles, otherwise it’s too easy to forego practicing natural-language writing in favour of machine-readable “stories” (i.e. code). :)</p><p>There have been a few minor bug fixes, documentation updates and some small improvements and there will probably be another minor-bump soon, to accommodate some changes that various L2 solutions are craving.</p><p>But the big items to show off are <strong>EIP-1559</strong> and the new ethers <strong>Playground</strong>.</p><h3>EIP-1559 (a.k.a. London) — Fee Market Hardfork</h3><p><a href="https://eips.ethereum.org/EIPS/eip-1559">EIP-1559</a> is out in the wild and running smoothly. Surprisingly smooth considering the significance of the change, which instills me with a great deal of confidence we can achieve great things together.</p><p>Since it was released, I have not had a single transactions not fulfilled within a minute; the prices have got out of hand due to <em>“NFT-mania”</em> a bit, but whenever the price is in the ballpark I can live with, <strong>things work without a hiccup</strong> in sight.</p><p>On that note, full EIP-1559 support was available as of version 5.4.0 and there should have been <strong>no code changes</strong> needed for most developers.</p><p><strong>Providers</strong> and <strong>Signers</strong> automatically detect if a network supports EIP-1559 and use it if available, otherwise fallback onto legacy transactions, unless explicitly told to do otherwise (via an explicit type field).</p><p>The <strong>Provider</strong> does have a new method (i.e. provider.getFeeData()) and few new properties to <em>blocks</em> (block.baseFee), <em>transactions</em> (tx.maxFeePerGas and tx.maxPriorityFeePerGas) and <em>receipts</em> (receipt.effectiveGasPrice) in responses for those who need access to the nitty-gritty.</p><p>One further point to consider is if you have code that uses tx.gasPrice, that it <strong>can now change</strong> depending on whether the block is in the mempool (in which case it is the maxFeePerGas) or has been mined (in which case it is the effectiveGasPrice). The future of what gasPrice will mean is still an ongoing conversation, so just keep that in mind if you find yourself using it.</p><p>Also, the transactions <strong>serializer and parser</strong> recognize type 2 to support EIP-1559, but with the addition of <a href="https://eips.ethereum.org/EIPS/eip-2718">type transactions</a> earlier this year (for <a href="https://eips.ethereum.org/EIPS/eip-2930">accessList transactions</a>), this required very few changes. It took longer to write the script to generate test cases than it did to add it.</p><h3>The Playground… It’s alive!</h3><p>The <a href="https://playground.ethers.org/">Playground</a> is where I spent a substantial portion of my time over the last few month.</p><p>It is something I’ve wanted to put together for a long time, talked about on numerous occasions and something I’ve already got a great deal of use out of; prototyping and tinkering some ideas, as well as help create examples for GitHub issues and discussions.</p><p>It is basically a web-based REPL environment with ethers loaded in it, sandboxing eval calls in a WebWorker, and providing a friendly UI and documentation along side the commands you use.</p><h4>Experimental Features</h4><p>There are some features which are <strong>off by default</strong>, as they are still experimental and in some cases may be more trouble than they are worth.</p><p>The experimental <strong>Auto-Complete</strong> uses a custom JavaScript lexer, which parses JavaScript backwards from the cursor to make educated guesses as to what you are trying to do.</p><p>It has full access to the help sub-system though, so it can recommend operations which might not otherwise be accessible to the JavaScript runtime and provide placeholders for the required parameters. It will get better with time, but please feel free to complain.</p><p>The experimental <strong>Pass-Through Provider</strong> enables access to <em>MetaMask</em> (or other injected Web3 providers) from the WebWorker environment. Every operation requested through the provider is logged to the screen, so you can see what is going on.</p><p>Soon there will be an additional portion of UI providing an extra level of security between the WebWorker environment and <em>MetaMask</em>, allowing the operation to be rejected before even being passed along.</p><h3>Odds ‘n Ends</h3><ul><li>Polygon (matic) support added to the various third-party providers, like INFURA and Alchemy; once a billing issue is worked out it will be available with the default provider</li><li>Launched the new <a href="https://ethers.org/">ethers.org</a> site; if you have an open-source project built on ethers, please <a href="https://ethers.org/building.html">submit it to be included</a> on the site</li><li>Resolving a lot of stale issues and trying to move issues which only served as discussions to the new <a href="https://github.com/ethers-io/ethers.js/discussions">GitHub Discussions</a> feature, once this is under control I can start releasing the beta v6 branch</li><li>More work on the Ancillary Package template, so it is easier to share the work load and get more exciting packages working in tandem with ethers</li><li><a href="https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md#ethersv546-2021-08-27-1534">Lots of little things</a></li></ul><h3>Until next we meet again…</h3><p>If you have any comments or suggestions, please reach out to me on Twitter (DMs are open, or just blast me publicly) or on GitHub (e-mail of ethers discussions).</p><p>Thanks! And keep on hacking! <strong>:)</strong></p><blockquote>“This was a triumph; I’m making a note here: HUGE SUCCESS. It’s hard to overstate my satisfaction.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf7cb47d348" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-september-2021-1bf7cb47d348">Highlights ethers.js: September 2021</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: May 2021]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-may-2021-2826e858277d?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/2826e858277d</guid>
            <category><![CDATA[error]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ether]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Thu, 20 May 2021 21:36:29 GMT</pubDate>
            <atom:updated>2021-05-25T06:10:18.766Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of </em><a href="https://github.com/ethers-io/ethers.js"><em>ethers</em></a><em> as of this article is 5.2.0.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*wX1E5PLnR8AlGQWL-1319g.jpeg" /><figcaption>Spring is here (and almost gone); sakura cherry blossom (by Ahmed Mulla)</figcaption></figure><p>Ahoy!</p><p>This highlights article is a bit earlier than usual (I’m targetting every 3-ish months), but it seemed like a good time to introduce some of the changes in <a href="https://github.com/ethers-io/ethers.js/releases/tag/v5.2.0">v5.2</a>, which are a bit more substantial and might benefit from a little extra explaining.</p><p>Also, by making a minor version bump I was also able to spruce up some other functionality that required slight changes to the signatures, in backwards-compatible ways.</p><h3>Custom Contract Error</h3><p><a href="https://blog.soliditylang.org/2021/04/21/custom-errors/">Solidity recently added support</a> for <strong>custom contract errors</strong>, which allow for more expressive errors than the existing Error(string message) type.</p><p>There isn’t much to say beyond, <strong>this is awesome</strong>! It has been a long-awaited feature, but is available as of Solidity 0.8.4.</p><p>And that now ethers supports them for all your error handling needs and desires, in <strong>both JSON ABIs</strong> and <strong>Human-Readable ABIs</strong>. and exposes the error details in thrown <strong>CALL_EXCEPTION</strong> errors.</p><p><strong><em>Example:</em></strong></p><pre><strong>// test.sol</strong><br>contract Test {<br>  <strong>error SomeCustomeError(address addr, uint256 balance);</strong></pre><pre>  mapping (address =&gt; uint) _balances;</pre><pre>  function throwIfNotZero(address owner) pure returns (bool) {<br>    if (_balances[owner] &gt; 0) {<br>      <strong>revert SomeCustomError(owner, _balances[owner]);</strong><br>    }<br>    return true;<br>  }</pre><pre>  // ... more code here ...</pre><pre>}</pre><p><em>The coresponding JavaScript (in ethers):</em></p><pre><strong>// example.js</strong><br>const abi = [<br>  &quot;function throwIfNotZero(address owner) pure returns (bool)&quot;,<br>  <strong>&quot;error SomeCustomError(address addr, uint256 value)&quot;</strong><br>];</pre><pre>const <strong>contract</strong> = new Contract(someAddress, abi, provider);<br>try {<br>  const <strong>result</strong> = <strong>await contract.throwIfNotZero(addr);<br></strong>  console.log(&quot;Result:&quot;, <strong>result</strong>);</pre><pre>} catch (e) {<br>  if (<strong>e.code</strong> === Logger.errors.<strong>CALL_EXCEPTION</strong>) {</pre><pre>    <strong>// If the error was SomeCustomError(), we can get the args...</strong><br>    if (<strong>e.errorName === &quot;SomeCustomError&quot;</strong>) {</pre><pre>      <strong>// These are both the same; keyword vs positional.</strong><br>      console.log(<strong>e.errorArgs.addr</strong>);<br>      console.log(e.errorArgs[0]);</pre><pre>      <strong>// These are both the same; keyword vs positional</strong><br>      console.log(<strong>e.errorArgs.value</strong>);<br>      console.log(e.errorArgs[1]);<br>    }<br>  }<br>}</pre><p><strong><em>Note:</em></strong><em> this mainly benefits constant contract methods or when using the callStatic technique of analyzing state-mutating contract methods, since transactions still cannot return their error data in a reverted (status = 0) transaction.</em></p><h3>Detecting Replacement Transactions</h3><p>A common problem many developers have to deal with is users <strong>changing their minds</strong> after submitting a transaction.</p><p>With the current surges and volatile gas prices, many users after submitting a transaction, may decide to <strong>increase the gasPrice</strong> to get their transaction in faster (or at all). But changing the gasPrice results in a different transaction hash, which is bad if your application is waiting indefinitely for that hash; ideally you would like to know the new hash and keep on truckin’.</p><p>MetaMask (and similar clients) also supports <strong>cancelling a transaction</strong>. The Ethereum network doesn’t explicitly support cancelling a transaction already in the mempool, but it can be approximated by sending a new transaction with the same nonce, but with a higher gasPrice (with the value and data set to zero, and the to set to from), effectively bribing miners to ignore the initial transaction and focus on the new one. Once this new transaction is mined, the original transaction has become invalid and therefore cancelled.</p><p>Sometimes, a user may just forget about a stale transaction that was under-priced and later make another, completely unrelated transaction which satisfies the current gas price, <strong>replacing the earlier stale transaction.</strong> This is ultimately the same as cancelling a transaction, but less explicit.</p><p>So, a new feature has been added to help developers <strong>detect and course-correct</strong> their applications when things go awry.</p><p>When using tx.wait() on a transaction made from the sendTransaction() method of a Signer (<strong>including non-constant methods on Contract</strong>), if the transaction is <em>repriced</em> or <em>cancelled</em>, a <strong>TRANSACTION_REPLACED</strong> error is thrown along with some extra details of what happened, allowing for appropriate <em>“next steps”</em> to be taken.</p><p><strong><em>Example:</em></strong></p><pre><strong>// Send the transaction</strong><br>const tx = await contract.transfer(to, amount);</pre><pre>try {<br>  <strong>// Wait for the transaction to be mined</strong><br>  const receipt = await tx.wait();</pre><pre>  <strong>// The transactions was mined without issue</strong><br>  myProcessMinedTransaction(tx, receipt);</pre><pre>} catch (error) {<br>  if (<strong>error.code</strong> === Logger.errors.<strong>TRANSACTION_REPLACED</strong>) {</pre><pre>    if (error.cancelled) {<br><strong>      // The transaction was replaced  :&#39;(</strong><br>      myProcessCancelledTransaction(tx, error.replacement);</pre><pre>    } else {</pre><pre><strong>      // The user used &quot;speed up&quot; or something similar<br>      // in their client, but we now have the updated info<br></strong>      myProcessMinedTransaction(error.replacement, error.receipt);<br>    }<br>  }<br>}</pre><p>The error object in the event of a <strong>TRANSACTION_REPLACED</strong> error has a few useful properties to simplify further processing:</p><pre>Error {<br>  <strong>code:</strong> &quot;TRANSACTION_REPLACED&quot;,</pre><pre>  // The reason why the transaction was replaced<br>  // - <strong>&quot;repriced&quot;</strong> is generally nothing of concern, the <br>  //   only difference in the transaction is the gasPrice<br>  // - <strong>&quot;cancelled&quot;</strong> means the `to` has been set to the `from`,<br>  //   the data has been set to `0x` and value set to 0<br>  // - <strong>&quot;replaced&quot;</strong> means that the transaction is unrelated to<br>  //   the original transaction<br>  <strong>reason:</strong> &quot;repriced&quot; | &quot;cancelled&quot; | &quot;replaced&quot;,</pre><pre>  // This is a short-hand property as the effects of either a<br>  // &quot;cancelled&quot; or &quot;replaced&quot; tx are effectively cancelled<br>  <strong>cancelled:</strong> (reason === &quot;cancelled&quot; || reason === &quot;replaced&quot;),</pre><pre>  // The TransactionResponse which replaced the original<br>  <strong>replacement:</strong> [ the replacement transaction response ]</pre><pre>  // The TransactionReceipt of the replacement transaction<br>  <strong>receipt:</strong> [ the receipt for the replacement transaction ],<br>}</pre><p><strong><em>NOTE:</em></strong><em> if a transaction is repriced or cancelled in the client, the original transaction may still be mined instead of the replacement, in which case the original code path is followed and the </em><em>catch is never entered</em></p><h3>Some house cleaning…</h3><ul><li>Several <strong>simple signature changes</strong> that bring the type-checking more in-line with the implementations, such as <em>BigNumberish</em> incuding <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt">bigint</a> and filters allowing null topics</li><li>The EtherscanProvider has been redesigned to make sub-classing more flexible, so their <strong>BscScan</strong> explorer APIs can be easily integrated; the ancillary package will be available soon</li><li>The FixedNumber formatted string and unit formatting no longer include decimal points for <strong>types</strong> which have <strong>zero decimal places</strong> (types with 1 or more decimal places will still always include a decimal and at least one whole and one decimal value) as well as parsing is now more forgiving if superfluous zeros are present</li><li>A small collection of other <strong>small improvements</strong> that jived well backwards-compatible signature changes</li></ul><p>As always, to see all the <strong>nitty gritty details</strong>, the <a href="https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md">Changelog</a> is automatically managed by the publish scripts, with links to the changes and issues they resolve.</p><h3>That’s all folks…</h3><p>If you have any comments or questions, feel free to reach out to me on <a href="https://twitter.com/ricmoo">Twitter</a> (via public Tweets, or DMs are open) or on <a href="https://github.com/ricmoo">GitHub</a> (e-mail or <a href="https://github.com/ethers-io/ethers.js/discussions">ethers discussions</a>).</p><p>Happy coding and thanks for reading! :)</p><blockquote>Who is this General Failure, and why are they reading my harddrive?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2826e858277d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-may-2021-2826e858277d">Highlights ethers.js: May 2021</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: March 2021]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-march-2021-173d3a545b8d?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/173d3a545b8d</guid>
            <category><![CDATA[ether]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Sat, 13 Mar 2021 01:18:37 GMT</pubDate>
            <atom:updated>2021-03-13T01:18:37.372Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of ethers as of this article is 5.0.32.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*r0Wa-boWgn_rFHxt3ob3sg.jpeg" /><figcaption>One year ago, in France for EthCC, wandering around finding parks that forbid dogs from playing soccer…</figcaption></figure><p>Ahoy!</p><p>Wow… Three months have just flown by and it’s already time for <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">Round 9 of the GitCoin Grants</a>, which I’m still appreciating each round as little nudge and a bit of pressure to release each quarterly update.</p><p>Again, I cannot express enough how thankful I am to everyone who contributes. Not just to ethers, but to all the projects that are out there, making a difference to myself, fellow developers and the ecosystem at large.</p><p>High-five yourself, and keep on begin excellent to one another. Party on!</p><h3>Issues and Pull Requests</h3><p>I’ve been trying to get as many <a href="https://github.com/ethers-io/ethers.js/issues">issues</a> triaged and <a href="https://github.com/ethers-io/ethers.js/pulls">pull requests</a> merged or closed before releasing a public beta for v6.</p><p>Once I make the fork, maintenance become twice as time consuming as patches need to be made against both branches, so it is best to start with as few outstanding issues as possible.</p><p>So, over the next few weeks I’ll be more aggressive resolving issues (closing stale issues, marking for future releases, etc.) but also migrating many of the issues to GitHub’s new <a href="https://github.com/ethers-io/ethers.js/discussions">Discussion</a> feature. Nearly half of the currently open issues are actually discussions anyways, which will leave issues open for just bugs (currently zero) and feature requests.</p><h3>Upcoming v5 Interface Changes</h3><p>The Berlin hard fork has a few EIPs in it that snuck up on me and are going live far faster than I expected.</p><p>So, the utils.parseTransaction and utils.serializeTransaction will soon have full <a href="https://eips.ethereum.org/EIPS/eip-2718">EIP-2718</a> (Typed Transaction Envelopes) and <a href="https://eips.ethereum.org/EIPS/eip-2930">EIP-2930</a> (Optional Access Lists) so keeping your applications up to date with the latest network changes should just be a matter of updating your version of ethers.</p><p>This does require an interface change, such as adding a type and accessList field, which will be optional parameters, so this should be backwards compatible.</p><p>For the most part, I expect this change to have very little impact on most developers as untyped transactions are still valid, so older versions of ethers will continue to work, but you will need to update ethers if you wish to send transactions that use the <em>optional access lists</em> or get the type property from provider.getTransaction(hash).</p><p>If anyone does have any issues though, I’ll be available to help out with any migration woes.</p><h4>V6 and Beyond!</h4><p>Most of my time over the last two months has gone into v6, refactoring, rewriting and experimenting with some TypeScript non-sense I’ve had rattling around in my head. I just thought I’d share a few bullet points that are on the horizon.</p><h4>Speak Better TypeScript</h4><p>When I started using TypeScript for v4, it was a brand new language to me, and I was still learning many of the finer intricacies, best practices and how other tools interacted with it and the code it generated.</p><p>Additionally, TypeScript has been an evolving language, and with each version, they seem to have been reading my mind, and addressing many of my early complaints.</p><p>Now that I’m a (little?) older and little wiser for the wear, there are a lot of areas I am focussing on to help make things <em>“pop”</em> a bit more with the typing system and fall into place.</p><h4>Modern (ish) JavaScript</h4><p>Currently v5 supports any ES3 (ish) environment. While this means it is likely to run more of less fine on that laptop in your closet from 2009, it also means a lot of newer features have not been able to be used, even internally.</p><p>In v6, ethers will require an ES2016 (aka ES5) environment.</p><p>This will allow ethers to use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields">private fields</a> (transpiled via WeakMaps), which means private variables will truely be private, which improves safety, security and performance.</p><p>It also opens up a world of useful features, such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxies</a>, which make for a much smoother meta-class experience, which is the basis for the Contract APIs.</p><p>This also means that node.js version 8 will no longer be supported, but I suspect this does not impact very many people.</p><h4>Contracts</h4><p><strong>Contracts</strong> will be one of the areas to see the most significant changes. They will use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy API</a>, which means a lot of things become possible that weren’t possible before.</p><p>For example, looking up a Contract method can be done with non-normalized signatures, so both foo(address) and foo(address bar) will work. Also, any warnings for ambiguous ABI methods can be deferred and only emitted if the offending methods are used.</p><p>I’m also planning an explicit (optional) <strong>Type</strong> Object, which will allow calling overloaded methods, without having to specify them by their signature at all, so contract.foo(Type.uint160(b) will know how to pick the right method if there are mulitple foo methods.</p><p>The <em>buckets</em> will also be going away (e.g. contract.staticCall.foo, contract.populateTransaction.foo) and the order will be moved around a bit (e.g. contract.foo.staticCall and contract.foo.populateTransaction) while the base method will still perform the default operations (e.g. contract.foo()). They were originally in place to more closely match how the Interface works so they could be iterated through, but the Interface is no longer a meta-class, so it is easier to inspect in general.</p><h4>Flexibility inside and out</h4><p>More objects will be proper classes, instead of basic objects with a plethora of properties.</p><p>A <strong>Transaction</strong> object can be created from a bunch of properties, or serialized transaction data (signed or unsigned), and depending on its type and what properties it has, can have other properties computed. There is also a mutable Transaction state which allows for easier incremental creation.</p><p><strong>Contract</strong> objects and <strong>Signer</strong> objects will both implement the Addressable interface, which means they can be used anywhere an address can, such as the to field in a transaction, or as the address passed into the Provider getStorageAt method.</p><p>The <strong>Web API</strong> is getting a major overhaul too, making it easier to interact with a larger variety of backends, including requests which need to be individually signed, similar to AWS requests.</p><h4>Dependencies</h4><p>I’ve been playing around with some alternatives to the current dependencies to reduce the number of dependant packages over all and select more compatible and friendly options.</p><p>Ethers currently sits at 5 dependencies (6 for node.js, as it requires a <a href="https://www.npmjs.com/package/ws">WebSocket</a> library) but 3 of those dependencies have historically been a headache for bundlers, and are tightly coupled to each other, so the plan is to replace <em>elliptic</em>, <em>BN.js</em> and <em>hash.js</em> with something lean and bundler-friendly.</p><p>For the sake of mystique and intrigue, I’ll just say “more on that later…” ;)</p><h3>Feedback</h3><p>Please do not hesitate to reach out to me on <a href="https://twitter.com/ricmoo">Twitter</a> (via public Tweets, or DMs are open) or <a href="https://github.com/ricmoo">GitHub</a> if you have any comments or suggestions.</p><p>Any and all feedback is welcome. Thanks! :)</p><blockquote>“Experience was of no ethical value. It was merely the name we gave to our mistakes.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=173d3a545b8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-march-2021-173d3a545b8d">Highlights ethers.js: March 2021</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights ethers.js: December 2020]]></title>
            <link>https://medium.com/ricmoo/highlights-ethers-js-december-2020-2e2db8bc800a?source=rss----7ea1b543a2b9---4</link>
            <guid isPermaLink="false">https://medium.com/p/2e2db8bc800a</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ether]]></category>
            <dc:creator><![CDATA[RicMoo]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 20:26:04 GMT</pubDate>
            <atom:updated>2020-12-03T20:26:04.258Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The current version of ethers as of this article is 5.0.23.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*TPcX86ngmM9axxQ7PbUJ-A.jpeg" /></figure><p>Hey all!</p><p>It’s been quite a while since I’ve posted any updates on ethers, so I thought I’d catch everyone up on some of the recent work I’ve been up to.</p><p>I’m hoping to make these articles a more regular occurrence, and thought that <a href="https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2">Round 8 of the GitCoin Grants</a> would be as good a reason as any to kick these articles off, doubling as updates to all my previous backers.</p><p>A <strong>huge</strong> thanks to all of you, by the way. It still feels so surreal that random strangers from around the world would volunteer their hard earned money to support some guy sitting in Toronto writing free software.</p><p>You <em>are</em> the bees knees. <em>*heart emoji*</em></p><h3>EIP-712: Sign Typed Data (experimental)</h3><p>One of the most requested (of which, the requests were always the most impassioned) features was support for <a href="https://eips.ethereum.org/EIPS/eip-712">EIP-712</a>, <strong>signing typed data</strong>, which is now available experimentally.</p><p>All built-in signers have the _signTypedData method and there is a _TypedDataEncoder class in the utilities for other libraries that wish to have lower level access to the primitives needed to sign typed data or cache intermediate steps.</p><p>Once people are happy with the API, the underscores will be dropped, although an alias will be kept for the remainder of v5 so code using it won’t break.</p><p>In v6, the signTypedData property will become part of the Signer Interface, but that would break backwards compatibility in v5 (to any existing custom sub-classes) so for v5, a class must opt-in by implementing the <a href="https://github.com/ethers-io/ethers.js/blob/master/packages/abstract-signer/src.ts/index.ts#L54">TypedDataSigner</a> interface.</p><p>I would also like to send out a quick thanks to <a href="https://twitter.com/recmo">recmo</a>, <a href="https://twitter.com/phabcd">PhABD</a> and <a href="https://twitter.com/danfinlay">danfinlay</a> for their assistance with this feature! Thanks!</p><h3>React Native Testing</h3><p>There is now <strong>full testing</strong> for React Native! I wanted to mention this and show off some of the things…</p><p>The test suite uses NPM to install the react native framework, ethers library and all the necessary CocoaPods to build a React Native App and launch it in an iOS simulator on GitHub actions as part of the Continuous Integration (CI).</p><p>One of the more interesting parts I wanted to show off for this solution is the <a href="https://github.com/ethers-io/ethers.js/blob/master/misc/ReactNativeTestApp/faux-registry/server.js">Faux Registry</a>, which I plan to break out at some point as a stand-alone package.</p><p>The Faux Registry is a simple node.js Web Server which mimics a normal NPM registry server, except it hijacks any request for a package managed by the monorepo, and serves the local, possibly unpublished version (from the monorepo) as if it were the published metadata and tarball. Any other requests are forwarded along to the actual NPM registry.</p><p>This allows the standard NPM workflow to be used when setting up React Native, proceeding how the real world will treat ethers once the version being tested is published.</p><h3>ESM Overhaul</h3><p>The ESM build system has undergone some major changes to make life simpler and tree-shaking far more effective for people using ethers in the browser and with bundlers.</p><p>There is still some work to be done to make tree-shaking possible for those that use bundlers for node.js distributions, but the majority of users using the ESM builds are browser-based, and it is generally easier for node.js builds to modify their config. Unfortunately, there is no best solution, only various degrees of terrible solutions, but I think this works the best for the widest possible audience.</p><p>The new build produce sub-packages with the module field pointed to browser-ready modules, so <a href="https://webpack.js.org/">webpack</a> and <a href="https://www.rollupjs.org/guide/en/">rollup.js</a> (and React Native, which uses webpack) require no additional configuration and work out of the box, with full tree-shaking.</p><p>The <a href="https://www.npmjs.com/package/elliptic">elliptic</a> library is also thinned and bundled into the SigningKey module library, which has traditionally been a pain point for bundlers as it has circular dependencies and thinning it (e.g. pulling out the large pre-generated sep256k1 tables and unused curves and dependencies) requires some somewhat involved code.</p><h3>Odds and ends…</h3><ul><li>Support for legacy external events with incorrect padding from a Solidity bug; by popular demand from a <a href="https://github.com/ethers-io/ethers.js/issues/891">fleet of Web3.js issues</a></li><li>The ENSProvider Interface was added to indicate support for <a href="https://eips.ethereum.org/EIPS/eip-1577">Content Hash</a> (like <a href="https://ipfs.io/">IPFS</a> or Swarm), <a href="https://eips.ethereum.org/EIPS/eip-634">Text Records</a> (email, website, etc.) and <a href="https://eips.ethereum.org/EIPS/eip-2304">Multi-Chain support</a> (e.g. lookup your Bitcoin address on Ethereum); all providers now support this, including any custom sub-classes (of BaseProvider) you may have written yourself, no additional code required</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity">Subresource Integrity</a> is now supported for the UMD bundles, and each release’s notes includes the <a href="https://github.com/ethers-io/ethers.js/releases/tag/v5.0.23">necessary code</a> with content hash</li><li>Lerna is no-more; replaced by a handful of <a href="https://github.com/ethers-io/ethers.js/blob/master/misc/admin/src.ts/cmds/link.ts">local scripts</a> that create the ratsnest of symlinks, this provides a great deal <strong>more flexibility</strong>, is a <strong>lot faster</strong> and <strong>reduced</strong> the number of dev dependencies by over 600, including some with incredibly outdated <strong>security issues</strong></li><li>Lots of <strong>quality-of-life</strong> improvements, input validation and minor <strong>bug fixes</strong></li></ul><h3>What’s Next?</h3><ul><li>Adding GitHub <strong>sponsorship options</strong> to see if there is any interest in community funding</li><li>I will be posting an <strong>article about v6</strong> which is slated for late-spring/early-summer.</li><li>Research and <strong>improve FallbackProvider</strong> for calls that are overly wild (e.g. use of now currently causes a lot of quorum issues in the FallbackProvider)</li><li>Use <strong>Twitter Polls</strong> to get some community feedback on what features or issues people are most interested in me focusing on next</li><li>Research <strong>replacing elliptic</strong> and bn.js libraries, which will make everyone’s bundling life even more simple (this will be part of the poll)</li></ul><blockquote>“Twinkly lights, shine.</blockquote><blockquote>If one of them goes out, then none of them light.</blockquote><blockquote>Or at least that’s how it used to be; now that LEDs work a bit differently.</blockquote><blockquote>But you know what I mean.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e2db8bc800a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ricmoo/highlights-ethers-js-december-2020-2e2db8bc800a">Highlights ethers.js: December 2020</a> was originally published in <a href="https://medium.com/ricmoo">RicMoo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>