Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect address by mnemonic phrase (BTC) #9

Open
turbo-nyasha opened this issue Aug 11, 2022 · 1 comment
Open

Incorrect address by mnemonic phrase (BTC) #9

turbo-nyasha opened this issue Aug 11, 2022 · 1 comment

Comments

@turbo-nyasha
Copy link

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
@AndreyMashukov
Copy link

AndreyMashukov commented Jul 10, 2024

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
"m/0'/0/0",        // Bip32
"m/44'/0'/0'/0/0", // Bip44
"m/49'/0'/0'/0/0", // Bip49
"m/84'/0'/0'/0/0", // Bip84 (Trust Wallet) <- use this one 

@turbo-nyasha

you should use correct Derivation Path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants