Challenge - 5 Problems
Multi-signature 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 multi-signature wallet approval count?
Consider a multi-signature wallet contract where 3 owners must approve a transaction. The code below simulates approvals. What is the final approval count?
Blockchain / Solidity
approvals = {'owner1': True, 'owner2': False, 'owner3': True}
approval_count = sum(1 for approved in approvals.values() if approved)
print(approval_count)Attempts:
2 left
💡 Hint
Count how many owners have True as their approval status.
✗ Incorrect
Only 'owner1' and 'owner3' have approved (True), so the count is 2.
🧠 Conceptual
intermediate1:30remaining
Which statement best describes a multi-signature wallet?
Choose the correct description of a multi-signature wallet.
Attempts:
2 left
💡 Hint
Think about how multiple people approve spending.
✗ Incorrect
Multi-signature wallets require multiple signatures (private keys) to approve transactions, increasing security.
🔧 Debug
advanced2:30remaining
What error does this multi-signature wallet code raise?
This Python-like pseudocode simulates a multi-signature wallet transaction approval. What error occurs when running it?
Blockchain / Solidity
owners = ['Alice', 'Bob', 'Charlie'] approvals = {'Alice': True, 'Bob': True} required = 3 count = sum(approvals[owner] for owner in owners) if count >= required: print('Transaction approved') else: print('Transaction pending')
Attempts:
2 left
💡 Hint
Check if all owners have approval entries.
✗ Incorrect
The code tries to access approvals['Charlie'], which does not exist, causing a KeyError.
🚀 Application
advanced3:00remaining
How many transactions can be approved with this multi-signature setup?
A multi-signature wallet requires 2 out of 3 owners to approve a transaction. Given the following approvals, how many transactions are approved?
Blockchain / Solidity
transactions = [
{'id': 1, 'approvals': {'Alice': True, 'Bob': True, 'Charlie': False}},
{'id': 2, 'approvals': {'Alice': False, 'Bob': True, 'Charlie': True}},
{'id': 3, 'approvals': {'Alice': False, 'Bob': False, 'Charlie': True}}
]
required = 2
approved_count = 0
for tx in transactions:
count = sum(tx['approvals'].values())
if count >= required:
approved_count += 1
print(approved_count)Attempts:
2 left
💡 Hint
Count transactions where approvals are at least 2.
✗ Incorrect
Transactions 1 and 2 have 2 approvals each, so 2 transactions are approved.
📝 Syntax
expert3:00remaining
Which option correctly defines a multi-signature wallet approval function in Solidity?
Select the correct Solidity function syntax that checks if a transaction has enough approvals.
Blockchain / Solidity
function isApproved(uint txId) public view returns (bool) { uint count = 0; for (uint i = 0; i < owners.length; i++) { if (approvals[txId][owners[i]]) { count++; } } return count >= required; }
Attempts:
2 left
💡 Hint
Check for correct function signature, loop bounds, and syntax.
✗ Incorrect
Option C uses correct Solidity syntax: 'public view returns (bool)', loop with i < owners.length, and proper increment and return statements.