Welcome to cryptomarketblog, the number one blog for crypto education. Here we explain the topics of the cryptocurrency using examples so that anyone can easily understand them. In this article we are going to show how to Deploy a Contract On Scroll.
What is Scroll?
Scroll is a zkEVM network. Scroll receives regular bytecodes from Layer 1 smart contracts, generates zk proofs off-chain using GPU power, then verifies the new states back on Ethereum Layer 1. They raised $30 Million In Series A funding from many reputable global enterprises.
Deploy a Contract On Scroll
Here is a step-by-step guide on how to Deploy a Contract On Scroll.
Requirement:
Need a wallet, with ETH on Scroll Testnet. If you don’t have a test ETH follow this guide.
Step 1: Go to https://remix.ethereum.org/
Step 2: Go to Workspace from the left-panel menu and choose the Create New File icon and name it as “cryptomarketblog.sol” (Give any name with .sol extension).
Step 3: Copy & Paste the below code in cryptomarketblog.sol
pragma solidity 0.8.17;
// SPDX-License-Identifier: MIT
contract CryptoMarketBlog {
string public name = "Crypto Market Blog";
string public symbol = "CMB";
uint8 public decimals = 18;
uint256 public totalSupply = 10000000;
mapping (address => uint256) public balances;
address public owner;
constructor() {
owner = msg.sender;
balances[owner] = totalSupply;
}
function transfer(address recipient, uint256 amount) public {
require(balances[msg.sender] >= amount, "Insufficient balance.");
balances[msg.sender] -= amount;
balances[recipient] += amount;
}
}
Step 4: Compilation
Go to the Solidity Compiler from the left-panel -> click on 'Compile cryptomarketblog.sol' -> If there is no error you'll see a green tick on solidity compiler button
Step 5: Deployment
I am deploying this on Scroll testnet, So we need some testnet ETH for Gas, If you don’t have test ETH on your MetaMask, follow this guide.
Go to the Deploy & Run Transactions sidebar from the left-panel -> Select environment as 'Injected Provider - MetaMask'then you will get a MetaMask pop-up -> Click on connect -> Click on Deploy -> confirm MetaMask transaction
Step 6: Verify Contract
Visit the Scroll contract you deployed on scroll explorer -> click on ‘Code’ tab -> click on ‘Verify & Publish’ -> select ‘Via flattened source code’ -> click on ‘Next’ -> enter Contract Name -> select compiler same as remix compiler -> select optimization as ‘No’ -> Enter the Solidity Contract Code -> enter the solidity contract code -> click on ‘Verify & Publish’
That’s it, You have successfully completed Contract Deployment On Scroll.