Example EIP to add secp256k1 curve as an algorithmic type
Abstract
This example EIP adds secp256k1 curve as an algorithmic type.
Motivation
secp256k1 is the commonly used curve, therefore it should be added.
Specification
This EIP defines a new EIP-7932 algorithmic type with the following parameters.
Constant | Value |
---|---|
ALG_TYPE |
Bytes1(0x0) |
GAS_PENALTY |
0 |
MAX_SIZE |
65 |
def verify(signature_info: bytes, parent_hash: bytes32) -> bytes20:
assert(len(signature_info) == 96)
r, s, v = signature_info[0:32], signature_info[32:64], signature_info[64:]
# This assumes `ecrecover` is identical to the `ecrecover` function in solidity.
signer = ecrecover(parent_hash, v, r, s)
return signer
Rationale
secp256k1 is the commonly used curve, therefore it should be added.
Backwards Compatibility
No backward compatibility issues found.
Security Considerations
Needs discussion.
Copyright
Copyright and related rights waived via CC0.