Puzzle #3
TinySig
Author
0xb958d9fa0417e116f446d0a06d0326805ad73bd5
yoloswaggins.eth
SoliditySolidity's logo.Puzzle
Curtacallsverify()
1
// SPDX-License-Identifier: Unlicense
2
pragma solidity ^0.8.17;
3
4
import {IPuzzle} from "../interfaces/IPuzzle.sol";
5
6
/// @title TinySig
7
/// @author Riley Holterhus
8
contract TinySig is IPuzzle {
9
10
// This is the address you get by using the private key 0x1.
11
// For this challenge, make sure you do not use *your own* private key
12
// (other than to initiate the `solve` transaction of course). You only
13
// need to use the private key 0x1 for signing things.
14
address constant SIGNER = 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf;
15
16
/// @inheritdoc IPuzzle
17
function name() external pure returns (string memory) {
18
return "TinySig";
19
}
20
21
/// @inheritdoc IPuzzle
22
function generate(address _seed) external view returns (uint256) {
23
return uint256(keccak256(abi.encodePacked(_seed)));
24
}
25
26
/// @inheritdoc IPuzzle
27
function verify(uint256 _start, uint256 _solution) external returns (bool) {
28
address target = address(new Deployer(abi.encodePacked(_solution)));
29
(, bytes memory ret) = target.staticcall("");
30
(bytes32 h, uint8 v, bytes32 r) = abi.decode(ret, (bytes32, uint8, bytes32));
31
return (
32
r < bytes32(uint256(1 << 184)) &&
33
ecrecover(h, v, r, bytes32(_start)) == SIGNER
34
);
35
}
36
}
37
38
contract Deployer {
39
constructor(bytes memory code) { assembly { return (add(code, 0x20), mload(code)) } }
40
}
41
First Blood
jinu.eth
04:56:48
34
Time Left

Solve locally (WIP)

  1. Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
  1. Set RPC_URL_MAINNET in .env
.env
RPC_URL_MAINNET=""
  1. Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.
Waterfall