Skip to content

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

Merged
DeckerSU merged 6 commits intostatic-experimentalfrom
patch-new-valuepools
Nov 29, 2023
Merged

add chain supply, transparent and burned coins value pools#65
DeckerSU merged 6 commits intostatic-experimentalfrom
patch-new-valuepools

Conversation

@DeckerSU
Copy link
Copy Markdown
Owner

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.

oxarbitrage and others added 6 commits November 17, 2023 22:56
Co-authored-by: Jack Grigg <jack@z.cash>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
from 0.8.1.3 diskblockindex have new fields, related to chain
supply caused by this block and delta in the transparent pool produced
by the action of the transparent inputs to and outputs from
transactions in this block.

See the: TRANSPARENT_VALUE_VERSION constant.
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 changed the title add chain supply, transparen and burned coins value pools add chain supply, transparent and burned coins value pools Nov 22, 2023
@DeckerSU DeckerSU merged commit 7044f9b into static-experimental Nov 29, 2023
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.

2 participants