You are on page 1of 12

Practices for Lesson 1:

Introduction to Hyperledger
Fabric
Practices for Lesson 1

Overview
In these practices, you will learn to create AWS Managed Blockchain Network, VPC Endpoint,
Fabric Client Instance and setting of the IAM permissions.

Use Case
• Blockchain technology accelerates the Mortgage Lending Process. In this course we
consider one such Mortgage Loan Process i.e, Gold Loan. The Implementation is based
on Hyperledger Fabric which is a distributed ledger framework.
• The Implementation handles Gold Loan Transactions between Service Provider and the
Customers.
• The Hyperledger Fabric Ledger keeps track of the transactions made between the
Service Provider and the Customers.
• The Chaincode implementations in this Course includes Invoking Gold Loan Application,
Business Logic for Quality Test and Customer getting the Application Status.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

2 Practice for Lesson 1: Introduction to Hyperledger Fabric


Practice 1-2: Create and set up Fabric Client Instance and setting the
IAM Permissions

Overview
In this practice, you will learn to create IAM role permissions policy for Hyperledger Fabric Client
Instance.

Assumption
You should have completed the Practice 1-2

Tasks:
1. Create an IAM policy role in AWS console.
a. Navigate to services and type IAM to add the policy role.

b. In IAM console, click Policies from the Dashboard and click Create policy as shown
below

c. Click JSON tab and create a policy in JSON format. Copy the below code and paste
it in the JSON editor

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

Practice for Lesson 1: Introduction to Hyperledger Fabric 3


{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListNetworkMembers",
"Effect": "Allow",
"Action": [
"managedblockchain:GetNetwork",
"managedblockchain:ListMembers"
],
"Resource": [
"arn:aws:managedblockchain:*:<AWS-ID>:networks/*"
]
},
{
"Sid": "AccessManagedBlockchainBucket",
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::us-east-1.managedblockchain/*"
},
{
"Sid": "ManageNetworkResources",
"Effect": "Allow",
"Action": [
"managedblockchain:CreateProposal",
"managedblockchain:GetProposal",
"managedblockchain:DeleteMember",
"managedblockchain:VoteOnProposal",
"managedblockchain:ListProposals",
"managedblockchain:GetNetwork",
"managedblockchain:ListMembers",
"managedblockchain:ListProposalVotes",
"managedblockchain:RejectInvitation",
"managedblockchain:GetNode",
"managedblockchain:GetMember",
"managedblockchain:DeleteNode",
"managedblockchain:CreateNode",
"managedblockchain:CreateMember",
"managedblockchain:ListNodes"
],
"Resource": [
"arn:aws:managedblockchain:*::networks/*",
"arn:aws:managedblockchain:*::proposals/*",
"arn:aws:managedblockchain:*:<AWS-ID>:members/*",
Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

4 Practice for Lesson 1: Introduction to Hyperledger Fabric


"arn:aws:managedblockchain:*:<AWS-ID>:invitations/*",
"arn:aws:managedblockchain:*:<AWS-ID>:nodes/*"
]
},
{
"Sid": "WorkWithNetworksForAcct",
"Effect": "Allow",
"Action": [
"managedblockchain:ListNetworks",
"managedblockchain:ListInvitations",
"managedblockchain:CreateNetwork"
],
"Resource": "*"
}
]
}
d. Now, copy the ID of AWS account by clicking on the username at the right corner.

e. Edit the JSON code by providing the AWS ID and click Review Policy as shown
below

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

Practice for Lesson 1: Introduction to Hyperledger Fabric 5


f. Provide the name and description for the policy and click Create policy

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

6 Practice for Lesson 1: Introduction to Hyperledger Fabric


2. Add the policy to the role in AWS console
a. Click Roles from the IAM Dashboard and click Create role as shown below.

b. Click on EC2 and click Next: Permissions to add permissions as shown below

c. In create role page, select Blockchain policy by typing blockchain in the search bar
and click Next to add tags as shown below.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

Practice for Lesson 1: Introduction to Hyperledger Fabric 7


d. Skip the tags and click Next to give the name for the role.
e. Provide the name as Blockchain for the role and click create role as shown below

3. Create an EC2 Instance for Fabric Client using Amazon Linux AMI in AWS EC2 console.
a. Navigate to EC2 console to create an Instance as shown below.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

8 Practice for Lesson 1: Introduction to Hyperledger Fabric


b. In EC2 console, click Instances from the navigation menu in the left side as shown
below.

c. Click Launch Instances to create a Fabric Client Instance in EC2 console as shown
below.

d. Choose Amazon Linux AMI with 64-bit and click Select as shown below.

e. Now, choose the Instance type as t2.micro and click Next to Configure Instance
details.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

Practice for Lesson 1: Introduction to Hyperledger Fabric 9


f. In the Configure Instance Details page, leave the options as default and click Next to
add Storage.
g. In the Add storage page, leave the options as default and click Next to add tags.
h. Add tags or skip this step and click Next to add security groups.
i. Further, click Select an existing security group and choose the Security Group ID
Blockchain-client created in previous practice and click Review and Launch

j. Review the Instance Details and click Launch as shown below

k. In the dialogue box, download the key pair by providing the name and click Launch
Instances.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

10 Practice for Lesson 1: Introduction to Hyperledger Fabric


l. Verify the Instance is running successfully in the EC2 Instance console as shown
below.

m. Provide the name for the instance as blockchain as shown below.

4. Set the IAM Permissions to the Instance created.


a. Select the Instance created in the previous step and click Actions and choose
Instance settings. Under Instance settings, select Attach/Replace IAM role
Note: If you have new AWS UI, select Security to attach IAM role.

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

Practice for Lesson 1: Introduction to Hyperledger Fabric 11


b. In Attach/Replace IAM Role console, select the role Blockchain and click Apply as
shown below.

c. View the IAM role is applied to the Fabric Client Instance successfully.

5. Keep the AWS console open for the next practice

Copyright © 2020, Proton Expert Systems & Solutions. All rights reserved.

12 Practice for Lesson 1: Introduction to Hyperledger Fabric

You might also like