blockcore-explorer icon indicating copy to clipboard operation
blockcore-explorer copied to clipboard

Show Current Block Reward

Open MudDev opened this issue 5 years ago • 9 comments

With chains like x42 BTC and XDS, where the rewards decrease over time the information is outdated on the network page.

Is it possible to get the reward from the highest tip block instead of the consensus?

Example, for x42, It shows 20 here when the reward today is 2 image

MudDev avatar Jun 24 '20 14:06 MudDev

I thought about this when I first made this, there might be rules (logic) implemented that will change this at random, or based on any kind of logic. Not sure how we can find the correct reward considering that PoW, PoS (hot and cold) creates different coinbase structures.

This is under the section: "Configuration (Consensus)", which is only showing the "hardwired" consensus rules for the network, it's not retrieved from the actual chain.

So one option could be to hide it depending on chain settings? Or even having a manual configuration value is also a way to do it.

sondreb avatar Jun 24 '20 15:06 sondreb

But if the block was accepted by the network, wouldn't that mean it fits the consensus rules so it would be fine to be dynamic. You wont have a PoW and a PoS reward in a single block...

EDIT: I seeeeeeeeee..... It could be random... Might need some manual config. :laughing::laughing:

MudDev avatar Jun 24 '20 16:06 MudDev

Would require different logic, take this latest block on x42 I just picked:

https://explorer.blockcore.net/x42/explorer/transaction/13b36908bcaa55cc2a0a02f97a4bfae652bc0ca0e56e614df1d853c30597cd3b

The actual coinbase transaction has 0 coins output.

The second transaction is this:

https://explorer.blockcore.net/x42/explorer/transaction/0fc829a0af2016dbbc31b24d27ca62d7193e2b8c65d11b5eccebdbd2527a94e6

How is the indexer going to be able to see the reward from this?

Here is the JSON for this transaction:

{
"symbol": "X42",
"blockHash": "bb0b6ed41581aebba82918cb6191ccada4e751a1829f08cf1dc0b6bfc84b8f2a",
"blockIndex": 878606,
"timestamp": 1593025792,
"transactionId": "0fc829a0af2016dbbc31b24d27ca62d7193e2b8c65d11b5eccebdbd2527a94e6",
"confirmations": 3,
"isCoinbase": false,
"isCoinstake": true,
"lockTime": "Height : 0",
"rbf": false,
"version": 1,
"inputs": [
{
"inputIndex": 1,
"inputAddress": "XDno5dy5WpTNWnzxGqZAcULGM7Snui6Pvp",
"coinBase": null,
"inputTransactionId": "cf3cc470f0f57db2ac639ca020d70129dd07f90ac5c468678b7061617684e36d",
"scriptSig": "4830450221009c24c8647834c3049e99c41765eec0ac06f795e81f2ac00d4642a54b6324518402201471fd6b6c66b3ae96816a747f783607fe9ee0e86349e09b353e30343e86688a01",
"scriptSigAsm": "30450221009c24c8647834c3049e99c41765eec0ac06f795e81f2ac00d4642a54b6324518402201471fd6b6c66b3ae96816a747f783607fe9ee0e86349e09b353e30343e86688a01",
"witScript": "",
"sequenceLock": "4294967295"
}
],
"outputs": [
{
"address": null,
"balance": 0,
"index": 0,
"outputType": null,
"scriptPubKeyAsm": "",
"scriptPubKey": "",
"spentInTransaction": null
},
{
"address": "XDno5dy5WpTNWnzxGqZAcULGM7Snui6Pvp",
"balance": 36894240222,
"index": 1,
"outputType": "TX_PUBKEY",
"scriptPubKeyAsm": "0355ab312b4d1bdb22a00dabb679bfde38cdaa19ccdebbe1fb9ee92ab9d2e7ce8c OP_CHECKSIG",
"scriptPubKey": "210355ab312b4d1bdb22a00dabb679bfde38cdaa19ccdebbe1fb9ee92ab9d2e7ce8cac",
"spentInTransaction": null
}
]
}

sondreb avatar Jun 24 '20 19:06 sondreb

Are we missing an important feature in the indexer? When I look at this block here you posted on the old x42 explorer, I see the reward.

https://explorer.x42.tech/block/bb0b6ed41581aebba82918cb6191ccada4e751a1829f08cf1dc0b6bfc84b8f2a

@Dennis what explorer are you using for this?

MudDev avatar Jun 24 '20 19:06 MudDev

@dennis what explorer are you using for this?

iquidus

DennisAMenace avatar Jun 24 '20 20:06 DennisAMenace

@MudDev I am not the dennis you wish to notify :)

dennis avatar Jun 24 '20 21:06 dennis

@dangershony ? I can look at this perhaps later in the holiday.

sondreb avatar Jun 24 '20 21:06 sondreb

Ah this should be added to the RPC call for getblockchaininfo and then the indexer can serve the correct values. To get th correct value we need to fetch the coinview rule and call the method on there.

dangershony avatar Jun 24 '20 22:06 dangershony

You basically need to grab the coinstake transaction, take the output - input, and that is the block reward.

sondreb avatar Sep 26 '22 15:09 sondreb