team-exor / eiquidus

Feature-rich open-source altcoin block explorer. Regular Updates ~ Platform Independent ~ Mobile Friendly ~ Supports Themes, Markets, Charts, Claiming Addresses, Public API's, Custom RPC Cmds, Bitcoin, Heavycoin, zk-SNARKs ~ List Masternodes, Network Peers, Top 100 Wallets ~ Built-in Update Script ~ Highly Customizable
https://explorer.exor.io
BSD 3-Clause "New" or "Revised" License
90 stars 186 forks source link

Burned coins vs. circulating supply #18

Open deadthings opened 2 years ago

deadthings commented 2 years ago

Bug report (of sorts???): When adding a burn address to settings.json, it does in fact create the "Burned Coins" category in the Wealth Distribution table as expected. It does not, however, remove the coins in that address from the quantity reported in the coin_supply_panel. I imagine this is by design, but would like to open a discussion at least to suggest that burned coins should be subtracted from circulating supply so long as they continue to be categorized as burned (i.e., COINBASE [in our case] minus "Burned Coins").

If somehow they get spent through hack or crack, they will wind up in some other address. And since the explorer depends on address to determine burn status, they will re-enter circulating supply automatically once a richlist-reindex is done, no? I just feel like while they are burnt, they should not count towards circulating supply. Thoughts?

joeuhren commented 2 years ago

As you may have already deduced, the burned coins option under the wealth_distribution option only affects the totals on the top 100/richlist page, it was never designed to remove coins from the coin supply and would require another layer of complexity to achieve.

For my own coin project, I figured it would be confusing to see a different supply value in the wallet vs the explorer so I chose to subtract the burned coins from the total supply in the blockchain itself. I'm not sure the best way to remedy that confusion if you were to subtract the burned coins from the supply in the explorer only, maybe by displaying 2 supply values? Real supply and Burned supply? I personally don't like it, but maybe there will be some better ideas.

As far as getting the explorer to display the burned supply, I can think of a couple different ways to accomplish that:

  1. Create a new function that will lookup all burned coin addresses in the mongo addresses database and return the sum of all burned address balances. This function would need to be called after every block sync to subtract that value from the running supply value.

  2. An alternate option might be to add a new if statement somewhere in the sync code that will check if the current tx being synced includes a burned address on the sending or receiving end and save the amount going in or out from that address to a running total. At the end of the sync, add that total to a new burned coin total in the stats database. Then, every time the current supply is to be shown, it will return the real supply minus burned coins. This option would either require a resync or probably better to create a new function that can be run on demand to get the sum of all burned coin balances and save it to the database.

Also, as far as burned coins being spent through some kind of hack, that would be quite the feat given that burn addresses should be provably unspendable using a special wallet address like the generic-unspendable script generates where the private key for the burn address is impossible to generate and therefore can never be spent.

joeuhren commented 1 year ago

Please note that this request has been added to Exor's public task list and development will begin as soon as the funding goal has been met.

View more details here: https://exor.io/task?id=4&tid=716efb051f527992b5994ed4a3801b35b35825f2