Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: jrosales on August 05, 2018, 01:58:25 AM



Title: What are these wallet addresses??
Post by: jrosales on August 05, 2018, 01:58:25 AM
Hello friends, in the course of adding bitcoin as a mean of donation for a non-profit, I came across with something I could not find an explanation.
I am using Bitcoin Core v0.16.1. The wallet has several addresses in the right format, and others with an unknown format.
They all validate just fine, the hdmasterkeyid is the same for the valid addresses as for these other, but I know are not valid.
Additionally, a valid validated address, whose validation output reads below contains an embedded address similar to the one right below.
Can anyone explain me what are those invalid addresses, their use, and the reason they were added.  Thanks a lot!

------Start insert invalid------
{
  "isvalid": true,
  "address": "bc1q5cwyt5gvjd7hjdqjlgxy8c08d3guk7gzdmk6tq",
  "scriptPubKey": "0014a61c45d10c937d793412fa0c43e1e76c51cb7902",
  "ismine": true,
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "a61c45d10c937d793412fa0c43e1e76c51cb7902",
  "pubkey": "02a8993288187150da1004e6eb446609b70256352191833cb010f3f0efd55f7968",
  "account": "",
  "timestamp": 1532141579,
  "hdkeypath": "m/0'/0'/3'",
  "hdmasterkeyid": "b8a1da04c8b60c4e169f725ab45a21688055d7e5"
}
------Ends insert invalid------

------Start insert valid------
{
  "isvalid": true,
  "address": "3M9vWs3GdoQmydabrVAcbPw2coWP8essnp",
  "scriptPubKey": "a914d5811b339742b7340e93e5b1d8e7892d0db7f80987",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_keyhash",
  "hex": "001438b84077c582438d6d49311b3ed236cfc8fe57c7",
  "pubkey": "03fabc1e47392c38bd8a5fb9305ecc7d435bab7a627f118c869928c85888cb79ba",
  "embedded": {
    "isscript": false,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "38b84077c582438d6d49311b3ed236cfc8fe57c7",
    "pubkey": "03fabc1e47392c38bd8a5fb9305ecc7d435bab7a627f118c869928c85888cb79ba",
    "address": "bc1q8zuyqa79sfpc6m2fxydna53kely0u478u4zcga",
    "scriptPubKey": "001438b84077c582438d6d49311b3ed236cfc8fe57c7"
  },
  "addresses": [
    "bc1q8zuyqa79sfpc6m2fxydna53kely0u478u4zcga"
  ],
  "account": "",
  "timestamp": 1532141579,
  "hdkeypath": "m/0'/0'/4'",
  "hdmasterkeyid": "b8a1da04c8b60c4e169f725ab45a21688055d7e5"
}

------Ends insert valid------



Title: Re: What are these wallet addresses??
Post by: achow101 on August 05, 2018, 05:14:37 AM
Those addresses are not invalid, they are segwit addresses. Native segwit uses a different address format from non-segwit ("normal" 1 and 3 addresses).

The address within an address that you see is a P2SH address. This is an address that contains within it a script, which itself can map to another address.

It is important to note that Bitcoin does not use addresses at a low level. Rather addresses are turned into scripts, and vice versa, for those scripts. So P2SH addresses contain scripts, and those scripts may map to an address, thus you will see an address within an address.