Bitcoin Forum
May 01, 2024, 09:33:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core 0.16 and bech32  (Read 345 times)
wachtwoord (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1125


View Profile
March 14, 2018, 04:27:05 PM
Last edit: March 14, 2018, 07:05:10 PM by wachtwoord
 #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!
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714599190
Hero Member
*
Offline Offline

Posts: 1714599190

View Profile Personal Message (Offline)

Ignore
1714599190
Reply with quote  #2

1714599190
Report to moderator
1714599190
Hero Member
*
Offline Offline

Posts: 1714599190

View Profile Personal Message (Offline)

Ignore
1714599190
Reply with quote  #2

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

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
March 14, 2018, 07:46:40 PM
Last edit: March 14, 2018, 08:27:46 PM by Xynerise
Merited by achow101 (1), nc50lc (1), HCP (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: 2086
Merit: 4316

<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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
TheQuin
Hero Member
*****
Offline Offline

Activity: 2576
Merit: 882


Freebitco.in Support https://bit.ly/2I9BVS2


View Profile WWW
March 15, 2018, 08:31:50 AM
Last edit: March 15, 2018, 08:47:07 AM by TheQuin
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


freebitcoin.TO WIN A  LAMBORGHINI!..

.
                                ▄▄▄▄▄▄▄▄▄▄███████████▄▄▄▄▄
                    ▄▄▄▄▄██████████████████████████████████▄▄▄▄
                    ▀██████████████████████████████████████████████▄▄▄
                    ▄▄████▄█████▄████████████████████████████▄█████▄████▄▄
                    ▀████████▀▀▀████████████████████████████████▀▀▀██████████▄
                      ▀▀▀████▄▄▄███████████████████████████████▄▄▄██████████
                           ▀█████▀  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀█████▀▀▀▀▀▀▀▀▀▀
                   ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
wachtwoord (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1125


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: 2086
Merit: 4316

<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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6571


Just writing some code


View Profile WWW
March 16, 2018, 04:34:26 AM
Last edit: March 16, 2018, 05:41:47 PM by achow101
Merited by TheQuin (1), wachtwoord (1), HCP (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 (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1125


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
Full Member
***
Offline Offline

Activity: 198
Merit: 130

Some random software engineer


View Profile
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.

Hi, I'm just some random software engineer.
You can check my projects: Bitcoin & altcoin balances/addresses listing dumps: https://balances.crypto-nerdz.org/
wachtwoord (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1125


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: 3374
Merit: 6571


Just writing some code


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:  

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