handshake-org / handshake-org/hsd

ChainDB "burned" value could be improved

Open
#380 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
306
PR merge metrics
No merged PRs in 30d

Description

The `burned` value in chainstate is only updated when a name is REGISTERED. However, many users will buy a name and may not ever register (if they just want to hold the name for its own value). Users are incentivized to REGISTER at least once, because that is how they get their "change" back from the second-highest-bid. However, they might never do that.

A much more accurate measure of the perma-locked value is in the value of all names on the chain. Even in the middle of the reveal process this value will be up-to-the-minute accurate and may provide a more accurate picture of the circulating coin supply.

Example from this moment, height `4510`:

```
$ hsd-cli info
{
...
"state": {
"tx": 69238,
"coin": 53258,
"value": 259685422871882,
"burned": 199207850000
}
}

$ hsd-rpc getnames | jq '.[] | .value' | paste -sd+ | bc
828334841958
```

The locked value of all names on chain is actually `629,126.991958 HNS` higher than what chainDB reports based only on REGISTERs

Contributor guide

Open the contributing guide

Research direction

Start by tracing the ChainDB chainstate update for the `burned` value and compare it with the name values returned by `hsd-rpc getnames`. Use `hsd-cli info` at a known chain height to verify the accounting, and consider the work done when the reported locked value reflects the relevant on-chain names rather than only REGISTER transactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.