Categories
Bitcoin

Why does vout sometimes not have address?

I am trying to parse all transactions. I found that some transactions do not have addresses in their vout.

The following content was written by thx9527 on July 07, 2020, 04:40:54 AM in the thread Why does vout sometimes not have address?. All content is owned by the author of the bitcointalk.org post. (original)


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:

Code:
bitcoin-cli getrawtransaction 4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0 true

Here is the result:


Code:
{

  “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:

Code:
bitcoin-cli getrawtransaction 4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a true

Here is the result:


Code:
{

  “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!

The following content was written by achow101 on July 07, 2020, 04:48:34 AM in the thread Why does vout sometimes not have address?. All content is owned by the author of the bitcointalk.org post. (original)


At the protocol level, Bitcoin doesn’t use addresses. It uses a custom scripting language. Addresses are merely a human shorthand for some kinds of scripts. These scripts have a standard form, so when software sees those scripts, it can produce the corresponding address. However not all (and in fact most) scripts correspond to addresses.

What you are looking at is a Pay to pubkey script. This does not have an address. Thus no address is shown.

The following content was written by TheArchaeologist on July 07, 2020, 11:31:10 AM in the thread Why does vout sometimes not have address?. All content is owned by the author of the bitcointalk.org post. (original)


^^ That being said, most explorers translate the (uncompressed) pubkey which is in the script to an address.

So what happens:
Code:
txid = 4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0
pubkey from script = 04994b2548a865ad7e786c691bb9cac7d15afc60b8b4500e24e79ec1cd910830b7dd799defdfdc1a7136e4976d2086daa319a7923f633987905a86aaece612ab9b
pubkey to address = 19wBtLQYtLgriGWLjgAXWwedTBgPYbjE97

txid = 4caea993e7caa859840a8ebac457c31420bb4fb79b528d870556c5a2eec5da7a
pubkey from script =0405d71f20e493a0721e705944e7151a1d7c1b9a9cd546cc44c2f348fa6e27b588ddfdd7b3e52c9af208598f3b2ac519af9d7ee78cea4f237ee5028020e33633c9
pubkey to address = 12WSoZ84ZJAKDo4MbbgKQtw3qT8gTF2o4e

The following content was written by BTCW on July 08, 2020, 02:18:33 AM in the thread Why does vout sometimes not have address?. All content is owned by the author of the bitcointalk.org post. (original)


You need a better explorer. Check this out, you can view each transaction (including the one in the OP) either visually, as JSON or as the raw tx dada. It’s awesome.

https://learnmeabitcoin.com/explorer/transaction/4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0

The following content was written by TheArchaeologist on July 08, 2020, 06:10:32 AM in the thread Why does vout sometimes not have address?. All content is owned by the author of the bitcointalk.org post. (original)


You need a better explorer. Check this out, you can view each transaction (including the one in the OP) either visually, as JSON or as the raw tx dada. It’s awesome.

https://learnmeabitcoin.com/explorer/transaction/4bec1175f9682fc10118bbb146d1def8fd82fdffdf27da8beea327469f79b2b0
That’s based on bitcoin core 18.0 so it’s just running an older version of bitcoin core than the current one or OP’s one. Back then bitcoin-cli or rpc-calls would indeed do the translation to address based on public key.

By Ali Sherief

Editor-in-chief and serial coder & blogger.