This repository was archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 161
RPC unlock Ethermint key and eth_sign #99
Merged
+115
−18
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b485fe3
Set up personal account api for personal sign
austinabell ee2b218
Added unlocking key functionality and attach to eth rpc
austinabell ecc1a3c
Implemented eth_sign
austinabell 2826bd8
Transform V in sig based on yp and fix bug
austinabell 9db5702
Fix lint issue
austinabell d674af0
Remove escape character from comment
austinabell 4701622
Merge branch 'development' into austin/rpckeys
austinabell 4e274ed
Merge branch 'development' into austin/rpckeys
austinabell 8402538
Switch error handling to panic on invalid unlocked key
austinabell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package rpc | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| sdkcontext "github.com/cosmos/cosmos-sdk/client/context" | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/common/hexutil" | ||
| ) | ||
|
|
||
| // PersonalEthAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec. | ||
| type PersonalEthAPI struct { | ||
| cliCtx sdkcontext.CLIContext | ||
| } | ||
|
|
||
| // NewPersonalEthAPI creates an instance of the public ETH Web3 API. | ||
| func NewPersonalEthAPI(cliCtx sdkcontext.CLIContext) *PersonalEthAPI { | ||
| return &PersonalEthAPI{ | ||
| cliCtx: cliCtx, | ||
| } | ||
| } | ||
|
|
||
| // Sign calculates an Ethereum ECDSA signature for: | ||
| // keccack256("\x19Ethereum Signed Message:\n" + len(message) + message)) | ||
| // | ||
| // Note, the produced signature conforms to the secp256k1 curve R, S and V values, | ||
| // where the V value will be 27 or 28 for legacy reasons. | ||
| // | ||
| // The key used to calculate the signature is decrypted with the given password. | ||
| // | ||
| // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
| func (e *PersonalEthAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) { | ||
ansermino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return nil, nil | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.