0
0
Blockchain / Solidityprogramming~30 mins

Monitoring deployed contracts in Blockchain / Solidity - Mini Project: Build & Apply

Choose your learning style9 modes available
Monitoring Deployed Contracts
📖 Scenario: You are working as a blockchain developer. You have deployed several smart contracts on a blockchain network. Now, you want to monitor these deployed contracts to check their status and keep track of their addresses.
🎯 Goal: Build a simple Python script that stores deployed contract addresses, sets a monitoring threshold, filters contracts based on the threshold, and prints the filtered list.
📋 What You'll Learn
Create a dictionary with contract names and their deployed block numbers.
Add a variable to set a block number threshold for monitoring.
Filter contracts deployed after the threshold block number.
Print the filtered contracts.
💡 Why This Matters
🌍 Real World
Blockchain developers often need to monitor deployed smart contracts to track their deployment status and ensure they are active on the network.
💼 Career
This project teaches basic data handling and filtering skills useful for blockchain monitoring tools and DevOps automation scripts.
Progress0 / 4 steps
1
Create a dictionary of deployed contracts
Create a dictionary called deployed_contracts with these exact entries: 'TokenA': 1050, 'TokenB': 1105, 'TokenC': 980, 'TokenD': 1150
Blockchain / Solidity
Need a hint?

Use curly braces {} to create a dictionary with keys as contract names and values as block numbers.

2
Set the block number threshold
Create a variable called block_threshold and set it to 1000
Blockchain / Solidity
Need a hint?

Just assign the number 1000 to the variable block_threshold.

3
Filter contracts deployed after the threshold
Create a new dictionary called recent_contracts that contains only the contracts from deployed_contracts where the block number is greater than block_threshold. Use a dictionary comprehension with contract and block as variables.
Blockchain / Solidity
Need a hint?

Use a dictionary comprehension to filter items where block number is greater than block_threshold.

4
Print the filtered contracts
Write a print statement to display the recent_contracts dictionary.
Blockchain / Solidity
Need a hint?

Use print(recent_contracts) to show the filtered contracts.