<?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>Forem: Monierate Engineering Blog</title>
    <description>The latest articles on Forem by Monierate Engineering Blog (@monierate).</description>
    <link>https://forem.com/monierate</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%2Forganization%2Fprofile_image%2F6200%2F6dee5a44-6a5b-4085-af2c-f989e8b1e92c.png</url>
      <title>Forem: Monierate Engineering Blog</title>
      <link>https://forem.com/monierate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/monierate"/>
    <language>en</language>
    <item>
      <title>What is a Blockchain?</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Sun, 27 Nov 2022 02:40:07 +0000</pubDate>
      <link>https://forem.com/monierate/what-is-a-blockchain-11g0</link>
      <guid>https://forem.com/monierate/what-is-a-blockchain-11g0</guid>
      <description>&lt;p&gt;A blockchain is literally a chain of blocks.&lt;/p&gt;

&lt;p&gt;Think of it as blocks lined together piece by piece and each block is unique and a continuation of the previous.&lt;/p&gt;

&lt;p&gt;Now you might be wondering, what is inside these blocks? You can literally think of these blocks as storage units that stores data so we can store different kinds of things in these blocks.&lt;/p&gt;

&lt;p&gt;You may have heard of data storage in Computers, a data storage is just data held in a computer. &lt;strong&gt;A blockchain is an open and decentralized data storage&lt;/strong&gt;. Data in a blockchain are stored in chains of blocks spread across many computers network, instead of on a single computer. Because this data storage is open and decentralized, anyone can access, read, and store information in it at any time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each blockchain has a consensus mechanism&lt;/strong&gt;, a way in which this distributed network agrees on what new information is written on that data storage, ensuring that the data is true and therefore trustworthy.&lt;/p&gt;

&lt;p&gt;It is stated in the bitcoin whitepaper, &lt;strong&gt;a double spend should never happen&lt;/strong&gt;. This is due to the bitcoin decentralized ledger, every node connected to the network ensures that no coins have been double spent.&lt;/p&gt;

&lt;p&gt;Unlike a normal data storage, data stored in a blockchain are immutable, so once a data get into one of these blocks, it can't be changed. Everyone(or majority) participating in the network gets a copy of these data, so if an individual try to change theirs, there will be a conflict with the rest(majority) and they may get kicked out of the network.&lt;/p&gt;

&lt;p&gt;In blockchain, a &lt;strong&gt;single point of failure is also not possible&lt;/strong&gt;. In the bitcoin blockchain for example, there are thousands of nodes(severs) connected to the network. If a particular node goes down, the network does not go down, other nodes will continue to run.&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>What is the Double Spend Problem?</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Thu, 24 Nov 2022 12:40:35 +0000</pubDate>
      <link>https://forem.com/monierate/what-is-the-double-spend-problem-cep</link>
      <guid>https://forem.com/monierate/what-is-the-double-spend-problem-cep</guid>
      <description>&lt;p&gt;If you are intending to start a career in blockchain/web3, one important concept to understand is the Double Spend Problem.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1595381737793675264-763" src="https://platform.twitter.com/embed/Tweet.html?id=1595381737793675264"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1595381737793675264-763');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1595381737793675264&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A double spend problem describe the potential of a single asset to be spent more than once.&lt;/li&gt;
&lt;li&gt;Trusted central financial entity (like a bank or PayPal) can help avoid double spend problem, but the costs are many.&lt;/li&gt;
&lt;li&gt;Bitcoin solves the double spend problem cheaply by using a &lt;a href="https://river.com/learn/terms/d/decentralized-ledger/"&gt;decentralized ledger&lt;/a&gt;, which the public can access. Because the public can examine the full history of transactions, everyone is sure that no coins have been double spent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Double Spend Problem
&lt;/h2&gt;

&lt;p&gt;Digital files like text, audios, and video are easily duplicated. You can record a song on a computer, with the click of a button create multiple copy of that song, send those copies to more than one person while keeping the original copy. This is one of things that makes digital devices desiring and easy to use.&lt;/p&gt;

&lt;p&gt;But countless and easy duplication of money is a problem. A monetary system where anyone is allowed to duplicate the money they have is bad. In computer science, this problem is called the double spend problem, the potential of a single asset to be spent more than once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Physical Money
&lt;/h2&gt;

&lt;p&gt;Let’s say I have 10 dollars in cash. I give you 5 dollars, leaving me with a balance of 5 dollar. I can’t physically spend my 10 dollars again because my balance is just 5 dollar. No double-spending.&lt;/p&gt;

&lt;p&gt;However, on the internet, the double spend problem can easily occur. I can just copy/paste the 10 dollars and send to you, leaving me with same 10 dollar in my wallet too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solutions
&lt;/h2&gt;

&lt;p&gt;Initially, to get around this issue of double spending money, we trusted a central financial entity (like a bank or PayPal) to verify transactions and dictate the balance of any given account. So no one can easily duplicate their money.&lt;/p&gt;

&lt;p&gt;However, the problems with trusting a financial entities are many. They are slow. Most of them charge fees and impose limits on the size, type, and number of transactions a user can execute. If you live in Europe and send 1000 dollars to your family in Africa, it may take up to 30 days for them to receive the money.&lt;/p&gt;

&lt;p&gt;In 2009, a revolution began with the arrival of Bitcoin blockchain. For the first time in history, rather than trusting on central entities to avoid the double spend problem, the public  could verify transactions of digital money without the need for that central entity. If I have 10 Bitcoin in my wallet, and I send you 5 of them, then we could trust technology and cryptography to update our wallet balances instead of trusting a bank.&lt;/p&gt;

&lt;p&gt;Bitcoin solves the double spend problem by using a &lt;a href="https://river.com/learn/terms/d/decentralized-ledger/"&gt;decentralized ledger&lt;/a&gt;, which the public can access. Because the public can examine the full history of transactions, everyone is sure that no coins have been double spent. Additionally, the transaction records in the network is immutable and not control by a single entity or individual.&lt;/p&gt;

&lt;p&gt;When I sends 5 bitcoin to you, the network destroy the 5 bitcoin I(the sender) own and create a new coin owned by you (the receiver). The destruction of my(the sender) 5 bitcoin  is recorded for all to see, so that I can never send it to someone else. And on average the transaction is confirmed and settle within an hour. There is no limit in the transaction one can make. And a single entity can't flag off the transaction.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Become a Web3/Blockchain Engineer with &lt;a href="https://school.forward.africa/"&gt;this&lt;/a&gt; 8-week program.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>webdev</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>What is Single Point of Failure?</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Thu, 24 Nov 2022 10:53:25 +0000</pubDate>
      <link>https://forem.com/monierate/what-is-single-point-of-failure-1pg4</link>
      <guid>https://forem.com/monierate/what-is-single-point-of-failure-1pg4</guid>
      <description>&lt;p&gt;If you are intending to start a career in blockchain/web3, one important concept to understand is the Single Point of Failure, also known as SPOF.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1516247207523008516-630" src="https://platform.twitter.com/embed/Tweet.html?id=1516247207523008516"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1516247207523008516-630');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1516247207523008516&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A single point of failure is any part of a system that, if it fails, will stop the entire system from working.&lt;/li&gt;
&lt;li&gt;The best way to avoid this is to reject depending on a single point entirely and has many distributed points.&lt;/li&gt;
&lt;li&gt;Bitcoin blockchain is a decentralized network where transactions are stored and distributed across multiple nodes(servers). If a single node fails, the network does not go down and transactions won't be lost.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Single Point of Failure
&lt;/h2&gt;

&lt;p&gt;A single point of failure is any part of a system that, if it fails, will stop the entire system from working.&lt;/p&gt;

&lt;p&gt;For example a business owner needs $2500 per month to keep her business running. But she only got one client that pay her $2500 per month for her service. If that client decide to stop doing business with her, the business dies.&lt;/p&gt;

&lt;p&gt;Another example is a football team that depends on only one star player to win matches; If that players gets an injury, the team stop winning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solutions
&lt;/h2&gt;

&lt;p&gt;Two types of solutions to the Single Point of Failure:&lt;/p&gt;

&lt;p&gt;The first is to minimize the chance of the single point failing. For you the business owner, this means, you make sure the client sign a lifetime contract with you. For the football team, they ensure the star player is always fit. &lt;/p&gt;

&lt;p&gt;The second rejects depending on a single point entirely and has many distributed points.  For the business owner, this means, she has many clients that pay her $2500 per month, so if one decides not to pay her any particular month, her business keeps going.&lt;/p&gt;

&lt;h2&gt;
  
  
  A decentralized network
&lt;/h2&gt;

&lt;p&gt;The second solution is the optimal solution. Since no matter what happen to any single client, the business keep running smoothly. The business is never going to depend or rely on any single client.&lt;/p&gt;

&lt;p&gt;This is the idea of the Bitcoin blockchain - a decentralized and trustless network where transaction data are stored and distributed across multiple nodes(servers). If a single node fails, the network does not go down and original data won't be lost.&lt;/p&gt;

&lt;p&gt;Become a Web3/Blockchain Engineer in &lt;a href="https://school.forward.africa"&gt;this&lt;/a&gt; 8-week program.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>bitcoin</category>
      <category>computerscience</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to declare an array in Solidity</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Sat, 19 Nov 2022 00:47:55 +0000</pubDate>
      <link>https://forem.com/monierate/how-declare-an-array-in-solidity-1ppg</link>
      <guid>https://forem.com/monierate/how-declare-an-array-in-solidity-1ppg</guid>
      <description>&lt;p&gt;You can declare an array in Solidity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type[length] name = [ ... ];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Arrays in Solidity are fixed collections of elements with the same data type values. Each element has an index(position) within the array. An array is useful for holding fixed or unknown collections of values without having to create a different variable for each value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's say you have vote counts from five polling units. Instead of creating five variables to hold each of these votes count, you create a single array to hold them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uint[5] votes = [10, 20, 8, 88, 14];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An array starts with the &lt;strong&gt;type&lt;/strong&gt;, &lt;strong&gt;length&lt;/strong&gt;, identifier, and values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type&lt;/strong&gt; is the data type of the array. In the above example, we specify this array should contain only unsigned integers. Solidity support multiple &lt;a href="https://www.geeksforgeeks.org/solidity-types/?ref=lbp" rel="noopener noreferrer"&gt;types&lt;/a&gt; e.g string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Length&lt;/strong&gt; of the array specifies the total values that the array can hold. Our example we set the array to hold only five values. If your array may contain unknown or infinite values, then you can just leave the length empty &lt;code&gt;uint[]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Identifier&lt;/strong&gt; is the name of the array. Just give it any name that makes sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Values&lt;/strong&gt; are the values in the array.&lt;/p&gt;

&lt;p&gt;Hope that helps!&lt;/p&gt;

&lt;p&gt;Recommended: &lt;a href="https://dev.to/forwardschool/how-to-get-array-length-in-solidity-335a"&gt;How to get the length of an array in Solidity&lt;/a&gt;&lt;/p&gt;

</description>
      <category>api</category>
    </item>
    <item>
      <title>How to get array length in Solidity</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Sat, 19 Nov 2022 00:11:30 +0000</pubDate>
      <link>https://forem.com/monierate/how-to-get-array-length-in-solidity-335a</link>
      <guid>https://forem.com/monierate/how-to-get-array-length-in-solidity-335a</guid>
      <description>&lt;p&gt;Solidity has a special array property called &lt;code&gt;.length&lt;/code&gt; that returns the Length of an Array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;array.length
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The length of an Array is the total number of indexes, positions, or values in that array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's say you have an array called &lt;code&gt;values&lt;/code&gt; containing integers as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int[] values = [15, 10, 14, 45]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get the length of &lt;code&gt;values&lt;/code&gt;, you can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uint len = values.length
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The variable &lt;code&gt;len&lt;/code&gt; is now the length of &lt;code&gt;values&lt;/code&gt; in this case 4 (an unsigned integer). &lt;/p&gt;

&lt;p&gt;Hope that helps.&lt;/p&gt;

</description>
      <category>api</category>
    </item>
    <item>
      <title>Fix: ethers.getContract is not a function Hardhat Solidity</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Thu, 17 Nov 2022 13:30:45 +0000</pubDate>
      <link>https://forem.com/monierate/fix-ethersgetcontract-is-not-a-function-hardhat-solidity-243b</link>
      <guid>https://forem.com/monierate/fix-ethersgetcontract-is-not-a-function-hardhat-solidity-243b</guid>
      <description>&lt;p&gt;When you are trying to run a Solidity contract with &lt;code&gt;hardhat run scripts/deploy.js&lt;/code&gt; you may experience getting the error &lt;strong&gt;"ethers.getContract is not a function"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To fix the error &lt;strong&gt;"ethers.getContract is not a function&lt;/strong&gt;, ensure you install the package by running &lt;code&gt;yarn add --dev hardhat @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers&lt;/code&gt; on your project terminal.&lt;/p&gt;

&lt;p&gt;Open your terminal and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add --dev hardhat @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If the &lt;strong&gt;"ethers.getContract is not a function"&lt;/strong&gt; error is not resolved, or a new error emerges, try updating your &lt;code&gt;scripts/deploy.js&lt;/code&gt; to the latest codes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Assuming I have the following &lt;code&gt;MyName.sol&lt;/code&gt; contract:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract MyName {
    function name() public pure returns(string memory) {
        return "Jeremy Ikwuje";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My deploy scripts will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="n"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hre&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hardhat"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;async&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;hre&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ethers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getContractFactory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"MyName"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;const&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;MyName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deploy&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deployed&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;await&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Saving this script as &lt;code&gt;scripts/deploy-name.js&lt;/code&gt;, I will then go ahead and run the command below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; npx hardhat run scripts/deploy-name.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should work!&lt;/p&gt;

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

&lt;p&gt;When trying to run a Solidity contract with &lt;code&gt;hardhat run scripts/deploy.js&lt;/code&gt; you may experience getting the error &lt;strong&gt;"ethers.getContract is not a function"&lt;/strong&gt;. To fix the error, ensure you install the package by running &lt;code&gt;yarn add --dev hardhat @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers&lt;/code&gt; on your project terminal. If a new error emerges, try updating your &lt;code&gt;scripts/deploy.js&lt;/code&gt; to the latest codes on the documentation.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>testing</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Fix: Cannot find module '@nomicfoundation/hardhat-toolbox' Solidity</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Thu, 17 Nov 2022 11:34:48 +0000</pubDate>
      <link>https://forem.com/monierate/fix-cannot-find-module-nomicfoundationhardhat-toolbox-solidity-1mf6</link>
      <guid>https://forem.com/monierate/fix-cannot-find-module-nomicfoundationhardhat-toolbox-solidity-1mf6</guid>
      <description>&lt;p&gt;When you are trying to compile a Solidity contract with &lt;code&gt;npx hardhat compile&lt;/code&gt; you may experience getting the error &lt;strong&gt;Cannot find module '@nomicfoundation/hardhat-toolbox'&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To fix the error &lt;strong&gt;"Cannot find module '@nomicfoundation/hardhat-toolbox'"&lt;/strong&gt;, ensure you install the package by running &lt;code&gt;npm install --save-dev @nomicfoundation/hardhat-toolbox&lt;/code&gt; on your project terminal. If an error persist (probably due to dependencies) then install all packages required by the plugin. You can also use &lt;strong&gt;yarn&lt;/strong&gt; to install it.&lt;/p&gt;

&lt;p&gt;Open your terminal and install &lt;strong&gt;Hardhat Toolbox&lt;/strong&gt; by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev @nomicfoundation/hardhat-toolbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If the &lt;strong&gt;"Cannot find module '@nomicfoundation/hardhat-toolbox"&lt;/strong&gt; error is not resolved, try installing all dependencies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Run the following command to install all dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you prefer to use &lt;strong&gt;yarn&lt;/strong&gt;, the following command will also install all dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then go ahead compiling your Solidity smart contract.&lt;/p&gt;

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

&lt;p&gt;As explained above, to fix the error &lt;strong&gt;"Cannot find module '@nomicfoundation/hardhat-toolbox'"&lt;/strong&gt;, ensure you install the package by running &lt;code&gt;npm install --save-dev @nomicfoundation/hardhat-toolbox&lt;/code&gt; on your project terminal. If it still throws an error (probably due to dependencies) then install all packages required by the plugin. You can also use yarn to install all the dependencies.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>web3</category>
      <category>hardhat</category>
      <category>solidity</category>
    </item>
    <item>
      <title>yarn: command not found on Windows 10</title>
      <dc:creator>Jeremy Ikwuje</dc:creator>
      <pubDate>Thu, 17 Nov 2022 09:12:33 +0000</pubDate>
      <link>https://forem.com/monierate/yarn-command-not-found-on-windows-10-36pe</link>
      <guid>https://forem.com/monierate/yarn-command-not-found-on-windows-10-36pe</guid>
      <description>&lt;p&gt;&lt;strong&gt;I recently got this error after installing yarn on my Windows 10 PC. The reason is that the yarn installation PATH wasn't added to my system environmental variables.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To solve this error, I simply added the &lt;strong&gt;yarn&lt;/strong&gt; PATH to my system environmental variables.&lt;/p&gt;

&lt;p&gt;Here is how you can solve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Ensure yarn is installed globally
&lt;/h2&gt;

&lt;p&gt;Run the following command to installed yarn globally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g yarn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will download and install &lt;strong&gt;yarn&lt;/strong&gt; globally (remember you will need to have Node.js installed).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Confirm the installation.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the command above returns the &lt;strong&gt;yarn&lt;/strong&gt; version, then you are good to go. No need to proceed to the next step.&lt;/p&gt;

&lt;p&gt;However, if you get the error &lt;strong&gt;"yarn: command not found"&lt;/strong&gt;, you will need to add the correct PATH to your system environmental variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Add yarn to your path
&lt;/h2&gt;

&lt;p&gt;Open your terminal and run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config get prefix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command output the path where &lt;strong&gt;npm&lt;/strong&gt; puts your globally installed packages. The path will look something like &lt;code&gt;C:\Users\Your_User_Name\AppData\Roaming\npm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Copy this path from your terminal and add it to your system environment variables.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After adding the path to your system environments, you will have to restart the terminal for the changes to take effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the following command to confirm yarn is working fine.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;To solve the error &lt;strong&gt;"yarn: command not found"&lt;/strong&gt; on windows 10, install the &lt;strong&gt;yarn&lt;/strong&gt; package globally by running &lt;code&gt;npm install -g yarn&lt;/code&gt; and restarting your terminal. Confirm the command &lt;code&gt;yarn -v&lt;/code&gt;. If the command fails, make sure the correct PATH is set in your system's environment variable.&lt;/p&gt;

</description>
      <category>yarn</category>
      <category>git</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
