This will likely turn into an endpoint request at the end, but will start as an exploration of how to best compile and serve data similar to the mining dashboards available now.
https://miamining.com
https://mining.nyc
Some of the raw data is available through API endpoints, but the file sizes are growing pretty large:
https://miamining.com/blocks
https://miamining.com/winners
https://miamining.com/stacking
Since the data is organized per block, I think this is a situation similar to #42 where we can take advantage of KV, although the logic is a bit more complex.
The KV key name could be mia-miningdata-{blocknumber}, with information stored for each block height since the contract activated.
The /blocks and /winners data above could be combined into one json record with a little more specificity:
{
"minersVerified": "boolean",
"miners": {
"address": "ustx",
"address": "ustx",
"address": "ustx",
"address": "ustx"
},
"winnerVerified": "boolean",
"winnerClaimed": "boolean",
"winner": {
"miner": "address",
"commitment": "ustx",
"reward": "citycoins",
}
}
miners keeps track of the list of miners who participated in that block, which can be found by querying and filtering the transactions, then extracting the addresses.
minersVerified is set to true sequentially after the last 200 blocks are accounted for and verified, due to mine-many transactions spanning up to 200 blocks. This should be monitored/updated by a cron script.
winner keeps track of the winning miner, commitment, reward, and whether they claimed it.
winnerVerified is set to true once the winner data is populated via is-block-winner, and indicates the winner properties are available.
winnerClaimed is based on querying the winning miner address against can-claim-mining-reward once the winning address is known. This should be separate as the miner doesn't have to claim right away.
Both data points should be monitored/updated by a cron script.
The resulting endpoint could take query parameters for start and end then aggregate the KV responses with promise.All(). It will be interesting to see how the performance scales here with how many blocks are returned at a time.
Stacking data could follow a similar format:
mia-stackingdata-{cycleid}
{
"amountToken": "citycoins",
"amountUstx": "ustx",
"firstBlock": "blockheight",
"lastBlock": "blockheight",
"complete": "boolean"
}
Side note - is it possible to know the number of Stacked addresses in a cycle? That's one interesting data point that doesn't exist here.
@Jamil would love to know if you have any additional input here!
This will likely turn into an endpoint request at the end, but will start as an exploration of how to best compile and serve data similar to the mining dashboards available now.
https://miamining.com
https://mining.nyc
Some of the raw data is available through API endpoints, but the file sizes are growing pretty large:
https://miamining.com/blocks
https://miamining.com/winners
https://miamining.com/stacking
Since the data is organized per block, I think this is a situation similar to #42 where we can take advantage of KV, although the logic is a bit more complex.
The KV key name could be
mia-miningdata-{blocknumber}, with information stored for each block height since the contract activated.The
/blocksand/winnersdata above could be combined into one json record with a little more specificity:{ "minersVerified": "boolean", "miners": { "address": "ustx", "address": "ustx", "address": "ustx", "address": "ustx" }, "winnerVerified": "boolean", "winnerClaimed": "boolean", "winner": { "miner": "address", "commitment": "ustx", "reward": "citycoins", } }minerskeeps track of the list of miners who participated in that block, which can be found by querying and filtering the transactions, then extracting the addresses.minersVerifiedis set to true sequentially after the last 200 blocks are accounted for and verified, due to mine-many transactions spanning up to 200 blocks. This should be monitored/updated by a cron script.winnerkeeps track of the winning miner, commitment, reward, and whether they claimed it.winnerVerifiedis set to true once the winner data is populated viais-block-winner, and indicates thewinnerproperties are available.winnerClaimedis based on querying the winning miner address againstcan-claim-mining-rewardonce the winning address is known. This should be separate as the miner doesn't have to claim right away.Both data points should be monitored/updated by a cron script.
The resulting endpoint could take query parameters for
startandendthen aggregate the KV responses withpromise.All(). It will be interesting to see how the performance scales here with how many blocks are returned at a time.Stacking data could follow a similar format:
mia-stackingdata-{cycleid}{ "amountToken": "citycoins", "amountUstx": "ustx", "firstBlock": "blockheight", "lastBlock": "blockheight", "complete": "boolean" }Side note - is it possible to know the number of Stacked addresses in a cycle? That's one interesting data point that doesn't exist here.
@Jamil would love to know if you have any additional input here!