Blockchain CBSA – Objectives – Hyperledger Part 6
- AWS Managed Blockchain (DEMO ONLY) No support and not on the exam
Alright, well, let’s talk about AWS manage blockchain in this demo. Now this is a very new service. At the time of writing, this is still in preview mode, so you need to be basically authorized to access the service. However, by the end of April, early May 2019, this should be general availability. So let’s talk about what exactly this is. So this is actually very similar to how things work essentially with IBM blockchain as a service.
And instead of traditionally with AWS, you deployed the AWS blockchain templates, which was more of a manual process and you had to configure and know quite a bit about AWS, to be honest, to deploy it effectively or correctly, like security groups, ACLs permissions, firewall settings, you name it. So there’s a lot there to sort of figure out and determine. AWS manage blockchain service takes a lot of that overhead out of the way and lets you just get to work a lot quicker. Now there’s currently the support right now for the managed blockchain when we go here to create a network is basically hyperledger fabric. One, two.
Now, Aetherium will be coming down the road at the time of writing. That, as you can see, is not available. Now there’s two additions there’s Starter and Standard. In this demo, we’re just going to go with Starter. We don’t need to have, of course, a lot of choices for our Amis, for those folks not familiar with Amazon Amis or machine images, basically the EC, two instances we’re going to deploy. And again, we don’t need to have additional nodes and peers, so we’re just going to leave it at Starter.
The next thing we want to talk about is a network name. This is just going to identify to us what this blockchain network is about. I’m going to call this dev one test network, just for example, and then I could put in a description. I’ll just put in this as a test. Again, just something simple. Now this is essentially our voting policy. This is essentially our endorsement policy, as we would call it, in hyperledger fabric. So we have some decisions to make here as well.
Now when it comes to the approval threshold, we want to say do we want to have greater than or greater than or equal to? So do we want to have, for example, 52% of the nodes? If we deploy, let’s say ten nodes or five nodes, what is the percentage that we want to set? So basically we want to have the yes votes above 50%. That would make the most sense in this case, but once again, we don’t need to worry too much about that.
And then let me bring this up again. My screen is a little bit limited and you could see that I have over here proposal duration. This is how long you want to leave the voting opened. And then simply after that, we would simply just go next. And now what I want to do is enter the member names. Now remember that generally we want to have essentially the member being an organization in a lot of cases, or a company. I’m just going to call this Company A. I’m going to just say Company A is my test company. Now, I also need to think about a few other things like the password and username for the certificate authority.
So I’m going to call this CA admin and then I’m going to create a password. Again, it’s going to be CA admin. Now, it says it has to be characters, whatever it is, right over eight. So we’re good. And again, they’re going to have different stipulations. So we got to play around with this until we meet it. Now, again, I wouldn’t typically use a password like this, but this is just for demo purposes and we just want to make it simple. So again, I’m going to cut and paste that so I don’t forget it. See? Admin exclamation . 123. Now once we do this, we go next and you can see there it’s going to create our blockchain network and our member options initially is going to be Company A. The admin and password is there and we just go create network and member what’s going on.
Now, as you can see up here, it is creating the network. This is going to take a few minutes. It’s not going to be super quick. You can see over here status as well. We’re going to come back to that when it is done. Now it’s still running. It’s been about probably eight minutes or so. It’s still going. But it did create the end point. So it’s doing some work.
The next step will be the order service node. But I wanted to talk about a few things before this finishes. So we’re under details and when we go to members, this is where we could go ahead and identify the members of our blockchain service. Now generally we’re going to want to create another company called Company B. Let’s say once we’re done, we’ll go ahead and add another member and then we’ll also go up here and create a proposal as well. And then when there’s a proposal, it will show up here as well.
But if we go back to the manage blockchain service, you can see that this is the process that you’re going to go through. It’s creating a network right now. Then step two will invite additional members, add peers, and then deploy an application. With that said, we’ll come back to this and see how it turns out. Okay, so we finally got the network to be deployed. Now this took literally 25 minutes to come up as available. I refreshed. Once again, your mileage may vary. It could just depend on the geo you use or network provider or just the workload. But with that said, we did deploy the dev one test network. So let’s go ahead and take a look at it.
When I select, we could see now that the status is available and that’s what we see. And then we could see that we have an endpoint as well as our VPC endpoint Services up as well. Now we have one member and it says Starter Addition and no proposals as of yet. It also deployed fabric one, two, let’s go take a look at members.
You can see that we have one member and we have a couple of choices. We could delete the member if we want, again if we want, or we can go select it as well and create a pure node as well as part of that membership. But before we do anything, let’s go take a look. Proposals and there’s no proposals because again, nothing has occurred yet. We go ahead and propose an invitation. But before we do that, what we want to do is basically go ahead and select Company A and we want to create a peer node.
Now to do that, we need to select the instance type. Now this is one of the differences between the two plans and AWS manage Blockchain service. Our instance types are going to be limited to a smaller medium config with this amount of these CPUs and Ram. I’m just going to go ahead and select Small. And now when I select Availability Zones, I could select either one of these. Now, if you select like, I’ll be honest, one A or one B generally that’s what most folks select. I’ve seen it to where it would just come back as resources not available.
So what I do is I generally just go to one C 1D. It really just depends on what is available in Nova. So let’s go ahead and create a pure node. Now that’s going to go ahead and create a pure node. Let’s go ahead and go back and just check on that pure node. You can see it’s still saying Creating. And again, this is not a magic wand where it just comes up automatically. So let’s come back when it is done. Okay, so let’s just double check that the node creation completed and we do have our member there. So that’s good. Let’s check members here and we have Company A.
And let’s check company a and you can see that there are two pure nodes under Company A. Okay? So since we have our pure nodes, what we want to do now is go back to networks and select the correct network. And now what we need to do is we need to basically create what’s called a VTC endpoint. So basically the service is up and running and this gives us the information here. So we cut and paste it as well and you can see that it’s con AWS, us, East One, et cetera. Manage Blockchain Service now this is again going to be for APIs. If we want to go ahead and add an API gateway and connect via that way via an application or the CLI for example. But we want to go here first and create a VPC. So this end point, this is actually the end point and we need to think about a few things and again to really give this justice for folks that don’t know AWS. This is like another course in itself to be very honest. So I’m just going to talk briefly about each of these.
And if you’re not familiar with AWS, then again there’s probably going to be a little bit more training on your part to really understand what’s going on. Now what we want to do is we need to select the VPC. So the VPC is again a virtual private cloud. Now I have several VPCs, the one I want to select, in this case my blockchain. And this is all created beforehand. So before the demo this was created. But again, I’m not here to teach AWS and this would be a whole course itself to be honest. Now what I want to do next is select the subnet. Now I’m just going to go ahead and select the default subnet. In this case, no need to change it. You can see that it says Public Subnet. Now security group, what is a security group? Basically think of a security group as essentially a way to containerize our ACLs. Also to a security group sometimes is referred to almost like a firewall as well.
So definitely just think about it from that perspective. But basically it’s a set of rules that sort of define how the group of EC two instances are going to basically work together or be part of the same subnet as well. But anyway, security groups, again, a little bit more to talk about there. But for the purpose of this course, just think of it as essentially a group of EC two instances. Now the one I want to select is going to be this one here, Hyperledger Blockchain. Now this is another one I created. This is blockchain book. This is actually for the template service. So I’m going to go ahead and select that one. And then again if I go here, I could also select default as well. So I could add additional security groups. So for example, if I deploy different types of EC two instances and I want to create an instance group, I could add several different security groups if I so choose.
Now since we’re just playing around here and walking through some of the basics, just going to go ahead and go create. So basically what I just did is I just added a VPC endpoint for my EC two instances to be able to connect to essentially the blockchain network. And lastly, you may run into in the documentation a term called private link. That’s essentially, basically the same thing. It’s just basically allowing us to connect from the endpoint to the EC to security group. Okay, so now what we’ve done is essentially, basically added a member. We then of course activated the VPC endpoint. And then the next thing we want to consider is go over here to members and you can see that we only have one member. So what we probably want to do is add another member. So what we could do is create a proposal to either invite or remove members. Now generally we could invite other AWS accounts or we could just create a member with the same account for test purposes.
Now of course we have some options here. So we go ahead and propose invitation and the invitation is to basically as company A, we’re going to go ahead and do a test and then we need to specify an AWS account. Now I’m going to go ahead and enter my account and I’m just going to go ahead and add. Now it says again that’s an account number or account ID. So what you want to do is not enter like the email, you need to go into your AWS account and get your account ID and then go ahead and add another one if you so choose. And then you just go create and we need to remove that of course, and then just go create so that’ll, go ahead and add that. Now this is a proposal. So what’s happening is that you have about 24 hours to accept it. So let’s go back and check what the status is and it allows us to vote as a company member and the status is in progress.
Now what’s going to happen next is it says vote on proposal. So we’re going to go yes. And now it says do we want to confirm that we want this member to join or not? It says all votes are final. We’re going to go ahead and confirm and you could go ahead and see that was confirmed. So let’s go ahead and check and what is the status? And it says approved. So that’s basically the next step we’re going to do. Let’s go back to networks, check our network again. We could see that we have basically our member and then our proposal as well, which was approved down here. Now the next thing that we’d want to do is we now need to think about a few things before we move on. And now basically what we want to do now is we want to go back to networks, we want to consider a few things. So the first thing is, is let’s go back actually to the test network and we want to actually start thinking about how we want to install our sample code. Now to do that there’s a GitHub that you want to go to and it’s over here at the AWS link. And let me go and bring that down a little bit and that will be the link and it’s in the documentation. This is the cloud formation template to provision the EC.
Two instances that we’re going to use in the AWS manage blockchain. Now this gives you the instructions on what to do. And the template is essentially right here. So what we want to do is select templates and then download the YAML file. And then we’re going to add this essentially to cloud formation. So again, this is a YAML file. You can see that it tells essentially how to set everything up, exports everything, how to connect actually down here to the CA server and all that as well. Now for the purposes of this demo, this is again, once we get to this point and start actually making transactions, that’s another whole class in itself.
So what we’re going to do is go back here to the test network and then what I’d recommend is go back to the networks and go back to manage blockchain and walk through the steps right here initially to get started with AWS blockchain. Now there’s a small actually over here getting started with the Amazon Manage blockchain. It’s right here. Now the reality is that the manage blockchain service and the templates, I personally like the templates because it just seems much more efficient. What they do is they sort of start the front end for you, but the whole back end you still got to deal with with cloud formation and you still have to set up your security groups.
You still need to install your code and they’re just managing the VMs for you once you get it set up. But you still got to do all the work. And to be very fair, this isn’t super efficient in a lot of respects compared to like IBM blockchain. But there’s is what they’re trying to get to and this is still really in basically alpha mode or actually preview mode. So I’m hoping by the time that they get to Ga that this will be fully smooth out. So this is just Amazon. Manage blockchain. So the template service is another demo in itself. So let’s go ahead and move on.
- Hyperledger Composer (depricated but still tested as far use case
Let’s talk about hyperledger composer Now, Composer is a really great way to develop on hyperledger fabric and it really enables the developers to go to market quicker. It allows them a lower learning curve. But let’s talk about what it is, how it’s used, and get into some of the details of Composer. So Composer is an application development framework. This is really built specifically for hyperledger fabric and the goal is to reduce time and the complexity of development. One of the challenges with developers is going to be not so much developing the smart contracts of the code, it’s really how to connect to the blockchain itself. So hyperledger composer really makes things easy. So the tool is going to help your developers create applications that are going to really enable the ability for your developers to develop on hyperledger fabric without having to know Go, for example, because this is based on JavaScript, so JavaScript is widely known, it’s really going to enable the development cycle to a degree. Okay? When it comes to blockchain applications, one of the things to pay attention to is that you can develop your chain code and Go or Java programming.
Now, the reason some developers would want to use Java programming is because A, they already know it and B, it’s not really low level programming like in Go. So Go is closer to the machine code than anything, and a lot of people don’t know Go. It’s a little bit newer. So what was really done was that with Composer, it enables the developers to use JavaScript and is able to translate that into basically Go for the developers to connect to the blockchain network. So it really facilitates that chain code development. Now, Composer has many components. It also allows the developers to create and recycle what they’ve done through what’s called banana files. So a BNA file is also known as Banana file. Now, on the exam, I think the only thing I saw around Hyperledger Composer was basically what file is used to store the network archive, and that’s a Banana file. Now, when it comes to Composer, there’s components to it. There’s also an online version of Composer called Composer Playground. We’ll talk about that in the upcoming module.
So Composer uses what’s called a connection profile. It enables the developers to connect up to the blockchain service without having to know Go, without having to know any kind of complex programming language. So the connection profiles in JSON, right? JavaScript, right? Nothing more, nothing less. Connection profiles most often provided by creators of the system that they refer to. And basically what this means is a connection profile does what it’s going to basically tell your smart contractor code how to connect to the network. Now, you can also use queries as well. As part of this, there’s APIs that support that. For the purposes of this course, we won’t get too deep into this. I will go through the demo coming up and walk you through Composer. Again, I would encourage you if you want to know how to program or develop on Composer. And Composer is eventually going to be going away as well.
They’re going to be changing the name, I believe, to IBM develop is my understanding. But with that said, for now it’s Composer. So when you develop, for example, your business network, you can set your access control. So there’s an ACL file you go ahead and set up. Now there’s a term that was also on the exam that was a little surprised. You want to know what a historian is. So a historian is a special type of registry that records successful transactions conducted on the network. That’s really what it is. Just think of the historian as essentially something that’s recording transactions. There’s also other components. I won’t get into each of these in this course. If you want to know more, take my hyperledger course. So Composer is a modeling language. So we need to know that. Now the modeling language is going to save everything as what’s called a CTO file. This CTO file is going to contain basically a namespace, resource definitions, et cetera.
Now Composer also has a namespace and the namespace is going to define the assets, events, participants, et cetera. I’m going to walk you through this in the demo, it’s just so much easier to show you how this works and to explain it because with development and program it’s just easy to see if you actually go through it. Now, when it comes to participants, for example, in a blockchain network, you’re going to have actors, for example, and these actors are going to interact with the application. So for example, you have a developer, a blockchain user, those are the actors and they may want to interact with blockchain resources and those resources will be called assets. Now when an asset is transferred from one actor to another, that’s called a transaction. Now in Composer, resources are going to be one of the three. They’re going to be assets, participants, transactions or events, an enumerated type or a concept.
Now when it comes to resource definition, they’re going to have properties as well. And once again, this is a subject that really deserves two to 3 hours on. But again, for this exam, there’s really going to be no more than a question or two on Composer. And you want to know first of all, what Composer is as a framework. And then second of all, remember I just told you what is a banana file, what is a CTO file? That’s really the focus of the exam.
Now just for those curious, if you’re going to go ahead and develop in Composer, you can see that this looks oddly enough like what? JavaScript, right? So if you’re already developing JavaScript, you’re going to be a hyperledger blockchain guru in no time. And again, here’s some other examples. In the demo, I walk you through a lot of this, so I won’t spend a lot more time on it now. Other areas that are supported from a programming perspective would be a raise, primitive approaches, validators relationships, imports and decorators as well. And there are, of course, several review questions I will let you look at as well in this area. Let’s go ahead and move onto the demo.