Hi,
I’m trying to use the hdwallet code (github.com/incognitochain/incognito-chain/wallet) to replicate behaviour of the mobile app. I can generate child accounts with the following code, however, the keys/addresses do not match the ones generated via the mobile app. I would expect these to be the same, if the same mnemonic phrase is used to seed the master key:
package main
import (
"fmt"
"github.com/incognitochain/incognito-chain/wallet"
)
func main() {
// 12 words, backup phrase as exported from mobile app - redacted
phrase := "one two ... ..."
mnemonic := wallet.MnemonicGenerator{}
seedBytes := mnemonic.NewSeed(phrase, "")
masterKey, err := wallet.NewMasterKey(seedBytes)
if err != nil {
fmt.Printf("Failed to create new master key: %s", err)
}
for i := uint32(0); i <= 2; i++ {
childKey, err := masterKey.NewChildKey(i)
if err != nil {
fmt.Printf("Failed to create new child key: %s", err)
}
privKeyBytes := childKey.Base58CheckSerialize(wallet.PriKeyType)
fmt.Printf("private key %d: %v\n", i, privKeyBytes)
paymentAddrBytes := childKey.Base58CheckSerialize(wallet.PaymentAddressType)
fmt.Printf("payment addr %d: %v\n", i, paymentAddrBytes)
}
}
Any pointers/tips on what am I doing wrong? Thanks!