0
0
Blockchain / Solidityprogramming~30 mins

Contract verification on Etherscan in Blockchain / Solidity - Mini Project: Build & Apply

Choose your learning style9 modes available
Contract verification on Etherscan
📖 Scenario: You have just deployed a smart contract on the Ethereum blockchain. To make your contract's source code public and allow others to verify it, you need to verify your contract on Etherscan.This project will guide you through the steps to prepare and submit your contract for verification on Etherscan.
🎯 Goal: Learn how to prepare your smart contract source code and metadata, and submit it to Etherscan for verification.
📋 What You'll Learn
Have a deployed smart contract address
Have the exact source code of the deployed contract
Know the compiler version used for deployment
Understand how to use Etherscan's contract verification interface
💡 Why This Matters
🌍 Real World
Verifying your smart contract on Etherscan makes your code public and trustworthy. It helps users and developers see exactly what your contract does.
💼 Career
Blockchain developers often need to verify contracts to ensure transparency and security. This skill is essential for roles involving smart contract deployment and auditing.
Progress0 / 4 steps
1
Prepare the contract source code
Create a string variable called source_code that contains the exact Solidity source code of your deployed contract. Use triple quotes to include multiple lines.
Blockchain / Solidity
Need a hint?

Use triple quotes ''' to write the full Solidity code as a string.

2
Specify the compiler version
Create a string variable called compiler_version and set it to the exact Solidity compiler version used to deploy the contract, for example, "v0.8.0+commit.c7dfd78e".
Blockchain / Solidity
Need a hint?

Check your deployment logs or compiler settings to find the exact compiler version string.

3
Prepare the verification metadata
Create a dictionary called verification_data with keys "address", "sourceCode", and "compilerVersion". Set "address" to the deployed contract address "0x1234567890abcdef1234567890abcdef12345678", "sourceCode" to the source_code variable, and "compilerVersion" to the compiler_version variable.
Blockchain / Solidity
Need a hint?

Use a dictionary with the exact keys and values as described.

4
Print the verification data
Write a print statement to display the verification_data dictionary.
Blockchain / Solidity
Need a hint?

Use print(verification_data) to show the dictionary.