Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the gas limit for a transaction.
Blockchain / Solidity
transaction = {"to": recipient, "value": amount, "gas": [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using too low or too high gas limits causing transaction failure or waste.
✗ Incorrect
The standard gas limit for a simple ETH transfer is 21000 units.
2fill in blank
mediumComplete the code to calculate the total transaction fee.
Blockchain / Solidity
total_fee = gas_price * [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Multiplying gas price by nonce or value instead of gas limit.
✗ Incorrect
The total fee is gas price multiplied by gas limit.
3fill in blank
hardFix the error in the code to set the gas price correctly.
Blockchain / Solidity
transaction['gasPrice'] = [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong case or misspelled variable names.
✗ Incorrect
The correct variable name is gas_price matching the code context.
4fill in blank
hardFill both blanks to create a dictionary comprehension for gas fees above a threshold.
Blockchain / Solidity
high_fees = {tx_id: tx['gasPrice'] * [1] for tx_id, tx in transactions.items() if tx['gasPrice'] [2] threshold} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys or wrong comparison operators.
✗ Incorrect
Calculate fee by multiplying gasPrice and gasLimit, filter fees greater than threshold.
5fill in blank
hardFill all three blanks to create a filtered dictionary of transactions with fees above a limit.
Blockchain / Solidity
filtered = {tx['from']: tx['gasPrice'] * [1] for tx in tx_list if tx['gasPrice'] [2] min_price and tx['gasLimit'] [3] max_limit} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up comparison operators or using wrong keys.
✗ Incorrect
Calculate fee by gasPrice * gasLimit, filter gasPrice greater than min_price and gasLimit less than max_limit.