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

Problem: cannot generate ledger address #326

Closed
leejw51crypto opened this issue Jul 20, 2021 · 11 comments
Closed

Problem: cannot generate ledger address #326

leejw51crypto opened this issue Jul 20, 2021 · 11 comments
Assignees
Labels
enhancement New feature or request Status: Stale

Comments

@leejw51crypto
Copy link
Contributor

ethermintd keys add my --ledger

Error: address  rejected
@leejw51crypto
Copy link
Contributor Author

after clear this issue, try signing as well

@fedekunze
Copy link
Contributor

opened an issue on SDK: cosmos/cosmos-sdk#9734

@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Jul 21, 2021

started
i will try with cosmos ledger app first.

@leejw51crypto leejw51crypto self-assigned this Jul 23, 2021
@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Jul 27, 2021

work plan

  1. check with cosmos ledger app
  2. check with ethereum ledger app

@leejw51crypto
Copy link
Contributor Author

option 1 not working , because of
image

118 is hard-coded for generating address, also signing

@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Aug 5, 2021

generating, signing with ledger working good with testing program.
using go-ethereum, package

import 	"github.com/ethereum/go-ethereum/accounts/usbwallet"

adding this code now

to change cosmos level, need to override

https://github.com/cosmos/ledger-cosmos-go

and fix this interface to ethereum style, just 4 functions
replace with go-ethereum/usbwallet
then current cosmos command will work , too. (for ledger)

	SECP256K1 interface {
		Close() error
		// Returns an uncompressed pubkey
		GetPublicKeySECP256K1([]uint32) ([]byte, error)
		// Returns a compressed pubkey and bech32 address (requires user confirmation)
		GetAddressPubKeySECP256K1([]uint32, string) ([]byte, string, error)
		// Signs a message (requires user confirmation)
		SignSECP256K1([]uint32, []byte) ([]byte, error)
	}

@fedekunze
Copy link
Contributor

Can we create an ADR for this so that I can share it with @jleni and propose either additional changes or create a new ledger application?

@fedekunze fedekunze added enhancement New feature or request and removed Type: Bug labels Aug 6, 2021
@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Aug 9, 2021

ok, i'll create adr
to resolve go-ethereum usbwallet and cosmos ledger colision

build ethermintd with ethereum ledger code

go build  -tags cgo,ledger --ldflags "-extldflags \"-Wl,--allow-multiple-definition\"" .\cmd\ethermintd

for launch.json


    {
      "name": "Add Ledger",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${workspaceFolder}/cmd/ethermintd",
      "env": {
        "KEY": "mykey",
        "CHAINID": "ethermint-2",
        "MONIKER": "localtestnet",
        "KEYRING": "test",
        "KEYALGO": "eth_secp256k1",
        "LOGLEVEL": "fatal",
        "TRACE": ""
      },
      "args": [
        "keys",
        "add",
        "myledger0",
        "--keyring-backend",
        "test",
        "--ledger"
      ],
      "buildFlags": "-tags='cgo,ledger' --ldflags '-extldflags '-Wl,--allow-multiple-definition''"
    }

@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Aug 12, 2021

used
signer := ethtypes.NewEIP2930Signer(args.ChainID.ToInt())

and directly give txfound to tx-builder

chainid := ethSigner.ChainID()
	txfound, err := wallet0.SignTx(accounts[0], tx, chainid)
	msg.FromEthereumTx(txfound)

and double checked

	sender3, _ := ethSigner.Sender(tx3)

@leejw51crypto
Copy link
Contributor Author

leejw51crypto commented Aug 13, 2021

in code-review

leejw51crypto added a commit to leejw51crypto/ethermint that referenced this issue Aug 16, 2021
correct conversion

refactoring

tidy up

fix compile

show bech32 address together

tidy up

show bech32 in adding address
@github-actions
Copy link

github-actions bot commented Oct 1, 2021

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Status: Stale
Projects
None yet
Development

No branches or pull requests

2 participants