Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion mycelo/env/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ func (accountType *AccountType) UnmarshalText(text []byte) error {
return nil
}

// path is based on https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#path-levels
func mustDerivationPath(accountType AccountType, idx int) accounts.DerivationPath {
return hdwallet.MustParseDerivationPath(fmt.Sprintf("m/%d/%d", int(accountType), idx))
return hdwallet.MustParseDerivationPath(fmt.Sprintf("m/44'/%d'/%d'/0/%d", MyceloCT.Int(), int(accountType), idx))
}

// DeriveAccount will derive the account corresponding to (accountType, idx) using the
Expand Down
13 changes: 13 additions & 0 deletions mycelo/env/coin_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package env

// CoinType represents the coin_type based on BIP-44
// Refer to https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#path-levels
type CoinType int

// https://github.com/satoshilabs/slips/blob/master/slip-0044.md
// This number is not duplicated in SLIP-0044 and copied from `ChainID` in `cmd/mycelo/templates.go`
var MyceloCT CoinType = 9099000

func (c CoinType) Int() int {
return int(c)
}