Author

Topic: Segwit questions: P2PKH versus P2SH-P2WPKH (Read 368 times)

legendary
Activity: 2324
Merit: 1125
December 19, 2017, 07:09:36 PM
#15
I didn't react to the latest reply from goatpig yet. Thanks for the info. I will refrain from using segwit then until the 0.96.4 offline bundle version comes out to make sure I can actually spend my outputs.

Thanks for the clarification.
legendary
Activity: 3766
Merit: 1364
Armory Developer
December 19, 2017, 09:29:35 AM
#14
Can I go to my online PC with the watch-only wallet and generate there a SegWit address? will it be linked to my private key? will any software in case armory is discontinued for example in the future be able to retrieve this BTC from the segwit address using the private key in a paper backup?

Yes, yes, and yes.
newbie
Activity: 2
Merit: 0
December 19, 2017, 04:21:20 AM
#13
Thanks for your response.

I have one additional question. In the case explained in the previous post where I have an offline-online combo. I cannot generate the segwit address in the offline machine until 0.96.4 with the command you show me, but... Can I go to my online PC with the watch-only wallet and generate there a SegWit address? will it be linked to my private key? will any software in case armory is discontinued for example in the future be able to retrieve this BTC from the segwit address using the private key in a paper backup?
legendary
Activity: 3766
Merit: 1364
Armory Developer
newbie
Activity: 2
Merit: 0
December 16, 2017, 01:07:53 PM
#11
But... if you have an air-gapped machine... then you cannot work with SegWit? how do you work with the offline-online combo in SegWit if there is no node in the offline side?
legendary
Activity: 2324
Merit: 1125
December 16, 2017, 12:12:00 PM
#10
Quote
Further I was under the impression the WITNESS service flag is enabled by default in 0.14.2. Is that incorrect?

Has been since 0.13.1. Maybe you want to double check your node is actually advertising the WITNESS flag.



I managed to get it (create a P2SH-P2WPKH address) to work today. Didn't change anything, just restarted Armory. I don't know why it didn't work before.
legendary
Activity: 3766
Merit: 1364
Armory Developer
December 15, 2017, 08:42:35 PM
#9
Quote
Further I was under the impression the WITNESS service flag is enabled by default in 0.14.2. Is that incorrect?

Has been since 0.13.1. Maybe you want to double check your node is actually advertising the WITNESS flag.

legendary
Activity: 2324
Merit: 1125
December 15, 2017, 08:06:10 PM
#8
from the 0.96.2 changelog (https://github.com/goatpig/BitcoinArmory/blob/master/changelog.txt#L29)

Quote
- Enabled SegWit on the mainnet. Running against a node with WITNESS service bit flagged will allow you to create SegWit addresses.

Armory has to be online, i.e. both DB and node have to be running, and your node has to advertise the NODE_WITNESS flag in its version packet. Most likely you are doing this with your node turned off?

Sorry if I'm misunderstanding but I'm pretty sure Armory and my node are online. In the right bottom of the Armory screen it says "Connected (499513 blocks)" (and NOT node offline). I always sync Bitcoin core and then close it down before starting Armory. Further I was under the impression the WITNESS service flag is enabled by default in 0.14.2. Is that incorrect?
legendary
Activity: 3766
Merit: 1364
Armory Developer
December 15, 2017, 07:47:57 PM
#7
from the 0.96.2 changelog (https://github.com/goatpig/BitcoinArmory/blob/master/changelog.txt#L29)

Quote
- Enabled SegWit on the mainnet. Running against a node with WITNESS service bit flagged will allow you to create SegWit addresses.

Armory has to be online, i.e. both DB and node have to be running, and your node has to advertise the NODE_WITNESS flag in its version packet. Most likely you are doing this with your node turned off?
legendary
Activity: 2324
Merit: 1125
December 15, 2017, 06:12:24 PM
#6
The online machine: making the transaction.
legendary
Activity: 3766
Merit: 1364
Armory Developer
December 15, 2017, 05:30:59 PM
#5
You're asking for the offline or the online machine?
legendary
Activity: 2324
Merit: 1125
December 15, 2017, 03:59:15 PM
#4
How do I create a segwit address? When I click receive it just makes a new P2PKH address. If I go to my address book and click "address type: P2PKH"  it shows me a window to change the address type. It allows switching to P2SH-P2PK but P2SH-WPKH is grayed out. I am in expert mode and as I said earlier am using Bitcoin core 0.14.2. Anything I'm doing wrong?
legendary
Activity: 2324
Merit: 1125
December 15, 2017, 02:56:56 PM
#3
Thanks! Smiley
legendary
Activity: 3766
Merit: 1364
Armory Developer
December 15, 2017, 12:16:05 PM
#2
1) Yes

2) It won't pick SegWit unless the tx you are spending from is SegWit. Otherwise it will pick P2SH-P2K. You would have to manually set your change address to nested P2WPKH to get it to create SegWit change when spending from a legacy outputs.

3) Doesn't matter for Core as long as it's a SegWit compliant version (13.1 and later iirc). For new address types, you want to keep the signer and online instance in lock step until the code congeals.

4) The fee is computed on the basis of full sat/byte for the non SW part, and discounted sat/weight for the witness data. Here's an example to illustrate:

You are setting the fee at 200 sat/B in the GUI for a 400 bytes tx that is half tx data, half witness. That gives you:

- 200 bytes at full 200 s/B (the 200 bytes of the plain tx data)

- 200 bytes at 50 s/B (discounted 200 bytes of witness data)

Your total fee is 50000 satoshis, your tx weighs 250 units, you effective fee is 200 s/wu.

If you choose the enforce a flat fee manually on a SW tx, the code will display the estimated s/wu of your tx.

All values in the GUI for unsigned tx are estimates, as signatures can vary by 1-2 bytes from the high end value Armory uses.
legendary
Activity: 2324
Merit: 1125
December 15, 2017, 11:23:09 AM
#1
I have never used anything but P2PKH addresses before. I was looking to spend an input but for the first time since segwit I would have a change address. Because of that Armory warned me I would lose privacy unless I set change address to auto select (instead of P2PKH).

1. Does the privacy loss here only refer to the fact that one output starts with a 3... (P2SH) and one with a 1... (P2PKH) giving an outside observer the ability to guess that the P2PKH is likely my change address?

Using the new segwit address could be useful as I would save on tx fees in the future and it's interesting to try out the "new" functionality. So some additional questions:

2. Once I change the default change address to auto select it shows me a P2SH (3....) address for the change in the transaction preview. Is this a segwit (P2SH-P2WPKH) address or can it also be a P2SH-P2PK address? How do I see the difference?

3. Is there any risk with spending from the segwit address? My configuration: Armory 0.96.3 (online) and 0.96.2 (offline) and Bitcoin core 0.14.2 (I like being a version behind)

4. Is the fee selection automatically changed from sat/byte to sat/weight-unit? Is there a how to available online?

Thanks in advance!
Jump to: