Sprout Circuit Value Tracking

So new in version 1.0.14 is the ability to track the total amount of shielded ZEC in the Sprout circuit:

Nodes can now track the total amount of shielded ZEC inside the Sprout circuit. This is measured by adding up the ZEC moving between the Transparent Value Pool and JoinSplits (see Anatomy of a Zcash Transaction). getblockchaininfo shows the total for the entire chain, while getblock will show the total as of a specific block.

Running this I get:

 "valuePools": [
    {
      "id": "sprout",
      "monitored": true,
      "chainValue": 115983.42599566,
      "chainValueZat": 11598342599566
    }
  ]

So assuming I interpret this correctly there are ~116,000 ZEC in shielded addresses (out of ~ 3 Million ZEC in existence). So that’s around 4% of the total supply are actually in shielded addresses.

I’m wondering why the large discrepancy between this figure and https://explorer.zcha.in/statistics/network which has the shielded value at just ~58,000 ZEC?

1 Like

Possibly a bug in the explorer code?

You can also use this Python script.

It’s a bit slow, against a running install of zcashd, it took about 10 hours to count ~240,000 blocks.

python sproutcounter.py 396 433

    value entering sprout circuit    = 10.71830000
    value leaving sprout circuit     = 0.27450000
    shielded value in sprout circuit = 10.44380000

python sproutcounter.py 1 241964

    value entering sprout circuit    = 3634697.72584490
    value leaving sprout circuit     = 3510258.15050241
    shielded value in sprout circuit = 124439.57534249
3 Likes

Thanks for this I finally finished running that script :slightly_smiling_face:

python sproutcounter.py 1 250165
value entering sprout circuit    = 3739962.38428111
value leaving sprout circuit     = 3623772.34097587
shielded value in sprout circuit = 116190.04330524

which matches up exactly with the output from getblockchaininfo so I guess yeh it’s a bug with zcha.in.

{
  "chain": "main",
  "blocks": 250165,
  "headers": 250165,
  "bestblockhash": "000000000063e82f0be73e3d8bbe37eabab70537813c1ba1c0bea0c6e0cebd51",
  "difficulty": 6202728.051934351,
  "verificationprogress": 0.9999961872871392,
  "chainwork": "0000000000000000000000000000000000000000000000000016a309d6696912",
  "pruned": false,
  "commitments": 722400,
  "valuePools": [
    {
      "id": "sprout",
      "monitored": true,
      "chainValue": 116190.04330524,
      "chainValueZat": 11619004330524
    }
  ]
}
1 Like

@garethtdavies I saw your Medium post, well done!

With your experience with this new auditing tool, It would be great to have a article explanation of how it address the criticism of Zcashs lack of supply audit-ability.

It should also be noted that the Zchain explorer has been very buggy lately and the maintainers of it haven’t been heard from recently. I would suggest for anyone doing an audit use a different explorer like

https://zcashnetwork.info
https://zcash.blockexplorer.com
https://bitinfocharts.com/zcash/

2 Likes

Thanks @Shawn, I’m glad you brought this up as I was doing some thinking about it along those lines but wasn’t sure I was on the right track.

My primitive understanding is let’s assume someone can and has generated a gazillion ZEC we would only detect these when they are moved between the shielded and transparent pool and so someone theoretically could keep these undetected in a shielded address?

Also, I think on GitHub there are discussions/proposals about auditing the shielded value - I vaguely recall something about detecting a balance exceeding the # of mined ZEC when moving between Sprout and Sapling but can’t seem to locate it.

On that note is there an easy way to see the value of ZEC in the transparent pool? It’s obviously available as it’s in transparent addresses - I’m just curious if there is a simple way to generate this number.

That’s a long way of saying I’m far from understanding this topic but when I do I will definitely write about it!

1 Like

And you found that link I was after: https://github.com/zcash/zcash/issues/2248#issuecomment-292816770 in this thread: How is research on auditing the total number of coins going?

1 Like