Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: How can I get blockchain_random_seed in ervery block?  (Read 260 times)

0 Members and 1 Guest are viewing this topic.

Offline kinglaw0577

  • Full Member
  • ***
  • Posts: 94
    • View Profile
    • BitShares Richlist
How can I get blockchain_random_seed in ervery block?
« 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.
☆bitshares Richlist富豪榜 http://richlist.btsabc.org
☆BTSABC wallet online比特帝国在线钱包 https://bit.btsabc.org

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12057
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: How can I get blockchain_random_seed in ervery block?
« Reply #1 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
}
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline kinglaw0577

  • Full Member
  • ***
  • Posts: 94
    • View Profile
    • BitShares Richlist
Re: How can I get blockchain_random_seed in ervery block?
« Reply #2 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": []
}
☆bitshares Richlist富豪榜 http://richlist.btsabc.org
☆BTSABC wallet online比特帝国在线钱包 https://bit.btsabc.org

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12057
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: How can I get blockchain_random_seed in ervery block?
« Reply #3 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
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline kinglaw0577

  • Full Member
  • ***
  • Posts: 94
    • View Profile
    • BitShares Richlist
Re: How can I get blockchain_random_seed in ervery block?
« Reply #4 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!

☆bitshares Richlist富豪榜 http://richlist.btsabc.org
☆BTSABC wallet online比特帝国在线钱包 https://bit.btsabc.org

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12057
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: How can I get blockchain_random_seed in ervery block?
« Reply #5 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 ..
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline bytemaster

Re: How can I get blockchain_random_seed in ervery block?
« Reply #6 on: December 02, 2014, 04:02:08 PM »
Next release will include RAND in the CLI output of list_blocks.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

 

Google+