Open Mainframe Project
Summer internship
Blockchain technology
Laszlo Szoboszlai
Linux Foundation
Date of presentation (02/11/2016)
Session <?>
• Introduction to Blockchain technology and the project
• Structure of a chaincode
• Personal approach to writing HumanityCoins chaincode
• Demo (if everything goes well)
Agenda
Short introduction to blockchain
• Distributed ledger technology
• Stores chaincode, not a currency like bitcoin
• High security through distributed ledger (all nodes need
to be altered at the same time)
• Ideal for batch operation (consensus takes time)
• Hyperledger fabric is the Linux Foundation’s
implementation of blockchain
Introduction to the project
• Humanity Coins
• The idea comes from IBM fellow Donna Dillenberger
• System to encourage people to do good things
• You can give (thank) points to someone who done a
good deed to you
Introduction to the project
(technical details)
• Three levels of thanks: small(1 point), medium (5 pts)
and large (10 points)
• An optional message can be added to the thank
• Points and messages are stored on the ledger
• Front end (mobile) application can access the ledger
through rest API (under development)
• Tweeting auditor to ensure fair use of the system
My work through the project
• Setting up development environment (Golang, docker etc…)
• Testing different settings of networks by increasing security level
• Creating a shell script to start up four validating peers with security,
encryption and consensus enabled, similar to IBM’s High Security
Business Network
• Writing the chaincode, the application written on top of hyperledger
infrastructure
• Github code:
• HumanityCoins chaincode encapsulated in a hyperledger peer as a
docker container:
Structure of a Chaincode
• Every chaincode has to implement 3 functions (Init, Invoke, Query)
• Can have more functions on top of the above 3
• The functions can do anything but traditionally
– Init : initialises data on the ledger
– Invoke : used to modify data on the ledger and
– Query : is for reading data from the ledger
• Coded in Go programming language (now Java is supported as
well, and more coming)
• Data stored as key – value pairs (keys tend to be strings, values on
the ledger are byte arrays)
Implementation of chaincode
(unusual functions)
• Let’s call it addThanks instead of Invoke
• Three types of Query: getUser, getKeys and getRandomUser
instead of a single query
Implementation of the
chaincode
(data structures)
• Structs are converted to a
JSON object before written to the ledger
• Each user has a thanklist stored where the
name of the thanker, the type of the thank
and a short message is stored
• In order to make getRandomUser() easier
the user names are stored in a separate
struct as well (KeyList)
Implementation of the
chaincode
(init function)
• Init is used to initialise the users with their starting points
• Usernames and initial points are passed through args
• Requires even number of parameters
• KeylistObj is filled simultaneously
Implementation of chaincode
(init function cont’d)
• Entity struct is filled from variables and empty thanklist is created
• Entity struct to JSON object -> ledger
• KeyListObj to JSON object -> ledger (PutState function)
• Initialisation ready
Testing
• Tried to follow TDD principles
• After initial skeleton chaincode I created a test script in bash ( first
time all tests failed)
• Tweaked all the functions to pass all the tests
• Extended the chaincode with the extra functions (getKeys(),
getRandomUser() ) but first I created the test scenarios that needed
to be passed
• Finally everything was green
Issues & solutions
• Rapidly changing codebase -> stick to v 0.5
• Issues with LinuxONE on Marist cloud -> got a box from Vicom
Infinity (and another one later)
• Changing project -> writing own chaincode instead of using IBM
demo code
• Connect to IBM HSBN -> set up a HSBN simulation on my box
Future work
• Rewards part of chaincode and app (ie Coffee shop
gives free cup of coffee to people over 1000 points)
• Integration with smart meters
• Port to IBM Bluemix
• Connect with Zos connect
Things I have learnt trough the
summer
• How to write a chaincode
• How Hyperledger fabric blockchain works
• Go programming language
• Docker
• Advanced bash scripting
• TDD, agile methodologies
• How to communicate with stakeholders
Few bigThanks
(the 10 points one )
go to:
• Volodymyr Paprotski (my mentor, IBM)
• Herbert Daly (co-mentor, University of Bedfordshire)
• Leonard Santalucia (co-mentor, Vicom Infinity)
• Yongkook Kim (co-mentor, Vicom Infinity)
• Development team on slack
• people from Marist College
Live demo
Session feedback
• Please submit your feedback at
http://conferences.gse.org.uk/2016/feedback/nn
• Session is nn
This is the last
slide in the deck
Insert
Custom
Session
QR code

OMP GSE

  • 1.
    Open Mainframe Project Summerinternship Blockchain technology Laszlo Szoboszlai Linux Foundation Date of presentation (02/11/2016) Session <?>
  • 2.
    • Introduction toBlockchain technology and the project • Structure of a chaincode • Personal approach to writing HumanityCoins chaincode • Demo (if everything goes well) Agenda
  • 3.
    Short introduction toblockchain • Distributed ledger technology • Stores chaincode, not a currency like bitcoin • High security through distributed ledger (all nodes need to be altered at the same time) • Ideal for batch operation (consensus takes time) • Hyperledger fabric is the Linux Foundation’s implementation of blockchain
  • 4.
    Introduction to theproject • Humanity Coins • The idea comes from IBM fellow Donna Dillenberger • System to encourage people to do good things • You can give (thank) points to someone who done a good deed to you
  • 5.
    Introduction to theproject (technical details) • Three levels of thanks: small(1 point), medium (5 pts) and large (10 points) • An optional message can be added to the thank • Points and messages are stored on the ledger • Front end (mobile) application can access the ledger through rest API (under development) • Tweeting auditor to ensure fair use of the system
  • 6.
    My work throughthe project • Setting up development environment (Golang, docker etc…) • Testing different settings of networks by increasing security level • Creating a shell script to start up four validating peers with security, encryption and consensus enabled, similar to IBM’s High Security Business Network • Writing the chaincode, the application written on top of hyperledger infrastructure • Github code: • HumanityCoins chaincode encapsulated in a hyperledger peer as a docker container:
  • 7.
    Structure of aChaincode • Every chaincode has to implement 3 functions (Init, Invoke, Query) • Can have more functions on top of the above 3 • The functions can do anything but traditionally – Init : initialises data on the ledger – Invoke : used to modify data on the ledger and – Query : is for reading data from the ledger • Coded in Go programming language (now Java is supported as well, and more coming) • Data stored as key – value pairs (keys tend to be strings, values on the ledger are byte arrays)
  • 8.
    Implementation of chaincode (unusualfunctions) • Let’s call it addThanks instead of Invoke • Three types of Query: getUser, getKeys and getRandomUser instead of a single query
  • 9.
    Implementation of the chaincode (datastructures) • Structs are converted to a JSON object before written to the ledger • Each user has a thanklist stored where the name of the thanker, the type of the thank and a short message is stored • In order to make getRandomUser() easier the user names are stored in a separate struct as well (KeyList)
  • 10.
    Implementation of the chaincode (initfunction) • Init is used to initialise the users with their starting points • Usernames and initial points are passed through args • Requires even number of parameters • KeylistObj is filled simultaneously
  • 11.
    Implementation of chaincode (initfunction cont’d) • Entity struct is filled from variables and empty thanklist is created • Entity struct to JSON object -> ledger • KeyListObj to JSON object -> ledger (PutState function) • Initialisation ready
  • 12.
    Testing • Tried tofollow TDD principles • After initial skeleton chaincode I created a test script in bash ( first time all tests failed) • Tweaked all the functions to pass all the tests • Extended the chaincode with the extra functions (getKeys(), getRandomUser() ) but first I created the test scenarios that needed to be passed • Finally everything was green
  • 13.
    Issues & solutions •Rapidly changing codebase -> stick to v 0.5 • Issues with LinuxONE on Marist cloud -> got a box from Vicom Infinity (and another one later) • Changing project -> writing own chaincode instead of using IBM demo code • Connect to IBM HSBN -> set up a HSBN simulation on my box
  • 14.
    Future work • Rewardspart of chaincode and app (ie Coffee shop gives free cup of coffee to people over 1000 points) • Integration with smart meters • Port to IBM Bluemix • Connect with Zos connect
  • 15.
    Things I havelearnt trough the summer • How to write a chaincode • How Hyperledger fabric blockchain works • Go programming language • Docker • Advanced bash scripting • TDD, agile methodologies • How to communicate with stakeholders
  • 16.
    Few bigThanks (the 10points one ) go to: • Volodymyr Paprotski (my mentor, IBM) • Herbert Daly (co-mentor, University of Bedfordshire) • Leonard Santalucia (co-mentor, Vicom Infinity) • Yongkook Kim (co-mentor, Vicom Infinity) • Development team on slack • people from Marist College
  • 17.
  • 18.
    Session feedback • Pleasesubmit your feedback at http://conferences.gse.org.uk/2016/feedback/nn • Session is nn This is the last slide in the deck Insert Custom Session QR code

Editor's Notes

  • #4 A distributed ledger is a consensus of replicated, shared, and synchronized digital data geographically spread across multiple sites, countries, and/or institutions.
  • #5 Unexpected non financial “thank” random acts of kindness New currency (no cost to you ) On public blockchain so governments can see it