Mastering Corda

Book description

Mastering Corda provides you with a consistent, linear, and paced path to learning Corda and building modern enterprise-grade decentralized applications. Using this book, anyone from a complete blockchain beginner to an experienced blockchain or enterprise architect can rapidly understand and write applications like a pro while exploring the technical nuances and intricacies of the Corda platform.

Corda is designed for use cases such as finance and investments, supply chain, healthcare, trade finance, insurance, and real estate that require a high-volume of transactions, scalability, and data privacy. If you have basic Java skills, this book will help you understand blockchain and show how you can get started immediately and be involved in the disruption of the future.

With this book, you will:

  • Understand Corda's value proposition and alignment with business strategies--particularly relevant to business executives and architects
  • Dive deep into Corda's architecture and blockchain fundamentals
  • Rapidly gain extensive knowledge of and hands-on experience with building Corda applications
  • Compare and contrast Corda with Bitcoin, Ethereum, and Hyperledger
  • Effectively prepare for the Corda certification exam and job interviews involving blockchain
  • Perform data analytics and machine learning on Corda nodes

Publisher resources

View/Submit Errata

Table of contents

  1. Foreword
  2. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. O’Reilly Online Learning
    4. How to Contact Us
    5. Acknowledgments
  3. 1. Business Cases for Corda
    1. What Is Blockchain?
    2. Solving Double Spend
    3. What Is Corda?
    4. Business Cases
      1. Decentralized Finance and Digital Assets
      2. Tokenization
      3. Capital Raising
      4. Traceability and Provenance
      5. Reconciliation Cost Reduction
      6. Reconciliation Revenue Streams
      7. Better AI
    5. Enterprise Requirements
      1. Privacy
      2. Know Your Counterparty
      3. Permissioning
      4. Scalability and Performance
      5. Integration and Developer Adoption
    6. A Brief History of Corda
    7. On-Ledger Versus Off-Ledger Data
    8. Challenges to Adoption
      1. The Critical Mass Challenge
      2. Alternatives to Corda
      3. Portability
    9. Corda Enterprise
    10. Corda Business Networks Toolkit
    11. Wrap-Up
  4. 2. Essential Corda and Blockchain Cryptography
    1. Understanding Hashes
      1. The SHA-256 Hash Algorithm
      2. Hashes in Corda
    2. Asymmetric Cryptography
      1. Symmetric Key Cryptography
      2. Modern Cryptography
    3. The Encryption Process
      1. Combining Encryption with Hashes
      2. Proof of Origin
      3. Combining Encryption with Proof of Origin
      4. Proof of Ownership of a Public Key
      5. Key Generation Algorithms: Elliptical Curves
      6. Corda and Keys
    4. Digital Signatures
      1. Corda Digital Signatures
    5. Digital Certificates
      1. The X.509 Digital Certificate Structure
      2. Corda Digital Certificates
    6. Merkle Trees
      1. Corda Merkle Trees
    7. Wrap-Up
  5. 3. Your First Corda Smart Contract
    1. The Echo CorDapp
      1. Flow Basics
    2. High-Level Overview of the Echo CorDapp
    3. Creating a New CorDapp Project
      1. Loading the Template Code into IntelliJ
    4. Overview of Scaffolding Code
      1. The Initiator
      2. The Responder
      3. The Gradle Build File
      4. Gradle Wrapper Scripts
    5. Underlying Mechanics of the Echo CorDapp
    6. Coding the Echo CorDapp
      1. Coding the Responder Flow
      2. Completing the EchoInitiatorFlow
    7. Deploying the Echo CorDapp
    8. Launching the Echo CorDapp
      1. Invoking Echo Flows
    9. Template Web App and Mock Testing
    10. Wrap-Up
  6. 4. Blockchain Fundamentals
    1. Apocalypse Now
    2. Going Digital
      1. A Digital Ledger
      2. A Digital Asset
      3. Digital Asset Valuation Factors
      4. Trust the System
      5. The Parallels
      6. Distrust the System, Trust Algorithms
    3. The Blockchain Symphony
      1. Dispute Resolution
      2. Consensus
    4. Blockchain Components
      1. Nodes
      2. Network
      3. Data Structures
    5. Machinery in Action
      1. Mining
      2. Asymmetric: Work Versus Verification
      3. Consensus, Byzantine Fault Tolerance, and Forks
      4. Difficulty
    6. Wrap-Up
  7. 5. Corda Fundamentals
    1. Corda and Corda Networks
    2. Corda Network Participants and Services
      1. Identity Manager
      2. Network Map Service
      3. Notary
      4. Oracles
      5. Transaction Model
      6. Transaction Finality
      7. Consensus
    3. Node Design and Architecture
      1. Vault and Ledger
      2. Node Services
      3. Vault Service
      4. Key Management Service
      5. Network Service
      6. Corda RPC
    4. Node Technology Components
      1. Turing-Complete Smart Contracts
      2. Deterministic JVM
      3. Data Storage
      4. Messaging and Message Queue
      5. Quasar
    5. Corda Applications
    6. The Corda Network
    7. Corda Testnet
    8. The Marketplace
    9. Wrap-Up
  8. 6. Building a Distributed Task CorDapp
    1. Understanding States
      1. Aspects of States
      2. State Transitions Between Multiple Parties
    2. Creating States in Corda
    3. Understanding Transactions
      1. Transaction Inputs and Outputs
      2. Transactions in Corda
      3. Transaction Propagation
      4. Flows That Manage Transactions
    4. Building the ToDoDist CorDapp
      1. Model and Code the ToDoState State
      2. Creating a ToDoState on the Ledger
      3. Running CreateToDoFlow to Create a To-Do Item
      4. Assigning a To-Do to Another Party
    5. Wrap-Up
  9. 7. Extending ToDoDist with Advanced States
    1. Commands: Transaction Intent
    2. Corda Commands
      1. Creating Commands
      2. Organizing Commands
    3. Contracts: State Transition Constraints and Validations
      1. Create a ToDo Contract
    4. Making States Queryable
      1. Step 1: Create a Model Class
      2. Step 2: Create a Grouping Marker for the Versions
      3. Step 3: Define a Schema Version of the Model
      4. Step 4: Refactor TaskModel as an Inner Class in ToDoSchemaV1
      5. Step 5: Implement the QueryableState Interface
      6. Inspecting a Queryable State
      7. Schedulable States
    5. Requiring Signatures by a Certain Time
      1. Corda TimeWindows
      2. Creating To-Do Time Windows
    6. Attaching a File to a To-Do
      1. ToDoDist Attachment
      2. Running AttachDocToDoInitiator
    7. Wrap-Up
  10. 8. State Linking, Fungibility, Coin Selection, and Observers
    1. Complex States
    2. Linking States
      1. Locating States on the Ledger
      2. Linking States via StateRef
      3. Linking States via linearId
    3. Reference States
      1. Publishing and Using a Reference State
      2. Example: Stock Symbol
    4. Fungibility
      1. Non-fungible States
      2. Fungible States
    5. Coin Selection
      1. Soft Locking
    6. Fungible Stablecoin Cash on Ledger
      1. Refactoring for Multiple Coin Selection and Fractional Amounts
      2. Redemption: Burning a State
    7. Propagating States to Observers
    8. State Design
    9. Wrap-Up
  11. 9. Tokens and the Token SDK
    1. What Are Tokens?
    2. Why Do We Use Tokens?
      1. The Era of Tokens Is Upon Us
    3. A Brief History of Tokens on Blockchain
      1. Bitcoin as a Rigidly Defined Token
      2. Ethereum: Programmable Tokens with Rigid Transactions
    4. Corda: Coming Full Circle
      1. Illustrating Token Fundamentals with Code
      2. Token Ownership
      3. Token with Owner
      4. Types of Tokens
      5. Controlling the Volume
      6. Transferring Tokens Out
      7. Transferring Tokens In
      8. Using the Kotlin infix Operator
    5. Non-fungible Tokens
      1. Coding a Non-fungible Token
    6. The Token SDK
    7. Corda Settler and Redemption
    8. Wrap-Up
  12. 10. Oracles and Corda Services
    1. Corda Oracles
      1. Prime: The Example Corda Oracle CorDapp
      2. The Oracle Node
      3. The Client Node
    2. Filtered Transactions
      1. Running the Prime Oracle
    3. Corda Oracles with Java: The SDR Oracle
      1. Obtaining SDR Data
      2. Project Setup
      3. Coding the Command Object
      4. Coding the SDR Corda Service
      5. The sign Method
      6. The Client’s Initiator Flow
      7. Running the SDR Oracle
    4. The Economics of Oracles
    5. Wrap-Up
  13. 11. Node Internals and Analytics
    1. Why Python?
    2. Quick Start
      1. Installing PyCorda
      2. The Python REPL
      3. Programmatically Downloading the H2 DB Drivers
      4. Exploring a Node
      5. Reading the Java Keystore for a Node
      6. Node and Vault Snapshot to File
    3. Exploring the Vault and CorDapp
      1. Analyzing a Transaction
      2. Invoking the Obligation CorDapp’s API Directly from Python
      3. Generating Tons of Transactions
    4. Time-Series Charts
      1. Piping Monitoring Data to Plotly
    5. Building a Simple Monitoring Web App with PyCorda and Flask
    6. PyCorda’s Future
  14. 12. Corda RPC and Vault Queries
    1. CordaIQ
    2. Obtaining a CordaRPCOps Instance
      1. RPC Client Setup
    3. RPC Methods
      1. Network
      2. Party and Public Key Query
      3. Flows
      4. Querying and Managing the Vault
      5. Transaction Notes
      6. Attachment Management
      7. Node Management
      8. Notary
      9. State Machine Management
    4. Monitoring RPC Calls
      1. Using Jolokia
      2. Using Hawtio
      3. Pause and Resume via Browser
    5. Wrap-Up
  15. A. The Obligation CorDapp
    1. Installing the Obligation CorDapp
  16. B. Kotlin Cheat Sheet
    1. Key Kotlin Points
  17. C. Comparison Tables
  18. D. DAML for Corda
    1. What Is DAML?
    2. What Is DAML for Corda?
    3. What Does It Mean for Corda Developers?
  19. Index

Product information

  • Title: Mastering Corda
  • Author(s): Jamiel Sheikh
  • Release date: October 2020
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492047186