ethereum / eth-account

Account abstraction library for web3.py
http://eth-account.readthedocs.io/
MIT License
272 stars 158 forks source link

Create `LedgerAccount` type #25

Open pipermerriam opened 6 years ago

pipermerriam commented 6 years ago

What is wrong

Hardware wallets are great!

How can they be implemented.

https://gist.github.com/bargst/5f896e4a5984593d43f1b4eb66f79d68

This appears to be a great starting point.

The base Account object should probably assume the default path. We should probably also expose an API for accessing sub-accounts at a different path assuming the ledger supports arbitrary BIP32 paths.

pipermerriam commented 6 years ago

Probably not a blocker but: #24 is likely related to this in some way since both leverage HD wallets in some form.

bargst commented 6 years ago

Some work merged in a local feature branch in #34 pending in-depth review and security audit.

pipermerriam commented 6 years ago

Alternate implementation from the shadowlands guy

https://github.com/kayagoban/shadowlands-core/blob/master/shadowlands/credstick/ledger_ethdriver.py

benjiqq commented 3 years ago

@pipermerriam has anyone attempted any progress in this direction?

digging into this a bit

this referenced code moved from https://github.com/kayagoban/shadowlands-core/blob/master/shadowlands/credstick/ledger_ethdriver.py to https://github.com/kayagoban/shadowlands/blob/master/shadowlands/credstick/ledger_ethdriver.py

this gist needs rebase https://gist.github.com/bargst/5f896e4a5984593d43f1b4eb66f79d68

there is a PR #34 mentions https://github.com/mikeshultz/ledger-eth-lib

benjiqq commented 3 years ago

made some progress on python with ledger using #34 branch

https://gist.github.com/benjyz/c4d96eb79a46c7d3d34d64f4870e2f8d

managed to get the version number and address from the device. have to read up on derivation paths. for some reason ledger live uses different paths

the code uses: ETH_DERIVATION_PATH_PREFIX = "m/44'/60'/0'/" ledger live uses ETH_DERIVATION_PATH_PREFIX = "44'/60'/1'/0/0"

see https://ethereum.stackexchange.com/questions/19055/what-is-the-difference-between-m-44-60-0-0-and-m-44-60-0

benjiqq commented 3 years ago

should be this

ETH_DERIVATION_PATH = "m/44'/60'/0'/0/0"

benjiqq commented 3 years ago

maybe add a flag like this https://github.com/ethereum/eth-account/blob/master/eth_account/account.py#L79