Deploy and Verify Your Contract Using Remix and Blockscout

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
- You’ll see a file explorer on the left-hand side in the Remix IDE.
- Click the "Create New File" icon and name your file.
- 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
- Navigate to the Solidity Compiler tab.
- Ensure the compiler version matches the one specified in your contract's pragma directive (e.g., ^0.8.0).
- Click the "Compile simplestorage.sol" button.
- 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
- Navigate to the Deploy & Run Transactions tab.
- In the "Environment" dropdown, select "Injected Provider - MetaMask" if you're using MetaMask or another appropriate option if you are using another wallet.
- MetaMask will prompt you to connect your account to Remix. Follow the instructions to connect.
- In the "Contract" dropdown, select your contract (simplestorage).
- Click the "Deploy" button.
- MetaMask will prompt you to confirm the transaction. Review the transaction details (gas price, gas limit, etc.) and click "Confirm."
- Once the transaction is successful, the deployed contract will appear in the "Deployed Contracts" section.
Step 5: Verify Contract with Blockscout
- Go to the plugin manager and search for the “Contract Verification” Plugin. Click the Activate button to start using.
- Select the chain that your MetaMask wallet utilized for the deployment and paste your contract address.
- Review the verification receipts to check the status of your contract verification.
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
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.