<blockquote>
  <p>In the above blockchain.info link I gave, what are those strange-looking addresses starting with "bc1...", and</p>
</blockquote>

<p>Those are bech32 addresses. These are specified in <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki" rel="nofollow noreferrer">BIP 173</a></p>

<blockquote>
  <p>Is there a way to extract such data from the output of getrawtransaction?</p>
</blockquote>

<p>No. The latest release of Bitcoin Core does not have functionality for converting native witness outputs into bech32 addresses. However blockchain.info does so they are displaying those outputs as bech32 addresses. Bech32 functionality in Bitcoin Core will be released in Bitcoin Core 0.15.1 along with segwit wallet functionality.</p>

<blockquote>
  <p>If not, how did blockchain.info did it?</p>
</blockquote>

<p>Blockchain.info does not use Bitcoin Core. They have their own custom software and it seems that they have implemented bech32.</p>

CC BY-SA 3.0
2017-10-09T19:01:49.390Z
2017-10-09T19:01:49.390Z
Ava Chow
<p>To obtain a bech32 address you need to start from the hrp (prefix, determines mainnet or testnet), witness version, redeem script and pass them to a segwit bech32 encoder. </p>

<p><a href="https://github.com/Samourai-Wallet/samourai-wallet-android/blob/develop/app/src/main/java/com/samourai/wallet/segwit/bech32/SegwitAddress.java#L48" rel="nofollow noreferrer">https://github.com/Samourai-Wallet/samourai-wallet-android/blob/develop/app/src/main/java/com/samourai/wallet/segwit/bech32/SegwitAddress.java#L48</a></p>

<p>More bech32 code can be found here: <a href="https://github.com/sipa/bech32" rel="nofollow noreferrer">https://github.com/sipa/bech32</a></p>

CC BY-SA 3.0
2017-11-24T08:46:52.050Z
2017-11-24T08:46:52.050Z
T. DeV D
<p>I'm trying to analyse this transaction:</p>

<p><a href="https://blockchain.info/tx/a388d6f88373aacf2a5c170eeff4adf51f2c6744da26375d5890f42d653a2e6c" rel="nofollow noreferrer">https://blockchain.info/tx/a388d6f88373aacf2a5c170eeff4adf51f2c6744da26375d5890f42d653a2e6c</a></p>

<p>I used to be able to just run <code>bitcoin-cli getrawtransaction txid 1</code> and get a reasonable output, but running it with this particular transaction id, I get this:</p>

<pre><code>{
  "txid": "a388d6f88373aacf2a5c170eeff4adf51f2c6744da26375d5890f42d653a2e6c",
  "hash": "c856582f997dc4b6f1e009f2096c4e549aeaeeb3f20703dbd71476dc957f77ec",
  "version": 1,
  "size": 383,
  "vsize": 192,
  "locktime": 0,
  "vin": [
    {
      "txid": "37138d3df8e1d41bf6474ecdc21d53f78ab9907c500172de31bda4048556bd83",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "",
        "304402205ed1d5ac8bee5f58da52cdf6fe6e64dccd9560c84ae933172ad26ae1fd7468eb02201e5db99e00d7fd3997b2b457c4b689c1cd8b2708afa128d030fc62055117d07401",
        "3045022100fa5054964962656890e466b35f111ab5b2f869eb41c39a6830bde9b7f00013b00220592d5369b295ec49e90504060748a67cc371519ab945fbcbb9e99b5b1d8040dc01",
        "52210375e00eb72e29da82b89367947f29ef34afb75e8654f6ea368e0acdfd92976b7c2103a1b26313f430c4b15bb1fdce663207659d8cac749a0e53d70eff01874496feff2103c96d495bfdd5ba4145e3e046fee45e84a8a48ad05bd8dbb395c011a32cf9f88053ae"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.08000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 04645ed4e7b22362e4baf1aa396115450d99347c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91404645ed4e7b22362e4baf1aa396115450d99347c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1QDwdPsF1cpf6Wvmo8QmFWZKUVGh1KzNh"
        ]
      }
    },
    {
      "value": 0.01043487,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d",
        "hex": "0020701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d",
        "type": "witness_v0_scripthash"
      }
    }
  ],
  "hex": "0100000000010183bd568504a4bd31de7201507c90b98af7531dc2cd4e47f61bd4e1f83d8d13370100000000ffffffff0200127a00000000001976a91404645ed4e7b22362e4baf1aa396115450d99347c88ac1fec0f0000000000220020701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d040047304402205ed1d5ac8bee5f58da52cdf6fe6e64dccd9560c84ae933172ad26ae1fd7468eb02201e5db99e00d7fd3997b2b457c4b689c1cd8b2708afa128d030fc62055117d07401483045022100fa5054964962656890e466b35f111ab5b2f869eb41c39a6830bde9b7f00013b00220592d5369b295ec49e90504060748a67cc371519ab945fbcbb9e99b5b1d8040dc016952210375e00eb72e29da82b89367947f29ef34afb75e8654f6ea368e0acdfd92976b7c2103a1b26313f430c4b15bb1fdce663207659d8cac749a0e53d70eff01874496feff2103c96d495bfdd5ba4145e3e046fee45e84a8a48ad05bd8dbb395c011a32cf9f88053ae00000000",
  "blockhash": "000000000000000000e8b63e15371848d765904e3bcfee1d0b45a37247fca9c2",
  "confirmations": 7,
  "time": 1507561656,
  "blocktime": 1507561656
}
</code></pre>

<p>So, there are no addresses in the second output. But blockchain.info has this to say:</p>

<pre><code>bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej (0.09083487 BTC - Output) --&gt; 1QDwdPsF1cpf6Wvmo8QmFWZKUVGh1KzNh - (Unspent) 0.08 BTC, 
bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej - (Unspent) 0.01043487 BTC
</code></pre>

<p>I have multiple questions:</p>

<ol>
<li><p>In the above blockchain.info link I gave, what are those strange-looking addresses starting with "bc1...", and </p></li>
<li><p>Is there a way to extract such data from the output of <code>getrawtransaction</code>?</p></li>
<li><p>If not, how did blockchain.info did it?</p></li>
</ol>

CC BY-SA 3.0
2017-10-09T16:30:58.200Z
Search about "Bech32 address format": https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki Bech32 is a way to write SegWit addresses
MCCCS
CC BY-SA 3.0
2017-10-09T17:15:33.457Z
Thanks, that's indeed it! Any clue how to get it from bitcoind?
Ivan Voras
<bitcoind><json-rpc><segregated-witness>
SegWit, Bitcoin JSON-RPC and (strange?) addresses
Ivan Voras
# SegWit, Bitcoin JSON-RPC and (strange?) addresses

(Asked by: username_0 on 2017-10-09)

I'm trying to analyse this transaction:

<https://blockchain.info/tx/a388d6f88373aacf2a5c170eeff4adf51f2c6744da26375d5890f42d653a2e6c>

I used to be able to just run `bitcoin-cli getrawtransaction txid 1` and get a reasonable output, but running it with this particular transaction id, I get this:

```
{
  "txid": "a388d6f88373aacf2a5c170eeff4adf51f2c6744da26375d5890f42d653a2e6c",
  "hash": "c856582f997dc4b6f1e009f2096c4e549aeaeeb3f20703dbd71476dc957f77ec",
  "version": 1,
  "size": 383,
  "vsize": 192,
  "locktime": 0,
  "vin": [
    {
      "txid": "37138d3df8e1d41bf6474ecdc21d53f78ab9907c500172de31bda4048556bd83",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "",
        "304402205ed1d5ac8bee5f58da52cdf6fe6e64dccd9560c84ae933172ad26ae1fd7468eb02201e5db99e00d7fd3997b2b457c4b689c1cd8b2708afa128d030fc62055117d07401",
        "3045022100fa5054964962656890e466b35f111ab5b2f869eb41c39a6830bde9b7f00013b00220592d5369b295ec49e90504060748a67cc371519ab945fbcbb9e99b5b1d8040dc01",
        "52210375e00eb72e29da82b89367947f29ef34afb75e8654f6ea368e0acdfd92976b7c2103a1b26313f430c4b15bb1fdce663207659d8cac749a0e53d70eff01874496feff2103c96d495bfdd5ba4145e3e046fee45e84a8a48ad05bd8dbb395c011a32cf9f88053ae"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.08000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 04645ed4e7b22362e4baf1aa396115450d99347c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91404645ed4e7b22362e4baf1aa396115450d99347c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1QDwdPsF1cpf6Wvmo8QmFWZKUVGh1KzNh"
        ]
      }
    },
    {
      "value": 0.01043487,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d",
        "hex": "0020701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d",
        "type": "witness_v0_scripthash"
      }
    }
  ],
  "hex": "0100000000010183bd568504a4bd31de7201507c90b98af7531dc2cd4e47f61bd4e1f83d8d13370100000000ffffffff0200127a00000000001976a91404645ed4e7b22362e4baf1aa396115450d99347c88ac1fec0f0000000000220020701a8d401c84fb13e6baf169d59684e17abd9fa216c8cc5b9fc63d622ff8c58d040047304402205ed1d5ac8bee5f58da52cdf6fe6e64dccd9560c84ae933172ad26ae1fd7468eb02201e5db99e00d7fd3997b2b457c4b689c1cd8b2708afa128d030fc62055117d07401483045022100fa5054964962656890e466b35f111ab5b2f869eb41c39a6830bde9b7f00013b00220592d5369b295ec49e90504060748a67cc371519ab945fbcbb9e99b5b1d8040dc016952210375e00eb72e29da82b89367947f29ef34afb75e8654f6ea368e0acdfd92976b7c2103a1b26313f430c4b15bb1fdce663207659d8cac749a0e53d70eff01874496feff2103c96d495bfdd5ba4145e3e046fee45e84a8a48ad05bd8dbb395c011a32cf9f88053ae00000000",
  "blockhash": "000000000000000000e8b63e15371848d765904e3bcfee1d0b45a37247fca9c2",
  "confirmations": 7,
  "time": 1507561656,
  "blocktime": 1507561656
}

```

So, there are no addresses in the second output. But blockchain.info has this to say:

```
bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej (0.09083487 BTC - Output) --> 1QDwdPsF1cpf6Wvmo8QmFWZKUVGh1KzNh - (Unspent) 0.08 BTC, 
bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej - (Unspent) 0.01043487 BTC

```

I have multiple questions:

1. In the above blockchain.info link I gave, what are those strange-looking addresses starting with "bc1...", and
2. Is there a way to extract such data from the output of `getrawtransaction`?
3. If not, how did blockchain.info did it?

**Tags:** bitcoind, json-rpc, segregated-witness

> **Comments:**
> **username_1**: Search about "Bech32 address format": https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki Bech32 is a way to write SegWit addresses  
> **username_0**: Thanks, that's indeed it! Any clue how to get it from bitcoind?  

---

## 2 answers

### Answer by username_2 on 2017-10-09. Score: 2 | Accepted answer

> In the above blockchain.info link I gave, what are those strange-looking addresses starting with "bc1...", and

Those are bech32 addresses. These are specified in [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)

> Is there a way to extract such data from the output of getrawtransaction?

No. The latest release of Bitcoin Core does not have functionality for converting native witness outputs into bech32 addresses. However blockchain.info does so they are displaying those outputs as bech32 addresses. Bech32 functionality in Bitcoin Core will be released in Bitcoin Core 0.15.1 along with segwit wallet functionality.

> If not, how did blockchain.info did it?

Blockchain.info does not use Bitcoin Core. They have their own custom software and it seems that they have implemented bech32.


---

### Answer by username_3 on 2017-11-24. Score: 1

To obtain a bech32 address you need to start from the hrp (prefix, determines mainnet or testnet), witness version, redeem script and pass them to a segwit bech32 encoder.

<https://github.com/Samourai-Wallet/samourai-wallet-android/blob/develop/app/src/main/java/com/samourai/wallet/segwit/bech32/SegwitAddress.java#L48>

More bech32 code can be found here: <https://github.com/sipa/bech32>


---

