Deploy and Verify Your Contract Using Remix and Blockscout

Illustration showing a connection between the Blockscout logo and another logo with a gear inside a chat bubble, symbolizing integration or collaboration.

Remix is a robust browser-based integrated development environment (IDE) that facilitates the development, compilation, and deployment of smart contracts. Its user-friendly interface makes it an ideal choice for both novice and experienced developers.

Blockscout has been integrated into the Remix IDE, enabling users to verify their contracts directly within the editor. This integration simplifies the publication of source code and metadata, making it possible for others to inspect and interact with the contracts.

This article will guide you through the process of deploying a smart contract and verifying it using BlockScout on the Remix IDE.

Prerequisites

  • A web browser (Chrome, Firefox, etc.)
  • A MetaMask wallet (or another compatible Ethereum wallet) and some ETH for deploying to mainet.

Step 1: Access Remix IDE

Open your web browser and navigate to the Remix IDE website: remix.ethereum.org.

Step 2: Create a New Solidity File

  1. You’ll see a file explorer on the left-hand side in the Remix IDE.
  2. Click the "Create New File" icon and name your file.
Remix IDE interface displaying a Solidity smart contract called SimpleStorage with set and get functions, showing gas estimates and code structure in the editor.
  1. Paste your Solidity contract code into the editor. For this example, we'll use a simple "Simple storage" contract;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract SimpleStorage {
uint256 private storedNumber;

event NumberUpdated(uint256 newValue);

function setNumber(uint256 _number) public {
        storedNumber = _number;
   emit NumberUpdated(_number);
}

function getNumber() public view returns (uint256) {
    return storedNumber;
    }
}

Step 3: Compile the Contract

  1. Navigate to the Solidity Compiler tab.
  2. Ensure the compiler version matches the one specified in your contract's pragma directive (e.g., ^0.8.0).
Remix IDE showing the Solidity Compiler panel with version 0.8.26 selected, an arrow pointing to the compile icon on the left sidebar, and a highlighted 'Compile simplestorage.sol' button.
  1. Click the "Compile simplestorage.sol" button.
  2. If the compilation is successful, you'll see a green checkmark. If there are errors, review your code and fix them.

Step 4: Deploy the Contract

  1. Navigate to the Deploy & Run Transactions tab.   
  2. In the "Environment" dropdown, select "Injected Provider - MetaMask" if you're using MetaMask or another appropriate option if you are using another wallet.   
  3. MetaMask will prompt you to connect your account to Remix. Follow the instructions to connect.   
Remix IDE's 'Deploy & Run Transactions' panel with 'Injected Provider - MetaMask' selected, a gas limit field set to 3000000, and the 'Deploy' button highlighted to deploy the SimpleStorage smart contract to the Ethereum mainnet.
  1. In the "Contract" dropdown, select your contract (simplestorage).
  2. Click the "Deploy" button.
  3. MetaMask will prompt you to confirm the transaction. Review the transaction details (gas price, gas limit, etc.) and click "Confirm."  
  4. Once the transaction is successful, the deployed contract will appear in the "Deployed Contracts" section.    
Remix IDE showing successful deployment of the SimpleStorage smart contract. The console displays transaction details including block number, transaction index, sender and contract address, and a confirmation message with links to view on Etherscan and Blockscout.

Step 5: Verify Contract with Blockscout

  1. Go to the plugin manager and search for the “Contract Verification” Plugin.  Click the Activate button to start using.
Remix IDE Plugin Manager with 'Contract Verification' plugin highlighted, showing option to verify deployed smart contract code on Sourcify, Etherscan, and Blockscout simultaneously. Arrow points to the plugin panel and contract deployment confirmation.
  1. Select the chain that your MetaMask wallet utilized for the deployment and paste your contract address.
💡
Please note that you can verify your contract across multiple explorers at once; for this guide, I will verify only on BlockScout.
"Contract Verification panel in Remix IDE showing Ethereum Mainnet selected, with the contract 'SimpleStorage' targeted for verification. Blockscout is checked as the verification service, with a red arrow pointing to the verification icon.
  1. Review the verification receipts to check the status of your contract verification.
Remix IDE showing the Contract Verification receipts tab with a verified contract on Ethereum Mainnet. The contract named 'SimpleStorage' is shown as successfully verified on Blockscout, with a green checkmark and a copy link icon.

The green check mark indicates success; if it fails, a cancel icon will appear along with the reason for the failure.

We can now view our verified contract on Blockscout.

Step 6: View on Blockscout

Copy the contract address of your code and paste it on Blockscout 

Blockscout contract verification page showing verified source code for 'SimpleStorage' on Ethereum. Includes compiler version, EVM settings, file path, and Solidity source code with contract details.

The image provides proof that our contract has been successfully verified. With this verification, you now have the ability to view critical components of your contract, including the Application Binary Interface (ABI) and the bytecode.

The ABI serves as a bridge, defining how the contract interacts with other systems, while the bytecode represents the compiled instructions that are executed on the blockchain.