MyHush / hush3

Hush: Speak And Transact Freely
https://myhush.org
Other
15 stars 13 forks source link

Add shielded stats to getchaintxstats via zindex #27

Closed leto closed 5 years ago

leto commented 5 years ago

WIP, but getting close to mergability.

This attempts to add both transaction stats and payment stats, where one transaction can have many payments.

TODO:

NOTE: This RPC output format is expected to change. Current key names we inherited from Bitcoin are confusing and I will standardize/organize things in a better way. The main level keys all apply to the entire transaction set, while the shielded_only section gives breakdowns of types of shielded transactions, just inside the shielded tx set.

Example output from HUSH mainnet:

{
  "time": 1566216369,
  "txcount": 159288,
  "shielded_txcount": 6268,
  "fully_shielded_txcount": 38,
  "deshielding_txcount": 3250,
  "shielding_txcount": 2980,
  "shielded_payments": 6681,
  "fully_shielded_payments": 48,
  "deshielding_payments": 829,
  "shielding_payments": 5804,
  "window_final_block_hash": "00000001b5c2fb603ebc3b392edfe906522db90ab5b3dfeb2103cfff34469445",
  "window_final_block_height": 73355,
  "window_block_count": 17280,
  "window_interval": 2606257,
  "window_txcount": 30619,
  "window_payments": 95946,
  "window_fully_shielded_payments": 25,
  "window_shielded_payments": 2760,
  "window_shielding_payments": 2654,
  "window_deshielding_payments": 81,
  "txrate": 0.0117482658080151,
  "shielded_txrate": 0.001052467197210406,
  "fully_shielded_txrate": 5.755380225357668e-06,
  "paymentrate": 0.03681371407347779,
  "shielded_paymentrate": 0.001058989961465811,
  "fully_shielded_paymentrate": 9.592300375596113e-06,
  "shielded_tx_percent": 0,
  "fully_shielded_tx_percent": 0,
  "shielding_tx_percent": 0,
  "deshielding_tx_percent": 0,
  "shielded_payments_percent": 0,
  "fully_shielded_payments_percent": 0,
  "shielding_payments_percent": 0,
  "deshielding_payments_percent": 0,
  "shielded_only": {
    "fully_shielded_tx_percent": 0.005468465184104995,
    "shielding_tx_percent": 0.4673714910681736,
    "deshielding_tx_percent": 0.5271600437477215,
    "fully_shielded_payments_percent": 0.009057971014492754,
    "shielding_payments_percent": 0.9615942028985507,
    "deshielding_payments_percent": 0.02934782608695652
  }
}