Challenge - 5 Problems
Cross-chain Bridge Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a simple cross-chain token lock function
What is the output of this Solidity function when called with amount = 100 and sender balance = 150?
Blockchain / Solidity
mapping(address => uint256) balances;
function lockTokens(uint256 amount) public returns (string memory) {
require(balances[msg.sender] >= amount, "Insufficient balance");
balances[msg.sender] -= amount;
// Tokens locked for cross-chain transfer
return "Tokens locked";
}
// Assume balances[msg.sender] = 150 before callAttempts:
2 left
💡 Hint
Check the require condition and the initial balance.
✗ Incorrect
The function checks if the sender has enough balance (150 >= 100). Since true, it subtracts 100 and returns "Tokens locked".
🧠 Conceptual
intermediate1:30remaining
Understanding cross-chain message verification
Which of the following best describes the role of a relayer in a cross-chain bridge?
Attempts:
2 left
💡 Hint
Think about how information is passed securely between chains.
✗ Incorrect
Relayers watch events on the source chain and submit cryptographic proofs to the destination chain to confirm token locking or burning.
🔧 Debug
advanced2:30remaining
Identify the error in cross-chain token minting code
What error will this Solidity code produce when mintTokens is called without proper verification?
Blockchain / Solidity
mapping(address => uint256) public balances;
function mintTokens(address to, uint256 amount) public {
// Missing verification of cross-chain proof
balances[to] += amount;
}Attempts:
2 left
💡 Hint
Consider security implications of minting without checks.
✗ Incorrect
The code compiles and runs but lacks proof verification, allowing anyone to mint tokens arbitrarily, causing a logical security flaw.
📝 Syntax
advanced1:30remaining
Syntax error in cross-chain event emission
Which option correctly fixes the syntax error in this Solidity event emission code?
Blockchain / Solidity
event TransferLocked(address indexed sender, uint256 amount);
function lock(uint256 amount) public {
emit TransferLocked(msg.sender, amount)
}Attempts:
2 left
💡 Hint
Check the end of the emit statement.
✗ Incorrect
In Solidity, statements must end with a semicolon. The missing semicolon causes a syntax error.
🚀 Application
expert2:00remaining
Calculate the number of confirmations needed for secure cross-chain transfer
A cross-chain bridge requires 12 confirmations on the source chain before releasing tokens on the destination chain. If blocks are produced every 15 seconds, how long in minutes does a user wait before tokens are released?
Attempts:
2 left
💡 Hint
Multiply confirmations by block time, then convert seconds to minutes.
✗ Incorrect
12 confirmations × 15 seconds = 180 seconds = 3 minutes. But 3 minutes is option A, so check carefully: 12 × 15 = 180 seconds = 3 minutes. Option A is 3 minutes, so correct answer is A.