以太坊智能合约漏洞安全测试
演练平台地址:https://capturetheether.com/challenges/lotteries/guess-the-new-number/
参考文档:https://www.anquanke.com/post/id/154104
1 Warmup
1.1 Deploy a contract
题目要求:
- Install MetaMask.
- Switch to the Ropsten test network.
- Get some Ropsten ether. Clicking the “buy” button in MetaMask will take you to a faucet that gives out free test ether.
代码:
pragma solidity ^0.4.21; contract DeployChallenge {
// This tells the CaptureTheFlag contract that the challenge is complete.
function isComplete() public pure returns (bool) {
return true;
}
}}
1.2 Call me
代码:
1.3 Choose a nickname
题目要求:
It’s time to set your Capture the Ether nickname! This nickname is how you’ll show up on the leaderboard.
The CaptureTheEther smart contract keeps track of a nickname for every player. To complete this challenge, set your nickname to a non-empty string. The smart contract is running on the Ropsten test network at the address 0x71c46Ed333C35e4E6c62D32dc7C8F00D125b4fee.
代码:
2 Lotteries
2.1 Guess the number
2.2 Guess secret number
2.3 Guess the random number
2.4 Guess the new number
代码: