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

restoring from seed #730

Open
JFixby opened this issue Feb 10, 2021 · 5 comments
Open

restoring from seed #730

JFixby opened this issue Feb 10, 2021 · 5 comments

Comments

@JFixby
Copy link

JFixby commented Feb 10, 2021

I`m using btcsuite/btcwallet v0.11.0 and trying to restore from the hex seed.

Unfortunately after the restoring some funds and accounts are missing and the wallet does not recognize its addresses (unspent outputs) in blockchain.

Is there a way to restore from the hex seed on some other alternative wallet to retrieve the funds? I tried Electrum but it didn`t recognize the hex seed generated by the btcsuite/btcwallet.

Can I convert maybe the hex seed into some format recognized by other alternative wallets?

@guggero
Copy link
Collaborator

guggero commented Feb 10, 2021

There hasn't been a tagged release in a while but many things were fixed anyway.
You can try out the master branch. Maybe your problem was fixed by #682.

You can paste the hex seed here for example: https://guggero.github.io/cryptography-toolkit/#!/hd-wallet (or use the provided offline version!) where it says "Seed hex". Then you'll get the xprv... out which Electrum might understand.

@JFixby
Copy link
Author

JFixby commented Feb 12, 2021

Ok I produced xprv from the seed using btcwallet code:

import (
	"encoding/hex"
	"fmt"
	"github.com/btcsuite/btcd/chaincfg"
	"github.com/btcsuite/btcutil/hdkeychain"
	"github.com/jfixby/pin/lang"

	"github.com/decred/dcrwallet/pgpwordlist"
	"github.com/jfixby/pin"

	"testing"
)

func TestSeed(t *testing.T) {

	hexs := "asdf...." //btcwallet generated seed
	data, err := hex.DecodeString(hexs)
	lang.CheckErr(err)

	// Derive the master extended key from the seed.
	rootKey, err := hdkeychain.NewMaster(data, &chaincfg.MainNetParams)
	lang.CheckErr(err)

	rootPubKey, err := rootKey.Neuter()
	lang.CheckErr(err)

	fmt.Println("Master private key: ", rootKey)
	fmt.Println("Master public key: ", rootPubKey)
}

It prints out xprv...

However bitcoin-cli importprivkey does not recognize the format. Is it possible to convert it to something compatible?

Also I checked btcctl --wallet dumpwallet says method is not implemented. Is it expected behaviour?

@wpaulino
Copy link
Contributor

I believe bitcoin-cli importprivkey expects a private key in Wallet Import Format (WIF). See https://en.bitcoin.it/wiki/Wallet_import_format for more info.

@JFixby
Copy link
Author

JFixby commented Mar 9, 2021

Seems like I'm in a forced hodl here. The less I'm trying to fix the problem the more money I make on my locked btc. xD

@wpaulino
Copy link
Contributor

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

3 participants