# Step-by-step guide of deploying contracts on: zkSync Era, Base, Scroll

By [The Roccrypto](https://paragraph.com/@roccrypto) · 2023-06-22

---

### In this article, you will find 3 guides of deploying contracts on zkSync Era, Base, and Scroll.

**Let’s get started!**

* * *

![](https://storage.googleapis.com/papyrus_images/17459cc1b90fe03fe95b002b288ca917e4242f8705d5031600eaaa6cd3071ce1.png)

zkSync Era
----------

**Deploy price:** ~5$ in ETH **Deploy difficulty:** Classic method (code) - difficult. Thirdweb method - easy.

### Classic method:

*   Download **Visual Studio Code** from the official website: [https://code.visualstudio.com/](https://code.visualstudio.com/)
    
*   Choose **English language** and leave the checkboxes in their default state.
    
*   After the installation, create a **folder** on your desktop named `zksync`
    

![](https://storage.googleapis.com/papyrus_images/c185e3324c5324bd7ca2c3c4ab63d3ef4f7810e49bf4edb98d20083f0ee737dc.png)

*   Launch **VSCode** and open this folder
    

![](https://storage.googleapis.com/papyrus_images/ff12edaf1f6f6f2c4c0564498d60bfe6c7dadfa719a80760dba0858786565349.png)

*   [Download](https://nodejs.org/dist/v18.16.0/node-v18.16.0-x64.msi) & install Node.js from its official website. During the installation, leave the settings unchanged. **Afterwards, restart your PC.**
    
*   Go back to **VSCode**, press **CTRL + J** to open the terminal.
    
*   Insert the following command into the terminal:
    

    npm init -y
    

*   If you have such output, then everything is fine:
    

![](https://storage.googleapis.com/papyrus_images/b7ae8f55f0c2fe7ca0266fc31b568a115679a68b7088423c95ef928ec1428c2d.png)

*   Insert the following command and wait till the installation finishes
    

    npm add -D typescript ts-node @types/node ethers@^5.7.2 zksync-web3@^0.14.3 @ethersproject/hash @ethersproject/web hardhat @matterlabs/hardhat-zksync-solc @matterlabs/hardhat-zksync-deploy
    

*   Insert the following command which will install the **OpenZeppelin** **contract** **library**:
    

    npm install @openzeppelin/contracts
    

*   Press “**+”** and create the file `hardhat.config.ts`
    

![](https://storage.googleapis.com/papyrus_images/7031dd294d656401d99361abf38a1f36f5aeb409f1cb3460ca1cb7b10241684e.png)

*   Insert the following code in `hardhat.config.ts` and press **CTRL + S** to save the file:
    

    import "@matterlabs/hardhat-zksync-deploy";
    import "@matterlabs/hardhat-zksync-solc";
    
    module.exports = {
      zksolc: {
        version: "1.3.5",
        compilerSource: "binary",
        settings: {},
      },
      defaultNetwork: "zkSyncMainnet",
    
      networks: {
        zkSyncMainnet: {
          url: "https://zksync2-mainnet.zksync.io",
          ethNetwork: "mainnet",
          zksync: true,
        },
      },
      solidity: {
        version: "0.8.17",
      },
    };
    

*   Press on another **“+”** and create the `contracts` folder. Press on this folder and create the `contract.sol` file in it. Any parameters (those in “ “ quotes) you can customize according to your needs (full token name & ticker). Insert the following code:
    

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.9;
    
    import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
    import "@openzeppelin/contracts/access/Ownable.sol";
    
    contract Roccrypto is ERC20, Ownable {
        constructor() ERC20("roccrypto", "rocc") {
            _mint(msg.sender, 100 * 10 ** decimals());
        }
    
        function mint(address to, uint256 amount) public onlyOwner {
            _mint(to, amount);
        }
    }
    

*   Press **CTRL + S** to save your file
    
    Here we create a simple **ERC-20** Token with the ticker `rocc`. Any other contracts can be used from **OpenZeppelin** documentation. However, in order to deploy them, we have to understand **JavaScript/TypeScript** programming languages. If you want to deploy some other contracts which are not mentioned in this guide, and you don’t know any of this programming languages - use **ChatGPT**. It will easily write the `deploy.ts` script for the contract you want to deploy.
    
    [https://docs.openzeppelin.com/](https://docs.openzeppelin.com/)
    
*   Compile the contract by inserting the following command:
    

    npx hardhat compile
    

*   If you have such output, then everything is fine:
    

![](https://storage.googleapis.com/papyrus_images/d94398a710acc732250cfdf23e3a4443b7b32b2eb940c9fd62167de27e817360.png)

*   Open the `zksync` folder and create a new folder named `deploy`. In that file we must create the typescript file `deploy.ts`. Insert the following code and change the `0x123…` addreess, to which the tokens will be minted. Press CTRL + S:
    

    import fs from "fs";
    import { utils, Wallet } from "zksync-web3";
    import * as ethers from "ethers";
    import { HardhatRuntimeEnvironment } from "hardhat/types";
    import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
    
    const PRIV_KEY = fs.readFileSync(".secret").toString();
    
    export default async function (hre: HardhatRuntimeEnvironment) {
      console.log(`Running deploy script for the Roccrypto contract`);
    
      const wallet = new Wallet(PRIV_KEY);
    
      const deployer = new Deployer(hre, wallet);
      const artifact = await deployer.loadArtifact("Roccrypto");
    
      const roccryptoContract = await deployer.deploy(artifact, []);
      console.log("constructor args:" + roccryptoContract.interface.encodeDeploy([]));
    
      const contractAddress = roccryptoContract.address;
      console.log(`${artifact.contractName} was deployed to ${contractAddress}`);
    
      // Mint some tokens to an address.
      const to = "0x123..."; // Адрес куда минтить токены.
      const amount = ethers.utils.parseEther("10"); // Сколько токенов нужно заминтить на этот адрес
      const mintHandle = await roccryptoContract.mint(to, amount);
      await mintHandle.wait();
    
      console.log(`Minted ${amount} tokens to ${to}`);
    }
    

*   Create a file named `.secret` in general `zksync` folder. We have to insert a **private** **key** from which the contract will be deployed. Keep in mind, that your address has to have a balance of ~5$ in ETH in zkSync Era mainnet. **It is highly not recommended to hold a signifficant balance if you are unsure about your next actions. Please test first and then deploy on multiple accounts. I am not responsible for your funds.**
    
*   Finally, deploy the contract with the command:
    

    npx hardhat deploy-zksync
    

We’ve successfully deployed our contract and minted some rocc tokens to our address.

![](https://storage.googleapis.com/papyrus_images/8279cfe18dd519c2b45a6c41c662ca3c88155ef666d83f5b805cae17159423c0.png)

### Thirdweb method:

You can also deploy zkSync smart contracts by using **Thirdweb**. If you simply don’t like the classic method - you better use this one.

*   Go to **Thirdweb** website and find the contract we need - `Token`
    

[https://thirdweb.com/explore](https://thirdweb.com/explore)

*   Press `Deploy now`
    

![](https://storage.googleapis.com/papyrus_images/373ebf44b17db02bd65da4daca6bbea6a2af3d5ed63e7d95a9594123edd8b418.png)

*   Fill in the details of our token and make sure to select `zkSync Era Mainnet`.
    
*   Press `Deploy Now` and sign the transaction.
    

![](https://storage.googleapis.com/papyrus_images/0e25ffaec10619350d74607b0809502cecac2d6aa6de6be87f81a8d52d01af20.png)

*   **That’s it, we’ve successfully deployed our contract:**
    

![](https://storage.googleapis.com/papyrus_images/1354636442b4169c41e64aac0e4788921f091b3d8369a6c20e3fdda13d4d975a.png)

* * *

![](https://storage.googleapis.com/papyrus_images/73af106100b2806d2f455981c27b125190195a2b075e256f35a5c8473407fbe4.png)

Base
----

**Deploy price:** FREE (Goerli ETH) **Bridge:** [bridge.base.org/deposit](http://bridge.base.org/deposit) **Deploy difficulty:** Easy

To begin with, use the bridge to obtain ETH to your wallet.

*   Go to [Chainlist](https://chainlist.org/), find `Base Goerli Testnet`, and connect your wallet to it. Make sure you switched the network afterwards.
    

![](https://storage.googleapis.com/papyrus_images/832c42a65839e65ee44340cf5928e6c4f56fb329ead658ed197168260e79bac6.png)

*   Go to [OpenZeppelin Contracts Wizard](https://docs.openzeppelin.com/contracts/4.x/wizard).
    
*   Choose `ERC-20` token and fill in the parameters according to your preferences. Check the boxes for `Mintable` and `Burnable`
    

![](https://storage.googleapis.com/papyrus_images/432535c754f3635d7a7feadf43bd3ab02708d929c44e8de7a191310755333e9f.png)

*   Press `Open in Remix`
    
*   Check the box for `Auto compile`
    

![](https://storage.googleapis.com/papyrus_images/88dd7851434c788e7c8b6ac57179d2a5a1a7aa373f543a726c22606f15e887eb.png)

*   Choose `Injected Provider - Metamask` and connect the wallet to the website.
    

![](https://storage.googleapis.com/papyrus_images/4e22ed28296fabef4eb4ddf3aec1c7b7a334c188112059dd32d9574a9dd427d9.png)

*   Press the `Deploy` button and confirm the transaction in Metamask
    

![](https://storage.googleapis.com/papyrus_images/c5794b5e4de8ba79e23183ec545c420ecc171ce0ff615e801716a05f335131db.png)

**Now we have successfully deployed the contract on Base! However, to avoid repeating the same contracts every time, I suggest experimenting and deploying different ones.**

![](https://storage.googleapis.com/papyrus_images/4f4dc1dee15e1f9f22873ea87b660cd947ccc4c03e4fe7470a1898842703ab7f.png)

* * *

![](https://storage.googleapis.com/papyrus_images/2b87d11214d0cd0342d09c3b27523ca7553ea864d39bbc7b9f91a026d68e3a07.png)

Scroll
------

**Deploy price:** FREE (Goerli ETH) **Bridge:** [scroll.io/bridge](http://scroll.io/bridge) **Deploy difficulty:** Easy

To begin with, use the bridge to obtain ETH to your wallet.

*   Go to [**Chainlist**](https://chainlist.org/), find `Scroll Alpha Testnet` and connect your wallet to it. Make sure you switched the network afterwards.
    

![](https://storage.googleapis.com/papyrus_images/552828953e2663d8ba96ffbe620ee47d2bf215e7759ca69c24f53039aa69e7a2.png)

*   Go to [OpenZeppelin Contracts Wizard](https://docs.openzeppelin.com/contracts/4.x/wizard).
    
*   Choose `ERC-20` token and fill in the parameters according to your preferences. Check the boxes for `Mintable` and `Burnable`
    

![](https://storage.googleapis.com/papyrus_images/432535c754f3635d7a7feadf43bd3ab02708d929c44e8de7a191310755333e9f.png)

*   Press `Open in Remix`
    
*   Check the box for `Auto compile`
    

![](https://storage.googleapis.com/papyrus_images/88dd7851434c788e7c8b6ac57179d2a5a1a7aa373f543a726c22606f15e887eb.png)

*   Choose `Injected Provider - Metamask` and connect the wallet to the website.
    

![](https://storage.googleapis.com/papyrus_images/4e22ed28296fabef4eb4ddf3aec1c7b7a334c188112059dd32d9574a9dd427d9.png)

*   Press the `Deploy` button and confirm the transaction in **Metamask**
    

![](https://storage.googleapis.com/papyrus_images/c5794b5e4de8ba79e23183ec545c420ecc171ce0ff615e801716a05f335131db.png)

**Congratulations! We have successfully deployed our final contract!**

### If this guide was useful, share it and follow my channels for more:

[https://twitter.com/roccrypto\_tw](https://twitter.com/roccrypto_tw)

[https://t.me/roccrypto](https://t.me/roccrypto)

---

*Originally published on [The Roccrypto](https://paragraph.com/@roccrypto/step-by-step-guide-of-deploying-contracts-on-zksync-era-base-scroll)*
