Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
615dcfe
WIP setting up Ethereum key CLI commands
austinabell Jul 25, 2019
ca0e587
Functional key gen and showing Ethereum address
austinabell Jul 26, 2019
752834f
Cleaned up changes
austinabell Jul 26, 2019
97d0259
WIP setting up Ethereum key CLI commands
austinabell Jul 25, 2019
288ae3e
Functional key gen and showing Ethereum address
austinabell Jul 26, 2019
e5211ad
Cleaned up changes
austinabell Jul 26, 2019
2b0a8b4
Merge branch 'austin/emintkeys' of github.com:ChainSafe/ethermint int…
austinabell Jul 26, 2019
102a218
Changed address to cosmos specific address
austinabell Jul 26, 2019
7e156d7
Remove default bech32 prefixes and add basic add command test
austinabell Aug 9, 2019
7e809a9
Changed Private key type to slice of bytes for compatibility and stor…
austinabell Aug 9, 2019
1cfde94
switch back to using cosmos crypto Keybase interfaces
austinabell Aug 9, 2019
5eada04
Changed key output to ethereum addressing instead of bitcoin and key …
austinabell Aug 9, 2019
b857feb
Updated show command and added test
austinabell Aug 9, 2019
77a9c8f
Remove prefix requirement for showing keys and added existing keys co…
austinabell Aug 9, 2019
f2ce82c
Removed unnecessary duplicate code
austinabell Aug 9, 2019
5d9b7bd
Readd prefixes for accounts temporarily
austinabell Aug 9, 2019
80893be
Fix linting issue
austinabell Aug 9, 2019
32f27f4
Remove TODO for setting PK to specific length of bytes (all functions…
austinabell Aug 9, 2019
e6ac4f9
Cleaned up descriptions to remove multi-sigs
austinabell Aug 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func newTestStdFee() auth.StdFee {
// GenerateAddress generates an Ethereum address.
func newTestAddrKey() (sdk.AccAddress, tmcrypto.PrivKey) {
privkey, _ := crypto.GenerateKey()
addr := ethcrypto.PubkeyToAddress(privkey.PublicKey)
addr := ethcrypto.PubkeyToAddress(privkey.ToECDSA().PublicKey)

return sdk.AccAddress(addr.Bytes()), privkey
}
Expand Down
11 changes: 8 additions & 3 deletions cmd/emintcli/main.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package main

import (
"github.com/cosmos/ethermint/rpc"
"github.com/tendermint/go-amino"
"os"
"path"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/ethermint/rpc"
"github.com/tendermint/go-amino"

"github.com/cosmos/cosmos-sdk/client"
sdkrpc "github.com/cosmos/cosmos-sdk/client/rpc"
sdk "github.com/cosmos/cosmos-sdk/types"
emintkeys "github.com/cosmos/ethermint/keys"

emintapp "github.com/cosmos/ethermint/app"
"github.com/spf13/cobra"
Expand All @@ -24,6 +26,7 @@ func main() {

// Read in the configuration file for the sdk
config := sdk.GetConfig()
// TODO: Remove or change prefix if usable to generate Ethereum address
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
Expand All @@ -49,7 +52,9 @@ func main() {
// TODO: Set up rest routes (if included, different from web3 api)
rpc.Web3RpcCmd(cdc),
client.LineBreak,
// TODO: Remove these commands once ethermint keys and genesis set up
keys.Commands(),
emintkeys.Commands(),
client.LineBreak,
)

Expand Down
1 change: 1 addition & 0 deletions cmd/emintd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func main() {
cdc := emintapp.MakeCodec()

config := sdk.GetConfig()
// TODO: Remove or change prefix if usable to generate Ethereum address
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
Expand Down
4 changes: 3 additions & 1 deletion crypto/codec.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package crypto

import "github.com/cosmos/cosmos-sdk/codec"
import (
"github.com/cosmos/cosmos-sdk/codec"
)

var cryptoCodec = codec.New()

Expand Down
25 changes: 25 additions & 0 deletions crypto/keys/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package keys

import (
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/hd"
emintCrypto "github.com/cosmos/ethermint/crypto"
cosmosKeys "github.com/cosmos/cosmos-sdk/crypto/keys"
)

var cdc *codec.Codec

func init() {
cdc = codec.New()
cryptoAmino.RegisterAmino(cdc)
cdc.RegisterInterface((*cosmosKeys.Info)(nil), nil)
emintCrypto.RegisterCodec(cdc)
cdc.RegisterConcrete(hd.BIP44Params{}, "crypto/keys/hd/BIP44Params", nil)
cdc.RegisterConcrete(localInfo{}, "crypto/keys/localInfo", nil)
cdc.RegisterConcrete(ledgerInfo{}, "crypto/keys/ledgerInfo", nil)
cdc.RegisterConcrete(offlineInfo{}, "crypto/keys/offlineInfo", nil)
// cdc.RegisterConcrete(multiInfo{}, "crypto/keys/multiInfo", nil)
cdc.Seal()
}
Loading