Building Enterprise Blockchain Solutions on AWS
eBook - ePub

Building Enterprise Blockchain Solutions on AWS

A Developer's Guide to Build, Deploy, and Managed Apps Using Ethereum, Hyperledger Fabric, and AWS Blockchain (English Edition)

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Building Enterprise Blockchain Solutions on AWS

A Developer's Guide to Build, Deploy, and Managed Apps Using Ethereum, Hyperledger Fabric, and AWS Blockchain (English Edition)

About this book

Define your enterprise blockchain system using the AWS blockchain managed service.

Key Features
? Practical implementation of blockchain applications across Healthcare, Banking, and Finance.
? Covers complete solutions, including writing smart contracts, executing chain codes, and deploying blockchain private networks.
? Best practices to write smart contracts, add authentication, manage security, and create Ethereum wallets.

Description
Building Enterprise Blockchain Solutions on AWS is a step-by-step guide for building, deploying, and managing decentralized applications on the AWS Blockchain. You will learn to build real-world decentralized applications for the Healthcare supply chain, Asset Tracker, and bank auditing applications with Hyperledger Fabric and Ethereum.The first section introduces you to the world of blockchain, AWS Blockchain offerings, and the Quantum Ledger Database. The second section introduces the concepts of Hyperledger Fabric, building the Hyperledger Fabric network with the Amazon Managed Blockchain, running the chaincode for the healthcare supply chain, building the API and UI using the Fabric node.js SDK, and adding members to the Fabric network on AWS. This book will help you to master Ethereum, Hyperledger Fabric, and the AWS Blockchain. You will be able to develop dApps for any domain, build private networks, and run your dApps on the AWS Blockchain. You will be an expert in writing and running smart contracts with Solidity and node.js chaincodes.

What you will learn
? Learn Hyperledger Fabric to build your private blockchain network.
? Write and deploy smart contracts on both Ethereum and Hyperledger Fabric.
? Add security, authentication, and keep monitoring the performance of dApps.
? Practical exposure of blockchain explorer, Truffle, Web3js, Ganache, Etherscan, Metamask, Ethereum wallet, and Remix.

Who this book is for
This book is well-crafted for software developers, system architects, application developers, and aspiring blockchain developers who want to create decentralized applications (dApps) at speed without wasting time in concepts and making complete use of Amazon-managed blockchains. Readers with some understanding of Ethereum and smart contracts would be helpful to speed up the learning of the concepts although it not an essential requirement.

Table of Contents
1. An Introduction to a Blockchain
2. Exploring a Blockchain on AWS
3. Exploring the Amazon Quantum Ledger Database
4. Exploring Hyperledger Fabric
5. The AWS Managed Blockchain to Create a Fabric Network
6. Developing the Chaincode, API, and UI with the Fabric SDK on AWS
7. Adding Members to the Fabric Network on AWS
8. Deep Dive into the Ethereum Blockchain
9. The AWS Blockchain Template to Create a Private Ethereum Network
10. The Solidity Smart Contract Language
11. Creating and Deploying the Asset Tracker Contract on AWS
12. Testing and Interacting with the Asset Tracker on AWS

About the Authors
Murughan Palaniachari is a developer, speaker, blogger, trainer, DevOps, and Blockchain expert. He has 14+ years of software development and operations experience in multiple technology stacks, including C#, Javascript, NodeJS, Java, Python, and Blockchain. He has expertise in Blockchain, Ethereum, Solidity, Hyperledger Fabric, and Cryptocurrency. He is an expert in building Enterprise Blockchain solutions using Ethereum, Hyperledger Fabric, and Stellar. He is an organizer of TAC – Technical Agility Conference, meetup organizer of Blockchain, DevOps, and Cloud.
Blog links: https://elevate-org.com/, https://devopsgames.com
LinkedIn Profile: https://www.linkedin.com/in/murughan/

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Building Enterprise Blockchain Solutions on AWS by Murughan Palaniachari in PDF and/or ePUB format, as well as other popular books in Computer Science & Cloud Computing. We have over one million books available in our catalogue for you to explore.

CHAPTER 1

An Introduction to a Blockchain

We have top technologies to modernize the way we operate, but we haven’t had any technology in the past that could bring trust to the system. Traditional applications are centralized in nature, where the operating company owns and controls the application data and behavior. Data stored in these centralized servers could be hacked, deleted, or modified, which makes centralized applications to be non-trustable.
A blockchain is a peer-to-peer distributed, secured, shared, immutable ledger, and decentralized technology that brings trust to the system. A blockchain is the future of the Internet and will revolutionize the way businesses are operating.

Structure

In this chapter, we will discuss the following topics:
  • What is a blockchain?
  • Why a blockchain?
  • Issues with Web2.0 and centralized infrastructure
  • Features of a blockchain
  • How a blockchain works
  • Consensus mechanism algorithms
  • Public blockchain
  • Private and permissioned blockchain
  • Criteria to choose a blockchain
  • Blockchain use-cases

Objectives

After studying this unit, you should be able to:
  • Understand the concept of a blockchain
  • Understand how a blockchain works
  • Discuss the types of blockchain
  • Identify blockchain use-cases

Challenges with the traditional centralized infrastructure

Applications like Facebook, Gmail, Twitter, or any banking and ecommerce applications we use on a daily basis runs on a centralized infrastructure that means these applications have complete control over application data and application behavior.
Because of this centralized nature, if data is compromised by a hacker, then our data is at risk. Also, application data can be tampered by hackers or authority organizations. This leads us to not trust the system. For example, when you send an email, it is processed by the central authority and stored in the database. Email service providers have control over your data, and they can use the data for their promotions.
Let's look at some of the challenges being faced by applications hosted on a centralized infrastructure:
  • Centralized power: Day-to-day applications we use are central in nature, and the operating company has complete control over the application behavior and data.
  • Lack of trust and integrity: The data stored in centralized systems can be tampered anytime by the system owners or hackers, which leaves us to work within a non-trustable environment, spending a lot of money with agreements, and paying for a third party like a bank to manage the trust between the parties.
  • Lack of traceability: It is unable to track the province of any asset like high-value goods (Rolex, Diamond, Gold, and so on.), supply chain, healthcare, and government. In the supply chain, when a consumer finds the food is contaminated, we don't have any trusted process to find out the root cause as hundreds of parties are involved in the entire system starting from the producer to the consumer. Each one maintains their own central digital database, or even worse, maintains data in a non-digital format or do not maintain any data at all.
  • Lack of visibility: Data is not transparent across the business. For instance, in the transportation and logistics industry, when a consumer sends the parcel, it takes days or weeks to reach the destination. While it's in the transition period, the consumer can't get the right information on the state of their parcel. For example, if the parcel is a perishable item, then is that parcel being maintained at the right temperature and humidity, or when will the end user receive the product. All these pieces of information are not visible to everyone or to relevant parties.
  • Fraud and data tampering: Since the data is controlled by the central authority, they can tamper the data. Business legal agreements are managed through paper or something else which is not as much transparent and traceable, which opens the door for fraud.
  • High operating cost: We spend a lot of money and time to secure servers and data from hackers. There is a high cost to maintain the authenticity of data as many intermediate, manual work, and paperwork are involved in a business.
  • Middlemen: Too many middlemen are involved in the business. In agriculture, for example, the farmer often gets paid only a little percentage of money that the consumer pays. Most of the money goes to the middlemen and there is no peer-to-peer business.
Now that we've seen some of the challenges of the existing infrastructure, let's look at how a blockchain could eliminate or reduce the preceding problems.

What is a blockchain?

A blockchain is a shared ledger which records transactions in a block in an append-only manner. A blockchain is maintained by a peer-to-peer distributed system within the decentralized infrastructure, which is secured by the cryptographic hashing mechanism and with the support of smart contracts, effective collaboration, and cooperation between organizations and individuals.
Let's look at some features of a blockchain.

Cryptographically secured

A blockchain maintains all the events/transactions in the immutable ledger in a linear, chronological order with details like block number, nonce – unique number added by miners, block hash – unique identifier, previous block hash – unique identifier of the previous block, encrypted transaction/message, timestamp, Merkle, and transaction list.
Sets of transactions are stored in a block with the cryptographic hash key, and the blocks are connected to the previous block with cryptographic hashing which forms an immutable chain of blocks.
Figure 1.1: Cryptographically secured
Immutability is achieved through a cryptographically secured process called hashing. Hashing takes in input data and creates 64 random characters as output digital signatures. Whether it's a single character or full Wikipedia content, it always generates 64 random characters as the Hash key. Even for a small change in the input, it creates an altogether different hash. There is no way to figure out the input with the output hash key. The algorithm used here is SHA-256.

Immutability

Data stored in a blockchain is an unalterable history of transactions. If data needs to be updated, then a new block gets added instead of deleting the old data. As the blocks are linked with the previous hash, data tampering will lead to breaking the entire chain. This feature of immutability makes it easy for auditing and traceability purpose.
Figure 1.2: Immutability
In the preceding image, we can see that tampering data in the second block leads to breaking the entire blockchain from the second block. This is proof that someone is trying to tamper the data.

Distributed ledger

A blockchain stores data in a distributed manner wherein data is replicated and shared across multiple parties globally in a peer-to-peer network and synchronized with the latest data without any central point of control.
Figure 1.3: Distributed ledger
In the preceding diagram, we can see nodes such as Node 1, Node 2 till Node N which maintains the replicated copy of the ledger.

Decentralized

A blockchain is a completely decentralized network of nodes, unlike the case of traditional companies where everything is stored centrally. This way it eliminates the central point of control and gives control back to the user or other parties in the network. Also, rather than relying on the central party to handle the security, a blockchain uses consensus to validate the correctness of data that goes into a blockchain by making use of the data that is replicated across multiple nodes. For the same reason, it also eliminates the problem of a single node failure.
Figure 1.4: Decentralized
In the preceding diagram, we can see that data is decentralized and all the five organizations have the replicated copy of the ledger any time a new block gets created. All the nodes will be synchronized with the latest data.

Smart contract

With the release of the second generation blockchain, Ethereum introduces the concept of Smart Contract. In the traditional system, we manage business contracts with paper and some third-party bank or government legal agreement to transact.
Smart contracts revolutionize the way we run a business. All the business rules are coded as a program and deployed into the blockchain which gets executed based on the event. Because of this immutability concept, a smart contract can’t be overwritten. For example: In the case of a supply chain, where multiple parties involved to run a business, we write/code all the agreements as smart contracts. Smart contract has events/business logic which gets executed when particular conditions are met. In the Ethereum blockchain, we use the solidity language to write smart contracts. These smart contracts are validated and executed in the Ethereum virtual machine by the public. In a private and permissioned ledger Hyperledger Fabric, we call it chaincode and it can be written in Golang, Node.js, and Java.

How a blockchain works

In the blockchain decentralized world, a request is processed by peer-to-peer distributed nodes instead of a central authority. Anyone can host the node and process the request in a public blockchain. Once the...

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. About the Author
  6. About the Reviewer
  7. Acknowledgement
  8. Preface
  9. Errata
  10. Table of Contents
  11. 1. An Introduction to a Blockchain
  12. 2. Exploring a Blockchain on AWS
  13. 3. Exploring the Amazon Quantum Ledger Database
  14. 4. Exploring Hyperledger Fabric
  15. 5. AWS Managed Blockchain to Create Fabric Network
  16. 6. Developing the Chaincode, API, and UI with the Fabric SDK on AWS
  17. 7. Adding Members to the Fabric Network on AWS
  18. 8. Deep Dive into Ethereum Blockchain
  19. 9. AWS Blockchain Template to Create Private Ethereum
  20. 10. Solidity Smart Contract Language
  21. 11. Create and Deploy Asset Tracker Contract on AWS
  22. 12. Testing and Interacting with Asset Tracker on AWS
  23. Index