UOS共识节点收益计算

UOS的共识节点,奖池有三个:uosio.bvpay、uosio.bpay 、uosio.vpay
他们之间的关系是,uosio.bvpay是奖池源头,uosio.bpay是出块奖池,uosio.vpay是投票奖池。

bvpay.jpg

uosio.bvpay奖池源奖金的0.8将会进入出块奖池,奖池源的0.2将会进入投票奖池。
查看总奖池:

cluos --url http://rpc.uos.iccob.com:9008 get table uosio.bvpay uosio.bvpay bpvtpay
{
  "rows": [{
      "id": 0,
      "start_line": 1554185715,
      "laster_line": 1554340049,
      "dead_line": 1556777715,
      "inherit": "0.0000 UOS",
      "quantity": "244518.9665 UOS"
    },{
      "id": 1,
      "start_line": 1556777715,
      "laster_line": 1556777715,
      "dead_line": 1559369715,
      "inherit": "0.0000 UOS",
      "quantity": "0.0000 UOS"
    }
  ],
  "more": false
}

curl命令:

curl --request POST \
--url http://rpc.uos.iccob.com:9008/v1/chain/get_table_rows \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"code":"uosio.bvpay","table":"bpvtpay","scope":"uosio.bvpay","json": true}'

id = 0代表当前奖励周期,id = 1代表下一次奖励周期,周期长度为30天。
假如现在的时间戳在周期0内,那么bp发起一次领奖,能领取多少钱呢?
假设为领取时刻为t,则奖池源发放的奖金为:

out_all = (t - laster_line_0) * quantity_0 * 10000 / (dead_line_0 - laster_line_0);  (1)

奖金会分为两部分流入uosio.bpay与uosio.vpay。其中,0.8*out_all 进入uosio.bpay,0.2进入uosio.vpay。
查看系统合约global参数:

cluos --url http://rpc.uos.iccob.com:9008 get table uosio uosio global
{
  "rows": [{
      "max_block_net_usage": 2097152,
      "target_block_net_usage_pct": 1000,
      "max_transaction_net_usage": 524288,
      "base_per_transaction_net_usage": 12,
      "net_usage_leeway": 500,
      "context_free_discount_net_usage_num": 20,
      "context_free_discount_net_usage_den": 100,
      "max_block_cpu_usage": 450000,
      "target_block_cpu_usage_pct": 1000,
      "max_transaction_cpu_usage": 150000,
      "min_transaction_cpu_usage": 100,
      "max_transaction_lifetime": 3600,
      "deferred_trx_expiration_window": 600,
      "max_transaction_delay": 3888000,
      "max_inline_action_size": 4096,
      "max_inline_action_depth": 4,
      "max_authority_depth": 6,
      "max_ram_size": "8589934592",
      "total_ram_bytes_reserved": "4607367427",
      "total_ram_stake": "57844214019",
      "last_producer_schedule_update": "2019-04-04T05:46:45.000",
      "last_pervote_bucket_fill": "1554340049000000",
      "pervote_bucket": 27244585,
      "perblock_bucket": 100966841,
      "total_unpaid_blocks": 183296,
      "total_activated_stake": "29178000000",
      "thresh_activated_stake_time": "1548746649000000",
      "last_producer_schedule_size": 12,
      "total_producer_vote_weight": "28178000000.00000000000000000",
      "last_name_close": "2019-04-03T10:10:13.000"
    }
  ],
  "more": false
}

curl命令:

curl --request POST \
--url http://rpc.uos.iccob.com:9008/v1/chain/get_table_rows \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"code":"uosio","table":"global","scope":"uosio","json": true}'

里面有4个参数与奖励有关

"pervote_bucket": 27244585  --- 当前投票奖励资金池
"perblock_bucket": 100966841 --- 当前块奖励资金池
"total_unpaid_blocks": 183296 --- 当前未结算的区块数
"total_producer_vote_weight": "28178000000.00000000000000000" --- 当前投票总量

下面查看bp的具体情况,以“uoskkkkonebp”为例:

cluos --url http://rpc.uos.iccob.com:9008 get table -l 1 -L uoskkkkonebp --index 1 uosio uosio producers
{
  "rows": [{
      "owner": "uoskkkkonebp",
      "total_votes": "1000000000.00000000000000000",
      "producer_key": "UOS8VjUQXSovjJ5LuubcAUK9r5LYda7j5dLTJcfrBHm6VSP2L3d8Y",
      "is_active": 1,
      "is_remove": 0,
      "release": 0,
      "url": "https://uoskkkkonebp.com/chain",
      "unpaid_blocks": 7577,
      "last_claim_time": "1554259259000000",
      "location": 0,
      "ulord_addr": "UWKPFY3dVd1z5zHancEFLy2XYpawbZWHNn"
    }
  ],
  "more": true
}

curl:

curl --request POST \
--url http://rpc.uos.iccob.com:9008/v1/chain/get_table_rows \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"code":"uosio","table":"producers","scope":"uosio","json": true , "index_position":"primary","limit":1 , "lower_bound":"uoskkkkonebp"}'

uoskkkkonebp的获得票数为1000000000.00000000000000000,未结算的生产区块数量为7385,最后一次领取奖励的时间戳为:1554259259000000

那么如果t时刻(t > 1554259259000000 + 3600)
uoskkkkonebp能领取出块的奖励为m,则:

m =  (out_all*0.8 + perblock_bucket)*unpaid_blocks / total_unpaid_blocks   (2)

uoskkkkonebp能领取的投票奖励为n,则:

n= (out_all*0.2 + pervote_bucket)*total_votes / total_producer_vote_weight  (3)
注:当n >= 100 0000时,即投票奖励大于100UOS,n才有效,否则不会发放投票奖励

uoskkkkonebp能够领取的总奖励为:m+n ,由(1)、(2)、(3)式可算出,注意最后得到的单位是“分”,要转化为"元",需要除以10000.
总结:
从(1)式可以看出,总奖池放出量在一个周期内是均匀的,但是由于每个bp领取的时间点不同,每个人计算得到的奖励是不同的。

你可能感兴趣的:(UOS共识节点收益计算)