Ethereum Smart Contract Development

Book description

Become an Ethereum Blockchain developer using a blend of concepts and hands-on implementations

About This Book

  • Understand the Ethereum Ecosystem and its differences from its rich cousin Bitcoin
  • Explore the Solidity programming language and smart contract optimizations
  • Get a developer's perspective of Blockchain-as-a-technology with exposure to common challenges faced while building decentralized applications

Who This Book Is For

If you want to know the ins and outs of the Ethereum network and build your own decentralized applications, then this book is what you need! This book is for anyone who is interested in blockchain and wants to become an Ethereum developer. It's ideal for existing Ethereum developers who want to develop Ethereum using smart contracts. Basic knowledge of cryptography is expected but is not mandatory.

What You Will Learn

  • Know how to build your own smart contracts and cryptocurrencies
  • Understand the Solidity language
  • Find out about data types, control structure, functions, inheritance, mathematical operations, and much more
  • See the various types of forks and discover how they are related to Ethereum
  • Get to know the various concepts of web3.js and its APIs so you can build client-side apps
  • Build a DAO from scratch and acquire basic knowledge of DApps on Ethercast
  • Be guided through the project so you can optimize EVM for smart contracts
  • Build your own decentralized applications (DApps) by taking a practical approach

In Detail

Ethereum is a public, blockchain-based distributed computing platform featuring smart contract functionality. This book is your one-stop guide to blockchain and Ethereum smart contract development.

We start by introducing you to the basics of blockchain. You'll learn about hash functions, Merkle trees, forking, mining, and much more. Then you'll learn about Ethereum and smart contracts, and we'll cover Ethereum virtual machine (EVM) in detail. Next, you'll get acquainted with DApps and DAOs and see how they work. We'll also delve into the mechanisms of advanced smart contracts, taking a practical approach.

You'll also learn how to develop your own cryptocurrency from scratch in order to understand the business behind ICO. Further on, you'll get to know the key concepts of the Solidity programming language, enabling you to build decentralized blockchain-based applications. We'll also look at enterprise use cases, where you'll build a decentralized microblogging site.

At the end of this book, we discuss blockchain-as-a-service, the dark web marketplace, and various advanced topics so you can get well versed with the blockchain principles and ecosystem.

Style and approach

This comprehensive guide takes a practical approach by showing you how to implement Blockchain in different Enterprise use cases. You'll quickly brush up on the basics of the blockchain database, then learn the advanced intricacies of smart contract development.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Ethereum Smart Contract Development
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. Blockchain Basics
    1. Understanding distributed systems
    2. The Byzantine Generals' Problem
      1. Losing strategy
      2. Winning strategy
    3. The CAP theorem
    4. Consensus in distributed systems
    5. Understanding the hash function and the Merkle tree
    6. Understanding a blockchain–a developer and trader's perspective
      1. Inside a block
    7. Blockchain mining and forking
    8. Blockchains – evolution, generations, and hype
    9. Summary
  8. Grokking Ethereum
    1. Understanding Ethereum
    2. The notion of decentralization
    3. The Ethereum ecosystem
      1. Mist
      2. Decentralized applications
      3. Middleware
        1. Swarm
        2. Whisper
        3. EVM
    4. Hardware clients and internet
    5. Turing completeness and the magic sauce
    6. Ethereum block, mining, and forking
    7. The Ethereum wallet and client interface
    8. Summary
  9. Hello World of Smart Contracts
    1. A smart contract in seven lines of code
    2. Remix in a nutshell
    3. Increment and decrement operations using Solidity
    4. Coding a loop
    5. Raising an issue on GitHub
    6. Smart contract on a private blockchain
      1. Writing the genesis block
      2. Building a private blockchain
      3. Connecting MIST browser using geth
      4. Mining ethers in a private blockchain
      5. Deploying smart contracts on our private chain
    7. Summary
  10. A Noob's Guide to DApps and DAO
    1. Understanding DApps
      1. Steps to develop a DApp
      2. Architecture of a DApp
    2. What is ethercast?
      1. btcrelay.org
      2. oraclize.it
      3. the-pitts-circus.com
    3. Understanding the design of DAO
    4. The rise and fall of DAO
    5. Summary
  11. Deep-Diving into Smart Contracts
    1. What makes a contract "smart"?
      1. Definition and design
      2. Role of code in a smart contract
    2. Basic anatomy of a smart contract design
      1. Smart contract optimization
      2. Smart contract auditing and compliance
    3. Designing a voting DApp
    4. Summary
  12. Solidity in Depth
    1. Need for solidity
    2. Nuances, syntax, and features of solidity
      1. Pragma, import, and comments
      2. Class properties of a contract
      3. Functions
      4. Events
      5. Inheritance
      6. Libraries
      7. Expression and control structures
      8. Units and variables
    3. Optimizer and debugging options
    4. Parity hack demystified
    5. Summary
  13. Primer on Web3.js
    1. Web3.js in the Ethereum ecosystem
    2. Running a smart contract using Web3.js
    3. API structure of Web3.js
    4. Designing an ownership contract
    5. Summary
  14. Developing a Cryptocurrency from Scratch
    1. Token versus coin
    2. ERC20 token development using Truffle
    3. Arbitrage trading for cryptocurrencies
    4. The ICO story
    5. Fiat2Crypto and Crypto2Crypto exchange
    6. Parity hack returns
    7. Summary
  15. Enterprise Use Cases
    1. Banking and payments
      1. Insurance
      2. Supply chain management
      3. Forecasting and prediction market
      4. Charity
      5. Public benefits
      6. Energy management
      7. Art and music
      8. Retail
      9. Real estate
      10. Cyber security
      11. Crowdfunding
    2. Networking and the Internet of Things
      1. Voting
      2. Government
      3. Private transport and ride sharing
      4. Cloud storage
      5. Healthcare
    3. Smart contract use cases
      1. Insurance
      2. Trade finance
      3. Derivatives
      4. Securities
      5. Accounts
      6. Digital identity
      7. Record-keeping
      8. Loans and mortgages
      9. Legal
      10. Supply chain
      11. Clinical trials
      12. Terminal disease research
    4. Decentralized microblogging
      1. Administrative and security constraints
        1. TwtAccount.sol
        2. TwtRegistry.sol
        3. Service setup on the private blockchain
        4. Reading tweets
    5. Summary
  16. BaaS and the Dark Web Market
    1. Playful privacy
    2. Types of blockchain
      1. Private blockchains
      2. Public blockchains
      3. Consortium blockchains
    3. Blockchain-as-a-service
    4. Enterprise platforms for BaaS
      1. IBM Hyperledger
      2. Microsoft Azure EBaaS
      3. Amazon Eris
    5. Dark web marketplace
    6. Project smartCV
    7. Summary
  17. Advanced Topics and the Road Ahead
    1. Common design patterns
      1. Restricting access
      2. Token systems
      3. Factory pattern
      4. Registries
      5. Voting systems
    2. DACs and DAS
    3. Ethereum improvement proposal
      1. Rational behind EIPs
      2. Types of EIP
      3. EIP life cycle
      4. EIP template
    4. Consortium blockchains
      1. Case study on R3 Corda
    5. Tangle beyond blockchain
      1. Shortcomings of a blockchain
      2. Tangle demystified
      3. Iota GitHub analysis
      4. Purchase and storage of Iota
    6. Summary
  18. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Ethereum Smart Contract Development
  • Author(s): Mayukh Mukhopadhyay
  • Release date: February 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788473040