Eos: get current block number in contract

Created on 1 Sep 2018  路  3Comments  路  Source: EOSIO/eos

tapos_block_num can't get the current block number

Most helpful comment

TAPOS stands for transaction as proof of stake. It's a reference block specified by the client.

I've seen developers use TAPOS as a source of randomness and it's totally wrong, as the client can put any valid block as TAPOS ref block.

For your question, there's currently no way to get current block number, but you can always get the current time instead.

All 3 comments

Why do you need it?

TAPOS stands for transaction as proof of stake. It's a reference block specified by the client.

I've seen developers use TAPOS as a source of randomness and it's totally wrong, as the client can put any valid block as TAPOS ref block.

For your question, there's currently no way to get current block number, but you can always get the current time instead.

tapos_block_num is the lower 16bit of the reference block number to be set in the transaction header.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

toonsevrin picture toonsevrin  路  3Comments

ResponsiveWebApps picture ResponsiveWebApps  路  3Comments

chanwitkepha picture chanwitkepha  路  3Comments

christola picture christola  路  3Comments

Npizza picture Npizza  路  3Comments