Skip to content

add chain supply, transparent and burned coins value pools#609

Merged
ca333 merged 7 commits intodevfrom
patch-new-valuepools
Jan 26, 2024
Merged

add chain supply, transparent and burned coins value pools#609
ca333 merged 7 commits intodevfrom
patch-new-valuepools

Conversation

@DeckerSU
Copy link
Copy Markdown

This PR introduces transparent and burned value pools to the getblockchaininfo and getblock RPC output. This allows you to view the total value statistics of the transparent value pool up to and including the last (or given) block, as well as the same statistics for burned (with OP_RETURN) coins, etc. To enable this monitoring, you'll need to either sync the chain from scratch or reindex the existing blockchain. Please note that after running a version of the daemon with these changes, it's not recommended to revert to an older version of the daemon using the same blockchain data folder. This is because the newer version introduces changes in the CDiskBlockIndex (de)serialization.

The example of such statistics output for getblockchaininfo:

  "chainSupply": {
    "monitored": true,
    "chainValue": 102275770.19701314,
    "chainValueZat": 10227577019701314
  },
  "valuePools": [
    {
      "id": "transparent",
      "monitored": true,
      "chainValue": 102358500.86915928,
      "chainValueZat": 10235850086915928
    },
    {
      "id": "sprout",
      "monitored": true,
      "chainValue": 1501.85954926,
      "chainValueZat": 150185954926
    },
    {
      "id": "sapling",
      "monitored": true,
      "chainValue": 0,
      "chainValueZat": 0
    },
    {
      "id": "burned",
      "monitored": true,
      "chainValue": 401213.55488257,
      "chainValueZat": 40121355488257
    }
  ],

Also, please note that the chainSupply amount only includes coinbase outputs and does not account for coins created by interest (rewards). This is why the values of chainSupply and transparent differ.

Burned coins refer to coins that are involved in transactions like the following:

{
  "txid": "e363f3ae4547dc4262d6e09c1a5113ac1d9d148320e61b03096f023a1a76053e",
  "overwintered": false,
  "version": 1,
  "locktime": 0,
  "vin": [
  ],
  "vout": [
    {
      "value": 1.00000000,
      "valueZat": 100000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 6465636b6572",
        "hex": "6a066465636b6572",
        "type": "nulldata"
      }
    }
  ],
  "vjoinsplit": [
  ]
}

In the example above, we see the burning of 1 COIN as the OP_RETURN outputs are unspendable, meaning this coin is effectively burned.

Corresponding PR in KomodoOcean codebase: DeckerSU/KomodoOcean#65

oxarbitrage and others added 5 commits November 29, 2023 14:21
Co-authored-by: Jack Grigg <jack@z.cash>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
burned coins refer to the value sent for OP_RETURN scripts:
```
"vout": [
...
    {
      "value": 2.00000000,
      "valueZat": 200000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_RETURN 6465636b6572",
        "hex": "6a066465636b6572",
        "type": "nulldata"
      }
    }
  ],
  "vjoinsplit": [
  ]
```
burned coins are also excluded from transparent pool.
this update activates burned coins value pool, see: BURNED_VALUE_VERSION
@DeckerSU DeckerSU requested review from Alrighttt and ca333 November 29, 2023 13:50
The change was made solely for debugging purposes and was
accidentally included in the PR. We are now reverting that change.
@ca333 ca333 merged commit f8fa475 into dev Jan 26, 2024
Alrighttt pushed a commit to Alrighttt/komodo that referenced this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants