First to clear all 11 challenges
1 full SCH seat · €450
Unlocked hints
Unlock a hint to view it here.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract CoinFlip {
uint256 public consecutiveWins;
uint256 lastHash;
uint256 FACTOR = 57896044618658097711785492504343953926634992332820282019728792003956564819968;
function flip(bool _guess) public returns (bool) {
uint256 blockValue = uint256(blockhash(block.number - 1));
if (lastHash == blockValue) {
revert();
}
lastHash = blockValue;
uint256 coinFlip = blockValue / FACTOR;
bool side = coinFlip == 1 ? true : false;
if (side == _guess) {
consecutiveWins++;
return true;
} else {
consecutiveWins = 0;
return false;
}
}
}
Starter exploit
// Already wired up for you - do NOT add imports or a contract wrapper:
// coinflipInstance -> the deployed CoinFlip contract
// PLAYER_PRIVATE_KEY / PLAYER_ADDRESS -> your key and address
// Write only the code below.
function run() external {
vm.startBroadcast(PLAYER_PRIVATE_KEY);
// TODO: implement the exploit.
vm.stopBroadcast();
}
CTF tour
This is your guided Solidity CTF workspace.
€900 worth · Two ways to win
1 full SCH seat · €450
1 full SCH seat · €450
August 4 to August 11, 2026. Winners are emailed after the event ends. One prize per player.
Sign in to save private notes on contract lines and continue your review later.
This removes it permanently from your private workspace.