<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Crypton Studio</title>
    <description>The latest articles on DEV Community by Crypton Studio (@cryptonstudio).</description>
    <link>https://dev.to/cryptonstudio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1243961%2F3640738c-6de5-4d6c-94f1-cd84299087e7.png</url>
      <title>DEV Community: Crypton Studio</title>
      <link>https://dev.to/cryptonstudio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cryptonstudio"/>
    <language>en</language>
    <item>
      <title>ERC-X Miner Contract Exploit on ERC-404 Standard: our Expert Analysis</title>
      <dc:creator>Crypton Studio</dc:creator>
      <pubDate>Fri, 16 Feb 2024 07:11:35 +0000</pubDate>
      <link>https://dev.to/cryptonstudio/erc-x-miner-contract-exploit-on-erc-404-standard-our-expert-analysis-46k2</link>
      <guid>https://dev.to/cryptonstudio/erc-x-miner-contract-exploit-on-erc-404-standard-our-expert-analysis-46k2</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mfodcsoz55xztemch7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mfodcsoz55xztemch7s.png" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer: The information presented in the article "ERC-X Miner Contract Exploit on ERC-404 Standard: our Expert Analysis" is provided for informational purposes only and should not be construed as advice or guidance for any purpose. Crypton Studio is not responsible for any further actions taken by readers and does not recommend taking any actions based solely on this information.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ERC-X contract exploit of the MINER project
&lt;/h2&gt;

&lt;p&gt;On 14 February 2024, the MINER project's ERC-X contract was exploited on the Ethereum mainnet due to a double-spend vulnerability resulting in a loss of 168.8 ETH (about $470,000).&lt;/p&gt;

&lt;p&gt;The ERC-X contract is a combination of ERC-20, ERC-721, ERC-1155 and ERC-404 and their extensions.&lt;/p&gt;

&lt;p&gt;MINER is a collection of 100,000 avatars linked to ERC-X tokens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjc70diqyyk02ml5gom0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjc70diqyyk02ml5gom0.png" alt="Image description" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Graph of MINER price drop by 60% according to Geckoterminal data&lt;/p&gt;

&lt;h2&gt;
  
  
  What is ERC-404?
&lt;/h2&gt;

&lt;p&gt;The ERC-404 is a new experimental standard that allows to combine the standard of fungible tokens (ERC-20) and non fungible tokens (ERC-721).&lt;/p&gt;

&lt;p&gt;The idea of these tokens is that non- fungible tokens are represented as fungible tokens and the reverse. Thus it is possible to increase liquidity due to the fact that non fungible tokens can be traded in smaller units in the form of fungible tokens.&lt;/p&gt;

&lt;p&gt;Let's look at an example. An ERC20 + NFT token is equal to one ERC-404 token. 1 NFT token cannot be divided into fewer parts, while 1 ERC-20 token is usually equal to 10 to the 18th degree of units, which is its divisibility.&lt;/p&gt;

&lt;p&gt;If the account balance is less than one ERC-404 token, it owns that amount of ERC-20. If the account balance is equal to or greater than one ERC-404, then it owns that amount of ERC-20 tokens and the relevant amount of NFTs.&lt;/p&gt;

&lt;p&gt;NFTs can be traded on NFT marketplaces such as OpenSea, while ERC-20 tokens can be traded on decentralised exchanges such as Uniswap. This allows to capture the liquidity of both NFT marketplaces and decentralised exchanges.&lt;/p&gt;

&lt;p&gt;It is important to note that ERC-404 is not an officially accepted standard by the Ethereum community and is experimental in itself, which in its turn implies risks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrygeboydg06p288e11q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrygeboydg06p288e11q.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ERC-404: Structure&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened with ERC-X contract  of the MINER project?
&lt;/h2&gt;

&lt;p&gt;Now let's analyse the vulnerability of the contract why this happened.&lt;/p&gt;

&lt;p&gt;The problem is that when calling the transfer function, which is responsible for transferring tokens, there is a check that the input arguments from and to are not null addresses. But there is no check that the from address is different from the to address. This means that it is possible to specify the same address as the sender and the receiver!&lt;/p&gt;

&lt;p&gt;Next, the transfer function calls the update function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00lhfu0fimbrjwpoepwn.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00lhfu0fimbrjwpoepwn.PNG" alt="Image description" width="609" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the _update function you should pay attention to the fact that address balances are initially saved to memory variables, which are further used for calculations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke2h7rt9e4koewvocjzx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke2h7rt9e4koewvocjzx.PNG" alt="Image description" width="568" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then the balance of address from is updated fromBalance ( which was cached ) - value. And immediately the value of the address from the calculation toBalance (which was cached) + value is overwritten. And if the from and to addresses are the same, the data is actually updated simply by the new value of the original balance + value. And in this case, this function simply increases the address balance!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xomlkf45pc49twkpyy4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xomlkf45pc49twkpyy4.PNG" alt="Image description" width="582" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To protect from this vulnerability, simply add a check that the address from != (not equal to) the address to!&lt;/p&gt;

&lt;p&gt;At the moment it is highly recommended not to interact with this contract!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This incident highlights the critical importance of auditing and following best practices in developing secure smart contracts because this is a known vulnerability.&lt;/p&gt;

&lt;p&gt;It is also very important to be careful when interacting with new standards, especially if they are not accepted by the Ethereum community. In this case, this contract was deployed on the network only a few days before it was exploited!&lt;/p&gt;

&lt;p&gt;At Crypton Studio, we understand the critical importance of security in blockchain development. That's why we strictly adhere to industry-leading best practices when creating smart contracts for our clients. Our team is experienced in identifying and mitigating vulnerabilities to ensure the integrity and reliability of your smart contracts. Whether your contracts need auditing, additional verification, or ongoing support, you can trust us to provide comprehensive solutions tailored to your specific needs. Partner with Crypton Studio for robust and secure smart contract development.&lt;/p&gt;

&lt;p&gt;Contact us by &lt;a href="https://crypton.studio/en/contacts"&gt;mail&lt;/a&gt; or &lt;a href="https://t.me/Crypton_Studio_Dev"&gt;message us on Telegram &lt;/a&gt;to learn more about our audit services and smart contracts development.&lt;/p&gt;

&lt;p&gt;Visit our website: &lt;a href="https://crypton.studio/en"&gt;https://crypton.studio/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>security</category>
      <category>vulnerabilities</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Now You Understand: Central Bank Digital Currency (CBDC) Explanation and Usage - Part 1</title>
      <dc:creator>Crypton Studio</dc:creator>
      <pubDate>Fri, 09 Feb 2024 07:09:35 +0000</pubDate>
      <link>https://dev.to/cryptonstudio/now-you-understand-central-bank-digital-currency-cbdc-explanation-and-usage-part-1-3l53</link>
      <guid>https://dev.to/cryptonstudio/now-you-understand-central-bank-digital-currency-cbdc-explanation-and-usage-part-1-3l53</guid>
      <description>&lt;p&gt;CBDCs have been much discussed in recent years, and various countries are exploring the possibilities of implementation. You may have heard or read about this digital currency, but do you have a good understanding of how CBDC is structured, how it can be used, and what impact central bank digital currency will have on the future of finance? We'll tell you all about CBDCs, welcome to Crypton Studio's Now You Understand articles. &lt;/p&gt;

&lt;p&gt;The Crypton Studio team explains and educates about web3 and blockchain technologies in the Now you understand article series. We are happy to share our expertise with you and strive for an open dialogue. Don't forget to share your opinion in the comments if you like our work. Enjoy reading!&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CBDC?
&lt;/h2&gt;

&lt;p&gt;Central Bank Digital Currency (CBDC) - a digital form of national bank money that is created, controlled and maintained by the central bank. It is legal tender and is the same central bank debenture as ordinary banknotes. CBDC is operated by a digital ledger that might or might not be a blockchain. &lt;/p&gt;

&lt;p&gt;This provides faster and more secure trsansactions between banks, institutions and individuals. Central banks control the issuance of CBDCs and stand as guarantors of this form of money as compared to cryptocurrencies. &lt;/p&gt;

&lt;p&gt;CBDCs now can take the following forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retail is used for settlements between individuals and legal entities, is designed for simple payments and represents a digital form of currency.&lt;/li&gt;
&lt;li&gt;Wholesale is used for interbank payments as a new infrastructural solution.&lt;/li&gt;
&lt;li&gt;CBDCs can also represent digital assets, they are also registered in a digital registry, which can be distributed or not distributed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CBDC is a major step forward the digitalization of money and the economy as a whole,  increasing its transparency, security and efficiency, including the automation of many processes and the reduction of transactions costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  CBDC: Use Cases
&lt;/h2&gt;

&lt;p&gt;CBDC is implemented mainly on platforms based on distributed ledger technology (DLT) with support for smart contracts (applications). That gives us many areas of usage and makes this implementation of a digital form of currency really useful for the financial system. Due to the platforms support for smart contracts it allows CBDC to be not just a digital currency but also a programmable form of currency. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fly6sfzjfxh6xgaeg6dlh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fly6sfzjfxh6xgaeg6dlh.png" alt="Brief explanation of how smart contracts work compared to the traditional system" width="690" height="618"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Smart contract support allows you to deploy programs that interact and operate with digital currency. For example, when we execute a property deal, we need someone to check the deal for compliance, approve it and register. &lt;/p&gt;

&lt;p&gt;In the case of CBDC, we do not need a third party to do this, we can just implement a smart contract, the logic of which will be similar to the logic of the deal. For instance, to control that one side owns the property, the other side has paid the declared value, and then make the transfer of this property, as an option in the form of a token. &lt;/p&gt;

&lt;p&gt;In this way we can automate the majority of transactions with almost any property, which significantly increases their availability, speed and performance. &lt;/p&gt;

&lt;p&gt;It also removes the workload from the infrastructure that is created for deals, cutting out the need for intermediaries and thereby reducing transactions costs. &lt;/p&gt;

&lt;p&gt;Tokenization is the process of converting rights to assets or property into digital tokens. Exactly it allows to make transactions fully digital and automated with the use of smart contracts.&lt;/p&gt;

&lt;p&gt;It has been researched that the cost of clearing and settlement of securities for the Central Banks of the G7 countries is more than $50 billion per year, due to the resource costs of asset transfers and account reconciliation. &lt;/p&gt;

&lt;p&gt;A DLT-based CBDC successfully solves the problem of inefficiencies and vulnerabilities compared to the current infrastructure. CBDC is natively digital and does not demand the expensive and labour-intensive reconciliation currently required for e-commerce and cross-border payments.&lt;/p&gt;

&lt;p&gt;It also allows to optimize the operation of any registry that is responsible for storing records of rights to property or assets. For example, DLT technology can replace and improve the work of registries of movable and immovable property, securities such as stocks, bonds etc. &lt;/p&gt;

&lt;p&gt;It also makes it possible to make deals available 24/7 by eliminating the need for a third party to determine the availability of transactions. Digital property/asset transactions increase the accuracy and security of transactions.&lt;/p&gt;

&lt;p&gt;Offline payment technology, which provides access to the financial system in areas not covered by banking services and allows transactions to be made without access to the Internet, is currently being actively researched and realized.&lt;/p&gt;

&lt;p&gt;We can see that CBDCs move the financial system into a digital form, which opens up many possibilities and optimizes the operation of the system as a whole. Thanks to this, CBDC has a direct control over the money supply, simplifying the distribution of state benefits, improving the control over transactions for tax control. Thus, timely payment of taxes or payment of bond coupons can be automated. &lt;/p&gt;

&lt;p&gt;The implementation of CBDC also allows to reduce costs and increase the availability of cross-border payments, including reducing credit risks by providing payment versus payment settlement.&lt;/p&gt;

&lt;h2&gt;
  
  
  CBDC vs Stablecoins: what’s the difference?
&lt;/h2&gt;

&lt;p&gt;There are several types of stablecoins: fiat-backed, cryptocurrency-backed, commodity-backed and algorithmic. In this comparison, we will focus on the first type - fiat-backed ones, because they have more in common with CBDCs and are the most popular. Examples of this type of stablecoins are Tether (USDT) and USD Coin (USDC).&lt;/p&gt;

&lt;p&gt;The principle of Stablecoins is that organizations issue tokens based on the reserves of traditional money in their accounts. That is, in this case the issuance and control of such tokens remain with private institutions and they are not directly controlled by Central Banks. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas277j4n5k14ndefi1re.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas277j4n5k14ndefi1re.png" alt="CBDCs vs Stablecoins" width="690" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While CBDC is a form of national currency, their issuance and control is owned by Central Banks, which provides higher security. Due to such regulation CBDC can ensure compliance with tax policy, while in stablecoins do not. It is also important to note that stablecoins use private money as collateral, while CBDCs are backed by government-issued money.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between private solutions and public blockchains?
&lt;/h2&gt;

&lt;p&gt;Public blockchains are primarily defined by the fact that they are open to the public. That means anyone can join and participate in the network. Public blockchains are such as Ethereum.  &lt;/p&gt;

&lt;p&gt;The consensus mechanism means that such a network is managed by the majority.  &lt;/p&gt;

&lt;p&gt;In particular, transactions are verified and included in new blocks. They are completely open and transparent, everyone can see all transactions and balances of any accounts. &lt;/p&gt;

&lt;p&gt;In order to complete a transaction in a public network, it is necessary to verify and confirm the agreement of the majority of participants, which involves commissions, which are the motivation, as well as a longer waiting time due to the fact that it is necessary for the majority of nodes to reach an agreement. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo353wu7fz1bkjqn14ohi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo353wu7fz1bkjqn14ohi.png" alt="Public Blockchain vs Private Blockchain" width="690" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Among the advantages of this solution, we have full transparency and no need to rely on a single control structure due to the high decentralization of the network, which ensures that no single entity controls the network.&lt;/p&gt;

&lt;p&gt;A private network is closed and restricted to authorized participants who have full control over the network and transactions on it. &lt;/p&gt;

&lt;p&gt;Private solutions allow centralized control over the network and also enable private transactions and private smart contracts. This solves privacy challenges that are very important for governments and corporations. &lt;/p&gt;

&lt;p&gt;Private solutions consensus mechanisms involve a very limited number of participants who verify and approve transactions, so transactions are much faster because they do not require majority verification. &lt;/p&gt;

&lt;p&gt;They also do not need such a concept as native currency and there are no transaction fees. These solutions appeal to governments and companies because of their centralized control and confidentiality solutions that also allow them to control the legality of their operations. Guarantee of this network are their participants, for example, governments and corporations. Examples of this type of solutions are Quorum, Corda, Hyperledger Besu etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  CBDC: Why use private solutions?
&lt;/h2&gt;

&lt;p&gt;There are several key reasons why public solutions are not suitable for CBDC implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High volatility:&lt;/strong&gt; Public cryptocurrencies mean an open market and they are subject to significant price movements, which entails heavy risks for both the government and ordinary users. This makes it difficult to use as a payment method, as changes in value can be in the tens of percent.&lt;/p&gt;

&lt;p&gt;In the case with private solutions, the Central Bank is the guarantor and has full control over the digital currency. CBDC is a form of currency rather than a cryptocurrency in its traditional meaning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy considerations:&lt;/strong&gt; In public solutions, all data is publicly available. Open data potentially brings risks for directions in which this is a key factor. In private solutions, it is possible to control privacy issues through private smart contracts, private transactions, and restrictions on network participants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Account control:&lt;/strong&gt; With public solutions, accounts and funds are under the control of the users themselves or organizations to which the users have delegated control.  In the case of private solutions, account control is usually performed by authorised entities.&lt;br&gt;
_&lt;br&gt;
Read "Now you understand: Central Bank Digital Currency (CBDC) explanation and usage, Part 2" about the most popular platforms for CBDC implementation around the world, the real story behind the Brazilian example, and global trends._&lt;/p&gt;

</description>
      <category>cbdc</category>
      <category>digitalcurrency</category>
      <category>blockchain</category>
      <category>cryptocurrency</category>
    </item>
    <item>
      <title>Ethereum Scaling 101: A Quick Dive Into Understanding Layer 2 and Sidechains</title>
      <dc:creator>Crypton Studio</dc:creator>
      <pubDate>Mon, 29 Jan 2024 11:05:32 +0000</pubDate>
      <link>https://dev.to/cryptonstudio/ethereum-scaling-101-a-quick-dive-into-understanding-layer-2-and-sidechains-51e5</link>
      <guid>https://dev.to/cryptonstudio/ethereum-scaling-101-a-quick-dive-into-understanding-layer-2-and-sidechains-51e5</guid>
      <description>&lt;p&gt;There is a lot of confusion right now about the definitions of what are Layer 2 solutions and what are not. The reason for this is that every scalability solution is called Layer 2, which is technically not always correct, as not all solutions fall into this category.&lt;/p&gt;

&lt;p&gt;If you try to understand this on your own, it is extremely difficult to find accurate and clear answers to these questions. So, in this article, we will take a closer look at some of the most popular Ethereum scalability solutions today and find out how they differ from each other. We will also understand exactly what &lt;strong&gt;sidechain&lt;/strong&gt;, &lt;strong&gt;Layer 2&lt;/strong&gt;, &lt;strong&gt;ZK-Rollup&lt;/strong&gt;, and &lt;strong&gt;Optimistic Rollup&lt;/strong&gt; are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is there a need for scalability?
&lt;/h2&gt;

&lt;p&gt;Let's start with why there is a need for scalability in the Ethereum network.&lt;/p&gt;

&lt;p&gt;The Ethereum main network has a throughput of only 15 transactions per second. As its popularity grew, this was insufficient, and transactions on the main network became expensive and slow. The high cost of transactions is a result of the network's growing popularity and the limited throughput.&lt;/p&gt;

&lt;p&gt;What if more transactions are sent than can be processed? Validators (those who add transactions to the blockchain) will select transactions that have a higher reward (fee). In this case, there is competition between the senders of transactions, and the cost starts to skyrocket. As the network becomes congested and costs increase, the speed of transactions also decreases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blockchain scalability challenges
&lt;/h2&gt;

&lt;p&gt;In understanding how scaling solutions work and the limitations they come with, it's easier to start with the blockchain trilemma, a theorem that says that the blockchain network has three main characteristics:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt; - responsible for the network's resistance to attack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decentralization&lt;/strong&gt; - responsible for the resistance to control by a lesser number of people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt; - responsible for the blockchain's ability to handle large volumes of transactions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgtb7zn76ey8hdmyu2vi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgtb7zn76ey8hdmyu2vi.png" alt="Image description" width="800" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Only two of these three parameters can be increased to the desired level at the same time.&lt;/p&gt;

&lt;p&gt;The Ethereum network is designed to have extremely high decentralization and security, which in itself is very good for the network. But as we found out from the trilemma - you can't have all three parameters at a huge level at once, so the Ethereum network doesn't have the highest throughput.&lt;/p&gt;

&lt;p&gt;There is a demand to process a high volume of transactions at a lower cost, which results in the need for scaling. Off-chain solutions for scaling the Ethereum network are being actively developed. Off-chain means that the main computations are moved outside the main network.&lt;/p&gt;

&lt;p&gt;The most popular solutions are sidechains and layer 2. Let's discuss them in the following.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Ethereum's off-chain scalability solutions: Sidechains and Layer 2?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frm55fticp1j7l9idh5mn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frm55fticp1j7l9idh5mn.png" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2&lt;/strong&gt; is a platform or service that is an overlay on top of the main network (Layer 1). All transactions in Layer 2 change the state of the main network, this way the security of the main network is inherited. Rollups are a way to implement layer 2 solutions. It's worth noting here that Layer 2 solutions are a platform, and it doesn't have to represent a blockchain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptydj6xusep1920l6w3g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptydj6xusep1920l6w3g.png" alt="Image description" width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sidechains&lt;/strong&gt; - This is a separate blockchain that runs in parallel with the main network. It is important to understand that Layer 2 always changes the state of the main network, inherits its security, and is on top of it, while sidechain is always a separate blockchain.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a sidechain?
&lt;/h2&gt;

&lt;p&gt;A sidechain is an isolated blockchain. This means transactions in sidechains do not change the state of the main network (layer 1/Ethereum).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funv86w6s2prbo3z7f9qs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funv86w6s2prbo3z7f9qs.png" alt="Image description" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because it is a separate blockchain, it could have its own consensus algorithm, set of validators, configurations that may differ from the main network, and its own native currency.&lt;/p&gt;

&lt;p&gt;This also means it may have a different balance of security - scalability - and decentralization. Sidechains usually sacrifice a level of decentralization or security to achieve high throughput. They are linked to the main network only by a cross-chain bridge that allows assets to be moved between the sidechain and the main network. Sidechains can be non-EVM compatible as well. A prime example of a sidechain is Polygon POS (MATIC).&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Layer 2 solutions? Take rollups as an example
&lt;/h2&gt;

&lt;p&gt;Rollups are a Layer 2 scaling solution for Ethereum.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kuwzp0kw6nmnngrlyny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kuwzp0kw6nmnngrlyny.png" alt="Image description" width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The general principle of rollups is that the transactions (TX) are being processed on a platform outside of the main network; a rollup is made from a multitude of transactions and sent to the smart contract in the main network (Layer 1), changing its state.&lt;/p&gt;

&lt;p&gt;As the rollup of these transactions is stored in the main network, its security is inherited. Actually, there are two types of Rollups implementation - &lt;strong&gt;Optimistic&lt;/strong&gt; and &lt;strong&gt;Zero Knowledge&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are Optimistic Rollups designed?
&lt;/h2&gt;

&lt;p&gt;As mentioned above, transactions are packaged into a rollup and sent to the smart contract on the main network. In the case of Optimistic Rollup, the smart contract in the main network does not check the sent data and trusts it by default, so it is called Optimistic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2vak4wzsaf7aca2fntf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2vak4wzsaf7aca2fntf.png" alt="Image description" width="800" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But what if someone wants to cheat? The idea is that these transactions are not being considered confirmed for a certain amount of time. During this period, any validator can send a fraud proof. Here, it should be noted that to become a validator, you need to place a stake in a smart contract.&lt;/p&gt;

&lt;p&gt;When a fraud proof is sent, the smart contract checks it. If cheating is detected, the validator who tried to cheat is penalized from his stake, and the validator who sent the cheating evidence is rewarded, motivating everyone to stay honest and watch the honesty of others.&lt;/p&gt;

&lt;p&gt;If a wrong fraud-proof is sent, the validator who sent it is penalized to prevent spamming. If no one has sent a valid fraud proof within this period of time and the period has expired, the transactions are moved to the confirmed status.&lt;/p&gt;

&lt;p&gt;The special feature here is that until this period expires, transactions are not confirmed, which means a long period of transaction confirmation. An example of a protocol working on the Optimistic Rollup principle is Optimism.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the general structure of ZK Rollups?
&lt;/h2&gt;

&lt;p&gt;ZK Rollups, different from Optimistic Rollups, do not depend on trust but on zero-knowledge cryptographic proofs called validity proofs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsibwz0cojk8wn1a41bk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsibwz0cojk8wn1a41bk.png" alt="Image description" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zero Knowledge Proofs allow one prover to cryptographically prove something to another verifier without providing any additional information.&lt;/p&gt;

&lt;p&gt;The way it works is as follows: a set of transactions is computed and compressed into a rollup.&lt;/p&gt;

&lt;p&gt;After that, a validity proof for this data is generated. With the data, the validity proof is sent to the smart contract of the main network. The smart contract verifies this proof, and if everything is correct, the transactions are immediately considered confirmed. In this case, everything is cryptographically linked, and there is no long waiting for confirmation of transactions. An example of this kind of protocol is StarkNet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the differences between Layer 2 and sidechains?
&lt;/h2&gt;

&lt;p&gt;Layer 2 is a solution that takes the computation and transaction processing outside the main network, but data verification still takes place in a smart contract on the Ethereum network. While sidechains are completely separate blockchains and are not directly&lt;/p&gt;

&lt;p&gt;linked to the Ethereum network, they work in parallel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Blockchains can only have two of these three parameters at the right level simultaneously: security, decentralization, and scalability. Sidechains are individual blockchains that reduce one of these parameters to achieve high throughput.&lt;/p&gt;

&lt;p&gt;Layer 2 solutions inherit the security of the main network and modify its state. Optimistic Rollups and Zero-Knowledge Rollups are Layer 2 solutions.&lt;/p&gt;

&lt;p&gt;Optimistic rollups work on the basis of trust and use fraud proofs within a certain time period. Therefore, they have a delay in confirming transactions.&lt;/p&gt;

&lt;p&gt;With zkRollups, there is no such delay in transaction confirmation because they are not based on trust and instead are based on zero knowledge cryptographic proofs. These proofs are called validity proofs.&lt;/p&gt;

&lt;p&gt;Solutions are compared by key parameters in the table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbba848ss00r0wo9y30ir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbba848ss00r0wo9y30ir.png" alt="Image description" width="545" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is important to understand that Layer 2 solutions inherit the security of the main network and are on top of it, while sidechains are just separate blockchains with different&lt;br&gt;
configurations.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>ethereum</category>
      <category>web3</category>
      <category>layer2</category>
    </item>
  </channel>
</rss>
