0
0
Blockchain / Solidityprogramming~20 mins

Monitoring deployed contracts in Blockchain / Solidity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Monitoring Deployed Contracts
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this command monitoring a deployed contract event?
You run the command to listen for Transfer events on an ERC-20 token contract:
web3.eth.subscribe('logs', {address: '0xTokenAddress', topics: [web3.utils.sha3('Transfer(address,address,uint256)')]})

What will this command output when a transfer happens?
Blockchain / Solidity
web3.eth.subscribe('logs', {address: '0xTokenAddress', topics: [web3.utils.sha3('Transfer(address,address,uint256)')]})
AA boolean true indicating subscription success
BA list of all past Transfer events from the contract
CA syntax error because 'topics' is not a valid parameter
DAn event log object containing transaction hash, block number, and data about the transfer
Attempts:
2 left
💡 Hint
Think about what 'subscribe' does in web3.js for event logs.
Configuration
intermediate
2:00remaining
Which configuration correctly sets up a Prometheus exporter for Ethereum node metrics?
You want to monitor your Ethereum node using Prometheus. Which Prometheus scrape config snippet correctly scrapes metrics from a node exposing metrics at http://localhost:9545/metrics?
A
scrape_configs:
  - job_name: 'eth_node'
    metrics_path: '/metrics'
    static_configs:
      - targets: ['localhost:9545']
B
scrape_configs:
  - job_name: 'eth_node'
    static_configs:
      - targets: ['http://localhost:9545/metrics']
C
scrape_configs:
  - job_name: 'eth_node'
    static_configs:
      - targets: ['localhost']
D
scrape_configs:
  - job_name: 'eth_node'
    static_configs:
      - targets: ['localhost:9545']
Attempts:
2 left
💡 Hint
Prometheus targets should be host:port without protocol, and metrics_path is set separately.
Troubleshoot
advanced
2:00remaining
Why does your contract event listener miss some events?
You wrote a script to listen to contract events using web3.js subscription, but it misses some events when the node restarts. What is the most likely cause?
AThe subscription only listens to new events after connection; missed events during downtime are lost
BThe contract ABI is outdated and cannot decode events correctly
CThe node is not synced fully and cannot provide event data
DThe web3.js version does not support event subscriptions
Attempts:
2 left
💡 Hint
Think about what happens to event subscriptions when the connection drops.
🔀 Workflow
advanced
2:00remaining
What is the correct workflow to monitor contract state changes reliably?
You want to monitor a deployed smart contract's state changes and ensure no events are missed even if your monitoring service restarts. Which workflow is best?
AUse event subscriptions only and restart them on service start
BOnly query the current contract state on demand without event listening
CPeriodically query past events from the last known block and combine with live subscriptions
DUse a centralized logging service that stores all blockchain transactions
Attempts:
2 left
💡 Hint
Consider how to handle downtime and missed events.
Best Practice
expert
3:00remaining
Which practice best improves monitoring scalability for many deployed contracts?
You manage monitoring for hundreds of deployed contracts on Ethereum. What is the best practice to scale event monitoring efficiently?
ARun one full node per contract to isolate event streams
BUse a centralized event indexing service like The Graph to query events
CSubscribe to all events on the main node and filter in your application
DPoll each contract's state every second to detect changes
Attempts:
2 left
💡 Hint
Think about reducing load and complexity on your own infrastructure.