2

Here is an output from getrawtransaction:

{
  "txid": "a2b9e3aa4adeb68a9b8b8b0bbc8d4890585cd711e89cda83e7f236397fac6218",
  "hash": "6d96c04d49eefe3eab4934188841ef3592c818bf789517b90b1f71ff75a14c26",
  "version": 2,
  "size": 183,
  "vsize": 156,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "02b0010101",
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 12.50000000,
      "n": 0,
      "scriptPubKey": {
    "asm": "03d81b3d2ac76e322dcb2e713cb8fdeaf68cb83406c0e4d28dcd10a880ef172a6a OP_CHECKSIG",
    "hex": "2103d81b3d2ac76e322dcb2e713cb8fdeaf68cb83406c0e4d28dcd10a880ef172a6aac",
    "reqSigs": 1,
    "type": "pubkey",
    "addresses": [
      "mwzWcEU4kBkJPSTgB8LSBfvyaEjdXmyGh7"
    ]
      }
    }, 
    {
      "value": 0.00000000,
      "n": 1,
      "scriptPubKey": {
    "asm": "OP_RETURN aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "hex": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "type": "nulldata"
      }
    }
  ],
  "hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0502b0010101ffffffff02807c814a00000000232103d81b3d2ac76e322dcb2e713cb8fdeaf68cb83406c0e4d28dcd10a880ef172a6aac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
  "blockhash": "4742b345fb92ce66f5fccaa880ebef29ebe44d8649114ddb06c4f7177047a717",
  "confirmations": 1,
  "time": 1512718207,
  "blocktime": 1512718207
}

I am interested in this bit:

{
  "value": 0.00000000,
  "n": 1,
  "scriptPubKey": {
    "asm": "OP_RETURN aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "hex": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "type": "nulldata"
  }
}

Who created it? (I am using regtest mode)

3

You did, presumably.

The transaction you're showing is the coinbase; it's a special transaction added by the miner. The OP_RETURN output is the SegWit block commitment. It is the Merkle root of all transactions' wtxid (a txid that includes the witnesses), thereby making sure that the block commits to all witnesses.

When running in regtest mode, you probably directly or indirectly from a script called the generate RPC call, which produces a new block. If there were any SegWit transactions in the block, the commitment is mandatory (and optional otherwise).

  • If I'm following you answer correctly, I don't have any SegWit outputs in my regtest block. The block has only the coinbase tx. And this tx's single output is to a legacy m address (thus not SegWit). Still I get an OP_RETURN and its data is not a utf8 string. – Thalis K. Apr 18 at 16:24
  • 2
    The segwit commitment is always created, even when there are no segwit transactions. It is not mandatory (a block without witnesses is permitted not to have such a commitment), but Bitcoin Core will always create it. It's not expected to be human readable or a string; it contains a hash of the wtxid merkle root. – Pieter Wuille Apr 18 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.