user132173: I'm running a bitcoin node on regtest. I'm writing scripts to interact with the chain-state database.
For my purpose, I'm creating, signing and sending a transaction to my node (pretty much following the instructions from here, specifically chapter 4 and 8)
{
  "amount": 0.00000000,
  "fee": -14.28700000,
  "confirmations": 200,
  "blockhash": "41dd1e98ab12148e8cd5c0ad06aab27beb4117f54b1e51916b7238535884cac2",
  "blockheight": 1001,
  "blockindex": 1,
  "blocktime": 1644326961,
  "txid": "9286a6f8e3814977efa6acd6320a4d4367f0bed85f9477c78da6c122086f49df",
  "walletconflicts": [
  ],
  "time": 1644326955,
  "timereceived": 1644326955,
  "bip125-replaceable": "no",
  "details": [
    {
      "category": "send",
      "amount": 0.00000000,
      "vout": 0,
      "fee": -14.28700000,
      "abandoned": false
    }
  ],
  "hex": "..."
}

Below is the transaction outputs:
 "vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 6268696a6b6c0a",
        "hex": "6a076268696a6b6c0a",
        "type": "nulldata"
      }
    },
    {
      "value": 10.71300000,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 e2698bbd6d475f022f8e5f852fa10ac761faa9c7",
        "hex": "0014e2698bbd6d475f022f8e5f852fa10ac761faa9c7",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": [
          "bcrt1quf5ch0tdga0sytuwt7zjlgg2casl42w8c2pr6d"
        ]
      }
    }
  ]

My problem: When I query the chainstate database and decode the TXIDs and output indexes, I see only the second output and not the first (i.e. the OP_RETURN one). I've retried on clean slate, other wallets, etc, but the problem still persists.
I've read 200 confirmations is as good as go, but I've tried the same after generating 400 more blocks too. Even still, that doesnt explain why I cant find my OP_RETURN UTXO in the chainstate folder.
For reference, this is my Python script that queries the chainstate folder:
db=plyvel.DB(chainstate_folder_path,compression=None)
arr=[]
for key,value in db:
    hexval=key.replace(b'C',b'')[::-1].hex()
    arr.append((int(hexval[:2]),hexval[2:]))

arr.sort(key=lambda x:x[1])
for i in arr:
    print(i)

What am I missing out? I really want to be able to parse my OP_RETURN UTXOs.

user101498: Since OP_RETURN are "provably" unspendable they are not stored in the chainstate database (nor cached in RAM).
If you want to see your OP_RETURN outputs you'll have to parse the block chain (or use -txindex and getrawtransaction on your node).

132173: <p>I'm running a bitcoin node on regtest. I'm writing scripts to interact with the chain-state database.</p>
<p>For my purpose, I'm creating, signing and sending a transaction to my node (pretty much following the instructions from <a href="https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line" rel="nofollow noreferrer">here, specifically chapter 4 and 8</a>)</p>
<pre><code>{
  &quot;amount&quot;: 0.00000000,
  &quot;fee&quot;: -14.28700000,
  &quot;confirmations&quot;: 200,
  &quot;blockhash&quot;: &quot;41dd1e98ab12148e8cd5c0ad06aab27beb4117f54b1e51916b7238535884cac2&quot;,
  &quot;blockheight&quot;: 1001,
  &quot;blockindex&quot;: 1,
  &quot;blocktime&quot;: 1644326961,
  &quot;txid&quot;: &quot;9286a6f8e3814977efa6acd6320a4d4367f0bed85f9477c78da6c122086f49df&quot;,
  &quot;walletconflicts&quot;: [
  ],
  &quot;time&quot;: 1644326955,
  &quot;timereceived&quot;: 1644326955,
  &quot;bip125-replaceable&quot;: &quot;no&quot;,
  &quot;details&quot;: [
    {
      &quot;category&quot;: &quot;send&quot;,
      &quot;amount&quot;: 0.00000000,
      &quot;vout&quot;: 0,
      &quot;fee&quot;: -14.28700000,
      &quot;abandoned&quot;: false
    }
  ],
  &quot;hex&quot;: &quot;...&quot;
}
</code></pre>
<p>Below is the transaction outputs:</p>
<pre><code> &quot;vout&quot;: [
    {
      &quot;value&quot;: 0.00000000,
      &quot;n&quot;: 0,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;OP_RETURN 6268696a6b6c0a&quot;,
        &quot;hex&quot;: &quot;6a076268696a6b6c0a&quot;,
        &quot;type&quot;: &quot;nulldata&quot;
      }
    },
    {
      &quot;value&quot;: 10.71300000,
      &quot;n&quot;: 1,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;0 e2698bbd6d475f022f8e5f852fa10ac761faa9c7&quot;,
        &quot;hex&quot;: &quot;0014e2698bbd6d475f022f8e5f852fa10ac761faa9c7&quot;,
        &quot;reqSigs&quot;: 1,
        &quot;type&quot;: &quot;witness_v0_keyhash&quot;,
        &quot;addresses&quot;: [
          &quot;bcrt1quf5ch0tdga0sytuwt7zjlgg2casl42w8c2pr6d&quot;
        ]
      }
    }
  ]
</code></pre>
<p><strong>My problem:</strong> When I query the chainstate database and decode the TXIDs and output indexes, I see only the second output and not the first (i.e. the OP_RETURN one). I've retried on clean slate, other wallets, etc, but the problem still persists.</p>
<p>I've read 200 confirmations is as good as go, but I've tried the same after generating 400 more blocks too. Even still, that doesnt explain why I cant find my OP_RETURN UTXO in the chainstate folder.</p>
<p>For reference, this is my Python script that queries the chainstate folder:</p>
<pre><code>db=plyvel.DB(chainstate_folder_path,compression=None)
arr=[]
for key,value in db:
    hexval=key.replace(b'C',b'')[::-1].hex()
    arr.append((int(hexval[:2]),hexval[2:]))

arr.sort(key=lambda x:x[1])
for i in arr:
    print(i)
</code></pre>
<p>What am I missing out? I really want to be able to parse my OP_RETURN UTXOs.</p>
 101498: <p>Since <code>OP_RETURN</code> are <a href="https://github.com/bitcoin/bitcoin/blob/280a7777d3a368101d667a80ebc536e95abb2f8c/src/script/script.h#L539-L547" rel="nofollow noreferrer">&quot;provably&quot; unspendable</a> they are not stored in the chainstate database (nor cached in RAM).</p>
<p>If you want to see your <code>OP_RETURN</code> outputs you'll have to parse the block chain (or use <code>-txindex</code> and <code>getrawtransaction</code> on your node).</p>
