Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

implement personal_ecRecover API method #566

Merged
merged 2 commits into from
May 2, 2018
Merged

Conversation

whilei
Copy link
Contributor

@whilei whilei commented Apr 14, 2018

Exposes existing crypto.EcRecover method to personal API module.

See https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecrecover for matching EF method.

For example:

> personal.sign("0xdeadbeef", eth.accounts[0], "foo");
"0x33a614e8cbf323cb705711a1c43c9a8522b11bc07f22d8425e73aec2075d331408d2ce4df925e29e87dae8bc6c79bfe3baeb185f75d9fc1b60e1acb5f8122e171c"
> personal.ecRecover("0xdeadbeef", "0x33a614e8cbf323cb705711a1c43c9a8522b11bc07f22d8425e73aec2075d331408d2ce4df925e29e87dae8bc6c79bfe3baeb185f75d9fc1b60e1acb5f8122e171c");
"0x3d1cf2f13db48a49bc07ae7018826b6ea2ede093"
> eth.accounts[0];
"0x3d1cf2f13db48a49bc07ae7018826b6ea2ede093"

Depends on #565

whilei added 2 commits April 14, 2018 06:16
This somehow did not affect the functionality of eth_sign, but receiver should be PublicBlockChainAPI
instead of txpool receiver.

solution: change method's receiver.

Also returns hexutil.Bytes instead of hex string for code cleanliness and consistency
@whilei whilei requested review from tzdybal and r8d8 April 14, 2018 11:21
Copy link
Contributor

@tzdybal tzdybal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@whilei whilei merged commit 7b02fe8 into master May 2, 2018
@whilei whilei deleted the feat/api-ecrecover-1 branch May 2, 2018 10:57
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants