-1

Is there a easy tutorial on how to sweep a bc1 segwit address? I know electrum can sweep private keys, but has anyone ever really tried it and wrote a tutorial on it?

I'm afraid of sending some coins to a bc1 paper wallet. I'm just looking for a tutorial or even a video of someone actually sweeping it.

1

How to import private keys into Bitcoin Core (from a paper wallet or elsewhere)

In Bitcoin Core, you can use the importprivatekey command.

Once you have your private key, guard it very carefully keeping it very secure and, do the following to import into Bitcoin Core:

  1. Open Bitcoin Core.
  2. Go to Help --> Debug.
  3. Go to the Console tab.
  4. type: importprivatekey "{private key}" "{label optional}"
  5. Create a new wallet backup.

Done. Note that you do not need to wait for Bitcoin Core to update before importing your private key. However, not all funds may show up in your wallet until it is completely up to date.

Hopefully, you have encrypted your wallet with a good passphrase that you will remember.

Usage:

>importprivkey "privkey" ( "label" ) ( rescan )

Adds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.

Arguments:

  1. "privkey" (string, required) The private key (see dumpprivkey)
  2. "label" (string, optional, default="") An optional label
  3. rescan (boolean, optional, default=true) Rescan the wallet for transactions

Note: This call can take minutes to complete if rescan is true, during that time, other rpc calls may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.

Examples:

Dump a private key
> dumpprivkey "myaddress"

Import the private key with rescan
> importprivkey "mykey"

Import using a label and without rescan
> importprivkey "mykey" "testing" false

Import using default blank label and without rescan
> importprivkey "mykey" "" false

  • so when "importing" a new private key, it creates a totally new wallet file? why cant it add it to an existing wallet? Also does this "import" know to import the 3 derivatives of addresses? 1xxx, 3xxx, and bc1xxx from a single private key? – Patoshi パトシ Feb 28 '18 at 3:25
  • 1
    @Patoshi As Adam has noted in his answer, you need to ensure you are using the correct version of Bitcoin Core for bc1 addresses. The rescan (defaults to true) takes care of finding funds on addresses. No, not a new wallet file. – Willtech Feb 28 '18 at 8:35
  • Don't have to worry about derivation path that generates an infinity of completely different address? – Patoshi パトシ Feb 28 '18 at 15:15
  • 1
    @Patoshi as I mentioned in my answer "set address type to bech32 in your bitcoin.conf file" so you get bech32 address, not the legacy one. Try to import it and see if you see your Bitcoins. You will not lose anything. – Adam Feb 28 '18 at 17:43
1

As Bitcoin core v0.16.0 released You can import Bech32 Segwit address as @Willtech Answer.

importprivkey "privkey" ( "label" ) ( rescan )

First Make sure that you are running the correct bitcoin core version

using getnetworkinfo

bitcoin-cli getnetworkinfo

{
  "version": 160000,
  "subversion": "/Satoshi:0.16.0/",
  "protocolversion": 70015,
  "localservices": "000000000000040d",
  "localrelay": true,
  "timeoffset": 0,
  "networkactive": true,
  "connections": 5
}

Now set address type to bech32 in your bitcoin.conf file

addresstype=bech32

so when "importing" a new private key, it creates a totally new wallet file? why cant it add it to an existing wallet? Also does this "import" know to import the 3 derivatives of addresses? 1xxx, 3xxx, and bc1xxx from a single private key?

  • No it doesn't create an new wallet file, it will just add it to your existing wallet file.

This way it should work 100% anyway if it didn't work. you still create your transaction manually and sign it using your private key.

  • seems like its not matured yet, as that tutorial seems pretty complicated. – Patoshi パトシ Feb 5 '18 at 22:33
  • @Patoshi That tutorial is far more complicated than it needs to be for your question. – Willtech Feb 28 '18 at 2:34
  • You were right guys, but that was before the release of Bitcoin 0.16.0 I made an edit. – Adam Feb 28 '18 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.