Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Solidity Programming Essentials

You're reading from  Solidity Programming Essentials

Product type Book
Published in Apr 2018
Publisher Packt
ISBN-13 9781788831383
Pages 222 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. Introduction to Blockchain, Ethereum, and Smart Contracts 2. Installing Ethereum and Solidity 3. Introducing Solidity 4. Global Variables and Functions 5. Expressions and Control Structures 6. Writing Smart Contracts 7. Functions, Modifiers, and Fallbacks 8. Exceptions, Events, and Logging 9. Truffle Basics and Unit Testing 10. Debugging Contracts 1. Other Books You May Enjoy Index

Blocks


Blocks are an important concept in Ethereum. Blocks are containers for a transaction. A block contains multiple transactions. Each block has a different number of transactions based on gas limit and block size. Gas limit will be explained in detail in later sections. The blocks are chained together to form a blockchain. Each block has a parent block and it stores the hash of the parent block in its header. Only the first block, known as the genesis block, does not have a parent.

A typical block in Ethereum is shown in the following screenshot:

There are a lot of properties associated with a block, providing insights and metadata about it, and following are some of important properties along with their descriptions:

  • The difficulty property determines the complexity of the puzzle/challenge given to miners for this block.
  • The gasLimit property determines the maximum gas allowed. This helps in determining how many transactions can be part of the block.
  • The gasUsed property refers to the actual gas used for this block for executing all transactions in it.
  • The hash property refers to the hash of the block.
  • The nonce property refers to the number that helps in solving the challenge.
  • The minerproperty is the account identifier of the miner, also known as coinbase or etherbase.
  • The number property is the sequential number of this block on the chain.
  • The parentHash property refers to the parent block's hash.
  • The receiptsRoot, stateRoot, and transactionsRoot properties refer to Merkle trees discussed during the mining process.
  • The transactions property refers to an array of transactions that are part of this block.
  • The totalDifficulty property refers to the total difficulty of the chain.
You have been reading a chapter from
Solidity Programming Essentials
Published in: Apr 2018 Publisher: Packt ISBN-13: 9781788831383
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}