diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-09 02:25:52 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-13 20:00:09 +0800 |
commit | 205ea9580215cca4093dff22ec61222bc3a6ff96 (patch) | |
tree | af6c38683d64bb47c0a31ba166533701cf95ed15 /accounts/accounts.go | |
parent | c5215fdd48231622dd56aba63a5187c6e42828d4 (diff) | |
download | dexon-205ea9580215cca4093dff22ec61222bc3a6ff96.tar.gz dexon-205ea9580215cca4093dff22ec61222bc3a6ff96.tar.zst dexon-205ea9580215cca4093dff22ec61222bc3a6ff96.zip |
accounts, cmd, internal, node: implement HD wallet self-derivation
Diffstat (limited to 'accounts/accounts.go')
-rw-r--r-- | accounts/accounts.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/accounts/accounts.go b/accounts/accounts.go index 6c9e0bbce..640de5220 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -20,6 +20,7 @@ package accounts import ( "math/big" + ethereum "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" @@ -71,7 +72,19 @@ type Wallet interface { // Derive attempts to explicitly derive a hierarchical deterministic account at // the specified derivation path. If requested, the derived account will be added // to the wallet's tracked account list. - Derive(path string, pin bool) (Account, error) + Derive(path DerivationPath, pin bool) (Account, error) + + // SelfDerive sets a base account derivation path from which the wallet attempts + // to discover non zero accounts and automatically add them to list of tracked + // accounts. + // + // Note, self derivaton will increment the last component of the specified path + // opposed to decending into a child path to allow discovering accounts starting + // from non zero components. + // + // You can disable automatic account discovery by calling SelfDerive with a nil + // chain state reader. + SelfDerive(base DerivationPath, chain ethereum.ChainStateReader) // SignHash requests the wallet to sign the given hash. // |