![Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript](http://img.images-bn.com/static/redesign/srcs/images/grey-box.png?v11.9.4)
Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript
293![Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript](http://img.images-bn.com/static/redesign/srcs/images/grey-box.png?v11.9.4)
Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript
293Paperback(1st ed.)
-
PICK UP IN STORECheck Availability at Nearby Stores
Available within 2 business hours
Related collections and offers
Overview
Use this book to write an Ethereum Blockchain Smart Contract, test it, deploy it, and create a web application to interact with your smart contract.
Beginning Ethereum Smart Contracts Programming is your fastest and most efficient means of getting started if you are unsure where to begin and how to connect to the Ethereum Blockchain. The book begins with a foundational discussion of blockchain and the motivation behind it. From there, you will get up close and personal with the Ethereum Blockchain, learning how to use an Ethereum client (geth) to connect to the Ethereum Blockchain to perform transactions such as sending Ethers to another account.
You will learn about smart contracts without having to wade through tons of documentation. Author Lee’s “learn-by-doing” approach will allow you to be productive and feel confident in your ability in no time. The last part of this book covers tokens, a topic that has taken the cryptocurrency market by storm.
Sample code in Python is provided in the book and online. C# samples are provided online.
What You'll Learn
- Understand the basic premise of blockchain and “record keeping” in a peer-to-peer network
- Experience blockchain in action by creating your own blockchain using Python and C#
- Know the foundation of smart contracts programming and how to deploy and test smart contracts
- Read a case study to illustrate the use of blockchain
- Be familiar with tokens, and how to create and launch your own ICO digital token
- Write smart contracts that transact using tokens
Who This Book Is For
Those who want to get started quickly with Ethereum Smart Contracts programming. Basic programming knowledge and an understanding of Python or C# is recommended.
Product Details
ISBN-13: | 9781484250853 |
---|---|
Publisher: | Apress |
Publication date: | 09/06/2019 |
Edition description: | 1st ed. |
Pages: | 293 |
Sales rank: | 1,083,740 |
Product dimensions: | 6.90(w) x 9.80(h) x 0.60(d) |
About the Author
Table of Contents
Chapter 1. What is Blockchain?We start with the motivations of Blockchain - the trust issues we face today and how we can solve that using decentralization. We will use a real-life example to bring about the discussion. Next, we will talk about Blockchain and how it fits into the decentralized model. By the end of this chapter readers would have a pretty solid understanding of the main Blockchain terminologies, such as mining, PoW, Merkele Tree/Root, etc.
Trust Today
Placement of Trusts
Centralization - Problems with Trust Today
Solving Trust Issues with Decentralization
Blockchain - A Huge Chain of Blocks
Chaining usng Hashing Functions
Assembling the Transactions
Mining the Blocks using Proof of Work
Structure of a Blockchain
Blockheaders
Merkle Tree and Root
Types of Nodes
Confirmations
Consensus
Rewards for Mining
Chapter 2. Implementing Your Own Blockchain
This chapter basically reinforces the concept covered in Chapter 1. By implementing your own Blockchain, it makes it very useful to understand concepts like transactions, mining, consensus, etc. Here, we implement the blockchains using Python and C#.
Implementing your own Blockchain using Python
Implementing your own Blockchain using C#
Chapter 3. Connecting to the Ethereum Blockchain
For this book, I will primarily use geth, an Ethereum client, to connect to the Ethereum blockchain. Readers will learn how to download and install geth, and use it to connect to the various Ethereum blockchains (mainnet, testnet, etc). Readers will learn about the various sync modes - fast, full, and light.
Installing Geth
Getting Started with Geth
Connecting to the various Ethereum Blockchains
Syncing with the Ethereum Blockchain
Chapter 4. Creating Your Private Ethereum Test Network
One feature of geth is that you can use it to create your own private test network, without connecting to the real blockchain. This makes development work much easier, and allow you to explore the Ethereum blockchain without needing to acquire ether.
Creating the Genesis Block
Creating a folder for storing Blockchain Data
Initiating a Blockchain Node
Starting Nodes
Creating Accounts
Checking the Balance of an Account
Ethereum Units
Pairing the Nodes
Performing Mining
Transferring Ethers between Nodes
Chapter 5. Using the Metamask Chrome Extension
In order to connect to the Ethereum blockchain to deploy and consume contracts, you need to hold Ether. An easy way would be to use the MetaMask Chrome extension. The MetaMask Chrome Extension is an Ethereum wallet. This chapter will show how you can use it to obtain Ethers for testing on the Ethereum testnet.
What is MetaMask?
Creating Accounts
Recovering Accounts
Getting Ethers
Transferring Ethers
Connecting MetaMask to Geth
Chapter 6. Introduction to Smart Contracts
Now that readers are familiar with the Ethereum blockchain, it is now time to explore the most exciting feature of it - Smart Contracts. Smart contracts are written using the Solidity programming language. This chapter goes through the syntax of the language and explores the most salient parts of the language.
Solidity
Hello, Solidity
Comments
Data Types
Integer Literals
Ether and Time Units
Arrays
Structures
Enums
State Variables
Control Structures
Functions
Fallback Functions
Special Variable
Cryptographic Functions
Inheritance
Modifiers and Events
Storage Layout
Chapter 7. Developing and Deploying Smart Contracts
This chapter dives into the details of developing and deploying the Smart contract using the Remix IDE. It also discusses how Smart Contracts can be called and tested from the command line.
Using the Remix IDE
Application Binary Interface (ABI)
Bytecode
Deploying the Smart Contract onto an Ethereum Node using Geth
Invoking the Contract from a Local Node
Invoking the Contract from a Another Node
Calling a Smart Contract from Another
Deploying a Contract Dynamically
Chapter 8. Testing Smart Contracts using ganache
Another tool that is useful for Smart Contract developers is Ganache. Ganache simulates an Ethereum network, and it comes with 10 pre-created accounts each credited with 100 Ethers. Using Ganache, developers can deploy their smart contract without needing to connect to the real Ethereum network.
What is ganache (formerly testrpc)?
Installing ganache
Deploying Smart Contracts to ganache
Connecting MetaMask to ganache
Importing the accounts in ganache into MetaMask
Chapter 9. Using the Web3.js API
Once a Smart contract is deployed, how does the end user use it? In this chapter, readers will learn how to use the Web3.js APIs in their Web application to consume Smart contracts. Readers will learn how Web3.js works and the techniques for connecting to the different Ethereum in the background.
What is Web3.js?
Installing Web3.js
Consuming a contract using Web3.js
Loading the page using file:///
Loading the page using http://
Chapter 10. Smart Contract Events
When a Smart Contract has finished performing a task, how does it inform the user? This is achieved using events. In this chapter, readers will extend some of the contracts developed in the earlier chapters to use events to extend the usefulness of the application.
What are events?
Defining events in your contract
Handling events in your web Application
Chapter 11. Project – Online Lottery
Now that readers have learned all the fundamental building blocks of blockchain, it is now time to put them into a working example. This chapter implements an online betting system using Smart Contracts.
How the Game Works
Creating the contract
Testing the Contract using the Remix IDE
Creating the Web Frontend
Testing the App
Chapter 12. Creating Your Own ERC20 Tokens
ICOs are all the rage these days! This bonus chapter talks about tokens and how you can create tokens using Smart Contracts. Once readers have learned how to create tokens, I will show them how to use tokens to pay for services in Smart Contracts.
What are Tokens?
Tokens Standards - ERC20 and ERC223
Creating Token Contracts
Deploying the Token Contracts
Adding Tokens to MetaMask
Paying for Smart Contracts using Tokens