Challenge - 5 Problems
Blockchain Confirmation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this transaction confirmation check?
Consider this pseudocode for checking transaction confirmations on a blockchain. What will be the printed output?
Blockchain / Solidity
confirmations = 3 required_confirmations = 6 if confirmations >= required_confirmations: print("Transaction confirmed") else: print(f"Waiting for {required_confirmations - confirmations} more confirmations")
Attempts:
2 left
💡 Hint
Check if the current confirmations meet or exceed the required confirmations.
✗ Incorrect
The code compares current confirmations (3) with required (6). Since 3 < 6, it prints the waiting message with the difference (6-3=3).
🧠 Conceptual
intermediate1:30remaining
Which statement best describes transaction confirmation?
In blockchain, what does a transaction confirmation mean?
Attempts:
2 left
💡 Hint
Think about when a transaction is considered secure and irreversible.
✗ Incorrect
A confirmation means the transaction is inside a block that is accepted as part of the main blockchain, making it harder to reverse.
🔧 Debug
advanced2:30remaining
Why does this confirmation count code raise an error?
This code snippet is intended to count confirmations but raises an error. Identify the cause.
Blockchain / Solidity
def check_confirmations(tx_hash): confirmations = blockchain.get_confirmations(tx_hash) if confirmations > 0: return confirmations else: return 0
Attempts:
2 left
💡 Hint
Check the syntax of the if statement line.
✗ Incorrect
The if statement is missing a colon at the end, causing a SyntaxError.
🚀 Application
advanced2:00remaining
How many confirmations does this code wait for before proceeding?
Given this code snippet, how many confirmations does it require before printing 'Confirmed'?
Blockchain / Solidity
required_confirmations = 12 current_confirmations = 10 while current_confirmations < required_confirmations: print(f"Current: {current_confirmations}, waiting...") current_confirmations += 1 print("Confirmed")
Attempts:
2 left
💡 Hint
Look at the condition that stops the loop.
✗ Incorrect
The loop runs until current_confirmations reaches 12, so it waits for 12 confirmations before printing 'Confirmed'.
❓ Predict Output
expert3:00remaining
What is the output of this asynchronous confirmation checker?
This JavaScript async function checks confirmations. What will it print?
Blockchain / Solidity
async function checkTx(txId) { let confirmations = 0; while (confirmations < 3) { confirmations++; console.log(`Confirmations: ${confirmations}`); await new Promise(resolve => setTimeout(resolve, 100)); } console.log('Transaction confirmed'); } checkTx('abc123');
Attempts:
2 left
💡 Hint
The function increments confirmations and waits 100ms each loop until 3 confirmations.
✗ Incorrect
The loop prints confirmations 1, 2, 3 with delays, then prints 'Transaction confirmed'.