Partial Reimplementation of libsecp256k1 in EVM
Designed to Work with ETHASM (mine, not the pyton one)
- Group Double takes 4 uint256 parameters: x, y, z and infinity and output 4 parameters x, y, z, and infinity of the double (X coordinate = x/z^2, Y coordinate = y/z^3).
- Group Add takes 8 parameters: x1, y1, z1, infinity1, x2, y2, z2, infinity2 and output 4 parameters x, y, z, and infinity of the addition result
- Scalarmult currently just use double and add method to do scalar multiplication. Inputs are 5 parameters. x, y, z, infinity, and k.
- Wrapper shows how to interface scalarmult with Solidity source code
- Field invert takes 1 parameter and output its inverse mod p
- All calldataload are offset by 4 to be compatible with Solidity ABI