9090 } else if x .URL ().Scheme == "ledger" {
9191 x .Open ("" )
9292 for j := 0 ; j <= 3 ; j ++ {
93- pathstr := fmt .Sprintf ("m/44'/60'/0' /%d" , j )
93+ pathstr := fmt .Sprintf (c . String ( "hd-path" ) + " /%d" , j )
9494 path , _ := accounts .ParseDerivationPath (pathstr )
9595 y , err := x .Derive (path , true )
9696 if err != nil {
@@ -170,6 +170,7 @@ func recover(data []byte, sig hexutil.Bytes, noPrefix bool) (common.Address, err
170170}
171171
172172func main () {
173+ var defaultHDPath = "m/44'/60'/0'" // aka "ledger legacy"
173174 var defaultKeyStores cli.StringSlice
174175 if runtime .GOOS == "darwin" {
175176 defaultKeyStores = []string {
@@ -205,6 +206,12 @@ func main() {
205206 EnvVar : "ETH_KEYSTORE" ,
206207 Value : & defaultKeyStores ,
207208 },
209+ cli.StringFlag {
210+ Name : "hd-path" ,
211+ Usage : "hd derivation path" ,
212+ EnvVar : "ETH_HDPATH" ,
213+ Value : defaultHDPath ,
214+ },
208215 },
209216 Action : func (c * cli.Context ) error {
210217 wallets := getWallets (c , defaultKeyStores )
@@ -216,7 +223,7 @@ func main() {
216223 } else if x .URL ().Scheme == "ledger" {
217224 x .Open ("" )
218225 for j := 0 ; j <= 3 ; j ++ {
219- pathstr := fmt .Sprintf ("m/44'/60'/0' /%d" , j )
226+ pathstr := fmt .Sprintf (c . String ( "hd-path" ) + " /%d" , j )
220227 path , _ := accounts .ParseDerivationPath (pathstr )
221228 z , err := x .Derive (path , false )
222229 if err != nil {
@@ -243,6 +250,12 @@ func main() {
243250 EnvVar : "ETH_KEYSTORE" ,
244251 Value : & defaultKeyStores ,
245252 },
253+ cli.StringFlag {
254+ Name : "hd-path" ,
255+ Usage : "hd derivation path" ,
256+ EnvVar : "ETH_HDPATH" ,
257+ Value : defaultHDPath ,
258+ },
246259 cli.BoolFlag {
247260 Name : "create" ,
248261 Usage : "make a contract creation transaction" ,
@@ -363,6 +376,12 @@ func main() {
363376 EnvVar : "ETH_KEYSTORE" ,
364377 Value : & defaultKeyStores ,
365378 },
379+ cli.StringFlag {
380+ Name : "hd-path" ,
381+ Usage : "hd derivation path" ,
382+ EnvVar : "ETH_HDPATH" ,
383+ Value : defaultHDPath ,
384+ },
366385 cli.StringFlag {
367386 Name : "from" ,
368387 Usage : "address of signing account" ,
0 commit comments