Bitcoin Forum
September 19, 2019, 05:51:10 PM *
News: Latest Bitcoin Core release: 0.18.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Looking for useful wallet address documentation  (Read 94 times)
kano
Legendary
*
Offline Offline

Activity: 2912
Merit: 1193


Linux since 1997 RedHat 4


View Profile
June 26, 2019, 01:44:14 AM
Merited by OmegaStarScream (2), bones261 (2), HeRetiK (1), o_e_l_e_o (1)
 #1

The getnewaddress command of course returns 'new' addresses.
However I can't seem to find some place where core has actually documented it properly.

There are 3 types of 'addresses'
There are multiple types of wallets
There are (of course) multiple versions of bitcoin core

Can someone point me to the core written documentation that clearly explains them - which must include:

1) Which wallet versions are required before core will generate each type of address
1a) or under what circumstances (e.g. with a unfinished keypool) it will not generate certain types

2) Which addresses can be converted to other types (within what restrictions) and how to do that

3) Which versions of core support which addresses and which wallets

Of course there's a large matrix of multiple versions, but clearly anyone who knows what core is doing will know the change over versions related to this
Obviously it doesn't need to list every version, just that it's supported since version X ... (or ... god forbid ... we dropped support at version Y)

This information SHOULD be somewhere in the core version but alas I've been unable to find it (with google help either)

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
Discord support invite at https://kano.is/ Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
1568915470
Hero Member
*
Offline Offline

Posts: 1568915470

View Profile Personal Message (Offline)

Ignore
1568915470
Reply with quote  #2

1568915470
Report to moderator
1568915470
Hero Member
*
Offline Offline

Posts: 1568915470

View Profile Personal Message (Offline)

Ignore
1568915470
Reply with quote  #2

1568915470
Report to moderator
1568915470
Hero Member
*
Offline Offline

Posts: 1568915470

View Profile Personal Message (Offline)

Ignore
1568915470
Reply with quote  #2

1568915470
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1568915470
Hero Member
*
Offline Offline

Posts: 1568915470

View Profile Personal Message (Offline)

Ignore
1568915470
Reply with quote  #2

1568915470
Report to moderator
1568915470
Hero Member
*
Offline Offline

Posts: 1568915470

View Profile Personal Message (Offline)

Ignore
1568915470
Reply with quote  #2

1568915470
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1890
Merit: 2742


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
June 26, 2019, 03:18:51 AM
Merited by HeRetiK (1), o_e_l_e_o (1)
 #2

None of this information is really documented anywhere... They're primarily in some version's release notes. The information that you are looking for can probably be found in the 0.16.0 Release Notes

1) Which wallet versions are required before core will generate each type of address
Being able to choose address types was introduced in Bitcoin Core 0.16.0, all current address types (legacy, p2sh-segwit, and bech32) were introduced in this version.

1a) or under what circumstances (e.g. with a unfinished keypool) it will not generate certain types
If the wallet still contains uncompressed public keys in the keypool, only legacy type addresses will be generated for those keys. Otherwise all address types can be generated if there are any keys in the keypool.

2) Which addresses can be converted to other types (within what restrictions) and how to do that
Bitcoin Core does not allow you to convert addresses to other types. You cannot do this in Bitcoin Core.

3) Which versions of core support which addresses and which wallets
All addresses are supported for all wallet types (HD and non-HD) so long as the individual keys are compressed. If a key is uncompressed, only a legacy type address will be returned.

This information SHOULD be somewhere in the core version but alas I've been unable to find it (with google help either)
Unfortunately it isn't. Like a lot of things in Bitcoin Core, it isn't really documented.

kano
Legendary
*
Offline Offline

Activity: 2912
Merit: 1193


Linux since 1997 RedHat 4


View Profile
June 26, 2019, 04:00:49 AM
 #3

Well I guess that answers most of the questions Smiley

Do you happen to know of the rules by which you can convert 'address' types.

I'm not looking for how, more just the requirements that allow them to be converted.

One reason for this is someone wanting to supply a 'bc' address and I was curious about under what conditions it is possible to determine an equivalent '3' address.
But of course in general the requirements of the 'addresses' to be able to convert any to another.

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
Discord support invite at https://kano.is/ Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1890
Merit: 2742


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
June 26, 2019, 02:24:25 PM
Merited by bones261 (2)
 #4

One reason for this is someone wanting to supply a 'bc' address and I was curious about under what conditions it is possible to determine an equivalent '3' address.
But of course in general the requirements of the 'addresses' to be able to convert any to another.
In general, you shouldn't be doing address conversions like this. A person gives you an address that they know their wallet is tracking and so they can easily spend the UTXOs associated with that address. By converting the address to a different type, you may make it much more difficult for the person to spend those Bitcoin and they may consider you to have not paid them because the transaction does not appear in their wallet. Not all wallets track all address types that they are able to spend.

You can always convert a bech32 address  (begins with 'bc') to the corresponding P2SH wrapped segwit address (begins with a '3'). A bech32 address maps to a specific scriptPubKey, just treat that scriptPubKey as a redeemScript and get the resulting P2SH address for that redeemScript (i.e. hash it with hash160 and base58 check encode that hash).

Any legacy address (begins with a '1') can be converted to bech32 (and thus p2sh-segwit). Legacy addresses encode the hash160 of the public key which is exactly the same thing that bech32 addresses encode. Just decode the address, extract the hash160, and re-encode that as bech32 with witness version 0. From there you can also go to p2sh-segwit as described above. You can do the same thing in reverse to go from bech32 to legacy.

P2sh-segwit however cannot be converted to any other address type unless you know the redeemScript. If you know the redeemScript, then you can get the bech32 address from the redeemScript and from there convert to a legacy address.

kano
Legendary
*
Offline Offline

Activity: 2912
Merit: 1193


Linux since 1997 RedHat 4


View Profile
June 26, 2019, 10:17:45 PM
 #5

Thanks for the details - much appreciated!

Maybe raise a git issue to add your replies to the main documentation? Smiley

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
Discord support invite at https://kano.is/ Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
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!