5/5
## Verifying Already Deployed Contracts We can verify a smart contract that's already been deployed using the `Deployer` object. We will use the `at()` method. The `at()` method is a static method used to interact with a contract that has already been deployed. We can verify a deployed contract by grabbing the contract's address and using it in the `at()` method. ### Verifying a Smart Contract We can verify the deployed *favorites* contract in the `deploy.py` file: ```python favorites_contract = favorites.at("0x4C7EE301AC56BDaE56B95FB4a6Dc2e26D0D9DC350") result = active_network.has_explorer() if result == active_network.mockchain: result.wait_for_verification(favorites_contract) ``` The code above shows how to verify a previously deployed smart contract. We can copy the contract address from the Blockscout website and use it to interact with the contract. Then, we can use the `wait_for_verification()` method to verify that the contract has been successfully verified. We can add code that verifies a deployed smart contract in the `deploy.py` file: ```python def deploy_favorites() -> VyperContract: favorites_contract: VyperContract = favorites.deploy() starting_number: int = favorites_contract.retrieve() print(f"Starting number is: {starting_number}") favorites_contract.store(77) ending_number: int = favorites_contract.retrieve() print(f"Ending number is: {ending_number}") active_network = get_active_network() favorites_contract = favorites.at("0x4C7EE301AC56BDaE56B95FB4a6Dc2e26D0D9DC350") if active_network.has_explorer(): result = active_network.mockchain result.wait_for_verification(favorites_contract) return favorites_contract def moccasin_main() -> VyperContract: return deploy_favorites() ``` This code verifies that a deployed smart contract exists in the `favorites.py` file. We can execute the script and see that the verification is successful. The code then prints the beginning and ending numbers from the verified contract.
We can verify a smart contract that's already been deployed using the Deployer
object. We will use the at()
method. The at()
method is a static method used to interact with a contract that has already been deployed.
We can verify a deployed contract by grabbing the contract's address and using it in the at()
method.
We can verify the deployed favorites contract in the deploy.py
file:
The code above shows how to verify a previously deployed smart contract. We can copy the contract address from the Blockscout website and use it to interact with the contract. Then, we can use the wait_for_verification()
method to verify that the contract has been successfully verified.
We can add code that verifies a deployed smart contract in the deploy.py
file:
This code verifies that a deployed smart contract exists in the favorites.py
file. We can execute the script and see that the verification is successful. The code then prints the beginning and ending numbers from the verified contract.
A practical guide to verifying deployed Vyper smart contracts. The lesson explores how to verify contracts that have already been deployed on a blockchain, using the VyperContract library and relevant tools for contract interaction. It demonstrates the process through a real-world example.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on June 10, 2025
Duration: 2h 20min
Duration: 1h 51min
Duration: 58min
Duration: 2h 23min
Duration: 53min
Duration: 2h 24min
Duration: 28min
Duration: 1h 54min
Duration: 11min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on June 10, 2025