0% found this document useful (0 votes)
10 views

Blockchain AWS

1. A client submits a transaction proposal to endorser peers. 2. Endorser peers simulate the transaction and return their endorsements to the client. 3. The client collects endorsements and broadcasts the transaction with endorsements to the ordering service. 4. The ordering service orders transactions and broadcasts to all peers. 5. Peers validate endorsements and validate the transaction meets policy before adding to the ledger.

Uploaded by

ihsanfaisal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Blockchain AWS

1. A client submits a transaction proposal to endorser peers. 2. Endorser peers simulate the transaction and return their endorsements to the client. 3. The client collects endorsements and broadcasts the transaction with endorsements to the ordering service. 4. The ordering service orders transactions and broadcasts to all peers. 5. Peers validate endorsements and validate the transaction meets policy before adding to the ledger.

Uploaded by

ihsanfaisal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Amazon Managed Blockchain

How to build an application with


Amazon Managed Blockchain

Michael Edge
[email protected]
Sr. Blockchain Architect
AWS Professional Services

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Housekeeping

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Housekeeping

• Everyone on mute
• During the hands-on part, I’ll explain every step in detail
• We are recording the session
• If you have questions use the chat box
• We will answer questions in the chat box during the webinar
• We will spend time on Q&A at the end of the webinar
• We have our team leads on the call: Product: Jon Fritz (jonfritz@) & Mert
Hocanin (hocanint@), Business Development: Shruthi Rao (shrurao@),
Marketing: Chirag Dhull (cdhull@)
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Agenda

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Agenda

Hands-on: create a Fabric network on Amazon Managed Blockchain


Discussion: where are the Fabric components located, and how to
interact with the network
Discussion: smart contracts, or ‘chaincode’
Hands-on: create channels, deploy chaincode
Discussion: Hyperledger Fabric SDK
Hands-on: deploy RESTful API server, which uses Fabric SDK
Hands-on: deploy web application

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hands-on webinar objectives

We will create a Fabric network on Amazon Managed Blockchain, then deploy


an application that interacts with the Fabric network:
• Create a Fabric network on Amazon Managed Blockchain
• Create a peer node in the network
• Create a new channel, install and instantiate chaincode
• Query the chaincode and invoke transactions
• Deploy a RESTful API which connects to the Fabric network and exposes the
chaincode functions as REST endpoints
• Test the RESTful API
• Deploy a Node.js web application that calls the RESTful API

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Announcing
General availability of
Amazon Managed Blockchain

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric available today and
Ethereum coming soon

AMB is now ready for production workloads with availability in US East (N.
Virginia)
• Customers can simply go to the AWS Management Console and get started
• For more info go to https://aws.amazon.com/managed-blockchain

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources

Blogs
• https://aws.amazon.com/blogs/database/build-and-deploy-an-application-for-
hyperledger-fabric-on-amazon-managed-blockchain/
• https://aws.amazon.com/blogs/database/add-new-members-to-a-hyperledger-
fabric-channel-on-amazon-managed-blockchain/
GitHub repo
• https://tinyurl.com/y7h6369b
• https://github.com/aws-samples/non-profit-blockchain

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Managed Blockchain
Fully-managed blockchain service, supporting both Hyperledger
Fabric and Ethereum frameworks

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is Amazon Managed Blockchain?

Amazon Managed Blockchain is a fully-managed


service that makes it easy to create and manage
scalable blockchain networks using popular open
source frameworks: Hyperledger Fabric and
Ethereum

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s get started

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s get hands-on

Create the Fabric network on Amazon Managed Blockchain

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric components

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fabric Network managed by Amazon Managed Blockchain

Hyperledger Fabric Ordering Service


(Orderer)

Member A

Fabric Certificate
Authority

Peer Node

Amazon VPC
PrivateLink

VPC Member A

In this webinar we will VPC Endpoint

build a Fabric network that


looks like this Fabric Client Node

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fabric Network managed by Amazon Managed Blockchain

Hyperledger Fabric Ordering Service


(Orderer)

Bank A Bank B RMO Central Bank

Fabric Certificate Fabric Certificate Fabric Certificate Fabric Certificate


Authority Authority Authority Authority

Peer Node Peer Node Peer Node Peer Node

Amazon VPC
PrivateLink

VPC Bank A VPC Bank B VPC RMO VPC Central


Buyer/Seller Buyer/Seller Arbitrator Observer

VPC Endpoint VPC Endpoint VPC Endpoint VPC Endpoint

Fabric Client Node Fabric Client Node Fabric Client Node Fabric Client Node

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Typical layered architecture

RESTful API
Interact with Use REST Connect via
application resources Fabric SDK

Layers we will build in this webinar:


1. Hyperledger Fabric network & chaincode that executes on the Fabric peer node
2. A RESTful API that uses the Hyperledger Fabric Client SDK to interact with the
Fabric network
3. A user interface application that calls the API

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Enough talking, Edge; get back to
building

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric Chaincode

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Chaincode basics

• Code executed on the network, that can query and update ledger
• Fabric supports chaincode in three languages:

• Chaincode executes within a Docker container on peer nodes


• Chaincode has two operations in its interface:
• Init()—Initializes the chaincode with parameters
• Invoke()—Invokes the chaincode with parameters
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Chaincode example

Let’s take a look at chaincode written in Node.js


• https://github.com/aws-samples/non-profit-blockchain/blob/master/ngo-
chaincode/src/ngo.js
• Lines 400 onwards show the implementation of the chaincode interface
• Line 455 shows how to add a new Donor to the ledger

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Transaction flow with Hyperledger Fabric

4 Broadcast endorsement

3 Endorsement signature

5 Verify policy

Ordering service
Peer-n
1 Transaction proposal

2 Transaction simulation

Submitting-client
Peer-1

6 Transaction delivery to peers

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Enough talking, Edge; deploy that
chaincode

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric SDK

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric SDKs

• Fabric provides SDKs in Node.js and Java


• Coming soon are SDKs for Go, Python and a REST SDK
• The SDK allows you to
• Register and enroll users
• Create & join channels
• Install & instantiate chaincode
• Invoke transactions
• Query the ledger

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hyperledger Fabric SDKs—example

Let’s take a look at how to use the Fabric SDK


• https://github.com/aws-samples/non-profit-blockchain/blob/master/ngo-rest-
api/app.js
• Line 203 shows how to post a new Donor—this calls the createDonor chaincode
method we looked at earlier
• https://github.com/aws-samples/non-profit-blockchain/blob/master/ngo-rest-
api/invoke.js
• The request is sent to the peer nodes for endorsement (line 51)
• All endorsements are packaged and sent to the orderer (line 127)

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Enough talking, Edge; wrap up the
hands-on part

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Summary

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Summary of today’s webinar

• We announced GA of Amazon Managed Blockchain


• We stepped through a hands-on lab where we created a Fabric network on
Amazon Managed Blockchain
• On top of that network we deployed a RESTful API that talks to
the network, and a web application that uses the RESTful API
• We discussed where the Fabric components located, how you would
interact with the Fabric network
• We discussed chaincode, and how to use the Fabric SDK

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources

Blogs
• https://aws.amazon.com/blogs/database/build-and-deploy-an-application-for-
hyperledger-fabric-on-amazon-managed-blockchain/
• https://aws.amazon.com/blogs/database/add-new-members-to-a-hyperledger-
fabric-channel-on-amazon-managed-blockchain/
GitHub repo
• https://tinyurl.com/y7h6369b
• https://github.com/aws-samples/non-profit-blockchain

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Channels

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Channels for access control

Channels allow isolation


of transactions among
specific members
in the network
Create or update a
channel with Member 1
Channel 1
Ledger Member 2
Channel 2
Ledger Member 3
Peer Peer Peer
configuration
transaction (configtx)
Member 1 Member 2 Member 3
Channel 1 Channel 2

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Peer nodes

• Stores a copy of the Submitting client

ledger database PeerLedger


block seqNo=blckNo
Validated Ledger
block
seqNo blckNo

• Executes chaincode blob1 blob1 tx1


blob2 tx2 Genesis block
and endorses blob3

transactions
PeerLedger Validated Ledger (VL)
Peer
• Validates
3

Verify endorsement, readset


transactions before Block
forming
4
If OK then apply writeset
Else invalid transaction (blob)
the final commit

Orders
to ledger Ordering service

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

You might also like