omp gse

18
Open Mainframe Project Summer internship Blockchain technology Laszlo Szoboszlai Linux Foundation Date of presentation (02/11/2016) Session <?>

Upload: laszlo-szoboszlai

Post on 08-Feb-2017

19 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: OMP GSE

Open Mainframe Project Summer internshipBlockchain technologyLaszlo SzoboszlaiLinux Foundation

Date of presentation (02/11/2016)Session <?>

Page 2: OMP GSE

• Introduction to Blockchain technology and the project • Structure of a chaincode• Personal approach to writing HumanityCoins chaincode• Demo (if everything goes well)

Agenda

Page 3: OMP GSE

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

Page 4: OMP GSE

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

Page 5: OMP GSE

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

Page 6: OMP GSE

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:

Page 7: OMP GSE

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)

Page 8: OMP GSE

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

Page 9: OMP GSE

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 thankand a short message is stored

• In order to make getRandomUser() easier the user names are stored in a separate struct as well (KeyList)

Page 10: OMP GSE

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

Page 11: OMP GSE

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

Page 12: OMP GSE

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

Page 13: OMP GSE

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

Page 14: OMP GSE

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

Page 15: OMP GSE

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

Page 16: OMP GSE

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

Page 17: OMP GSE

Live demo

Page 18: OMP GSE

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

InsertCustomSessionQR code