Open svasva opened 11 years ago
A way of checking for PoS blocks is looking at the flags
field on the block info.
A quick PHP snippet you can use, (taken from https://github.com/TheSerapher/php-mpos), is just make a regex check against proof-of-stake
on flags
:
if ( ! empty($blockInfo['flags']) && preg_match('/proof-of-stake/', $blockInfo['flags']) ) {
//proof-of-stake block!
}
Hope it helps!
Here's a PoS block of bottlecaps for example, I can't see any proof-of-stake flags on it:
{
"txid" : "0e690b43d08346bf004481ee45b2ae0c13184d701c576f3561dcac9342680ea2",
"version" : 1,
"time" : 1380752550,
"locktime" : 0,
"vin" : [
{
"txid" : "bb4d8dd0acbd3efcf7c00d4e65816d5b6661043a132b66a8d8923047c444e253",
"vout" : 1,
"scriptSig" : {
"asm" : "304502207a5b53cb937b283bd4889152555a309acd658d506b316370d1f766f466d03ae3022100c91972aaa409238b5fd97e540c24c3aa40e4b00b9e0a71f9ae5ffa7112c717fa01 0392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231",
"hex" : "48304502207a5b53cb937b283bd4889152555a309acd658d506b316370d1f766f466d03ae3022100c91972aaa409238b5fd97e540c24c3aa40e4b00b9e0a71f9ae5ffa7112c717fa01210392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231"
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 0.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "",
"hex" : "",
"type" : "nonstandard"
}
},
{
"value" : 250.20873800,
"n" : 1,
"scriptPubKey" : {
"asm" : "0392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231 OP_CHECKSIG",
"hex" : "210392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231ac",
"reqSigs" : 1,
"type" : "pubkey",
"addresses" : [
"EsWjT8GL7E3FXMpLhFv58HZUMHRBfFaS5R"
]
}
},
{
"value" : 250.20873800,
"n" : 2,
"scriptPubKey" : {
"asm" : "0392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231 OP_CHECKSIG",
"hex" : "210392f4f56054c44122d92bf950764ae395b1f846467c95975eec0322d37da97231ac",
"reqSigs" : 1,
"type" : "pubkey",
"addresses" : [
"EsWjT8GL7E3FXMpLhFv58HZUMHRBfFaS5R"
]
}
}
],
"amount" : 0.00000000,
"fee" : 0.41747600,
"confirmations" : 16660,
"generated" : true,
"blockhash" : "43e48c3989c6730be51ac8b708b1a5cfd67de8c22f65de36a000f0f238aad977",
"blockindex" : 1,
"blocktime" : 1380752550,
"txid" : "0e690b43d08346bf004481ee45b2ae0c13184d701c576f3561dcac9342680ea2",
"time" : 1380752550,
"timereceived" : 1380752550,
"details" : [
{
"account" : "",
"category" : "generate",
"amount" : 500.41747600
}
]
}
Oh nevermind, I was looking at gettransaction not at getblock.
Thanks!
But I'd still like to get pool rewards on specific account, is that even possible? P.S. Haven't seen any updates to this project in a while, is it dead?
Hey there,
I am having a trouble with getting blocks to be posted under pool account using address which i get from coind getaccountaddress pool. blocks are posted to that address but coind still reports them at account '', not 'pool'. Any suggestions?
P.S. Actually I'm doing that to get rid of PoS blocks accounted as block rewards by my frontend since i don't know any good method to differentiate PoS blocks and normal PoW blocks :(