Building BLOCKCHAIN Apps With HYPERLEDGER COMPOSER



my name's Simon stone I'm a maintainer on a project called hyper ledger composer which is our framework for building block chain solutions quick question or quick round of questions rather who's heard of hyper ledger composer before Oh a couple of hat has anyone actually tried it out no okay and that's a shame who's heard of blockchain Oh lots more hands excellent who's heard a bit coin pretty much the whole room right excellent has anyone aside from high political posers anyone tried building blockchain apps before whether a Bitcoin or etherium or quarter yeah couple of hands okay good and so I'm going to show you oh one final question who knows how to cope JavaScript yeah so I'm gonna show you how you as standard JavaScript developers can build a blockchain solution but first a quick round of blockchain introduction and this is going to be very quick so what is blockchain in one sentence is just a trusted distributed ledger a record of transactions that occur in a network and why do we need this well this is an example of a business network today you can see we've got six participants participant a and B terrible names but a bank an insurance company a regulator and an auditor and they all maintain their own Ledger's their own log of the transactions that they make within this business network and this is inefficient it's expensive and everyone is recording the same log of transactions there is also a bit of a problem here because if someone's records disagrees with someone else's there's no resolution apart from good to go to the court and be like well my ledger says this your ledger says that what do we do and blockchain solves this by giving us a shared replicated ledger where there is one ledger we all have a copy of it and we can all update it but in this case it's permissioned as well so I I only have permission to see what I'm allowed to see on that ledger so for example the bank might only have access to see bank records for people who bank with that that's a lot of uses of the word Bank the regulator might have access to see everything but might not have access to update the ledger whereas participant a might have very limited access to the ledger in order to just solve transactions for their bit of business and blockchain provides four key characteristics consensus everyone has to agree on the changes that get recorded on the ledger provenance you can use the blockchain ledger to track the history of an asset see where it came from immutability once something gets recorded on the blockchain ledger it's there forever and that's guaranteed by the blockchain and finality the blockchain is the single source of truth there's no our way says that on the blockchain but I'll go check my ledger the ledger should be the source of truth the blockchain ledger should be the source of truth rather and I asked about Bitcoin because bitcoin is really important it's the it's an unregulated shadow currency for those of you that haven't tried it out but it's the first blockchain application iBM is not interested in Bitcoin or cryptocurrency for that matter but what we are interested in is the technology to underpins Bitcoin that was introduced in around 2008 and we've really focused on using that blockchain technology to enhance business processes and blockchain for business differs from blockchain for crypto currencies and a couple of key areas it offers identity over our normality in Bitcoin nobody knows who you are you're just a certificate block think of in blockchain for business because we're in a business network we're dealing with parties that we already know and trust a bit more reputation is on the stake if I screw up or start trying to put invalid data into the ledger then my reputation is going to suffer and I'm going to lose customers and business Bitcoin uses a consensus algorithm called proof of work which is very resource-intensive essentially miners have to compete by solving mathematical problems using hashing in order to add blocks to the blockchain when they do this they are rewarded with bitcoins mining fees you need that for a pub untrusted Network where everyone is anonymous because anyone could be trying to update the ledger to transfer funds in there to their benefit whereas in blockchain for business there's a limited set of participants just those D duelling doing business with each other and so we can use a less resource-intensive consensus mechanism we call it selective endorsement where only the party's interested in the transaction maybe the buyer the seller their banks and maybe the regulator sign off on the transaction before it gets recorded to the blockchain we're interested in tracking assets just assets in general whatever kind of assets those might be rather than crypto currencies there are four main requirements for a blockchain for business those are a shared ledger the immutable log of transactions that everyone gets access to the smart contract the code that governs that ledger who can update it what updates are allowed to make what transactions are occurring in this network privacy the rules around who can see what data in the blockchain finally trust the knowledge that changes are only made and committed to the blockchain if people have signed off on them and what benefits does this bring well for starters it saves time many business processes today are still based on paper you still have to send letters off and this is clearly inefficient so blockchain makes certain transactions go from weeks and months down to days hours and minutes removes cost there's no overhead you don't have to manage your Ledger's anymore reduces risk of people tampering with your ledger and finally increases trust through shared processes regulators now have or regulators can now block use blockchain to gain full insight into what's occurring in a business network not just the information that they request be sent to them those of you where the key now may notice I'm not wearing an IBM t-shirt I'm wearing a hyper ledger t-shirt so those of you that aren't aware hyper ledger is an umbrella project started by the Linux foundation to build blockchain technologies for businesses started in December 2015 and it's grown rapidly since then IBM were one of the starting members we're now over 140 members it's all based around open source and open standards and it's a set of seven or eight projects under the hyper layer project now one of them is fabric hyper laser fabric which is a blockchain technology one of them is composer but there are other projects there as well and there's a big list of members of hi pleasure you'll see IBM on the left but some other big names as well Intel JPMorgan our free American Express and this list keeps getting updated on a regular basis which is great to see so now on to the important bits hi pleasure composer is a framework to accelerate the development of solutions on top of a blockchain platform such as hyper ledger fabric and why do we need that in the past it's traditionally being very difficult to build blockchain solutions on top of the existing technologies it's very technical and it's very new it's it's proven difficult we speak to a lot of clients over the past couple of years where they have really struggled they have great use cases but they really struggled to take those use cases and turn them into working pocs or even production deployments and composer our emphasis from a start was really on enabling people to deliver solutions quickly using a business centric vocabulary so before the blockchain solutions were all very technical is based around a key value pair map but now we want them to focus at their business use case level so they're focusing on the assets the participants and transactions that occur within their business network that are trying to port to blockchain we've given them business centric API so they can build applications around a blockchain business network and they can use those API to submit transactions create assets or update assets remove assets and work with participants and permissions as well and all of that data gets stored on the blockchain both in the ledger and in a database called the world state we've also got some tools that allow you to easily integrate blockchain solutions with your existing systems of record many of the companies adopting blockchain have been around for a very long time and have existing systems whether that's like EAP enterprise or ERP systems like sa P or Internet of Things devices and they need to bring the data from those systems to the blockchain as well and so we've built quite a extensive and open development toolset that most of you will probably be quite familiar with starting with the unfamiliar thing in the top left we built a custom domain specific language that allows you to model your business network this is a composer modeling language we've enabled you to write your business logic in smart contracts using standard JavaScript we have a web-based playground for learning composer trying it out testing your business Network in your solution we have some client libraries for building applications those are no js' libraries we have some editor plug-ins for a couple of popular editors ass women Visual Studio code we have a command line and a composer command we can do some cogeneration so because we know what the blockchain solution looks like because you've taken a time to model that solution using the composer modeling language we can generate a scaler to an angular application within a minute and finally we have some integration technology built on top of loopback and swagger open standards for building REST API so before I dive into the technical bits I'm going to show you a quick demo drink the first and this is a demo around a vehicle lifecycle of a vehicle within a network and you can see that we have quite a few participants in our vehicle tracking business Network we have Alex from the agency for vehicle standards Paul a buyer of a vehicle Debi the vehicle regulator the DMV in the US Tommen and insurer Mike the manufacturer and Vardar from the police but we're just going to focus on three key participants in this demo we're gonna focus on Paul who's going to buy a vehicle from Mike whilst Debi the regulator keeps a watchful eye over this Paul's going to use a mobile app to order his vehicle from Mike at areum who's going to integrate his chaim bits with enterprise integration tools and ERP and the Internet of Things he's enabled his he's got an existing factory process that he's had for years he started enabling with enabling it with IOT to start tracking the lifecycle of a vehicle as it moves through the factory floor and finally Debbie is going to use this new information stored on the blockchain to perform analytics and look for potential regulation fraud look at the apps so this is Paul's view of the blockchain he doesn't even know he's using a blockchain this is just a standard mobile application built with ionic and angular I believe I'm not a UI developer so and don't quiz me on those parts and so we're gonna build a car and we'll go for the area Nova anyone want to pick some options standard or executive trim the executive color purple interior color rum good choice extras tinted windows i recommended i recommending extended warranty these REM cars are a bit dodgy so i'm going to click the purchase and build button so what what happened when i click that button was a transaction got submitted to the blockchain to record that order onto the ledger we can see that mike from his merit man area manufacturing dashboard has instant insight into this order appearing in the blockchain network you see does it popped up and it's ready to start manufacturer most importantly though we can see that the transaction has been added to debbie's regulatory dashboard view of the blockchain so she can see and she has instant insight into that water being placed that's which has to mike and kick off the manufacturing process this bit requires a lot of imagination i'm afraid there's no real factory floor tied to this button and as we imagine the vehicle moving through the factory floor as events like the chassis being build the chassis number being stamped to intuit it going through the paint shop we're going to submit a dish all transactions to record those updates onto the blockchain you'll see that their status updates there Paul gets instant insight into his vehicle processing along but again importantly it's not gonna refresh we can see that Debbie gets instant insight into the lifecycle of the factory before it's even left it and finally she can see that the vehicle has moved into delivered State so we've tracked the whole ordering process from Paul ordering from the application all the way through to factory floor wood a way to delivery and we've done it on a blockchain Paul's being able to do that without knowing anything what he's interacting with Mike doesn't really know that he's interacting with a blockchain what the regulator has a full insight to what's going on and that's what's most important here so how do we build this demo we built it using hyper ledger composer which is a framework for building blockchain applications and we started off in this this is the composer playground at the web tool for learning composer and we had to build a set of files that make up a blockchain solution and the first of those are a model file written in the composer modeling language that describes everything you just saw in that demo so it describes a vehicle asset it describes a manufacturing participant and it describes some of the transactions that occur in that business network so if I click on PDA and an interesting bit don't know of you guys because you know let me just zoom in so here we've modeled a vehicle asset this is a type it's identified by a VIN a vehicle number it's got some vehicle details a status a relationship to the person who owns that vehicle a number plate and some other data as well we've modeled some transactions so we have a transaction for scrapping the vehicle or transaction for updating suspicious vehicles events as well so we can model events that occur in a blockchain business Network once you've modeled everything in your blockchain Business Network you need to start implementing your business logic and you do that with JavaScript for each transaction that you define in a model file you implement that logic so let's take a look at an example so when Mike clicked that button in the mobile application to order his vehicle he submitted a place order transaction to the blockchain which then executed this JavaScript code on that blockchain network it's fairly simple I hope it's fairly obvious all it does it creates a new instance of the order asset using a factory class fills out some properties of that order and then it stores it into an asset registry recording it on the blockchain for future use finally we create a new event an instance of a place order event to tell other applications that something has happened in the blockchain that an order has been placed so you can trigger downstream processing based off of that the other file which is not that great to look at but is a permissions file who can do what in this business network and there's a very simple demo where we simply said that everyone can do everything in this network this is connected to a real blockchain running on my laptop we can see that by going to the globe in the top left we defined a connection profile that defines where the blockchain network is where the nodes that make up that blockchain run once we've built everything in the composer playground you might want to switch to a more powerful maybe your favorite editor and as I mentioned we've built a couple of plugins for a couple of editors so we have a Visual Studio code plug-in it gives syntax highlighting a bit of code completion support and you can just work with your composer artifacts as you would any other standard JavaScript project we've also enabled you to be able to unit test your blockchain solutions built with composer using standard JavaScript unit testing tools so you can use maca to write unit tests around your business logic I scroll down so I have a test that says checks that Alex can read all of her assets in this network but we've also written a step library using cucumber so you can write a little more friendly for your business Network so given and nice and simple so a lot easier for those businesspeople that we're trying to target with this solution to start writing tests acceptance tests for what's being built we can also integrate it with standard code coverage tools like Istanbul so here's the code coverage report for our basic sample network our hello world you can simply see in the business logic for our sample transaction what parts it took just like any standard JavaScript once we build those artifacts that make up our blockchain business network we can package them up and deploy it into the blockchain at which at which point they start becoming a running thing that you can start interacting with but that's not where we stopped we wanted to enable developers to build solutions around that as well in the first part of any proper solution is being able to build a REST API for it so we started off with a technology called loopback is everyone familiar with loopback so loopback is just a framework for generating REST API from a variety of back end systems like databases and we built a loopback connector for composer that allows you to connect to a running Business Network deploy to blockchain and generate a REST API for it in a matter of seconds really and we package that up into a single easy-to-use command when you run that you get your familiar swagger UI at which point you can start writing applications against the REST API so for each type you define in your network we generate a REST API for it so we have REST API surround orders around manufacturer participants around all of the transactions as well you can also take this REST API and enable it for authentication using passports at passport has 300 different strategies for integrating with your existing authentication providers and will take care of the mapping between those users and the blockchain users for you so you don't have to worry about those parts because loopback is all standards-based it also generates a swagger document for your blockchain business network at which point you can plumb it into any tool that uses my favorite one is the swagger coach in if you don't want to use JavaScript you might want to use Java or.net that way inclined and so you can use swagger coach n to quickly generate an SDK for your programming language of choice so once you have a running REST API you really want to start building some client applications that interact with that blockchain business network and we really wanted to give users a hand helping hand brother and we've done that using a plug-in for yeoman so you can use the yeoman generator to generate an angular application from a running business network I'm sure most of you have seen it but it has a cool command-line you just say yo – ledger composer and it's going to ask you some questions do you want to connect to a running Business Network yes some information about the project to create license which network I want to connect to lots of questions and it goes off it connects to that blockchain business network and it generates an angular 2 application or angular 4 or other application with a set of UI components for all of the types that you've defined in that network so you can see this is our perishable goods sample and we generated an angular component for a shipment asset and a component for a contract asset I'm gonna cancel the npm install because i'm not connected to the Internet but here's one I prepared earlier it's not pretty to look at we haven't spent a lot of time on the UI design for this one I'm afraid but importantly you get a menu in the top right that gives you a list of all of the types in this network or just the assets in this case and then you get some generated components that allow you to interact with the blockchain so we've got a table that lets you work with shipments now you can see there's a shipment already stored on a blockchain for some bananas and then we generate some forms for adding updating and deleting assets from the blockchain as well now whilst it's not very pretty – look look at it shows any UI developer how to interact with the blockchain easily and they can take that and apply some proper UX and UI design to it finally I mentioned that the manufacturer has some existing business processes that we need to integrate with and for those of you that saw the next talk earlier we've built some nodes for node red that allow you to wire up various systems with your blockchain business network to scroll down to the pallet we can see them there the free hyper ledger composer nodes they allow you to subscribe to events from a blockchain business network as well as submit transactions and retrieve assets and participants from the blockchain scroll across so this bit of the flow at the top take some input from a WebSocket that's a bit of transformation and then submit an order to the blockchain so this is the node-red flow behind pools mobile application that he used to order is vehicle that's it for the demo and if I just finish off on some slides everything we do is open source everything you've just seen is open source and available today we released it in March and it was accepted into hyper ledger as a top-level projects as soon after everything we do is tracked in github you can see our plans for the future and our current list of issues and we'd love for you to come along and participate I have a comment on what we're doing provide feedback contributions are gladly welcomed and start planning to help us start planning to build for the future we also have weekly calls and they run on an alternating schedule we're in the UK so we get to cover most of the world that way we have a late afternoon call for us and an early morning call for us but that lets us get America and Japan and everything in between so and what we really like about those calls is not just a chance for us to talk about what we're doing it's a chance for our users to come along and show us what they're building with composure we're all over the Internet we're easy to find in search engines nowadays but you can find everything we've got a website a web page Rover on the hypoplasia website we've got our main main Doc's page it's got some tutorials and some documentation that help you get going with composer there's a publicly hosted version of that playground that development tool on bluemix that you can connect to and try out without having to install anything and you'd find all our source code and NPM modules in the usual places finally you can come and speak to us we're in rocket chair which is an open-source alternative slack that's run by the hyper ledger team we have a couple of channels in there we've got a Stack Overflow tag you can ask us questions on and you can also tweet us as well yeah thank you very much blockchain in about 25 minutes so thank you are there any questions [Applause]

34 thoughts on “Building BLOCKCHAIN Apps With HYPERLEDGER COMPOSER

  1. Thank You! Nice Video!!

    #Blockchain #Development #Services and #Artificial #Intelligence Services works in sync to integrate the smart logic into every bit of data. #Hyperledger Blockchain Development enables blockchain for businesses in Canada whereas #Ethereum Blockchain Platform provides solutions to local communities and global enterprises.

    Visit Us @ https://cipherhut.com/

  2. What about human errors during information registering?, As I know a record can´t be changed when your record it to a blockchain. Thanks.

  3. Looked at this and I am like: Why did they tool this so much, loopback is just overkill, should have kept to a simple express server. I don't want to learn openapi, when i will use graphql. REST is dead, and no I don't want to use loopback REST to GQL, just more useless stuff to learn with zero benefits. yoman to generate outdated angular app? when I rather just know how to code it up using a Angular CLI app. All this extra tooling is not needed, it adds complexity from someone else stack design decision. Just give me simple APIs I can use from JS for Composer, is this too much to ask for. Nope, IBM wants to force you to use their loopback, with more abstraction and coding than you need to develop a API server.

  4. Using Composer is one method to develop Hyperledger Fabric applications and here's another method if you want to take a look at,
    "Build a Blockchain PoC Application using Hyperledger Fabric", https://medium.com/coinmonks/build-a-blockchain-poc-application-using-hyperledger-fabric-6bbe633c2204

  5. hii sir great tutorial

    but i have one error
    when i start the angular app
    npm start

    [0]
    [0] ERROR in /home/bc/block-track/angular-app/src/app/model.ts (2,9): Duplicate identifier 'Participant'.
    [0]
    [0] ERROR in /home/bc/block-track/angular-app/src/app/model.ts (5,9): Duplicate identifier 'Participant'.
    [0] webpack: Failed to compile.

  6. You know what I love about this video the regulations, the private Blockchain, the big centralised mediaries being involved. Love that hyper ledger has some of the most dominant fiat controllers involved with sponsorship. I especially love how a private Blockchain is so Hashgraph. Your speech is so awesome, so hashgraph. Private Blockchain with already trusted nodes is the future, no proof of work, no proof of stake! Who needs that! It’s a waste of computation power. Please Mr “ I’m not pushing IBM man” please let me be a node in your private Blockchain!!! Please I can stack good bit!

  7. Are searchinging for the best Blockchain develpment company? Here i have experienced one of the best Blockchain development company Bitdeal (https://www.bitdeal.net/hire-blockchain-developers) who provides the highly secured Blockchain Applications…!

  8. Cryptocurrency investments are going to increase, because people are recognizing the trend and ignoring the noise.

  9. Impressive presentation and really thorough set of tools, plugins, features and integrations! Amazing indeed!

  10. Consensus, provenance, immutability, finality. If Hyperledger does not have consensus, how is it blockchain?

  11. Just completed your install and I must say that was the easiest and cleanest Unix install I've ever done. Great job!

  12. Clear explanation…would like to know more technically, we are facing errors while doing Network Admin Creation through Javascript.

    The error is explained in this link https://github.com/hyperledger/composer/issues/4015

    Any idea or suggestion is highly appreciated.

    Thanks.

  13. finally a presentation with demo !
    need more like this, please make more 🙂
    good job

  14. Original video source : https://vimeo.com/229651285

    You folks used to link to the original video until a month or two ago, what happened?

  15. It's not 'untrusted network' – it's trustless. It doesn't require trust. That's the whole point. Millenial's trust in governments and banks is at an all time low. Permissioned chains are not taking this into account which is a big mistake.

  16. Great and very helpful presentation! There is only one point that I did not understand: How can you ensure that nobody has tampered with the blockchain if there is no proof of work?

  17. Bitcoin does not REQUIRE TRUST Hence Trustless. A Trusted 3rd party is not necessary which is why Bitcoin is Superior Technology! Once AGAIN IBM GETS IT WRONG! – https://www.youtube.com/watch?v=GtKhYx2Vlb4&feature=youtu.be&t=788

Leave a Reply

Your email address will not be published. Required fields are marked *