Solidity smart contract project to allow the verification of ECDSA signatures.
Verification of a signature costs approx. 1 million gas.
- secp256r1/prime256v1/P-256
The contract aims to allow on-chain verification of ECDSA signatures. Thus the contract takes the signature, split into r and s, the signed data and the public key that purports to have produced the signature.
function Verify(uint X, uint Y, uint r, uint s, bytes memory input)
public pure returns (bool)
uint X, Y
EC coordinates of the public keyuint r, s
signature partsbytes memory input
the signed data/message
If the signature is valid then true
is returned else false
.
To run the tests, first clone and enter the repo:
git clone https://github.com/maxrobot/elliptic-solidity.git
cd elliptic-solidity
Then,
npm install
npm run testrpc
open a new terminal and in the same directory run,
npm run test