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
Learn Ethereum

You're reading from   Learn Ethereum A practical guide to help developers set up and run decentralized applications with Ethereum 2.0

Arrow left icon
Product type Paperback
Published in Aug 2023
Publisher Packt
ISBN-13 9781804616512
Length 814 pages
Edition 2nd Edition
Languages
Concepts
Arrow right icon
Authors (3):
Arrow left icon
Dongying Song Dongying Song
Author Profile Icon Dongying Song
Dongying Song
Zhihong Zou Zhihong Zou
Author Profile Icon Zhihong Zou
Zhihong Zou
Xun (Brian) Wu Xun (Brian) Wu
Author Profile Icon Xun (Brian) Wu
Xun (Brian) Wu
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Part 1: Blockchain and Ethereum Basics
2. Chapter 1: Blockchain and Cryptocurrency FREE CHAPTER 3. Chapter 2: Ethereum Architecture and Ecosystem 4. Chapter 3: Decentralized Finance 5. Chapter 4: EVM-Compatible Blockchain Networks 6. Chapter 5: Deep Research and the Latest Developments in Ethereum 7. Part 2:Ethereum Development Fundamentals
8. Chapter 6: Fundamentals of Solidity 9. Chapter 7: Web3 API Fundamentals 10. Chapter 8: Developing Your Own Cryptocurrency 11. Part 3: Ethereum Development Fundamentals
12. Chapter 9: Smart Contract Development and Test Fundamentals 13. Chapter 10: Writing a Frontend to Build the NFT Marketplace DApp 14. Chapter 11: Ethereum Tools and Frameworks 15. Part 4:Production and Deployment
16. Chapter 12: Setting Up Ethereum Private Chain 17. Chapter 13: Deployment of Your DApps 18. Chapter 14: Building Ethereum Wallets 19. Chapter 15: Oracles, Technology, and Layer 2 in Practice 20. Part 5:Conclusion
21. Chapter 16: Conclusion 22. Index 23. Other Books You May Enjoy

Examining smart contract execution under the hood

When interacting with smart contracts on the Ethereum blockchain, the Ethereum Web3 API or JSON-API interface uses the contract’s application binary interface (ABI) as the standard way to encode and decode the methods we call, as well as the input and output data. The same applies to calls from outside of the blockchain and calls between contracts. Data is encoded according to its type, as described in the ABI specification.

All the functions and events within the smart contract can be described using JSON descriptors, as shown in the following screenshot. A JSON description of the deposit ( the _tenant string memory) method is shown in the red box, while the RentPaid event is shown in the purple box:

Figure 6.23 – ABI for the Rent contract

Figure 6.23 – ABI for the Rent contract

When the deposit method is called, it will generate a function selector, which is calculated as the first 4 bytes of the keccak256 hash of the deposit...

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 €18.99/month. Cancel anytime