Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

Getting block information using the block variable

The block variable gives all of the information related to a block. It provides the details of the current block in which your current transaction is being executed. It has some members available that you can use to get specific information:

  • block.coinbaseThis provides the miner's EOA address of the current block.
  • block.difficultyThis provides the current difficulty level of the network as a uint256 value, which is used by the miners to solve the Proof of Work (PoW) puzzle.
  • block.gaslimit: This provides the total gas limit of the current block as a uint256 value. At the time of writing this book, 8 million gas is allocated to each block on Ethereum mainnet.
  • block.number: This provides ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content