{"id":13497899,"url":"https://github.com/miguelmota/sol-ecverify","last_synced_at":"2025-03-28T22:31:52.710Z","repository":{"id":66080575,"uuid":"110044405","full_name":"miguelmota/sol-ecverify","owner":"miguelmota","description":"A solidity library for verifying elliptic curve signatures in Ethereum (ecrecover)","archived":true,"fork":false,"pushed_at":"2019-01-20T05:17:52.000Z","size":9,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T14:36:44.694Z","etag":null,"topics":["cryptography","ecdsa","ecrecover","ecverify","ethereum","signature","smart-contracts","solidity","truffle","verification","web3"],"latest_commit_sha":null,"homepage":"https://github.com/miguelmota/sol-ecverify","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miguelmota.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-08T23:57:07.000Z","updated_at":"2023-01-28T03:24:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab24c83b-765e-476d-850d-6924c090c5dd","html_url":"https://github.com/miguelmota/sol-ecverify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelmota%2Fsol-ecverify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelmota%2Fsol-ecverify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelmota%2Fsol-ecverify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelmota%2Fsol-ecverify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miguelmota","download_url":"https://codeload.github.com/miguelmota/sol-ecverify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246110300,"owners_count":20725031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","ecdsa","ecrecover","ecverify","ethereum","signature","smart-contracts","solidity","truffle","verification","web3"],"created_at":"2024-07-31T20:00:44.169Z","updated_at":"2025-03-28T22:31:52.439Z","avatar_url":"https://github.com/miguelmota.png","language":"JavaScript","funding_links":[],"categories":["Specific statements"],"sub_categories":["Signature verification"],"readme":"\u003ch3 align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/168240/51435581-88763680-1c2f-11e9-87dc-dacf99aa8113.png\" alt=\"logo\" width=\"400\" /\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n\u003c/h3\u003e\n\n# sol-ecverify\n\n\u003e  A [solidity](https://github.com/ethereum/solidity) library for verifying elliptic curve signatures in Ethereum (wrapper around `ecrecover`).\n\n## API\n\n- **ecrecovery**(hash, sig) -\u003e `address`\n\n  - {bytes32} hash - 32 byte sha3 (keccak256) hash of original message data\n\n  - {bytes} sig - 65 byte signature string\n\n- **ecverify**(hash, sig, account) -\u003e `bool`\n\n  - {bytes32} hash - 32 byte sha3 (keccak256) hash of original message data\n\n  - {bytes} sig - 65 byte signature string\n\n  - {address} signer - 20 byte address of proposed signer\n\n\n## Getting started\n\n```javascript\nconst {sha3} = require('ethereumjs-util')\nconst account = '0xa462d983B4b8C855e1876e8c24889CBa466A67EB'\n\nconst msg = Buffer.from('some data')\nconst sig = web3.eth.sign(account, `0x${msg.toString('hex')}`)\n\n// https://github.com/ethereum/go-ethereum/issues/3731\nconst prefix = Buffer.from('\\x19Ethereum Signed Message:\\n');\nconst pmsg = `0x${sha3(Buffer.concat([prefix, Buffer.from(String(msg.length)), msg])).toString('hex')}`\n\nvar signer = await ECVerify.ecrecovery(pmsg, sig)\nconsole.log(signer) // \"0xa462d983B4b8C855e1876e8c24889CBa466A67EB\"\n\nvar verified = await ECVerify.ecverify(pmsg, sig, account)\nconsole.log(verified) // true\n```\n\n## Test\n\n```bash\ntruffle test\n```\n\n## Credit\n\nThanks to [@axic](https://github.com/axic) for providing this [gist](https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d) ([#79](https://github.com/ethereum/EIPs/issues/79#issuecomment-205051630))\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelmota%2Fsol-ecverify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiguelmota%2Fsol-ecverify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelmota%2Fsol-ecverify/lists"}