0
0
Blockchain / Solidityprogramming~10 mins

Multi-signature wallet concept in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the minimum number of signatures required.

Blockchain / Solidity
uint constant MIN_SIGNATURES = [1];
Drag options to blanks, or click blank then click option'
A2
B4
C1
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the minimum signatures to 1 defeats the purpose of multi-signature.
Using a number higher than the total number of owners.
2fill in blank
medium

Complete the code to check if the number of collected signatures meets the minimum required.

Blockchain / Solidity
require(signaturesCount [1] MIN_SIGNATURES, "Not enough signatures");
Drag options to blanks, or click blank then click option'
A<
B>=
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' would reject valid transactions.
Using '!=' would allow invalid counts.
3fill in blank
hard

Fix the error in the function that verifies if a signer is authorized.

Blockchain / Solidity
function isAuthorized(address signer) public view returns (bool) {
    return owners[[1]];
}
Drag options to blanks, or click blank then click option'
Asigner
Bmsg.sender
Caddress
Downer
Attempts:
3 left
💡 Hint
Common Mistakes
Using msg.sender instead of signer checks the wrong address.
Using 'address' or 'owner' are not valid variables here.
4fill in blank
hard

Fill both blanks to create a mapping that tracks signatures for each transaction.

Blockchain / Solidity
mapping(uint => mapping(address => [1])) public signatures;

function signTransaction(uint txId) public {
    signatures[txId][[2]] = true;
}
Drag options to blanks, or click blank then click option'
Abool
Bmsg.sender
Cuint
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using uint instead of bool for signature status.
Using address instead of msg.sender to mark the signer.
5fill in blank
hard

Fill all three blanks to create a function that executes a transaction after enough signatures.

Blockchain / Solidity
function executeTransaction(uint txId) public {
    require(signatures[txId][[1]], "Not signed by owner");
    require(signaturesCount [2] MIN_SIGNATURES, "Insufficient signatures");
    transactions[txId].[3]();
}
Drag options to blanks, or click blank then click option'
Amsg.sender
B>=
Ccall
Dtransfer
Attempts:
3 left
💡 Hint
Common Mistakes
Using transfer instead of call may not work for all transaction types.
Using '<' instead of '>=' causes logic errors.