BitShares Forum

Main => Technical Support => Topic started by: kinglaw0577 on December 01, 2014, 02:17:25 pm

Title: How can I get blockchain_random_seed in ervery block?
Post by: kinglaw0577 on December 01, 2014, 02:17:25 pm
I know get_info can get blockchain_random_seed,but I want get blockchain_random_seed in a history blocks.how can I get it?
I found these code:
: auto latency = now - block_data.timestamp;
:              block_record record( block_data, self->get_current_random_seed(), block_data.block_size(), :latency );
:              _block_id_to_block_record_db.store( block_id, record );


It seems block_current_random_seed have stored in db.but how can i get it in API.
Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: xeroc on December 01, 2014, 02:59:50 pm
Code: [Select]
delegate (unlocked) >>> blockchain_get_block 100
{
  "previous": "71524c64f3221c3fb77f93b8707669bdfbf7f33f",
  "block_num": 100,
  "timestamp": "2014-07-19T03:35:20",
  "transaction_digest": "c8cf12fe3180ed901a58a0697a522f1217de72d04529bd255627a4ad6164f0f0",
  "next_secret_hash": "119a1e39809ff06a25854c7f9a75b2f4e135afc8",
  "previous_secret": "a4b5f588ed9f9cf149f74a56be38f53881767b81",
  "delegate_signature": "20ace47fbc877db37a0983e8d7a3a74163c26e0d399df2cf7e5020f9eb2f025cacdbe6e7cf1ffa13f7ae250634cb6a34cb7c3dc059044012c63e2cc34b8f9655ff",
  "user_transaction_ids": [],
  "signee_shares_issued": 0,
  "signee_fees_collected": 0,
  "signee_fees_destroyed": 0,
  "random_seed": "5b9496384a9297c5629bf48ce2499adc8f220cd4",
  "block_size": 166,
  "latency": 11700880000000,
  "processing_time": 215
}
Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: kinglaw0577 on December 02, 2014, 12:41:03 am
I was confused. In my 0.4.24 client, only displays the following information=>
default (unlocked) >>> blockchain_get_block 100
{
  "previous": "71524c64f3221c3fb77f93b8707669bdfbf7f33f",
  "block_num": 100,
  "timestamp": "20140719T033520",
  "transaction_digest": "c8cf12fe3180ed901a58a0697a522f1217de72d04529bd255627a4a
d6164f0f0",
  "next_secret_hash": "119a1e39809ff06a25854c7f9a75b2f4e135afc8",
  "previous_secret": "a4b5f588ed9f9cf149f74a56be38f53881767b81",
  "delegate_signature": "20ace47fbc877db37a0983e8d7a3a74163c26e0d399df2cf7e5020f
9eb2f025cacdbe6e7cf1ffa13f7ae250634cb6a34cb7c3dc059044012c63e2cc34b8f9655ff",
  "user_transaction_ids": []
}
Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: xeroc on December 02, 2014, 07:00:48 am
Ah .. it seems I have a more recent build .. Usually I just checkout git-master .. that may be the reason .. so you either wait for the next release or upgrade to git-head ..

btw, also note that the date format has changed
Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: kinglaw0577 on December 02, 2014, 07:08:58 am
After 4 hours of reading the source code, I find the problem。
blockchain_get_block return digest_block,blockchain_list_blocks return block_record,
so I use blockchain_list_blocks get blockchain_random_seed,


Out of curiosity, I  spent 1 hours  changed the blockchain_get_block source code, now it can also return random_seed, I think xeroc is doing,

(wallet closed) >>> blockchain_get_block 100                                                                                                                                     {
  "previous": "71524c64f3221c3fb77f93b8707669bdfbf7f33f",
  "block_num": 100,
  "timestamp": "20140719T033520",
  "transaction_digest": "c8cf12fe3180ed901a58a0697a522f1217de72d04529bd255627a4ad6164f0f0",
  "next_secret_hash": "119a1e39809ff06a25854c7f9a75b2f4e135afc8",
  "previous_secret": "a4b5f588ed9f9cf149f74a56be38f53881767b81",
  "delegate_signature": "20ace47fbc877db37a0983e8d7a3a74163c26e0d399df2cf7e5020f9eb2f025cacdbe6e7cf1ffa13f7ae250634cb6a34cb7c3dc059044012c63e2cc34b8f9655ff",
  "user_transaction_ids": [],
  "random_seed": "5b9496384a9297c5629bf48ce2499adc8f220cd4",
  "block_size": 166,
  "latency": 10035102000000,
  "processing_time": 1000
}


Now the problem is that random_seed cannot display blockchain_list_blocks in CLI, expect BM next modification can let blockchain_get_block returns all the data, and CLI can display random_seed..

good job!

Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: xeroc on December 02, 2014, 12:20:39 pm
you can put feature requests directly into github.com/bitshares/bitshare/issue
Just link to the post with a short description of your request ..
Title: Re: How can I get blockchain_random_seed in ervery block?
Post by: bytemaster on December 02, 2014, 04:02:08 pm
Next release will include RAND in the CLI output of list_blocks.