BEGINNING ETHEREUM SMART CONTRACTS PROGRAMMING : with examples in python, solidity, and javascript
معرفی کتاب «BEGINNING ETHEREUM SMART CONTRACTS PROGRAMMING : with examples in python, solidity, and javascript» نوشتهٔ Wei-Meng Lee، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2023. این کتاب در 7 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «BEGINNING ETHEREUM SMART CONTRACTS PROGRAMMING : with examples in python, solidity, and javascript» در دستهٔ برنامهنویسی قرار دارد.
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. This new edition has been expanded and updated to cover web3.js APIs, additional Consensus Protocols, non-Fungible Tokens (NFTs), developing NFT tokens using ERC-721, and more!Beginning Ethereum Smart Contracts Programming, second edition 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 create a private Ethereum blockchain to perform transactions such as sending Ethers to another account on another node. 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, Solidity, and JavaScript is provided in the book and 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 * Know the foundation of smart contracts programming and how to deploy and test smart contracts * Work on 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 ForThose who want to get started quickly with Ethereum smart contracts programming. Basic programming knowledge and an understanding of Python or JavaScript is recommended. Table of Contents 4 About the Author 11 About the Technical Reviewer 12 Acknowledgments 13 Introduction 14 Chapter 1: Understanding the Science Behind Blockchain: Cryptography 15 What Is Cryptography? 15 Types of Cryptography 16 Hash Functions 17 Uses of Hashing 19 Implementing Hashing in Python 20 Symmetric Cryptography 21 Generating the Shared Key in Python 22 Performing Symmetric Encryption 23 Performing Symmetric Decryption 23 Asymmetric Cryptography 24 Generating and Saving the Public/Private Key Pairs 26 Encrypting Using the Public Key 28 Decrypting Using the Private Key 28 Digital Signature: Signing Using Private Key 29 Verifying the Digital Signature Using a Public Key 32 How Cryptography Is Used in Blockchain 32 Hashing 33 Symmetric and Asymmetric Cryptography 33 Digital Signature 34 Summary 35 Chapter 2: Understanding Blockchain 36 Motivations Behind Blockchain 37 Placement of Trust 37 Trust Issues 38 Solving Trust Issues Using Decentralization 39 Example of Decentralization 39 Blockchain As a Distributed Ledger 42 How a Blockchain Works 43 Chaining the Blocks 44 Immutability of Blockchains 47 Consensus Protocols 48 Proof of Work 50 The Mining Process 51 Proof of Stake (PoS) 54 Comparing PoW with PoS 55 Blockchain in More Detail 56 Types of Nodes 57 Merkle Tree and Merkle Root 60 Uses of Merkle Tree and the Merkle Root 61 Summary 62 Chapter 3: Implementing Your Own Blockchain Using Python 63 Your Conceptual Blockchain Implementation 63 Obtaining the Nonce 65 Installing Flask 67 Importing the Various Modules and Libraries 68 Declaring the Class in Python 68 Finding the Nonce 69 Appending the Block to the Blockchain 70 Adding Transactions 71 Exposing the Blockchain Class as a REST API 72 Obtaining the Full Blockchain 72 Performing Mining 72 Adding Transactions 73 Testing Your Blockchain 74 Synchronizing Blockchains 79 Testing the Blockchain with Multiple Nodes 84 Full Listing for the Python Blockchain Implementation 90 Summary 97 Chapter 4: Creating Your Own Private Ethereum Test Network 98 Downloading and Installing Geth, the Ethereum Client 98 Installing Geth for macOS 99 Installing Geth for Windows 100 Installing Geth for Linux 100 Creating the Private Ethereum Test Network 101 Creating the Genesis Block 102 Creating a Folder for Storing Node Data 103 Initiating a Blockchain Node 104 Starting Up the Nodes 105 Creating Accounts 106 Checking the Balance of an Account 107 Stopping the Node 108 Starting Another Node 108 Getting Information About the Node 109 Pairing the Nodes 111 Performing Mining 114 Examining a Block 115 Mining on Both Nodes 116 Transferring Ethers Between Nodes 117 Managing Accounts 118 Removing Accounts 120 Setting the Coinbase 120 Summary 121 Chapter 5: Using the MetaMask Crypto-Wallet 122 What Is MetaMask? 122 How MetaMask Works Behind the Scenes 123 Installing MetaMask 124 Setting Up the Accounts 126 Using the MetaMask Extension 130 Selecting Ethereum Networks 132 Getting Test Ethers 133 Creating Additional Accounts 137 Transferring Ethers 140 Recovering Accounts 146 Importing and Exporting Accounts 149 Exporting Accounts 149 Importing Accounts 153 Summary 155 Chapter 6: Getting Started with Smart Contracts 156 What Is a Smart Contract? 156 How Smart Contracts Are Executed 157 Your First Smart Contract 159 Using the Remix IDE 159 Compiling the Contract 163 Testing the Smart Contract Using the JavaScript VM 165 Getting the ABI and Bytecode of the Contract 169 Testing the Smart Contract Using the Goerli Testnet 173 Summary 177 Chapter 7: Storing Proofs Using Smart Contracts 178 A Smart Contract as a Store of Proofs 178 Creating the Smart Contract 179 Compiling the Contract 185 Deploying the Contract 187 Testing the Contract 188 Making Further Changes to the Smart Contract 191 Restricting Access to Functions 192 Accepting Payments in Smart Contracts 193 Events in Smart Contracts 199 Cashing Out 202 Destroying a Contract 204 Summary 205 Chapter 8: Using the web3.js APIs 206 What Is web3.js? 206 Installing web3.js 207 Testing the web3.js Using MetaMask 208 Interacting with a Contract Using web3.js 213 Summary 225 Chapter 9: Developing Web3 dapps using Python 226 Interacting with Ethereum Using Python 227 Registering with Infura 228 Connecting to Infura 231 Fetching a Block 232 Setting Up the Accounts 234 Getting the Balance of an Account 236 Transferring Ethers Between Accounts 236 Creating a Dapp Using Python 238 Loading the Contract 241 Base64 Encoding 242 Saving Credentials on the Blockchain 242 Verifying the Result 245 Summary 250 Chapter 10: Project: Online Lottery 251 How the Lottery Game Works 251 Defining the Smart Contract 253 Betting a Number 256 Setting the Winning Number and Announcing the Winners 259 Getting the Game Status and Winning Number 263 Cashing Out from the Contract 263 Testing the Contract 264 Announcing the Winner 268 Saving the ABI of the Contract 270 Deploying the Contract to the Testnet 272 Creating the Web Front End 273 Announcing the Winning Number 279 Cashing Out 281 The Complete Contract 282 Summary 287 Chapter 11: Creating Your Tokens 288 What Are Tokens? 288 How Tokens Are Implemented? 290 Minting New Tokens 291 Burning Tokens 291 Units Used Internally in Token Contracts 292 ERC-20 Token Standard 294 Creating Token Contracts 296 Overriding the Number of Decimal Places of Precision 297 Deploying the Token Contract 298 Adding the Token to MetaMask 300 What Can You Do with the Token? 300 Using Tokens for Smart Contract Payments 301 Selling Tokens Programmatically 309 Calculating the Amount of Tokens Bought 311 Deploying the Contract 313 Summary 319 Chapter 12: Creating Non-Fungible Tokens Using ERC-721 320 What Is an NFT? 320 Ownership vs. Copyright 322 Where Do You Buy or Sell NFTs? 322 Creating NFTs Using Token Contracts 323 Who Deploys the NFT Token Contract? 324 Using ERC-721 for Creating NFTs 324 Deploying the NFT Token Contract 325 Testing the NFT Contract 327 Getting the Owner of the Token 327 Preparing the Digital Asset to be Sold as an NFT 327 Minting the NFT 330 Getting the Name and Symbol of the NFT Token Contract 331 Finding the Balance of NFTs for an Address 332 Getting the Owner of an NFT 332 Getting the TokenURI of an NFT 333 Transferring an NFT to Another Account 333 Transferring Ownership of the Contract 335 Summary 336 Chapter 13: Introduction to Decentralized Finance 337 Limitations of Traditional Finance 337 Decentralized Finance 338 Components in DeFi 339 Stablecoins 339 Fiat-Backed Stablecoins 341 Crypto-Backed Stablecoins 342 What Is a DAO Exactly? 342 How DAI Works 345 DAI Liquidation 346 Non-Collateralized Stablecoins 348 Crypto Exchanges 348 Creating a Decentralized Exchange 350 Creating the Token Contract 351 Deploying the Token Contract 351 Creating the DEX Contract 353 Funding the DEX 359 Swapping WML Tokens for LWM Tokens 362 Summary 367 Index 368 Capture.PNG -1 Capture.PNG -1 Capture.PNG -1 Capture.PNG 1 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. This new edition has been expanded and updated to cover web3.js APIs, additional Consensus Protocols, non-Fungible Tokens (NFTs), developing NFT tokens using ERC-721, and more! Beginning Ethereum Smart Contracts Programming, second edition 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 create a private Ethereum blockchain to perform transactions such as sending Ethers to another account on another node. 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, Solidity, and JavaScript is provided in the book and 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 Know the foundation of smart contracts programming and how to deploy and test smart contracts Work on 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 JavaScript is recommended.
دانلود کتاب BEGINNING ETHEREUM SMART CONTRACTS PROGRAMMING : with examples in python, solidity, and javascript