Blockchain is being heralded as the innovation platform of the future and is widely used for cryptocurrency and data exchange. In a recent Forbes article, Tiana Laurence, one of blockchain’s pioneers, wrote that she thinks the next step for blockchain is “the so-called killer app to bring the technology to the masses, to simplify it and build a path to usage without inherently needing to understand the intricacies beneath it.”
We can’t promise you the “next killer app” part, but we can show you how you can build a blockchain-enabled app with OutSystems and Hyperledger Composer.
Hyperledger Composer: Blockchain’s Version of Low-Code?
Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier. It simplifies application development on top of the Hyperledger Fabric blockchain infrastructure, which allows components, such as consensus and membership services, to be plug-and-play. With Composer, you can model your business network and integrate existing systems and data with your blockchain applications.
Composer abstracts the blockchain complexities and, as a result, you can develop, test, and expose blockchain applications much faster. Its architecture is brilliant, something of a low-code tool for blockchain.
Installation is simple and straightforward, and Composer comes bundled with a few examples. For this how-to, I've selected the Car Auction Network.
The model implements:
- Two participants: The auctioneer and a member
- Two assets: A vehicle and a vehicle listing
- Two transactions: Making an offer (bid) on a car and closing a bid on an auction.
Once it is published, we are ready to go.
Exposing the Blockchain
The requirements for this app are very simple. A member can put a car up for sale at an auction and bid on current car auctions. An auctioneer can monitor the auctions and close the bids. We started by using the composer rest API generator to expose the blockchain part of the application, and the result is:
Consuming the API
From here, we used OutSystems to consume the API. Because it is in the Swagger format, OutSystems has no problem in introspecting it in its entirety.
For this kind of app, you must get good quality data that your audience recognizes. For example, they can relate to "2017 Ford Focus" better than "2017 Brand A Model Y.” You also need a VIN (vehicle identification number), vehicle details, some sense of vehicle value for the auction reserve price, and possibly some pictures.
Randomvin.com offers a random VIN generator, NHTSA offers a VIN details REST API, CARFAX provides current value information, and Autobytel provides generic photo based on make, model, and year. These were all consumed REST APIs.
Adding a Dashboard of Excitement
A mobile car auction app must be as exciting as the real-life version. Therefore, the user should see the incoming bids of others. Luckily for us, Hyperledger Composer implements events and the REST API exposes them through a WebSocket.
A quick update to the logic file implements the events in Composer:
// emit a notification that an offer has occurred var listingNotification = getFactory() .newEvent('org.acme.vehicle.auction', 'ListingNotification'); listingNotification.listing = listing; emit(listingNotification);;
From Silver Car to Silver Bullet? Not So Fast
Blockchain has some very interesting use cases when your solution requires a distributed ledger, involves multiple parties who don't necessarily trust each other, and immutable transactions, but it is not a silver bullet. Our auction app, for example, wouldn't apply to a single auction company but rather a network of unrelated entities, all following the same process enforced by the blockchain.
Nevertheless, the combination of Composer and OutSystems is very powerful, enabling you to develop a blockchain consumer application quickly.