SlideShare a Scribd company logo
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Developing Business
Blockchain Applications
on Hyperledger
May 2018
Dr.Thanachart Numnonda
IMC Institute
thanachart@imcinstitute.com
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Launch an Ubuntu virtual server
Using Google Cloud Platform
(You can skip this part if you already have an Ubuntu server)
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Launch Google Cloud Virtual Server
In this lab, we will use a GCP’s compute engine as our server w
● Ubuntu Server 14.04 LTS
● 2 vCPU, 7.5 GB memory
● 50 GB SSD
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
cloud.google.com
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Create Google Cloud Project
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Select Compute Engine
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Select Create Instance
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Create an instance with the following configuration
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Select boot disk as Ubuntu 14.04 and 50 GB
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Connect via SSH in browser window
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Connect to the instance
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Installing Hyperledger
development environment
Installing prerequisites
$ curl -O https://hyperledger.github.io/composer/latest/prereqs-ubu
$ chmod u+x prereqs-ubuntu.sh
$ ./prereqs-ubuntu.sh
Installing the Hyperledger Composer tools
$ npm install -g composer-cli
$ npm install -g composer-rest-server
$ npm install -g generator-hyperledger-composer
$ npm install -g yo
$ npm install -g composer-playground
Installing Hyperledger Fabric
$ mkdir ~/fabric-dev-servers && cd ~/fabric-dev-servers
$ curl -O https://raw.githubusercontent.com/hyperledger/composer-
tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
$ tar -xvf fabric-dev-servers.tar.gz
$ ./downloadFabric.sh
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Starting Hyperledger-Fabric
&
Hyperledger composer playground
Starting Hyperledger-Fabric
$ ./startFabric.sh
$ ./createPeerAdminCard.sh
Viewing running process
$ docker ps -a
Starting composer-playground
$ composer-playground
Obtain a server’s external IP
Launch web-playground (http://ip-address:8080)
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Running an example business
network
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Click Deploy a new business network
Provide basic information and select basic-sample
-network (provide the network admin as Admin@hlfv1 )
Provide credentials information
(Assign the Enrolment id: admin Enrolment secret : adminpw)
Now the network is defined, click Deploy.
The new business network will be shown,
click Connect now
thanachart@imcinstitute.com31
Open another terminal console,
Type command docker ps -a,
You will see another container is running
thanachart@imcinstitute.com32
thanachart@imcinstitute.com33
Exploring a business network
Viewing the following files:
● Model
● Script
● Access control
thanachart@imcinstitute.com34
Basic-sample-network
Definition
● Asset
○ SampleAsset
● Participant
○ SampleParticipant
● Transaction
○ SampleTransaction
● Event
○ SampleEvent
thanachart@imcinstitute.com35
Testing the business network definition,
Click Test tab
thanachart@imcinstitute.com36
Click Create New Participant
thanachart@imcinstitute.com37
Enter the first participant, the click Create New
thanachart@imcinstitute.com38
Enter the second participant, the click Create New
thanachart@imcinstitute.com39
A list of participants will be shown
thanachart@imcinstitute.com40
All transactions show events
thanachart@imcinstitute.com41
Select SampleAsset, the click Create New Asset
thanachart@imcinstitute.com42
Enter the new asset, the click Create New
thanachart@imcinstitute.com43
A list of assets will be shown
thanachart@imcinstitute.com44
Click Submit Transaction
thanachart@imcinstitute.com45
Enter the transaction information, the click Submit
thanachart@imcinstitute.com46
The asset value is now changed
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Developing a new business network
thanachart@imcinstitute.com48
my-bank-network
Definition
● Asset
○ Account
● Participant
○ Customer
● Transaction
○ AccountTransfer
Click Deploy a new business network
Provide basic information and select empty-business
-network (provide the network admin as Admin@hlfv1 )
Provide credentials information
(Assign the Enrolment id: admin Enrolment secret : adminpw)
Now the network is defined, click Deploy.
The new business network will be shown,
click Connect now
thanachart@imcinstitute.com54
thanachart@imcinstitute.com55
Edit a model file
○ /**
○ * Sample business network definition.
○ */
○ namespace org.imc.basic
○ asset Account identified by accountId {
○ o String accountId
○ --> Customer owner
○ o Double balance
○ }
○ participant Customer identified by customerId {
○ o String customerId
○ o String firstName
○ o String lastName
○ }
○ transaction AccountTransfer {
○ --> Account from
○ --> Account to
○ o Double amount
○ }
thanachart@imcinstitute.com56
Select Model file, click edit icon
thanachart@imcinstitute.com57
thanachart@imcinstitute.com58
Edit a script file
○ /**
○ * Place a transaction for transfering money
○ * @param {org.imc.basic.AccountTransfer} AccountTransfer
○ * @transaction
○ */
○ function accountTransfer(accountTransfer) {
○ if (accountTransfer.from.balance < accountTransfer.amount) {
○ throw new Error('Insufficient fund');
○ }
○
○ accountTransfer.from.balance -= accountTransfer.amount;
○ accountTransfer.to.balance += accountTransfer.amount;
○ return getAssetRegistry('org.imc.basic.Account')
○ .then(function(assetRegistry) {
○ return assetRegistry.update(accountTransfer.from);
○ })
○
thanachart@imcinstitute.com59
Edit a script file (cont.)
○ .then(function() {
○ return getAssetRegistry('org.imc.basic.Account');
○ })
○ .then(function(assetRegistry) {
○ return assetRegistry.update(accountTransfer.to);
○ });
○ }
thanachart@imcinstitute.com60
Select Add a file
thanachart@imcinstitute.com61
Choose Script File(.js), the click Add
thanachart@imcinstitute.com62
Deploying the updated business network,
Click Deploy change
thanachart@imcinstitute.com63
Click Upgrade
thanachart@imcinstitute.com64
Testing the business network definition,
Click Test tab
thanachart@imcinstitute.com65
Click Create New Participant
thanachart@imcinstitute.com66
Enter the first participant, the click Create New
thanachart@imcinstitute.com67
Enter the second participant, the click Create New
thanachart@imcinstitute.com68
A list of participants will be shown
thanachart@imcinstitute.com69
Select Account, the click Create New Asset
thanachart@imcinstitute.com70
Enter the first account, the click Create New
thanachart@imcinstitute.com71
Enter the second account, the click Create New
thanachart@imcinstitute.com72
A list of accounts will be shown
thanachart@imcinstitute.com73
Click Submit Transaction
thanachart@imcinstitute.com74
Enter the transaction information, the click Submit
thanachart@imcinstitute.com75
The account balances are now changed
thanachart@imcinstitute.com76
All transactions show events
Thanachart Numnonda, thanachart@imcinstitute.clockchain App on Hyperledger
Generate REST APIs
thanachart@imcinstitute.com78
List all of the business cards
$ composer card list
thanachart@imcinstitute.com79
Start the REST server & generate the API
$ composer-rest-server
Enter the name of the business network card to use: Admin@hlfv1
Specify if you want namespaces in the generated REST API: never use namespaces
Specify if you want to use an API key to secure the REST API: No
Specify if you want to enable authentication for the REST API using Passport: No
Specify if you want to enable event publication over WebSockets: Yes
Specify if you want to enable TLS security for the REST API: No
thanachart@imcinstitute.com80
Browse REST APIs (http://ip-address::3000/explorer)
Test the REST APIs
Developing Business  Blockchain Applications on Hyperledger
Developing Business  Blockchain Applications on Hyperledger
www.facebook.com/imcinstitute
Developing Business  Blockchain Applications on Hyperledger
Developing Business  Blockchain Applications on Hyperledger
Reference:
https://hyperledger.github.io/composer/latest/installing/installing-index.html
Thanachart Numnonda,Big Data as a Service Using Google Cloud Platform
Thank you
www.imcinstitute.com
www.facebook.com/imcinstitute

More Related Content

PPTX
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
PDF
Ethereum Smart Contracts on Hyperledger Fabric
PDF
Hyperledger Fabric Application Development 20190618
PPTX
Hyperledger
ODP
Blockchain Explorer
PDF
Developing applications with Hyperledger Fabric SDK
PDF
Tech Talk - Blockchain presentation
PDF
Hyperledger Fabric Technical Deep Dive 20190618
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Ethereum Smart Contracts on Hyperledger Fabric
Hyperledger Fabric Application Development 20190618
Hyperledger
Blockchain Explorer
Developing applications with Hyperledger Fabric SDK
Tech Talk - Blockchain presentation
Hyperledger Fabric Technical Deep Dive 20190618

What's hot (20)

PDF
Bitmark and Hyperledger Workshop: the Digital Assets and Property
PPTX
Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?
PDF
An introduction to blockchain and hyperledger v ru
PPTX
Hyperledger community update 20180528
PPTX
Hyperledger fabric 20180528
PDF
Excelian hyperledger walkthrough-feb17
PDF
Architecture of the Hyperledger Blockchain Fabric
PPTX
Blockchain, 
Hyperledger fabric & Hyperledger cello
PDF
Hyperledger whitepaper
PPTX
Hyperledger Fabric
PPTX
Hyperledger Fabric Hands-On
PDF
Introduction of Hyperledger Fabric & Composer
ODP
Blockchain Introduction
PPTX
Hyperledger Composer Update 2017-04-05
PDF
Hyperledger Fabric Architecture
PDF
Hyperledger Fabric update Meetup 20181101
PPTX
Hyperledger
PDF
Hyperledger fabric 3
PDF
Technical Introduction to Hyperledger Fabric v1.0
PPTX
Hyperledger fabric architecture
Bitmark and Hyperledger Workshop: the Digital Assets and Property
Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?
An introduction to blockchain and hyperledger v ru
Hyperledger community update 20180528
Hyperledger fabric 20180528
Excelian hyperledger walkthrough-feb17
Architecture of the Hyperledger Blockchain Fabric
Blockchain, 
Hyperledger fabric & Hyperledger cello
Hyperledger whitepaper
Hyperledger Fabric
Hyperledger Fabric Hands-On
Introduction of Hyperledger Fabric & Composer
Blockchain Introduction
Hyperledger Composer Update 2017-04-05
Hyperledger Fabric Architecture
Hyperledger Fabric update Meetup 20181101
Hyperledger
Hyperledger fabric 3
Technical Introduction to Hyperledger Fabric v1.0
Hyperledger fabric architecture
Ad

Similar to Developing Business Blockchain Applications on Hyperledger (20)

PDF
Micro services from scratch - Part 1
PDF
How to build an ETL pipeline with Apache Beam on Google Cloud Dataflow
PDF
TDC2017 | São Paulo - Trilha BigData How we figured out we had a SRE team at ...
PDF
Working with data using Azure Functions.pdf
PPTX
Fabric - Realtime stream processing framework
PDF
Sprint 31
PDF
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PDF
Scaling Experimentation & Data Capture at Grab
PPTX
F&O Summit 2023 Speaker X++ Tips and Tricks.pptx
PDF
Reactive & Realtime Web Applications with TurboGears2
PPTX
Apex Replay Debugger and Salesforce Platform Events.pptx
PDF
VictoriaMetrics: Welcome to the Virtual Meet Up March 2023
PDF
Config managementcampgent 2016
PDF
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
PDF
How to Build a Telegraf Plugin by Noah Crowley
PDF
arataga. SObjectizer and RESTinio in action: a real-world example
PDF
Introduction to trader bots with Python
PDF
Server Side Rendering of JavaScript in PHP
PPTX
Altitude San Francisco 2018: Logging at the Edge
PDF
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
Micro services from scratch - Part 1
How to build an ETL pipeline with Apache Beam on Google Cloud Dataflow
TDC2017 | São Paulo - Trilha BigData How we figured out we had a SRE team at ...
Working with data using Azure Functions.pdf
Fabric - Realtime stream processing framework
Sprint 31
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
Scaling Experimentation & Data Capture at Grab
F&O Summit 2023 Speaker X++ Tips and Tricks.pptx
Reactive & Realtime Web Applications with TurboGears2
Apex Replay Debugger and Salesforce Platform Events.pptx
VictoriaMetrics: Welcome to the Virtual Meet Up March 2023
Config managementcampgent 2016
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
How to Build a Telegraf Plugin by Noah Crowley
arataga. SObjectizer and RESTinio in action: a real-world example
Introduction to trader bots with Python
Server Side Rendering of JavaScript in PHP
Altitude San Francisco 2018: Logging at the Edge
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
Ad

More from IMC Institute (20)

PDF
นิตยสาร Digital Trends ฉบับที่ 14
PDF
Digital trends Vol 4 No. 13 Sep-Dec 2019
PDF
บทความ The evolution of AI
PDF
IT Trends eMagazine Vol 4. No.12
PDF
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
PDF
IT Trends 2019: Putting Digital Transformation to Work
PDF
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
PDF
IT Trends eMagazine Vol 4. No.11
PDF
แนวทางการทำ Digital transformation
PDF
บทความ The New Silicon Valley
PDF
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
PDF
แนวทางการทำ Digital transformation
PDF
The Power of Big Data for a new economy (Sample)
PDF
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
PDF
IT Trends eMagazine Vol 3. No.9
PDF
Thailand software & software market survey 2016
PDF
Digital transformation @thanachart.org
PDF
บทความ Big Data จากบล็อก thanachart.org
PDF
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
PDF
Thailand 4.0 Reality or Hype
นิตยสาร Digital Trends ฉบับที่ 14
Digital trends Vol 4 No. 13 Sep-Dec 2019
บทความ The evolution of AI
IT Trends eMagazine Vol 4. No.12
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
IT Trends 2019: Putting Digital Transformation to Work
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
IT Trends eMagazine Vol 4. No.11
แนวทางการทำ Digital transformation
บทความ The New Silicon Valley
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
แนวทางการทำ Digital transformation
The Power of Big Data for a new economy (Sample)
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
IT Trends eMagazine Vol 3. No.9
Thailand software & software market survey 2016
Digital transformation @thanachart.org
บทความ Big Data จากบล็อก thanachart.org
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
Thailand 4.0 Reality or Hype

Recently uploaded (20)

PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Transforming Manufacturing operations through Intelligent Integrations
PPT
Teaching material agriculture food technology
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
GamePlan Trading System Review: Professional Trader's Honest Take
NewMind AI Weekly Chronicles - August'25 Week I
Sensors and Actuators in IoT Systems using pdf
MYSQL Presentation for SQL database connectivity
Reach Out and Touch Someone: Haptics and Empathic Computing
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Transforming Manufacturing operations through Intelligent Integrations
Teaching material agriculture food technology
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift

Developing Business Blockchain Applications on Hyperledger