I suffered quite a dizzying writer’s block when I spun this manuscript in my head. I realized one thing for sure, it was way too big to fit into one article, furthermore, the proof of technology was an immense challenge, so I trimmed the narrative to address the initial thought, design and implementation of a mortgage loan processing and underwriting through a Fannie Mae overlay, running in the distributed ledger world. This is a real design and implementation, but may not cater to a complete mortgage straight through processing.
The structure of blockchain comprises ordered, linked blocks of transactions. The blockchain stays stored as file(s) or as a simple database. Blocks have "back" links, where each block can refer to its predecessor in the chain. It is like a stack of blocks, one layered on top of another, and commonly the first block is the prime mover of the stack.
Such being its structure, blockchain acts as a global public ledger of all transactions stored as blocks, which everyone in the network accepts as an authoritative record.
It is hard to imagine how anyone in the network agree on a single universal "truth" about who owns what, without having to trust anyone? Particularly, majority of us having learnt from our early childhood about our world of traditional payment systems that foster trust through a centralized authority, such as the bank, corporation or the government who verify, monitor and clear all monetary transactions. Blockchains in contrast, have no central authority, no team of dedicate database or systems administrators. Yet, every 'node' maintains a trusted copy of the public ledger it can present as an authoritative record. Unlike traditional systems, the blockchain has no central authority, but gets assembled autonomously by every node in the network. Every node in the network, acting on information transmitted across insecure network connections, can through consensus of members of a network arrive at the conclusive decision on a journal and assemble accurately replicated copies of the ledger.
Besides the characteristic absence of any centralized authority, transferring assets is yet another important functionality of a blockchain. How people buy, sell or barter goods in a business network with no governing body or policy makes blockchain an invaluable power-tool. Mortgage, conventional or unconventional loan is a party to such transfers of assets. In the highly regulated world of banking, blockchain provides a different flavor of such transfers, much different from the present.
Hyperledger as the blockchain of choice offers a strong separation of concerns.
For those who read my previous articles on V-Design can well correlate the Vs, Vr and Vt aspects of the design.
Let's start at the bottom of the stack and install the blockchain component. Hyperledger Fabric or the main Blockchain component comes with a built-in database CouchDB and the entire thing downloaded and run locally as a Docker image.
At the time of writing the article, I used the latest Hyperledger Composer assembled on Ubuntu Linux 16.0.4 and running Hyperledger Fabric v1.0 to prove the technology. Much reference and emphasis to Node.JS and Node Packaging Manager NPM have bene made in this article.
For a local install, these software components are needed:
$ mkdir ~/fabric-tools $ cd ~/fabric-tools $ curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip $ unzip fabric-dev-servers.zip
$ cd ~/fabric-tools $ ./downloadFabric.sh
The last command will download the Docker Image of Hyperledger Fabric.
You can read more about installation at the Hyperledger Composer tutorial site.
|Essential CLI tool||npm install -g composer-cli|
|REST Server to expose business networks as RESTful APIs||npm install -g composer-rest-server|
|Useful utility for generating application assets||npm install -g generator-hyperledger-composer|
|Yeoman for generating applications||npm install -g yo|
Download the Mortgage-Network application from github
$ cd ~/fabric-tools $ curl -LJO https://github.com/snoborder/mortgage-network/archive/master.zip $ mv mortgage-network-master.zip mortgage-network.zip $ unzip mortgage-network.zip
$ ./startFabric.sh $ ./createPeerAdminCard.sh $ cd mortgage-network
|Create the mortgage business network||$ yo hyperledger-composer:businessnetwork
See the illustration below
|Invoke composer runtime||$ composer runtime install --card PeerAdmin@hlfv1 --businessNetworkName mortgage-network|
|Deploy the mortgage business network archive||$ composer network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile|
|Import the networkadmin card||$ composer card import --file networkadmin.card|
|Ping the business network to determine it’s correct deployment||$ composer network ping --card admin@mortgage-network|
|Start the REST server||$ composer-rest-server (enter admin@mortgage-network)
See the illustration below
Caption: Creating the mortgage business network
Caption: Composer RESTful client
With the Hyperledger Composer REST client running on http://localhost:3000/explorer, the user can now invoke the RESTful GET/POST/PUT actions on the business network assets and persons, thus generating the ledger journals. I have added use-cases, invocations and commands in the GitHub ReadMe.
If you have Node-RED installed, then open a new terminal window and change to the Node-RED installation (likely it is ~/.node-red).
Install the Hyperledger Composer Node for Node-RED: $ npm i node-red-contrib-hyperledger-composer
Start Node-RED: $ node-red
Copy the flow to your Flow-Tab in Node-RED editor.
As you deploy the flow and invoke it, you get to see the results of the query on the debug tab.
At the end of the session, if Hyperledger Fabric instance gets stopped, then the next time you will have to restart the business network as suggested.
Example of a transaction:
$ cd ~/fabric-tools $ ./stopFabric.sh
$ composer network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile firstname.lastname@example.org --file networkadmin.card $ composer network ping --card admin@mortgage-network $ composer-rest-server -c admin@mortgage-network -n never -w true
Copyrights and Trademarks acknowledged. Hyperledger Composer - copyright of the Linux Foundation Node-RED is a project of the JS Foundation NodeJS is a copyright of NodeJS Foundation and Trademark of Joyent Inc Docker is copyright Docker Inc IBM is a Trademark of International Business Machines VSCode is copyright Microsoft Corporation
The code is available for download at GitHub