lmao.
QUESTION : how does the block reward work for this coin
first hundred block reward does not seem to match the code.
https://github.com/vcoin-z/virtualcoin/blob/9.2.0/src/main.cpp#L1324or i forked it also
https://github.com/bumbacoin/virtualcoin/blob/9.2.0/src/main.cpp#L1324for some random reason dev sent me 100k VC.
i had looked at block rewards previously, and i obviously don't fully appreciate their subtlety.
but it appears on a cursory inspection that the max block reward is 50 coins, so for the life of me i dinna ken where 100k would've come from to be randomly sent to me.
so, lacking a block explorer. i restarted my daemon with -txindex. and what do you know, the 2nd block has a reward of 1.7 million coins..
in fact i checked a few, and my guess is the first hundred blocks all have a reward of 1.7 million coins.
lolllll.
$ vc getblockhash 2
00000ae78dc793126ce402a0f29c306a10841203ca64db321fcf647ca8467c04$ vc getblock
00000ae78dc793126ce402a0f29c306a10841203ca64db321fcf647ca8467c04{
"hash" : "00000ae78dc793126ce402a0f29c306a10841203ca64db321fcf647ca8467c04",
"confirmations" : 2087,
"size" : 186,
"height" : 2,
"version" : 2,
"merkleroot" : "d6235f5deb62e6ca23dfc9203ba1e0ee477d4088ea0cfb1286655a1de17ee8d7",
"tx" : [
"
d6235f5deb62e6ca23dfc9203ba1e0ee477d4088ea0cfb1286655a1de17ee8d7"
],
"time" : 1483982277,
"nonce" : 106043,
"bits" : "1e0ffff0",
"difficulty" : 0.00024414,
"previousblockhash" : "000000298e2128eec401430714db3f2307cca97095515b7db6fc1e1bd21b3268",
"nextblockhash" : "00000244279a02ab4f24701eee130e77487f5e5666db28f16820ffe2f3bde621"
}
$ vc getrawtransaction
d6235f5deb62e6ca23dfc9203ba1e0ee477d4088ea0cfb1286655a1de17ee8d701000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0a520101062f503253482fffffffff010009695e1fa100002321032334dee83783497ec60687
654727893f81c5a5834a45f157d7d6e3abaff5115dac00000000
$ vc decoderawtransaction 01000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0a520101062f503253482fffffffff010009695e1fa100002321032334dee83783497ec60687
654727893f81c5a5834a45f157d7d6e3abaff5115dac00000000
{
"txid" : "d6235f5deb62e6ca23dfc9203ba1e0ee477d4088ea0cfb1286655a1de17ee8d7",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"coinbase" : "520101062f503253482f",
"sequence" : 4294967295
}
],
"vout" : [
{
"value" :
1771561.00000000, "n" : 0,
"scriptPubKey" : {
"asm" : "032334dee83783497ec60687654727893f81c5a5834a45f157d7d6e3abaff5115d OP_CHECKSIG",
"hex" : "21032334dee83783497ec60687654727893f81c5a5834a45f157d7d6e3abaff5115dac",
"reqSigs" : 1,
"type" : "pubkey",
"addresses" : [
"VWwF9YVbDo1X2jkYKSp291H3ikebApN3c5"
]
}
}
]
}
there's a mention of block 100 in the main.cpp, so i figured the rewards probably switch around then. so i tried block 99
# vc getblockhash 99
00000ddad8db4b6092456cc37cecae44ecb726172590022b592a680a473302c8# vc getblock
00000ddad8db4b6092456cc37cecae44ecb726172590022b592a680a473302c8{
"hash" : "00000ddad8db4b6092456cc37cecae44ecb726172590022b592a680a473302c8",
"confirmations" : 1990,
"size" : 187,
"height" : 99,
"version" : 2,
"merkleroot" : "340d2ced8790b696e53353732f23bd5f255b9802f2d4e276c56a4c08cea78757",
"tx" : [
"
340d2ced8790b696e53353732f23bd5f255b9802f2d4e276c56a4c08cea78757"
],
"time" : 1483987796,
"nonce" : 40541,
"bits" : "1e0ffff0",
"difficulty" : 0.00024414,
"previousblockhash" : "00000d341a554a2730dcac08ba58b3794c10202aec1a58f88c5fc233574726e0",
"nextblockhash" : "00000035f3a8e1647c49937f6ad2d61bc0ffa95c894238d808023289d521a48d"
}
# vc getrawtransaction
340d2ced8790b696e53353732f23bd5f255b9802f2d4e276c56a4c08cea7875701000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0b01630102062f503253482fffffffff010009695e1fa10000232102738260e5f73e252efc54
af9688b56660e84834d3b1754d773d9d2196506117acac00000000
# vc decoderawtransaction 01000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0b01630102062f503253482fffffffff010009695e1fa10000232102738260e5f73e252efc54
af9688b56660e84834d3b1754d773d9d2196506117acac00000000
{
"txid" : "340d2ced8790b696e53353732f23bd5f255b9802f2d4e276c56a4c08cea78757",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"coinbase" : "01630102062f503253482f",
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 1771561.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "02738260e5f73e252efc54af9688b56660e84834d3b1754d773d9d2196506117ac OP_CHECKSIG",
"hex" : "2102738260e5f73e252efc54af9688b56660e84834d3b1754d773d9d2196506117acac",
"reqSigs" : 1,
"type" : "pubkey",
"addresses" : [
"VUGejSZayTRWLjnEVE5k7rsmtvYEZxq7fs"
]
}
}
]
}
similarly block 100 has a reward of 1771561.00000000 coins. but luckily, the madness stops there and block 101 goes to a 1 coin reward.
# vc getblockhash 101
0000066a8f4c086e7e7f9c50e971629ecdab93612ba2fb1a27dae419ebbd5a3b# vc getblock
0000066a8f4c086e7e7f9c50e971629ecdab93612ba2fb1a27dae419ebbd5a3b{
"hash" : "0000066a8f4c086e7e7f9c50e971629ecdab93612ba2fb1a27dae419ebbd5a3b",
"confirmations" : 1989,
"size" : 187,
"height" : 101,
"version" : 2,
"merkleroot" : "c72271ad042f7b89d69cbc44aba3a8bc1dcd9d2c8a410fb4d06a244f5eaa7124",
"tx" : [
"
c72271ad042f7b89d69cbc44aba3a8bc1dcd9d2c8a410fb4d06a244f5eaa7124"
],
"time" : 1483987960,
"nonce" : 131745,
"bits" : "1e0685ec",
"difficulty" : 0.00059882,
"previousblockhash" : "00000035f3a8e1647c49937f6ad2d61bc0ffa95c894238d808023289d521a48d",
"nextblockhash" : "0000008d17d6a4d2f3305f435130d1c3b8e92273a7638d00ea93bd5c52c50e76"
}
# vc getrawtransaction
c72271ad042f7b89d69cbc44aba3a8bc1dcd9d2c8a410fb4d06a244f5eaa712401000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0b01650102062f503253482fffffffff0100e1f5050000000023210318a65ca888eacfa2ab76
fad7e0509ebac6adb085f2ecc2dfb41c31cd108e8607ac00000000
root@eight:~/.virtualcoin# vc decoderawtransaction 01000000010000000000000000000000000000000000000000000000000000000000000000fffff
fff0b01650102062f503253482fffffffff0100e1f5050000000023210318a65ca888eacfa2ab76
fad7e0509ebac6adb085f2ecc2dfb41c31cd108e8607ac00000000
{
"txid" : "c72271ad042f7b89d69cbc44aba3a8bc1dcd9d2c8a410fb4d06a244f5eaa7124",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"coinbase" : "01650102062f503253482f",
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 1.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "0318a65ca888eacfa2ab76fad7e0509ebac6adb085f2ecc2dfb41c31cd108e8607 OP_CHECKSIG",
"hex" : "210318a65ca888eacfa2ab76fad7e0509ebac6adb085f2ecc2dfb41c31cd108e8607ac",
"reqSigs" : 1,
"type" : "pubkey",
"addresses" : [
"VHvuUh2kHmZyLqas1rpjchtXt6p2DcKqSP"
]
}
}
]
}
EDIT.
i was pretty confused by the reward schedule, but after a bit of looking i realised it was reasonably straight forward, hidden in plain sight as it were
if(nHeight >= 100 && nHeight < 3000) { if((nHeight >= 101 && dDiff > 75) || nHeight >= 1000) {
// 222000/(((x+2600)/9)^2)
nSubsidy = (222000.0 / (pow((dDiff+2600.0)/9.0,2.0)));
if (nSubsidy > 25) nSubsidy = 5;
if (nSubsidy < 5) nSubsidy = 1;
} else {
nSubsidy = (1112.0 / (pow((dDiff+51.0)/6.0,2.0)));
if (nSubsidy > 500) nSubsidy = 5;
if (nSubsidy < 25) nSubsidy = 1;
}
}
else { nSubsidy = (1111.0 / (pow((dDiff+1.0),2.0)));
if (nSubsidy > 500) nSubsidy = 5;
if (nSubsidy < 1) nSubsidy = 1;
nSubsidy = pow (11.0, 6.0);
}
mystery solved
nSubsidy = pow (11.0, 6.0);
is 11^6 = 1771561