go-hdwallet icon indicating copy to clipboard operation
go-hdwallet copied to clipboard

Incorrect address by mnemonic phrase (BTC)

Open turbo-nyasha opened this issue 2 years ago • 1 comments

Hi, i'm try to generate address pool by mnemonic phrase (which i check with TrustWallet) and i got wrong address:

import (
	"fmt"
	"github.com/foxnut/go-hdwallet"
)

func main() {
	mnemonic := "build twice play danger limit faculty weird coil target immune zero reform"
	k, _ := hdwallet.NewKey(hdwallet.Mnemonic(mnemonic))
	w, _ := k.GetWallet(hdwallet.CoinType(hdwallet.BTC))
	addr1, _ := w.GetKey().AddressP2WPKH()
	//expected bc1q99pp52svzq4fqkl6p4c7zjywmafqydgw0g7a2y
	fmt.Println(addr1)
	//actual bc1qqsjukgskejs6n80dkdkvk5pnlfsfj0fux9a99r
}

Installing with -u option is not working, this is deps:

        github.com/btcsuite/btcd v0.20.1-beta // indirect
	github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
	github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d // indirect
	github.com/cpacia/bchutil v0.0.0-20181003130114-b126f6a35b6c // indirect
	github.com/ethereum/go-ethereum v1.9.13 // indirect
	github.com/foxnut/go-hdwallet v0.0.0-20200602072018-8db9c730e77c // indirect
	github.com/tyler-smith/go-bip39 v1.0.2 // indirect
	golang.org/x/crypto v0.0.0-20200427165652-729f1e841bcc // indirect
	golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect

turbo-nyasha avatar Aug 11 '22 06:08 turbo-nyasha