Bitcoin Forum
May 18, 2021, 09:55:08 PM *
News: Latest Bitcoin Core release: 0.21.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Segwit questions: P2PKH versus P2SH-P2WPKH  (Read 305 times)
wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 15, 2017, 04:23:09 PM
Merited by suchmoon (4), ETFbitcoin (1)
 #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!
1621374908
Hero Member
*
Offline Offline

Posts: 1621374908

View Profile Personal Message (Offline)

Ignore
1621374908
Reply with quote  #2

1621374908
Report to moderator
1621374908
Hero Member
*
Offline Offline

Posts: 1621374908

View Profile Personal Message (Offline)

Ignore
1621374908
Reply with quote  #2

1621374908
Report to moderator
1621374908
Hero Member
*
Offline Offline

Posts: 1621374908

View Profile Personal Message (Offline)

Ignore
1621374908
Reply with quote  #2

1621374908
Report to moderator
If you see garbage posts (off-topic, trolling, spam, no point, etc.), use the "report to moderator" links. All reports are investigated, though you will rarely be contacted about your reports.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1621374908
Hero Member
*
Offline Offline

Posts: 1621374908

View Profile Personal Message (Offline)

Ignore
1621374908
Reply with quote  #2

1621374908
Report to moderator
1621374908
Hero Member
*
Offline Offline

Posts: 1621374908

View Profile Personal Message (Offline)

Ignore
1621374908
Reply with quote  #2

1621374908
Report to moderator
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 15, 2017, 05:16:05 PM
Merited by wachtwoord (15), suchmoon (4), ETFbitcoin (2)
 #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.

wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 15, 2017, 07:56:56 PM
Last edit: December 15, 2017, 08:59:08 PM by wachtwoord
 #3

Thanks! Smiley
wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 15, 2017, 08: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?
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 15, 2017, 10:30:59 PM
 #5

You're asking for the offline or the online machine?

wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 15, 2017, 11:12:24 PM
 #6

The online machine: making the transaction.
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 16, 2017, 12:47:57 AM
 #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?

wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 16, 2017, 01:06:10 AM
 #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?
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 16, 2017, 01:42:35 AM
 #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.


wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 16, 2017, 05: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.
afrongen
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
December 16, 2017, 06: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?
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 16, 2017, 07:24:08 PM
 #12

https://github.com/goatpig/BitcoinArmory/blob/testing/changelog.txt#L9

afrongen
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
December 19, 2017, 09: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?
goatpig
Moderator
Legendary
*
Offline Offline

Activity: 2870
Merit: 1199

Armory Developer


View Profile
December 19, 2017, 02:29:35 PM
 #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.

wachtwoord
Legendary
*
Offline Offline

Activity: 2100
Merit: 1044


View Profile
December 20, 2017, 12:09:36 AM
 #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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!