Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Blockchain Programming with Solidity

You're reading from   Mastering Blockchain Programming with Solidity Write production-ready smart contracts for Ethereum blockchain with Solidity

Arrow left icon
Product type Paperback
Published in Aug 2019
Publisher Packt
ISBN-13 9781839218262
Length 486 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Jitendra Chittoda Jitendra Chittoda
Author Profile Icon Jitendra Chittoda
Jitendra Chittoda
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Getting Started with Blockchain, Ethereum, and Solidity
2. Introduction to Blockchain FREE CHAPTER 3. Getting Started with Solidity 4. Control Structures and Contracts 5. Section 2: Deep Dive into Development Tools
6. Learning MetaMask and Remix 7. Using Ganache and the Truffle Framework 8. Taking Advantage of Code Quality Tools 9. Section 3: Mastering ERC Standards and Libraries
10. ERC20 Token Standard 11. ERC721 Non-Fungible Token Standard 12. Deep Dive into the OpenZeppelin Library 13. Using Multisig Wallets 14. Upgradable Contracts Using ZeppelinOS 15. Building Your Own Token 16. Section 4: Design Patterns and Best Practices
17. Solidity Design Patterns 18. Tips, Tricks, and Security Best Practices 19. Assessments 20. Other Books You May Enjoy

Gas economic patterns

Ether has an economic value and is being traded on exchanges. Ether is used as a crypto fuel to execute transactions on the Ethereum blockchain. In Solidity, each function execution consumes gas. The gas consumed is always paid in ether from the transaction initiator to the block miner. Higher gas consumption by a contract would need more ether; similarly, lower gas consumption would incur a lower amount of ether, and thus lowers the execution cost. Hence, it is always preferred to write the contract in such a way that it can consume the least amount of gas possible for the processing of each transaction.

One possible way to reduce gas consumption is to always deploy the contract with an enabled optimization flag. This process optimizes the EVM bytecode, which then consumes less gas.

We will discuss some of the patterns that can be used to reduce the...

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime