user106687: I am trying to parse all transactions.
I found that some transactions do not have addresses in their vout.
There are two situations that vout does not have addresses.
The first one is the miner reward.
For example, run this:
bitcoin-cli getrawtransaction 4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0 true.
Here is the result:
{

  "txid": "4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0",

  "hash": "4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0",

  "version": 1,

  "size": 135,

  "vsize": 135,

  "weight": 540,

  "locktime": 0,

  "vin": [

    {

      "coinbase": "048521131a028d00",

      "sequence": 4294967295

    }

  ],

  "vout": [

    {

      "value": 50.25892368,

      "n": 0,

      "scriptPubKey": {

        "asm": "04994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9b OP_CHECKSIG",

        "hex": "4104994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9bac",

        "type": "pubkey"

      }

    }

  ],

  "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff08048521131a028d00ffffffff011008912b01000000434104994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9bac00000000",

  "blockhash": "00000000000009e63c0dc84756b1f535b0c8d7c51b849e60b6ce893a9c6a4d51",

  "confirmations": 506698,

  "time": 1308295622,

  "blocktime": 1308295622

}

You can see there is no addresses field in the first and only object of vout.
The second one is not a miner reward.
For example, run this:
bitcoin-cli getrawtransaction 4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a true.
Here is the result:
{

  "txid": "4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a",

  "hash": "4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a",

  "version": 1,

  "size": 234,

  "vsize": 234,

  "weight": 936,

  "locktime": 0,

  "vin": [

    {

      "txid": "c245fbf8c03de1ab3372f72cafbd40ef47882fc0aba02c424e70cb4b44c65241",

      "vout": 0,

      "scriptSig": {

        "asm": "304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e[ALL]",

        "hex": "48304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e01"

      },

      "sequence": 4294967295

    }

  ],

  "vout": [

    {

      "value": 115.00000000,

      "n": 0,

      "scriptPubKey": {

        "asm": "OP_DUP OP_HASH160 208bbec311f62e7881ee746d7f3a6ba097203815 OP_EQUALVERIFY OP_CHECKSIG",

        "hex": "76a914208bbec311f62e7881ee746d7f3a6ba09720381588ac",

        "reqSigs": 1,

        "type": "pubkeyhash",

        "addresses": [

          "13y62oZbRtF4SJx2sezC3PvvDBfXx42jJb"

        ]

      }

    },

    {

      "value": 2.00000000,

      "n": 1,

      "scriptPubKey": {

        "asm": "0405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9 OP_CHECKSIG",

        "hex": "410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac",

        "type": "pubkey"

      }

    }

  ],

  "hex": "01000000014152c6444bcb704e422ca0abc02f8847ef40bdaf2cf77233abe13dc0f8fb45c2000000004948304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e01ffffffff02001374ad020000001976a914208bbec311f62e7881ee746d7f3a6ba09720381588ac00c2eb0b0000000043410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac00000000",

  "blockhash": "000000000000098444048edc683a41d26be975e302019a51a7ca3c2cc21d4813",

  "confirmations": 506676,

  "time": 1308309497,

  "blocktime": 1308309497

}

You can see there is no addresses field in the second object of vout.
Please explain this or provide some keyword for me to search! Thank you guys!

user84856: I don't really know why it doesn't include some addresses.  Here's how to get both of the addresses for your second transaction example:
For vout index 0, it says the type is a pubkeyhash.  The hex value is the actual script run by bitcoin.  Here it is 76a914208bbec311f62e7881ee746d7f3a6ba09720381588ac, and if you have an opcode guide like this, you can decipher it.  Let's break it down:
opcode        word

0x76          OP_DUP  
0xa9          OP_HASH160    
0x14          PUSH the next 0x14 bytes (20 in dec): 208bbec311f62e7881ee746d7f3a6ba097203815
0x88          OP_EQUALVERIFY
0xac          OP_CHECKSIG

Those 20 bytes (208bbec311f62e7881ee746d7f3a6ba097203815) are a pubkey hash.  Now all you have to do is Base58Check those 20 bytes and you've got your address.  You can use this to do that: copy the 20 bytes into step 3 and hit send.  The address (13y62oZbRtF4SJx2sezC3PvvDBfXx42jJb) is shown at the bottom.  Steps 4 through 9 are what I refer to as "Base58Check" above.
For vout index 1, it says the type is a pubkey.  Let's break down the script (410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac):
opcode        word

0x41          PUSH the next 0x41 bytes (65 in dec):  0405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9
0xac          OP_CHECKSIG

Those 65 bytes are the public key for the address.  Now you have to SHA256 hash those bytes, then ripemd hash THOSE bytes, then run Base58Check on that.  You can use the link above again to do this, just paste the 65 bytes into step 1 and hit send.  The address (12WSoZ84ZJAKDo4MbbgKQtw3qT8gTF2o4e) is shown at the bottom.  You can also use this procedure to get the address for the miner reward example you mentioned.  Try it- you should get 19wBtLQYtLgriGWLjgAXWwedTBgPYbjE97.

user7272: An address is a convenience feature designed to make human usage of Bitcoin easier - the Bitcoin protocol itself does not know anything about addresses.
All outputs are actually sent to programs written in the Bitcoin Script language. These programs can take any form.
We have defined certain programs that can be encoded as addresses - namely, pay-to-public-key-hash, pay-to-script-hash, pay-to-witness-public-key-hash, and pay-to-witness-script-hash.
An output going to any other program will not be encodeable as an address - in your example, the program is known as a Pay to Public Key output, which locks coins directly to a public key, instead of locking them to the more commonly used public key hash (p2pkh addresses, starting with 1).
The output can still be spent.

106687: <p>I am trying to parse all transactions.</p>
<p>I found that some transactions do not have addresses in their vout.</p>
<p>There are two situations that vout does not have addresses.</p>
<p>The first one is the miner reward.</p>
<p>For example, run this:</p>
<p><code>bitcoin-cli getrawtransaction 4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0 true</code>.</p>
<p>Here is the result:</p>
<pre><code>{

  &quot;txid&quot;: &quot;4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0&quot;,

  &quot;hash&quot;: &quot;4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0&quot;,

  &quot;version&quot;: 1,

  &quot;size&quot;: 135,

  &quot;vsize&quot;: 135,

  &quot;weight&quot;: 540,

  &quot;locktime&quot;: 0,

  &quot;vin&quot;: [

    {

      &quot;coinbase&quot;: &quot;048521131a028d00&quot;,

      &quot;sequence&quot;: 4294967295

    }

  ],

  &quot;vout&quot;: [

    {

      &quot;value&quot;: 50.25892368,

      &quot;n&quot;: 0,

      &quot;scriptPubKey&quot;: {

        &quot;asm&quot;: &quot;04994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9b OP_CHECKSIG&quot;,

        &quot;hex&quot;: &quot;4104994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9bac&quot;,

        &quot;type&quot;: &quot;pubkey&quot;

      }

    }

  ],

  &quot;hex&quot;: &quot;01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff08048521131a028d00ffffffff011008912b01000000434104994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9bac00000000&quot;,

  &quot;blockhash&quot;: &quot;00000000000009e63c0dc84756b1f535b0c8d7c51b849e60b6ce893a9c6a4d51&quot;,

  &quot;confirmations&quot;: 506698,

  &quot;time&quot;: 1308295622,

  &quot;blocktime&quot;: 1308295622

}
</code></pre>
<p>You can see there is no addresses field in the first and only object of vout.</p>
<p>The second one is not a miner reward.</p>
<p>For example, run this:</p>
<p><code>bitcoin-cli getrawtransaction 4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a true</code>.</p>
<p>Here is the result:</p>
<pre><code>{

  &quot;txid&quot;: &quot;4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a&quot;,

  &quot;hash&quot;: &quot;4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a&quot;,

  &quot;version&quot;: 1,

  &quot;size&quot;: 234,

  &quot;vsize&quot;: 234,

  &quot;weight&quot;: 936,

  &quot;locktime&quot;: 0,

  &quot;vin&quot;: [

    {

      &quot;txid&quot;: &quot;c245fbf8c03de1ab3372f72cafbd40ef47882fc0aba02c424e70cb4b44c65241&quot;,

      &quot;vout&quot;: 0,

      &quot;scriptSig&quot;: {

        &quot;asm&quot;: &quot;304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e[ALL]&quot;,

        &quot;hex&quot;: &quot;48304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e01&quot;

      },

      &quot;sequence&quot;: 4294967295

    }

  ],

  &quot;vout&quot;: [

    {

      &quot;value&quot;: 115.00000000,

      &quot;n&quot;: 0,

      &quot;scriptPubKey&quot;: {

        &quot;asm&quot;: &quot;OP_DUP OP_HASH160 208bbec311f62e7881ee746d7f3a6ba097203815 OP_EQUALVERIFY OP_CHECKSIG&quot;,

        &quot;hex&quot;: &quot;76a914208bbec311f62e7881ee746d7f3a6ba09720381588ac&quot;,

        &quot;reqSigs&quot;: 1,

        &quot;type&quot;: &quot;pubkeyhash&quot;,

        &quot;addresses&quot;: [

          &quot;13y62oZbRtF4SJx2sezC3PvvDBfXx42jJb&quot;

        ]

      }

    },

    {

      &quot;value&quot;: 2.00000000,

      &quot;n&quot;: 1,

      &quot;scriptPubKey&quot;: {

        &quot;asm&quot;: &quot;0405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9 OP_CHECKSIG&quot;,

        &quot;hex&quot;: &quot;410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac&quot;,

        &quot;type&quot;: &quot;pubkey&quot;

      }

    }

  ],

  &quot;hex&quot;: &quot;01000000014152c6444bcb704e422ca0abc02f8847ef40bdaf2cf77233abe13dc0f8fb45c2000000004948304502200eee831084af8de8ebac477d3c56b5a4d428522df0ccaed41ede77570eac27a5022100af5786d35cdef15a97a775542217a7e9ee85b06d4f07c50bab768bce189e3d9e01ffffffff02001374ad020000001976a914208bbec311f62e7881ee746d7f3a6ba09720381588ac00c2eb0b0000000043410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac00000000&quot;,

  &quot;blockhash&quot;: &quot;000000000000098444048edc683a41d26be975e302019a51a7ca3c2cc21d4813&quot;,

  &quot;confirmations&quot;: 506676,

  &quot;time&quot;: 1308309497,

  &quot;blocktime&quot;: 1308309497

}
</code></pre>
<p>You can see there is no addresses field in the second object of vout.</p>
<p>Please explain this or provide some keyword for me to search! Thank you guys!</p>
 84856: <p>I don't really know why it doesn't include some addresses.  Here's how to get both of the addresses for your second transaction example:</p>
<p>For vout index 0, it says the type is a <code>pubkeyhash</code>.  The <code>hex</code> value is the actual script run by bitcoin.  Here it is <code>76a914208bbec311f62e7881ee746d7f3a6ba09720381588ac</code>, and if you have an opcode guide like <a href="https://en.bitcoin.it/wiki/Script" rel="nofollow noreferrer">this</a>, you can decipher it.  Let's break it down:</p>
<pre><code>opcode        word

0x76          OP_DUP  
0xa9          OP_HASH160    
0x14          PUSH the next 0x14 bytes (20 in dec): 208bbec311f62e7881ee746d7f3a6ba097203815
0x88          OP_EQUALVERIFY
0xac          OP_CHECKSIG
</code></pre>
<p>Those 20 bytes (<code>208bbec311f62e7881ee746d7f3a6ba097203815</code>) are a pubkey hash.  Now all you have to do is Base58Check those 20 bytes and you've got your address.  You can use <a href="https://gobittest.appspot.com/Address" rel="nofollow noreferrer">this</a> to do that: copy the 20 bytes into step 3 and hit send.  The address (<code>13y62oZbRtF4SJx2sezC3PvvDBfXx42jJb</code>) is shown at the bottom.  Steps 4 through 9 are what I refer to as &quot;Base58Check&quot; above.</p>
<p>For vout index 1, it says the type is a <code>pubkey</code>.  Let's break down the script (<code>410405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9ac</code>):</p>
<pre><code>opcode        word

0x41          PUSH the next 0x41 bytes (65 in dec):  0405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9
0xac          OP_CHECKSIG
</code></pre>
<p>Those 65 bytes are the public key for the address.  Now you have to SHA256 hash those bytes, then ripemd hash THOSE bytes, then run Base58Check on that.  You can use the link above again to do this, just paste the 65 bytes into step 1 and hit send.  The address (<code>12WSoZ84ZJAKDo4MbbgKQtw3qT8gTF2o4e</code>) is shown at the bottom.  You can also use this procedure to get the address for the miner reward example you mentioned.  Try it- you should get <code>19wBtLQYtLgriGWLjgAXWwedTBgPYbjE97</code>.</p>
 7272: <p>An address is a convenience feature designed to make human usage of Bitcoin easier - the Bitcoin protocol itself does not know anything about addresses.</p>
<p>All outputs are actually sent to programs written in the Bitcoin Script language. These programs can take any form.</p>
<p>We have defined certain programs that can be encoded as addresses - namely, pay-to-public-key-hash, pay-to-script-hash, pay-to-witness-public-key-hash, and pay-to-witness-script-hash.</p>
<p>An output going to any other program will not be encodeable as an address - in your example, the program is known as a Pay to Public Key output, which locks coins directly to a public key, instead of locking them to the more commonly used public key hash (p2pkh addresses, starting with 1).</p>
<p>The output can still be spent.</p>
