Bitcoin Forum
June 30, 2024, 09:34:15 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Masternodes] How to get the block rewards programmatically using RPC calls ?  (Read 99 times)
Deevibe (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
September 04, 2018, 06:34:15 PM
 #1

Hello,

I'm currently trying to develop a Masternode monitoring tool but I'm facing a problem I can't actually solve. Most of the MN coins are also PoW or PoS which means that the rewards perceived by the masternode are not 100% of the block rewards. I'm trying trough RPC (wallet debug console) to get that split amout whitout actually having to store it in my database.

Every MN coin has on his website a table showing the rewards through time. Something like that :

BlocksRewards
71401 — 262800    20 GIC
(4 GIC PoS + 16 GIC MN)
262801 — 525600    10 GIC
(2 GIC PoS + 8 GIC MN)

I want to be able to retrieve those number based on the current block. Or even better, get those directly with an RPC command.
I managed to find the following command
Code:
getblocktemplate

which gives me the following result :

Code:
{
  "capabilities": [
    "proposal"
  ],
  "version": 536870912,
  "rules": [
    "dip0001"
  ],
  "vbavailable": {
  },
  "vbrequired": 0,
  "previousblockhash": "0000000002336b6cdc1ed91044c5c3ef8edb216d960223e96d9c83f3ee7e5c68",
  "transactions": [
  ],
  "coinbaseaux": {
    "flags": ""
  },
  "coinbasevalue": 700000000,
  "longpollid": "0000000002336b6cdc1ed91044c5c3ef8edb216d960223e96d9c83f3ee7e5c68348",
  "target": "000000000547b700000000000000000000000000000000000000000000000000",
  "mintime": 1536085062,
  "mutable": [
    "time",
    "transactions",
    "prevblock"
  ],
  "noncerange": "00000000ffffffff",
  "sigoplimit": 40000,
  "sizelimit": 2000000,
  "curtime": 1536085594,
  "bits": "1c0547b7",
  "height": 141766,
  "masternode": {
    "payee": "GdSyNs5uaKmTQZjZz6XiqXituDxFd78HVq",
    "script": "76a914d70b6b963e602eed6d028e51f55a15f5aa859e3d88ac",
    "amount": 383250000
  },
  "masternode_payments_started": true,
  "masternode_payments_enforced": false,
  "superblock": [
  ],
  "superblocks_started": false,
  "superblocks_enabled": false
}

Which is perfect as I can look the current MN reward in masternode -> amount. But this command only works on a very few coins and for the vast majority of other coins, I get the following result :
Code:
error: {"code":-7,"message":"Out of memory"}

Is there an other command to retrieve that information or do I have to store the rewards structure in my database ? (Which is not ideal because a lot of coins are changing their structure down the road)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!