<p>You did, presumably.</p>

<p>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.</p>

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

CC BY-SA 4.0
2019-04-18T16:24:31.483Z
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.
thalisk
CC BY-SA 4.0
2019-04-18T17:14:14.070Z
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
CC BY-SA 3.0
2018-01-03T09:41:15.460Z
2018-01-03T09:41:15.460Z
Pieter Wuille
<p>Here is an output from <code>getrawtransaction</code>: </p>

<pre><code>{
  "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
}
</code></pre>

<p>I am interested in this bit:</p>

<pre><code>{
  "value": 0.00000000,
  "n": 1,
  "scriptPubKey": {
    "asm": "OP_RETURN aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "hex": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
    "type": "nulldata"
  }
}
</code></pre>

<p>Who created it? (I am using <code>regtest</code> mode)</p>

<bitcoind><json-rpc><segregated-witness><op-return>
Why is there an output with op-return in regtest mode?
Jus12
# Why is there an output with op-return in regtest mode?

(Asked by: username_0 on 2017-12-08)

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)

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


---

## 1 answers

### Answer by username_1 on 2018-01-03. Score: 4 | Accepted answer

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).

> **Comments:**
> **username_2**: 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.  
> **username_1**: 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.  

---

