Skip to main content
added 22 characters in body
Source Link
jtgrassie
  • 19.4k
  • 4
  • 15
  • 52

miner_tx_hash is just that - the transaction hash of the miner transaction. The miner transaction is the transaction that pays out the reward for mining the block. It'sThe inputs to this tx are type gen as itthey literally generatesgenerate new Monero.

And:

NewNow using get_transactions with the miner tx hash obtained above:

Yields:

miner_tx_hash is just that - the transaction hash of the miner transaction. The miner transaction is the transaction that pays out the reward for mining the block. It's type gen as it literally generates new Monero.

New using get_transactions with the miner tx hash obtained above:

miner_tx_hash is just that - the transaction hash of the miner transaction. The miner transaction is the transaction that pays out the reward for mining the block. The inputs to this tx are type gen as they literally generate new Monero.

And:

Now using get_transactions with the miner tx hash obtained above:

Yields:

Source Link
jtgrassie
  • 19.4k
  • 4
  • 15
  • 52

So what exactly the miner_tx_hash field in the block, and what is its relation to the miner_tx and other transactions in the block?

miner_tx_hash is just that - the transaction hash of the miner transaction. The miner transaction is the transaction that pays out the reward for mining the block. It's type gen as it literally generates new Monero.

If I use get_transactions() with the value of miner_tx_hash, it seems to find a transaction, but this transaction seems quite different from miner_tx embedded in the block. The one I get from get_transactions() has many more inputs and outputs etc.

Perhaps you are calling or parsing incorrectly. Here is a concrete example using testnet:

curl -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":1234567}}' \
  http://localhost:28081/json_rpc \
  | jq .result.block_header.miner_tx_hash

Extracts the miner tx hash: c37d119798660baed9ee62b3fc7323f98487b2e9c6a155be843e238e31fdb415

curl -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":1234567}}' \
  http://localhost:28081/json_rpc \
  | jq .result.json | jq -r | jq .miner_tx

Will extract the miner tx (form the same result, get_block with height 1234567):

{
  "version": 2,
  "unlock_time": 1234627,
  "vin": [
    {
      "gen": {
        "height": 1234567
      }
    }
  ],
  "vout": [
    {
      "amount": 6059550665332,
      "target": {
        "key": "81fb44f0bbd9e38e467461aed50ded48f2301ee0b0d553a1d0bc5a8a07cd0263"
      }
    }
  ],
  "extra": [
    1, ..., 78
  ],
  "rct_signatures": {
    "type": 0
  }
}

New using get_transactions with the miner tx hash obtained above:

curl -d '{"txs_hashes":["c37d119798660baed9ee62b3fc7323f98487b2e9c6a155be843e238e31fdb415"],"decode_as_json":true}' \
  http://localhost:28081/get_transactions \
  | jq .txs[0].as_json | jq -r
{
  "version": 2, 
  "unlock_time": 1234627, 
  "vin": [ {
      "gen": {
        "height": 1234567
      }
    }
  ], 
  "vout": [ {
      "amount": 6059550665332, 
      "target": {
        "key": "81fb44f0bbd9e38e467461aed50ded48f2301ee0b0d553a1d0bc5a8a07cd0263"
      }
    }
  ], 
  "extra": [ 1, ..., 78
  ], 
  "rct_signatures": {
    "type": 0
  }
}

Identical.