Switching to Segwit in Bitcoin Core?

15 replies 454 views
the_shardNewbie
Posts: 15 · Reputation: 34
#1Jan 8, 2020, 10:50 PM
I’ve got a wallet from 2014 and just restored it using Bitcoin Core version v28.1.0. There was some kind of conversion during the import, but I can't quite remember the specifics. While testing out some transactions, I got a message saying my wallet is using the P2WPKH or P2WSH format and that switching to Segwit could save me on fees. Can I change my wallet’s format to Segwit within Bitcoin Core? Or do I have to move everything to a different wallet? I did set up an Electrum wallet and made a test transfer to it. As far as I know, I can’t open or convert a Bitcoin Core wallet in Electrum. Also, I noticed that when I sent coins to other wallets, there’s an extra output that I’m puzzled about. I sent $100 from my legacy wallet to Electrum, but the total was around $1700. What’s up with that extra BTC? Does it get sent back to my wallet or what? Transaction: 940e24278a4b460cc967105c44ca3d98734419e95860cf3751afe317f77140a1 From: 12L3XrxpMiuu3QsLhwwvcPWuYcLnU6kZdm 0.02000031 BTC $1,607.29 To: bc1qzfhmmpwufdp4a25qn0vvg964z3tlu03ed4w6ck 0.00114981 BTC $92.40 bc1q99xys25dvk5sx00zuxj6kum76cnj2y09k2q9cc 0.01884258 BTC $1,514.25
2 Reply Quote Share
Posts: 706 · Reputation: 77
#2Jan 9, 2020, 02:17 AM
P2WPKH is the segwit for single signature wallet. P2WSH is the segwit for multisig wallet. So they are both segwit. Single signature wallet has low transaction fee than multisig. You can import the private key. If it is the master private key. On Electrum, click on 'standard wallet's -> 'use a master key'. Paste you master private key there. If it is private key that start from 5, K or L. On Electrum, click on 'import bitcoin addresses or private keys' and paste the private key in this format: For address that starts from 1 you can paste the address without adding any prefix to it or use this format: For address that starts from bc1: The change is sent to a change address on your wallet. Assuming you receive 1 BTC from someone, that makes it 1 unspent transaction output (UTXO). If you send 0.1 BTC to someone from the 1 BTC. The remaining 0.9 BTC is sent to another address on your wallet in the same transaction. The address the change is sent to is the change address.
4 Reply Quote Share
titanx539Member
Posts: 804 · Reputation: 117
#3Jan 9, 2020, 06:57 AM
Probably it's migrated into a "descriptor wallet". That also created new descriptors in your wallet file (containing new master private key), better make a backup of your new wallet.dat file. To check that, enter getwalletinfo in Bitcoin Core's Console (Window->Console). Find the result:  "descriptors": true, indicating that it's now migrated into a descriptor wallet, if "false", the "conversion" is something else. It's already set to SegWit by default since you're using v28.1.0, you can still freely select which address type to generate in the receive tab. For the default change address, you can see it in your transaction, the Change output was P2WPKH. To confirm if it's yours, open the Console, and type: getaddressinfo bc1q99xys25dvk5sx00zuxj6kum76cnj2y09k2q9cc Among the results, there should be an "ismine": true and "solvable": true, lines indicating that it's part of your wallet. The balance amounting to it should also be visible in the main tab.
3 Reply Quote Share
the_shardNewbie
Posts: 15 · Reputation: 34
#4Jan 9, 2020, 07:35 AM
First, thank everyone for their help. I checked the getwalletinfo info and the  "descriptors": true is set. When I run the getaddressinfo bc1q99xys25dvk5sx00zuxj6kum76cnj2y09k2q9cc I see the "ismine": true and "solvable": true are set. ------------------------------------------ Where I am confused, I just sent a transfer from my Bitcoin Core wallet to the Electrum wallet. When I check the transactions, I see the following message: This transaction paid ~40% more in fees due to inefficiencies associated with older wallets. How do I convert the wallet to the new format?
2 Reply Quote Share
Posts: 136 · Reputation: 32
#5Jan 9, 2020, 10:18 AM
You used the address 12L3XrxpMiuu3QsLhwwvcPWuYcLnU6kZdm to send the desired amount to bc1qzfhmmpwufdp4a25qn0vvg964z3tlu03ed4w6ck. The remaining amount returned to your change address, which is also part of your wallet (this is to protect your privacy). The address 12L3XrxpMiuu3QsLhwwvcPWuYcLnU6kZdm is of the Legacy type, while the address bc1qzfhmmpwufdp4a25qn0vvg964z3tlu03ed4w6ck is of the Native Segwit type. Transactions from Legacy addresses cost about 40% more than transactions from native segwit addresses. There is also the Nested SegWit address with the prefix 3, which is only about 10% more expensive in fees compared to Native SegWit (bc1), but still much cheaper than Legacy. However, that’s another topic. Now, where are you going to keep your bitcoins? Electrum or Bitcoin Core? In Electrum, you already have a standard wallet (SegWit), while in Bitcoin Core, your wallet was created before the segwit and Descriptor updates. However, you can still upgrade your Bitcoin Core wallet to Segwit and for the descriptor wallet! Simply, when you go to receive funds, you can choose the type of address in the "Receive" tab (the default will be bech32, which is Native SegWit). However, your wallet is in the old format (Berkeley DB Legacy), but Bitcoin Core will give you an option to "upgrade" the wallet to the new format called Descriptor Wallet. It is recommended to perform this upgrade, and you should make a new backup of your wallet.dat. If Bitcoin Core doesn’t prompt you, you can go to File > Migrate Wallet to perform the migration. Why update the backup again? Because you will gain new private keys (new addresses). This upgrade is necessary for you to enjoy the benefits of Taproot (a new Bitcoin protocol upgrade and a new address type similar to Native SegWit bc1). During the upgrade to the Descriptor Wallet, Bitcoin Core will automatically derive new descriptors (without you needing to do anything behind the scenes) from your master private key and import them into your wallet.dat. These will include addresses derived from the following derivation paths: BIP44 (used for Legacy addresses), BIP49 (used for Nested SegWit addresses), BIP84 (used for Native SegWit addresses, which will be the default), and BIP86 (new bech32m addresses, also known as Taproot).
3 Reply Quote Share
the_shardNewbie
Posts: 15 · Reputation: 34
#6Jan 10, 2020, 06:05 PM
When I restored my wallet, it prompted me to upgrade to the Descriptor wallet.  Checking the getwalletinfo info, the  "descriptors": true is set. This means the wallet was converted, right? When I go to File --> Migrate wallet, there is no wallet listed to migrate. Could there have been a problem with the upgrade?  I do have a backup of my original wallet, but I have made some transactions since I reopened it.  Will it cause issues upgrading the backup? As far as which wallet to use between Bitcoin Core or Electrum, I don't have a preference, but at this time my BTC is in the Bitcoin Core with  the legacy address. I one wallet better than the other?
2 Reply Quote Share
titanx539Member
Posts: 804 · Reputation: 117
#7Jan 10, 2020, 11:28 PM
Good, then you don't have to do anything since your wallet is now migrated to a descriptor wallet that will be the default solely supported wallet type in the later versions of Bitcoin Core. If you need a new receiving addresses, make sure that "Bech32 (SegWit)" is selected in the drop-down menu before clicking "Create new receiving address". That is just a Blockchain(dot)com blockexplorer message, it's telling that that specific transaction isn't efficient since it spent a legacy input. Your next transactions in Bitcoin Core will be SegWit since the change output is P2WPKH (Native SegWit), As well as when you spend that test output in Electrum since it's also SegWit.
5 Reply Quote Share
Posts: 790 · Reputation: 114
#8Jan 11, 2020, 05:48 AM
Depending on how much money you hold in your 2014-wallet, you may want to look into cold storage to increase your security.
4 Reply Quote Share
atlas_keyNewbie
Posts: 100 · Reputation: 16
#9Jan 11, 2020, 11:39 AM
I know that you know this but we should still clarify it so that OP doesn't think using bitcoin is free and doesn't cost anything. @charles05663 As you have noticed, there is a fee that you need to pay to have your transaction confirmed. Charles-Tim is right, but he forgot to mention that the remaining 0.9 BTC, minus the transaction fee, will be sent back to a change address of yours. Therefore, you will have a bit less than 0.9 BTC remaining from the 1 BTC UTXO that you spent.
0 Reply Quote Share
the_shardNewbie
Posts: 15 · Reputation: 34
#10Jan 13, 2020, 02:31 PM
After looking at the transactions in detail, I see how they were applied. What was confusing me, was the From transaction amount was much higher than the To amount and the To amount was split. In look at the From transaction, I see that they matched the payouts that I received when I was mining and that it was necessary to split the transaction. Thanks everyone who replied.  It help me get a better understanding of what was happening.
3 Reply Quote Share
dr_atlasMember
Posts: 419 · Reputation: 65
#11Jan 14, 2020, 03:34 AM
You need to understand that when you spend some coins from your wallet, your wallet has to choose a sufficiently large UTXO or even more than on, depending on the size of UTXOs in your wallet. An UTXO is an Unspent Transaction (Tx) Output. When you spend an UTXO, it has to be spent completely. It will be destroyed completely in a transaction. And because of this UTXO transaction model of Bitcoin, transaction inputs are destroyed in a transaction, the outputs of a transaction sum up to (sum of inputs) minus transaction fee. A common transaction has usually one transaction input, if the wallet finds an UTXO that is larger than desired transaction amount plus required transaction fee, and two transaction outputs. One of the outputs is the desired target address to send coins to and the other output is commonly the excess change coins that should go back into your own wallet. Very simplified. Another thing to understand is that your old wallet converted to a descriptor wallet still contains your old coins controlled by private keys (represented with appropriate descriptors) "on legacy addresses". If you want to benefit from lower transaction fees of Native Segwit you would need to consolidate your legacy address' coins to Native Segwit addresses. E.g. you could send all your coins in your wallet to a Native Segwit address of your wallet. Any transactions after this have inputs from Native Segwit address(es) and thus benefit from smaller size footprint of those. Of course you should know that such a consolidation reveals that all involved addresses on the input side likely belong to one single wallet and because there's no change address involved with a single target address, one can assume a self-transfer, so the target output address has the same owner as the inputs.
3 Reply Quote Share
the_shardNewbie
Posts: 15 · Reputation: 34
#12Jan 14, 2020, 04:55 AM
If I was to do this, there would be a transaction fee associated with this correct?  Not complaining, just asking. Is there an advantage of a Bitcoin Core over a Etectrum wallet or vise-versa?
5 Reply Quote Share
moonhq227Member
Posts: 334 · Reputation: 57
#13Jan 14, 2020, 07:13 AM
Depends on what you need it for If you want privacy, full control and security then Bitcoin core would be better But for speed and convenient usage then electrum Would be what you need. Best would be connecting electrum to Bitcoin core To get the best of both worlds. And yes if you consolidate utxos from legacy to native Segwit You will pay a transaction fee
4 Reply Quote Share
titanx539Member
Posts: 804 · Reputation: 117
#14Jan 15, 2020, 07:35 AM
Before deciding to do it or not, check first if you actually have to do it. Check if you still have any UTXO left that are associated with your old keystore. In the GUI, you can see the list in 'Send' tab's "Inputs" button that will be available if you enabled "Settings->Options...->Wallet->Enable coin control features". Check if you still have bitcoins with a legacy address shown in "Received with address". To help you decide, I'll add this: Bitcoin Core supports multiple script types, not just SegWit. And based from its privacy feature to match the change address' script type to the output, you will still receive legacy change outputs if you send to a legacy address. Anyways, the fee won't be much of an issue even if you're spending a legacy input if you're sending at low fee rate and using one or two inputs. Electrum has more wallet-related features like CPFP and the ability to utilize RBF to spend the unconfirmed transaction's input(s) to send back to self. Those normally requires manual process in Bitcoin Core. And of course, mnemonic phrase backup. On the other hand, the advantage of Bitcoin Core is the privacy of utilizing your own node while Electrum has to connect to a third-party server (node). You can connect your Electrum to your own server that requires Bitcoin Core but you could just use Bitcoin Core's wallet if you're not planning to utilize Electrum's features.
4 Reply Quote Share
atlas_keyNewbie
Posts: 100 · Reputation: 16
#15Jan 15, 2020, 09:13 AM
Don't let the terminology confuse you. I know that it can when you are new to all this. 'From' is the equivalent of the bill you give the cashier in the grocery store. Imagine that you have $10 in your pocket and you bought something in a store for $4. $10 is 'from'. It's the source you pay from. $4 is 'to'. It's who you are paying the money to. The other 'to' is the change you are supposed to get back (minus transaction fees) because you didn't spend all of your money. If you spent all of your money, there would only be one 'to' (again minus the transaction fee).
5 Reply Quote Share
dr_atlasMember
Posts: 419 · Reputation: 65
#16Jan 15, 2020, 02:27 PM
I want to add that you can't connect Electrum directly to Bitcoin Core. If you want privacy of your Electrum wallet addresses, you need to run your own Electrum server which connects and talks to Bitcoin Core. Your "light" Electrum wallet then talks to your own Electrum server. AFAIR an Electrum server doesn't run well, or if at all, with a pruned Bitcoin Core node. (I could be wrong.) Using a private "light" Electrum wallet comes with a price, you need a heavy full Bitcoin Core node and an Electrum server that also has some storage footprint. A pruned Bitcoin Core node can maintain your Bitcoin Core wallet just fine with a substantially smaller footprint and with same level of privacy.
0 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics