<?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 Alexandro T Netto on Medium]]></title>
        <description><![CDATA[Stories by Alexandro T Netto on Medium]]></description>
        <link>https://medium.com/@alextnetto?source=rss-7aa140737cc0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B6jO6q_it7mkdWmzXbgP0w.jpeg</url>
            <title>Stories by Alexandro T Netto on Medium</title>
            <link>https://medium.com/@alextnetto?source=rss-7aa140737cc0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 12:51:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alextnetto/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[ETHRegisterControllerV2]]></title>
            <link>https://medium.com/blockful/ethregistercontrollerv2-29d04eec48a5?source=rss-7aa140737cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/29d04eec48a5</guid>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ethereum-name-service]]></category>
            <dc:creator><![CDATA[Alexandro T Netto]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 14:46:03 GMT</pubDate>
            <atom:updated>2023-07-14T19:20:57.532Z</atom:updated>
            <content:encoded><![CDATA[<p>A brief resume of features Blockful did for ENS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*iRpMzWauILRJnLfmuKwmLA.gif" /></figure><h3>Intro</h3><p>This present article will cite the more relevant modifications embracing the features voted by the ENS community. The full technical article can be found <a href="https://medium.com/@guihcneves/ethereum-name-service-5494c49930bf">here</a> and the gas tests <a href="https://docs.google.com/spreadsheets/d/18bcSbpRuz2cPuy2_foI3jQLFJS_WYHciOGgEWkITtnI/edit">here</a>.</p><p>Embracing the features voted by the ENS community and demonstrating the gas savings of up to 40% per registration and 75% per renewal in relation to the current method.</p><h3>Features Implemented</h3><p><strong>Referral</strong></p><p>This feature aims at giving power to registrar apps and influencers as the protocol will share its service fees with the referrer.</p><p>Front-end apps can be built to prospect the ENS services in their own domain. An increase in engagement and more elaborated gamification of the protocol is expected.</p><p><strong>Commit with Payment</strong></p><p>Currently, the ENS app requires two transactions, the first being a plain commitment and the second a reveal where the user sends funds.</p><p>By now, a commitment has a minimal waiting period of 1 minute and maximum expiry date of 1 week, meaning that the user could commit to one name and only send the transaction a few days later, but this is not recommended as the name is only registered on the last step, taking 4 steps for the payment to happen. We changed the process so that users could pay first and have their names revealed later by the front-end app.</p><p>In the following diagram we can see how those interactions (referral + commit with payment) occur on-chain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W6ziMOXabChhn8kL.png" /><figcaption>internal function _SetBalance from ETHRegistrarControllerV2.sol</figcaption></figure><p><strong>Batch Commit</strong></p><p>Since in the last feature we added the option to pay in the commitment and the referral system, we expect single transactions to be more expensive due to storage use and more checks, but with the batch feature, we made the overall cost of multiple names a cheaper process.</p><p><strong>Batch Reveal</strong></p><p>This feature aims to reveal an entire batch of names at once. It will consume the commit creator&#39;s credits on the contract or use msg.value to reveal the batch, in case it meets all criteria.</p><p>We made this feature in a way where batches are the intention to register multiple names, containing multiple registrations residing in an array. Even 1 name, is an array with length 1, and so on.</p><p><strong>Batch Renew</strong></p><p>We found that renewals could also be done in batch, thus we tested the efficiency of it finding out that renewing a batch of 100 names will save up to 74% gas in a single transaction instead of running the same function 100 times.</p><h3>Contracts Modifications</h3><p>Organizing the core functions of the protocol, we implemented an interface(solidity’s struct), that will become a more elegant way of managing the registrations in batches:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51daa4efca8c123cf9c05a5a5186b453/href">https://medium.com/media/51daa4efca8c123cf9c05a5a5186b453/href</a></iframe><p>Every registration holds enough information to guarantee the purchase of names and services. This allows the contract to loop the batch, registering all names in it. Since the consumeCommitment is now called only once in multiple names registered, the gas consumption is reduced for batch name reveals.</p><p>We registered 190 names and measured the gas uses for the commits, reveals, and renews comparing the current batch (v2) approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/0*szWVwhncSaMaYQRv.png" /></figure><p>We first realize that there is a massive saving with the commit operation itself since the number of times this would be called would change from 190 to 1. Reducing the gas cost of the commits from 8398190 to 44201. If you notice, this will save around 99% of the current cost.</p><p>Now jumping to the reveal function which is the last step before firming the registration, we’ve managed to total 262705 of average gas cost for simple reveals including all the new features, this is an increase of around 12% for single registrations.</p><p>Although the first name might have a cost increase, the batch mechanism slightly reduces each subsequent name revealed, rapidly finding a plateau at around 40% discount for each name. After 10 names, the discount on new registrations would be reduced by 36%.</p><p>We can see in the chart below, the economy when registering batches in relation to a single registration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*BqRrezTvl0QRGTn5.png" /></figure><p>Notice how fast the batch registration pushes up the discount on a small number of names. While slightly decreasing the discount on the next name and so on. Every new batch unity is cheaper than the previous as it is showed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/0*LGp0BM4OsRfxZJrq.png" /></figure><p>What amazed us the most was the batch renewal. By doing the same 190 names renews we plotted the same chart doing a comparison between the single renew with the referrer feature and the batch renew:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*W9ZSuATz65wd605u.png" /></figure><p>At the 200&#39; name, the cost for each subsequent name will be a 75% discount. Reducing the usage of a single renewal from 84921 to 21780.</p><p>Following is the cost of each unity across renewals:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*uHoAlfv6Q7WK6CpL.png" /></figure><p>If you want to check all the test data, more charts, or contribute, google sheets are available <a href="https://docs.google.com/spreadsheets/d/18bcSbpRuz2cPuy2_foI3jQLFJS_WYHciOGgEWkITtnI/edit?usp=sharing">here</a> to read and comment on.</p><h3>Conclusion</h3><p>Overall speaking about the project: We saw a fascinating growing space for the ENS ecosystem, it feels that getting to know and work with all the mechanics in the contract somehow told us a story about the mission we are helping to build.</p><p>Follow us and learn more!</p><p><a href="https://blockful.io/"><strong>Blockful</strong></a><strong> </strong>|<strong> </strong><a href="https://twitter.com/Blockful_io">🐦</a> | <a href="https://github.com/blockful-io">🐱</a> |<a href="https://www.linkedin.com/company/blockful"> 👤</a></p><p><em>And thanks Gui Neves for your effort on this contribution too!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29d04eec48a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockful/ethregistercontrollerv2-29d04eec48a5">ETHRegisterControllerV2</a> was originally published in <a href="https://medium.com/blockful">Blockful</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Referral Feature added to ENS]]></title>
            <link>https://medium.com/blockful/referral-feature-added-to-ens-15c9635762b8?source=rss-7aa140737cc0------2</link>
            <guid isPermaLink="false">https://medium.com/p/15c9635762b8</guid>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum-name-service]]></category>
            <dc:creator><![CDATA[Alexandro T Netto]]></dc:creator>
            <pubDate>Wed, 03 Aug 2022 23:50:56 GMT</pubDate>
            <atom:updated>2022-08-06T02:34:16.589Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*U4Z63xQpjqvTj-yzAmGXZg.png" /></figure><p>Earn commission by creating ENS DApps</p><h3>Intro</h3><p>The Ethereum Name Service wants to implement a referral program inside its ecosystem, so we did it! Every registration of a new ENS or the renewal of one creates a referrer opportunity. The referral commission is settled by the contract owner and the ‘_setBalance’ function will split the purchase rewarding the same percentage that was previously settled. To disable referral commission, simply change its value to 0 and no rewards will be given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*iRpMzWauILRJnLfmuKwmLA.gif" /><figcaption>ENS registrations after referral feature</figcaption></figure><h3>Implementation</h3><p>For backward compatibility, we created ETHRegistrarControllerV2 and IETHRegistrarControllerV2 for adding this feature and the next ones we are working on.</p><p>No additional imports were needed. Currently using the IETHRegistrarControllerV2 interface.</p><h4>Variables</h4><p><strong>referralFee: </strong>A variable with type uint256 called ‘referralFee’ should be initialized with any value from 0 to 1000 — for better granularity. Representing the percentage for which the referrer will receive.</p><pre>uint256 public referralFee = 50;</pre><p><strong>balances: </strong>A mapping variable addressing the uint256 eth value into the referrer address. Storing the information within the contract that allows the referrer to claim that value by calling the ‘withdrawn’ function</p><pre>mapping(address =&gt; uint256) public balances;</pre><h4>Functions</h4><p><strong>setReferralFee: </strong>A set function, for the ‘referralFee’ value, was made to adjust as intended by the protocol. Notice the event emission registering the change as well as the conditionals to assure that the minimum and maximum percentage are possible to be set correctly.</p><ul><li>The function will accept one argument which will only be valid by being an int value between 0 and 1000, otherwise, it will revert.</li><li>Only the contract owner can call the function</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a37e49717d9a1b6b88e809e102f77f12/href">https://medium.com/media/a37e49717d9a1b6b88e809e102f77f12/href</a></iframe><p><strong>_setBalance: </strong>This function is supposed to split the eth received after purchase or renewal of an ENS domain, based on the percentage settled in the referralFee variable. It has two inputs:</p><ul><li>address referrer</li><li>uint256 amount</li></ul><p>The referrer will have the amount stored in a map in case criteria are met, being eligible to withdraw that amount by calling the ‘withdraw’ function. Otherwise, in case there is no referrer set or the commissions are off, the entire amount will be registered in the name of the current contract owner.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b88dbab0cff6f014de2f150df5c60a0/href">https://medium.com/media/9b88dbab0cff6f014de2f150df5c60a0/href</a></iframe><p><strong>withdraw: </strong>A regular and safe approach to withdraw:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f56565414a5867abfa331f067a6142c8/href">https://medium.com/media/f56565414a5867abfa331f067a6142c8/href</a></iframe><p>This will always, simply empty the user balance registry and transfer that amount back to him, the ‘msg.sender’.</p><p>Depending on how this function will be handled by the front-end or in case other contracts want to externally call it, we can save some future trouble on gas waste, by setting a ‘require’ function to avoid registering in the mapping and also trying to call a transaction evaluated in 0 eth.</p><h4>Interface</h4><p><strong>Event Emission: </strong>The importance of event emission is due to the easy task which is collecting those data externally to generate useful statistics. For this reason, we tried to implement the emit event where the ‘NameRegistered’ and ‘NameRenewed’ are being implemented, facing an issue with the _register function, where it reached a stack-too-deep issue. Remaking the contract&#39;s internal architecture to better fit the referrer event within both records above would be the best approach.</p><p><strong>Created events to handle referral business: </strong>Our turnaround was emitting the event inside the ‘_setBalance’ internal function, thus creating a separated event record named ‘ReferrerReceived’ and ‘ReferralFeeUpdated’, to track the referral usage, adding every successful referral program into the logs. ‘indexed’ is being used to search the logs easily</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1062f0a76b283bb6f49ab1e8f224d5a/href">https://medium.com/media/a1062f0a76b283bb6f49ab1e8f224d5a/href</a></iframe><h3>Changes</h3><p>The changes that had to be made to the previous version to better fit the referral function.</p><h4>Functions</h4><p><strong>register: </strong>This function is currently receiving the referrer address as an input from the back-end, being sent straight to the ‘_setBalance’ function after all the requirements have been met. Read concerns in conclusion, about a possible security breach and optimization. The function is called by passing two arguments:</p><ul><li>address referrer</li><li>uint256 totalPrice</li></ul><pre>_setBalance(referrer, totalPrice);</pre><p><strong>renewal: </strong>The renewal function follows the same behavior as the register. It receives the referrer address, inputting the value on the front-end, and only is used when the function calls ‘_setBalance’ after all the requirements are met.</p><h4>Interface</h4><p><strong>Moved events from ETHResitrarControllerV2.sol to IETHRegistrarControllerV2.sol: </strong>We realized that the standard for event management in the ENS contracts standard, is to have its initial structure settled inside the interface of the given contract that will emit the event. Although we have a different scenario in the ‘ETHRegistrarControllerV2’, where the structures were previously settled in the main contract, instead of where it is supposed to be, at ‘IETHRegistrarControllerV2’. Thus we moved the event structure.</p><h4>Extra improvements</h4><p>Rewriting some tests to TypeScript and adding typechain we found some errors and saw an opportunity for creating a npm package that we used in test improvements, if you are curious, <a href="https://medium.com/blockful/erc165-2e1a03a03280">here</a> is the article about it.</p><p><strong>BulkRenewal</strong>: We found that a test wasn&#39;t testing the renewAll function properly, discovering an error in the BulkRenewal.sol.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ccd8f1b7b9cff392dbf7e8a535fe2e3/href">https://medium.com/media/8ccd8f1b7b9cff392dbf7e8a535fe2e3/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb6d9fb80444e2bf4c2d5098ccb7804f/href">https://medium.com/media/cb6d9fb80444e2bf4c2d5098ccb7804f/href</a></iframe><p>For renewing a name you should only pay price.base (line 15 from gist above). The renewAll function was calling renew with msg.value being price.base + price.premium, causing the error &quot;Transaction reverted: function selector was not recognized and there’s no fallback nor receive function&quot;.</p><p><strong>ETHRegisterController (V1)</strong>: The withdraw test wasn&#39;t actually testing the withdraw functionality from the contract.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4db4ab2bd892f6e5a416bdc779ac10f0/href">https://medium.com/media/4db4ab2bd892f6e5a416bdc779ac10f0/href</a></iframe><p>The state from the local blockchain is being reverted after each test because of these hooks above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b890dd0d7ae1a57fd0bfdb6136b1059/href">https://medium.com/media/9b890dd0d7ae1a57fd0bfdb6136b1059/href</a></iframe><p>This means before the withdraw function is called, the contract already was with 0 ether, then the except assertion would pass even if the withdraw function wasn&#39;t executing as expected.</p><p>All corrections are at the <a href="https://github.com/blockful-io/ens-contracts">Blockful repository</a></p><h3>Conclusion</h3><p>There is a huge opportunity for referrals in the ecosystem. User and protocol working together to boost the protocol functionalities providing more engagement and flourishing the partnership.</p><p>Follow us and learn more!</p><p><a href="https://github.com/blockful-io"><strong>Blockful</strong></a><strong> </strong>|<strong> </strong><a href="https://twitter.com/Blockful_io">🐦</a> | <a href="https://github.com/blockful-io">🐱‍👤</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*h-s2WL64PHIJ4jjkiSywMQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15c9635762b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockful/referral-feature-added-to-ens-15c9635762b8">Referral Feature added to ENS</a> was originally published in <a href="https://medium.com/blockful">Blockful</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>