0
0
Blockchain / Solidityprogramming~20 mins

Multi-signature wallet concept in Blockchain / Solidity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-signature Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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)
A1
B2
C3
D0
Attempts:
2 left
💡 Hint
Count how many owners have True as their approval status.
🧠 Conceptual
intermediate
1:30remaining
Which statement best describes a multi-signature wallet?
Choose the correct description of a multi-signature wallet.
AA wallet that automatically sends funds to multiple recipients.
BA wallet that stores multiple cryptocurrencies in one address.
CA wallet that can only be accessed by one owner at a time.
DA wallet that requires multiple private keys to authorize a transaction.
Attempts:
2 left
💡 Hint
Think about how multiple people approve spending.
🔧 Debug
advanced
2: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')
AKeyError because 'Charlie' is missing in approvals dictionary
BTypeError because sum cannot add booleans
CNo error, prints 'Transaction approved'
DIndexError due to list access
Attempts:
2 left
💡 Hint
Check if all owners have approval entries.
🚀 Application
advanced
3: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)
A2
B3
C1
D0
Attempts:
2 left
💡 Hint
Count transactions where approvals are at least 2.
📝 Syntax
expert
3: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;
}
A
function isApproved(uint txId) public view returns bool {
    uint count = 0;
    for (uint i = 0; i &lt; owners.length; i++) {
        if (approvals[txId][owners[i]]) {
            count++;
        }
    }
    return count &gt;= required;
}
B
function isApproved(uint txId) public returns (bool) {
    uint count = 0;
    for (uint i = 0; i &lt;= owners.length; i++) {
        if (approvals[txId][owners[i]]) {
            count++;
        }
    }
    return count &gt;= required;
}
C
function isApproved(uint txId) public view returns (bool) {
    uint count = 0;
    for (uint i = 0; i &lt; owners.length; i++) {
        if (approvals[txId][owners[i]]) {
            count++;
        }
    }
    return count &gt;= required;
}
D
function isApproved(uint txId) public view returns (bool) {
    uint count = 0;
    for (uint i = 0; i &lt; owners.length; i++) {
        if (approvals[txId][owners[i]] == true) {
            count = count + 1;
        }
    }
    return count &gt;= required;
}
Attempts:
2 left
💡 Hint
Check for correct function signature, loop bounds, and syntax.