Bitcoin Forum
December 16, 2018, 06:47:48 PM *
News: Latest Bitcoin Core release: 0.17.0 [Torrent].
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core 0.16 and bech32  (Read 212 times)
wachtwoord
Legendary
*
Offline Offline

Activity: 1764
Merit: 1005


View Profile
March 14, 2018, 04:27:05 PM
 #1

I upgraded to 0.16 and tried to generate a bech32 address by clicking the request payment button with the "Generate bech32 address" checkbox checked however it simply generates an address starting with 1 and bnot with bc.

  • Is this a P2SH wrapped address?
  • If not, how do I generate a bech32 address?
  • If yes, how can I tell the addresses apart in my address book?
  • How is segwit visualized (if at all)? In the transaction screen I see nothing of the sort.

Thanks!
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1544986068
Hero Member
*
Offline Offline

Posts: 1544986068

View Profile Personal Message (Offline)

Ignore
1544986068
Reply with quote  #2

1544986068
Report to moderator
1544986068
Hero Member
*
Offline Offline

Posts: 1544986068

View Profile Personal Message (Offline)

Ignore
1544986068
Reply with quote  #2

1544986068
Report to moderator
Xynerise
Sr. Member
****
Offline Offline

Activity: 280
Merit: 281

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
March 14, 2018, 07:46:40 PM
Merited by achow101 (1), HCP (1), nc50lc (1)
 #2

it simply generates an address starting with 1 and bnot with bc.
The prefix is actually bc1, not bc.
Post the address generated.
Does it have capital and small letters?
What's the length?
Quote
  • Is this a P2SH wrapped address?
No, those always start with '3'
Quote
  • If not, how do I generate a bech32 address?
What you did was supposed to work.
Try start Bitcoin Core with
Code:
-addresstype=bech32
and try again
Quote
  • If yes, how can I tell the addresses apart in my address book?
The answer is no.
Addresses that start with'1' are not Segwit addresses neither are they Bech32.
The differences between Segwit addresses are (mostly) cosmetic already.
Quoting a previous post of mine
Quote
For most Bitcoin addresses their difference is cosmetic: P2PKH (addresses that start with 1) are definitely not Segwit addresses; P2PWPKH addresses (Bech 32 addresses, that start with bc1) are obviously segwit addresses.
The only confusion is in P2SH addresses (those that start with 3), they could be normal P2SH addresses (multisig, usually), or P2WPKH wrapped in P2SH (Segwit addresses).
However the only way to distinguish between them is only when the UTXO is spent, and the redeem script exposed.
Until then it is impossible to distinguish between them.
TL;DR: Segwit addresses start with either '3' or 'bc1'
Quote
  • How is segwit visualized (if at all)? In the transaction screen I see nothing of the sort.
How exactly do you mean?
Segwit works under the hood by reducing transaction size thereby reducing transaction fees.
HCP
Legendary
*
Offline Offline

Activity: 812
Merit: 1003

<insert witty quote here>


View Profile
March 15, 2018, 03:53:51 AM
 #3

I upgraded to 0.16 and tried to generate a bech32 address by clicking the request payment button with the "Generate bech32 address" checkbox checked however it simply generates an address starting with 1 and bnot with bc.
Just out of curiousity... what version did you upgrade from? and is your wallet an HD wallet? (does the HD icon in the bottom right corner have a X through it or does it say "HD Key generation is enabled" if you hover the mouse over it?)

I ask because if you have an old legacy wallet that isn't HD, it's possible it won't generate the SegWit addresses... It isn't mentioned explicitly in the release notes or anything, I'm just thinking out loud.

TheQuin
Hero Member
*****
Offline Offline

Activity: 756
Merit: 674


Freebitco.in Forum Dude https://bit.ly/2I9BVS2


View Profile WWW
March 15, 2018, 08:31:50 AM
Merited by HCP (1)
 #4

Just out of curiousity... what version did you upgrade from? and is your wallet an HD wallet? (does the HD icon in the bottom right corner have a X through it or does it say "HD Key generation is enabled" if you hover the mouse over it?)

I ask because if you have an old legacy wallet that isn't HD, it's possible it won't generate the SegWit addresses... It isn't mentioned explicitly in the release notes or anything, I'm just thinking out loud.

I've tried this with my old vintage 2013 non-HD wallet.dat and it produces bech32 addresses without any issues. To answer the OP it should work and I can't reproduce the problem.

Edit:
You can also try from the dubug console:

getnewaddress "" bech32


wachtwoord
Legendary
*
Offline Offline

Activity: 1764
Merit: 1005


View Profile
March 15, 2018, 06:16:03 PM
 #5

Just out of curiousity... what version did you upgrade from? and is your wallet an HD wallet? (does the HD icon in the bottom right corner have a X through it or does it say "HD Key generation is enabled" if you hover the mouse over it?)

I ask because if you have an old legacy wallet that isn't HD, it's possible it won't generate the SegWit addresses... It isn't mentioned explicitly in the release notes or anything, I'm just thinking out loud.

I've tried this with my old vintage 2013 non-HD wallet.dat and it produces bech32 addresses without any issues. To answer the OP it should work and I can't reproduce the problem.

Edit:
You can also try from the dubug console:

getnewaddress "" bech32


I keep getting an address with 1... both when I start the client with -addresstype=bech32 and with the command on the debug console.

I do really have a very old wallet.dat (non-HD) so maybe it is not available? (Although that seems to be contradicted above)
HCP
Legendary
*
Offline Offline

Activity: 812
Merit: 1003

<insert witty quote here>


View Profile
March 16, 2018, 03:55:52 AM
 #6

Try shutting down Bitcoin Core, then make a backup of your wallet.dat and rename it to "ORIGINALwallet.dat" or something similar... then start Bitcoin Core so that it creates a new (empty) wallet.dat and see if it creates "bc1" addresses.

It is quite possible that if your wallet is VERY old it is causing the issue... I don't have a wallet that old, so I can't try and replicate it.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 1610
Merit: 1834


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
March 16, 2018, 04:34:26 AM
Merited by wachtwoord (1), HCP (1), TheQuin (1), Xynerise (1)
 #7

Get an address from your wallet and go to the debug window. Then type
Code:
validateaddress <address>
Find the field for
Code:
iscompressed
and tell us what it says. I suspect it will say false.

Since you say that your wallet is old, there's a good chance that you still are using uncompressed public keys which are not allowed by segwit. This has nothing to do with a wallet being non-HD; it just means that you are using a wallet that does not support compressed public keys.

To use compressed public keys (so that you can use segwit), you can upgrade your wallet to use compressed public keys by starting Bitcoin Core with -upgradewallet. Note that this will not make your wallet HD, it will only upgrade it to support compressed public keys. Then you will need to flush and regenerate the keypool. Unfortunately I don't think there's a way to do that right now besides just generating a few hundred addresses. At some point it will start giving you p2sh wrapped addresses instead of legacy addresses as the keypool runs out of the old uncompressed public keys.

If your wallet is not encrypted, you can encrypt it and that will automatically flush and regenerate the keypool for you.

edit: validateaddress, not getaddressinfo

wachtwoord
Legendary
*
Offline Offline

Activity: 1764
Merit: 1005


View Profile
March 16, 2018, 11:59:41 AM
 #8

I think you're right but I the getaddressinfo command does not exist and I can't find a similar command in the list of commands you get by typing help. Do you know what you meant instead?

I also made a new wallet and can generate bech32 so that also seems to point in the direction of your conclusion. Seems like I'm best off retiring this wallet cause it is encrypted (and generating 100s of addresses doesn't sound like a fun endeavour or a good way to keep an overview of used addresses).
starmyc
Member
**
Offline Offline

Activity: 194
Merit: 86

Software engineer


View Profile WWW
March 16, 2018, 02:31:06 PM
Merited by wachtwoord (1), Xynerise (1)
 #9

I think you're right but I the getaddressinfo command does not exist and I can't find a similar command in the list of commands you get by typing help. Do you know what you meant instead?

I also made a new wallet and can generate bech32 so that also seems to point in the direction of your conclusion. Seems like I'm best off retiring this wallet cause it is encrypted (and generating 100s of addresses doesn't sound like a fun endeavour or a good way to keep an overview of used addresses).

I guess you can try the validateaddress api call:

Code:
$ bitcoin-cli validateaddress 1NNFJhT8mGyQAFF6Sr3sXQmGpmXzhdjrGx
{
  "isvalid": true,
  "address": "1NNFJhT8mGyQAFF6Sr3sXQmGpmXzhdjrGx",
[...]
  "pubkey": "02e1e96545df48f58852e537ec7820b940fea5b4834ed18062456ae126eb1e9d55",
  "iscompressed": true,
  "account": "",
[...}
}

It will only work if you're the owner of the address (ie: have private key), because it is impossible from a single address to know if its public key was compressed or not before hashing it.

Software engineer.
Tip me if you find my help useful: 3QBRMM2CLUTd7hqL4T9Ja2wy6B1VkbXyZ3
wachtwoord
Legendary
*
Offline Offline

Activity: 1764
Merit: 1005


View Profile
March 16, 2018, 04:12:07 PM
 #10

Thank you. Indeed the call is returning iscompresses false.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1610
Merit: 1834


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
March 16, 2018, 05:41:29 PM
 #11

I think you're right but I the getaddressinfo command does not exist and I can't find a similar command in the list of commands you get by typing help. Do you know what you meant instead?
Right, getaddressinfo was merged for 0.17, not 0.16. It's validateaddress for 0.16.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!