Skip to content

Instantly share code, notes, and snippets.

@io4
Created February 22, 2018 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save io4/9c8de4c1226b27adf06062efa74b460a to your computer and use it in GitHub Desktop.
Save io4/9c8de4c1226b27adf06062efa74b460a to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.18;
contract CardGuess {
address guesser = 0x0;
uint256 unlockblock = 0;
uint256 window = 10;
bytes32 public hash = 0x28c6468c5e6cd0cd9dac3b0cdfe6c9fde6593813f4a83628fa81f7099b4cf4e9;
function commit () public {
require(unlockblock < block.number);
guesser = msg.sender;
unlockblock = block.number + window;
}
function guess (string solution) public {
require(guesser == msg.sender);
require(keccak256(solution) == hash);
msg.sender.transfer(this.balance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment