<?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: vinod</title>
    <description>The latest articles on DEV Community by vinod (@vinodnextcoder).</description>
    <link>https://dev.to/vinodnextcoder</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%2F892256%2Fddeeaa6d-020b-4507-b352-78fea61f6509.png</url>
      <title>DEV Community: vinod</title>
      <link>https://dev.to/vinodnextcoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinodnextcoder"/>
    <language>en</language>
    <item>
      <title>Create Your First Simple dApp On ethereum</title>
      <dc:creator>vinod</dc:creator>
      <pubDate>Sun, 17 Jul 2022 05:06:46 +0000</pubDate>
      <link>https://dev.to/vinodnextcoder/create-your-first-simple-dapp-on-ethereum-55k1</link>
      <guid>https://dev.to/vinodnextcoder/create-your-first-simple-dapp-on-ethereum-55k1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In this article, we are going to build a simple CRUD decentralized application on the Ethereum blockchain.&lt;br&gt;
&lt;a href="https://github.com/vinodnextcoder/simple-dApp-typescript"&gt;Github repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1.Basic understanding of solidity or general programming. &lt;a href="https://remixide.readthedocs.io/en/latest/compile.html"&gt;Solidity Doc to read&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;2.Metamask extension on chrome or Firefox. (To connect with web3)&lt;/li&gt;
&lt;li&gt;3.Basic understanding of Web3.&lt;/li&gt;
&lt;li&gt;4.Get INFURA KEY &lt;a href="https://www.educative.io/answers/how-to-create-an-account-on-infura"&gt;Infura&lt;/a&gt;. create account and project&lt;/li&gt;
&lt;li&gt;5.Wallet on Metamask with some ether(coins)for a Ropsten network. You can get free testnet ether &lt;a href="https://app.mycrypto.com/add-account/web3"&gt;app.mycrypto.com&lt;/a&gt; You can go to app.mycrypto.com/faucet, or go to Tools &amp;gt; Use Testnet Faucet in the left-hand side menu on MyCrypto.com&lt;/li&gt;
&lt;li&gt;6.Nodejs or Typescript understanding.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Smart Contract Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is a simple curd smart contract, which deals with students’ data.&lt;/li&gt;
&lt;li&gt;Let’s deploy the contract in a remix environment&lt;/li&gt;
&lt;li&gt;First, navigate to address &lt;a href="https://remix.ethereum.org/"&gt;https://remix.ethereum.org/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add new curd.sol file and copy-paste the code from the repository.&lt;/li&gt;
&lt;li&gt;create account in metamask wallet and connect to Ropsten.&lt;/li&gt;
&lt;li&gt;Compile code using remix ide 3rd button solidity compiler&lt;/li&gt;
&lt;li&gt;From the left side click on the 4th deploy and run button deployment window will appear.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OzN7uaFG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j483y5maksgh9mtd71q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OzN7uaFG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j483y5maksgh9mtd71q.jpg" alt="Remix environment" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter your password in metamask and you will get connected with the remix environment.&lt;/li&gt;
&lt;li&gt;You can see your metamask wallet address on a
remix account.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select ropsten test-network in metamask extension and your wallet should looklike this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now the metamask prompt will appear as follows and will ask you to confirm the transaction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you can see the debug logs in the remix environment that the contract is creating and after successful deployment, the transaction log will appear as follows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OjJrN1eG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vovwy8rct0r910xu025.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OjJrN1eG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vovwy8rct0r910xu025.png" alt="Remix environment" width="880" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s verify contract deployment on ropsten explore by navigating to this addresshttps://ropsten.etherscan.io.&lt;/li&gt;
&lt;li&gt;Copy and paste the transaction hash from the log to the etherscan website.
&lt;a href="https://remix-ide.readthedocs.io/en/latest/create_deploy.html"&gt;Deploy doc&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bK_fLL3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b28m3u9lnxpdmxxt7zkm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bK_fLL3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b28m3u9lnxpdmxxt7zkm.png" alt="contract remix ide" width="880" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the above picture, we can see who created the transaction, It should match with your metamask wallet address.&lt;/li&gt;
&lt;li&gt;Now our contract is ready we can test the all functions of the contract.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RjOfaYuh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bupeeafklwfnrvbt66ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RjOfaYuh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bupeeafklwfnrvbt66ux.png" alt="Contract deploy" width="880" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build the decentralized application (dAPP)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, create an account on &lt;a href="https://infura.io"&gt;https://infura.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Then create a project and navigate to the project settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Qf18BlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcj4hg09atudg9k5utkh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Qf18BlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcj4hg09atudg9k5utkh.png" alt="Infura key website" width="877" height="988"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the endpoint as a Ropsten.
Note: We have deployed our contract on ropsten netwrok that why we are selecting Ropstenendpoint.&lt;/li&gt;
&lt;li&gt;Copy the project id and paste it into INFURA_KEY in the dapp.js&lt;/li&gt;
&lt;li&gt;Copy your metamask wallet address and paste it into
account in the dapp.js&lt;/li&gt;
&lt;li&gt;Export metamask private key and paste it into privateKey in the dapp.js.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-d2PKmX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zei9q4s9h1i25a6gfr2k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-d2PKmX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zei9q4s9h1i25a6gfr2k.png" alt="Contract abi key" width="880" height="447"&gt;&lt;/a&gt;&lt;br&gt;
*Paste the copied ABI array in the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Web3 from 'web3';
import Common, { Chain } from '@ethereumjs/common'
import { Transaction } from '@ethereumjs/tx'
// INFURA_KEY // Replace your infura-key
const web3 = new Web3('wss://ropsten.infura.io/ws/v3/' + process.env.INFURA_KEY);
const account = ''; // Replace wallet address with metamask wallet address

const contract_Address = ""; //replace deployed contract address
const abi: any[] =[];
const chck = web3.utils.toChecksumAddress(contract_Address)
const contract = new web3.eth.Contract(abi, contract_Address); // Instantiating smart contract`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;dapp.js&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the test dAPP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install dependencies using the below command.
&lt;code&gt;npm install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run the application using the following command
&lt;code&gt;npx ts-node src/index.ts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;After executing the application student will get created on the 
blockchain and we will get a receipt as follows
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  from: '0x8aeaexxxxxxxxxxxxxxxxxxxxxx',
  gasUsed: 101374,
  logs: [],
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  status: true,  to: '0x83977bf3e9xxxxxxxxxxxxxxxx',  transactionHash: '0x37169068b6606193XXXXXXXXXXXXXXXXXXXXX', 
   transactionIndex: 25, 
    type: '0x0'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Comment create function call and enable read function then re-run dapp.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{0:0,1:"vinod",2:"Msc"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
We have seen how to create smart contracts and how to deploy smart contracts on the remix and test-network environment. We learn how to build the dapp using web3js and interact with the ethereum blockchain.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
