<?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: Prabhat1308</title>
    <description>The latest articles on DEV Community by Prabhat1308 (@prabhat1308).</description>
    <link>https://dev.to/prabhat1308</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%2F956344%2F3fd1fc27-6553-406b-89dc-9053ae479df2.png</url>
      <title>DEV Community: Prabhat1308</title>
      <link>https://dev.to/prabhat1308</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prabhat1308"/>
    <language>en</language>
    <item>
      <title>Deploying a smart contract on POLYGON using Thirdweb's any EVM , any Contract feature</title>
      <dc:creator>Prabhat1308</dc:creator>
      <pubDate>Thu, 23 Mar 2023 20:28:36 +0000</pubDate>
      <link>https://dev.to/prabhat1308/deploying-a-smart-contract-on-polygon-using-thirdwebs-any-evm-any-contract-feature-1j2</link>
      <guid>https://dev.to/prabhat1308/deploying-a-smart-contract-on-polygon-using-thirdwebs-any-evm-any-contract-feature-1j2</guid>
      <description>&lt;p&gt;Deploying a contract to any EVM compatible blockchain has been tough for the newcomers all along . With this blog I will share with you how to easily deploy a contract on any EVM compatible chain using ThirdWeb's new feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a contract
&lt;/h2&gt;

&lt;p&gt;First I created a minimal and simple solidity contract on Remix and then deployed it on Ethereum Goerli Testnet.Below is the code for the 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: GPL-3.0

pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;

import "hardhat/console.sol";

contract Owner {

    address private owner;

    event OwnerSet(address indexed oldOwner, address indexed newOwner);
    modifier isOwner() {
        require(msg.sender == owner, "Caller is not owner");
        _;
    }
    constructor() {
        console.log("Owner contract deployed by:", msg.sender);
        owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
        emit OwnerSet(address(0), owner);
    }

    function changeOwner(address newOwner) public isOwner {
        emit OwnerSet(owner, newOwner);
        owner = newOwner;
    }

    function getOwner() external view returns (address) {
        return owner;
    }
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Accessing The Dashboard
&lt;/h2&gt;

&lt;p&gt;Then I get the address of my deployed contract from Remix and put it in the dashboard of ThirdWeb for the search contract on top left side of the dashboard.&lt;br&gt;
Here is how the dashboard looks.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7iy7vzz6rpwhmt21uv83.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7iy7vzz6rpwhmt21uv83.png" alt="ThirdWeb Dashboard"&gt;&lt;/a&gt;&lt;br&gt;
When you enter the address of the deployed contract it shows you in which chain it is deployed. Select it and after sometime you will be redirected to your deployed contracts Overview page.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr4cl2j0722u8f0f1ldeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr4cl2j0722u8f0f1ldeg.png" alt="The deployed address and its chain being shown"&gt;&lt;/a&gt;&lt;br&gt;
This is how the Overview page of your contract will look like.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5f5uynzyynp7ofs9r5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5f5uynzyynp7ofs9r5i.png" alt="Overview page "&gt;&lt;/a&gt;&lt;br&gt;
You can see my contract at this link &lt;a href="https://thirdweb.com/goerli/0xEBd012bF2F29ea06fc816759E9c4df2A64993f96" rel="noopener noreferrer"&gt;Deployed contract on goerli testnet&lt;/a&gt;&lt;br&gt;
You can see that it shows my contract address , recent events and extensions if any. But the real deal are the options which you can see on your left.&lt;br&gt;
For the scope of this article , I will only focus on the build option provided.&lt;/p&gt;
&lt;h2&gt;
  
  
  Deploying on Polygon mumbai testnet
&lt;/h2&gt;

&lt;p&gt;On clicking the build option you will be shown with the following interface. You can select which SDK you would want based on which language or framework you are working on be it REACT, JAVASCRIPT,PYTHON or GO. It also has unity SDK for game development. For more info you can see &lt;a href="https://portal.thirdweb.com/" rel="noopener noreferrer"&gt;ThirdWeb Docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5dlwltjyfpb49xxv0ns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5dlwltjyfpb49xxv0ns.png" alt="Build option"&gt;&lt;/a&gt;&lt;br&gt;
Now to enable the ThirdWeb framework to do its magic you need to download the ThirdWeb dependencies.For that you need to go to your project directory and write the following command on your command prompt/shell/terminal.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install @thirdweb-dev/sdk ethers@5&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note:ignore any warnings that pops up on your screen . Those will hardly affect your project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you are using hardhat for your project ,you need to change your  &lt;strong&gt;deploy.js&lt;/strong&gt; file . This is how my &lt;strong&gt;deploy.js&lt;/strong&gt; looked like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const hre = require("hardhat");

import { ThirdwebSDK } from "@thirdweb-dev/sdk/evm";

const sdk = new ThirdwebSDK("goerli");
const contract = await sdk.getContract(
  "0xEBd012bF2F29ea06fc816759E9c4df2A64993f96"
);

main().catch((error) =&amp;gt; {
  console.error(error);
  process.exitCode = 1;
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have reached this step , then you are almost ready to see the magic of ThirdWeb unveil in front of You.&lt;br&gt;
To deploy the contract you need to use the following command &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that we have not specified to which network we are deploying the contract to yet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;npx thirdweb deploy&lt;/code&gt;   &lt;/p&gt;

&lt;p&gt;After you write this , you will see this screen on your terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffyz23o6v61u3ohrgrxhs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffyz23o6v61u3ohrgrxhs.png" alt="VS code terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ThirdWeb not displaying properly! Scope for improvement ;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can now witness the true magic of ThirdWeb three framework! It automatically detects the project type , automatically detects the deployed contract, compiles it and gives us a link to deploy the contract.&lt;br&gt;
But the catch is &lt;strong&gt;We dont have to do any changes to deploy to any EVM compatible chain&lt;/strong&gt;.ThirdWeb takes that burden on itself and leaves us devs only to select where we have to deploy it to. On clicking the link provided we get to the following page.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frf9r6skngubsx224q599.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frf9r6skngubsx224q599.png" alt="mumbai deployment"&gt;&lt;/a&gt;&lt;br&gt;
We can select from as many as 700 chains to deploy to. Here I have selected to deploy it to mumbai testnet . You can find the other chains supported from this announcement article by ThirdWeb.&lt;br&gt;
&lt;a href="https://blog.thirdweb.com/any-contract-any-evm-chain/" rel="noopener noreferrer"&gt;Announcement blog&lt;/a&gt;&lt;br&gt;
Now you are left with only to sign the transaction to deploy and adding the contract to dashboard.&lt;/p&gt;

&lt;p&gt;Here you can see now that my &lt;em&gt;Owner&lt;/em&gt; contract is successfully deployed on polygon and goerli!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dzsak7kb8ruf0r9p3hi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dzsak7kb8ruf0r9p3hi.png" alt="successful deployment"&gt;&lt;/a&gt;&lt;br&gt;
Mission Complete ! &lt;br&gt;
Keep Buidling frens!&lt;/p&gt;

&lt;h2&gt;
  
  
  Experience with ThirdWeb
&lt;/h2&gt;

&lt;p&gt;Building with ThirdWeb was a very smooth and the docs are really well maintained. However the build instruction page can be made more &lt;em&gt;beginner friendly&lt;/em&gt; as after the framework grows popularity , the new web3 builders will prefer to build with ThirdWeb framework , however as they are not yet experienced , they might find it difficult to determine where in their project do they have to make the specified changes. Maybe specific instructions for hardhat and foundry can be put on the the build page.&lt;/p&gt;

&lt;p&gt;Also I am not sure as to how ThirdWeb will handle the deployment where a project might contain multiple contracts . Maybe a tutorial on how to do that would be great to make advanced projects using ThirdWeb framework for the people. The CLI interface is really good and i could not find any scope for improvement in it as it is really well made.I look forward to this as i start building great dapps using this framework.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>blockchain</category>
    </item>
  </channel>
</rss>
