drnugent / 2019-7-11-L-L-SF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blueband

Event URL: https://bit.ly/2JisLG9

An introduction to the IBM Blockchain Platform 2.0!

Linkedin.com/in/lennartfrantzell

Whitelisting.

News

Does Hyperledger Fabric perform at scale?

Forbes: Blockchain Goes To Work At Walmart, Amazon, JPMorgan, Cargill and 46 Other Enterprises

Cargill Hyperledger Grid

Target Blockchain for Supply Chain

Why new off-chain storage is required for blockchains

IBM Blockchain Twitter feeds:

Jerry Cuomo IBM Fellow and CTO, instigator of Blockchain: https://twitter.com/jerrycuomo

Christopher Ferris. IBM Fellow CTO Open Technology https://twitter.com/christo4ferris

Arnaud J Le Hors. Senior Technical Staff Member: https://twitter.com/lehors

Christian Cachin Swiss Cryptographer, Zurich. https://twitter.com/cczurich?lang=en

IBM Blockchain: https://twitter.com/ibmblockchain?lang=en

Mark Parzygnat.Program Director IBM Blockchain: https://twitter.com/meetmarkp?lang=en

blueband

Learning Objectives:

  1. Introduction

  2. On your laptop: how to install the IBM Visual Studio Code with the brand new IBP plugin

  3. How to create your first Smart Contract with Visual Studio Code

  4. How to launch the brand new IBM Blockchain Platform 2.0 in the IBM Cloud

blueband

Learning Objective 1: Introduction

It all started in October during the Global Financial Crisis in 2008 with Satoshi Nakamoto and his paper BitCoin: A Peer-to-Peer Electronic Cash System which addressed a key problem in electronic commerce:

A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.

Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending.

We propose a solution to the double-spending problem using a peer-to-peer network.

Let's start with Hyperledger:

  1. https://github.com/hyperledger/

  2. Hyperledger Fabric Now Supports Ethereum

  3. Cargill Hyperledger Grid for Supply Chain solutions

  4. Hyperledger Caliper Benchmark tool

  5. Hyperledger Quilt offers interoperability between ledger systems by implementing the Interledger protocol

  6. Hyperledger URSA a shared cryptographic library

Hyperledger Fabric 1.4.1

Enterprise grade permissioned distributed ledger platform that offers modularity and versatility for a broad set of industry use cases.

  1. Hyperledger Fabric’s First long term support release

  2. Raft ordering service Fault Tolerance consensus algorithm

Blockchain Use Cases

IBM Blockchain Garage Services

blueband

Learning Objective 2: On your laptop: how to install the IBM Visual Studio Code with the brand new IBP plugin

Visual Studio Code

https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform

An introduction to programming Hyperledger Fabric on SlideShare

IBM Blockchain Platform on SlideShare

IBM Blockchain Solutions on SlideShare

blueband

Learning Objective 3: Developing smart contracts with Visual Studio Code extension

Install IBM Blockchain Platform VS Code extension for free

Download Visual Studio Code

Install IBM Blockchain Platform for VS Code

Go through Tutorial One in VS Code: Local Smart Contract Development.

Follow the typical workflow from generating a new smart contract project, deploying code to the local_fabric_runtime and testing your transactions via an application gateway

my-asset-contract.ts


 * SPDX-License-Identifier: Apache-2.0
 */

import { Context, Contract, Info, Returns, Transaction } from 'fabric-contract-api';
import { MyAsset } from './my-asset';

@Info({title: 'MyAssetContract', description: 'My Smart Contract' })
export class MyAssetContract extends Contract {

    @Transaction(false)
    @Returns('boolean')
    public async myAssetExists(ctx: Context, myAssetId: string): Promise<boolean> {
        const buffer = await ctx.stub.getState(myAssetId);
        return (!!buffer && buffer.length > 0);
    }

    @Transaction()
    public async createMyAsset(ctx: Context, myAssetId: string, value: string): Promise<void> {
        const exists = await this.myAssetExists(ctx, myAssetId);
        if (exists) {
            throw new Error(`The my asset ${myAssetId} already exists`);
        }
        const myAsset = new MyAsset();
        myAsset.value = value;
        const buffer = Buffer.from(JSON.stringify(myAsset));
        await ctx.stub.putState(myAssetId, buffer);
    }

    @Transaction(false)
    @Returns('MyAsset')
    public async readMyAsset(ctx: Context, myAssetId: string): Promise<MyAsset> {
        const exists = await this.myAssetExists(ctx, myAssetId);
        if (!exists) {
            throw new Error(`The my asset ${myAssetId} does not exist`);
        }
        const buffer = await ctx.stub.getState(myAssetId);
        const myAsset = JSON.parse(buffer.toString()) as MyAsset;
        return myAsset;
    }

    @Transaction()
    public async updateMyAsset(ctx: Context, myAssetId: string, newValue: string): Promise<void> {
        const exists = await this.myAssetExists(ctx, myAssetId);
        if (!exists) {
            throw new Error(`The my asset ${myAssetId} does not exist`);
        }
        const myAsset = new MyAsset();
        myAsset.value = newValue;
        const buffer = Buffer.from(JSON.stringify(myAsset));
        await ctx.stub.putState(myAssetId, buffer);
    }

    @Transaction()
    public async deleteMyAsset(ctx: Context, myAssetId: string): Promise<void> {
        const exists = await this.myAssetExists(ctx, myAssetId);
        if (!exists) {
            throw new Error(`The my asset ${myAssetId} does not exist`);
        }
        await ctx.stub.deleteState(myAssetId);
    }

}

blueband

Learning Objective 4: How to launch the brand new IBM Blockchain Platform 2.0 in the IBM Cloud

Free IBM Cloud sign-up link: https://ibm.biz/BdzMtC

How to apply promocodes

IBM Cloud Catalog link: https://cloud.ibm.com/catalog/

1) Find IBM Blockchain Platform service in the IBM Cloud: https://cloud.ibm.com/catalog?search=blockchain.

IAM Enabled= "Identity and Access Management"

2) Launch IBM Blockchain Platform Service

IBM Blockchain Platform Console Video Series. Follow along this four part series to set up a business network on the IBM Blockchain Platform

Deploy a Peer on the IBM Blockchain Platform

Deploy an Ordering Service on the IBM Blockchain Platform

Create and join a channel on the IBM Blockchain Platform

3) Select Kubernetes Cluster in the IBM Cloud

Blockchain IBP Pricing "** Preview the IBM Blockchain Platform at no charge for 30 days when you link your IBM Blockchain Platform service instance to an IBM Cloud Kubernetes free cluster. Performance will be limited by throughput, storage and functionality. IBM Cloud will delete your Kubernetes cluster after 30 days and you cannot migrate any nodes or data from a free cluster to a paid cluster. "

4) IBM Blockchain Platform Console installed in IBM Cloud.

Build a Network Tutorial with the IBM Blockchain Platform

blueband

# Appendix

Debugging NPM

  1. The application uses Node.js and can sometimes get the wrong version of Node.
  2. If npm install gets errors,
  3. do: npm rebuild, npm install
  4. And if that doesn't work, do:
  5. nvm use 8.12.0 npm install or nvm use 8.12.0 npm rebuild npm install
  6. the same if npm start gets errors 1 You can also do the same if Visual Studio Code console, Local Fabric Ops pane, do Teardown and Restart Fabric Runtime
  7. If you get an error can't find xcode, do xcode-select --install

Where do we go from here?

Creating a basic Blockchain network using the IBM Blockchain Platform V2.0

SmartContract Trading using IBM Blockchain Platform Extension for VSCode (supports Fabric 1.4

Build a blockchain insurance app

IBM Developer SF Bay Area

IBM SF Bay Area Meetups

vcpi: https://cloud.ibm.com/registration/?cm_mmc=Email_Events-_-Developer_Innovation-_-WW_WW-_-alf\letstakeibmblockchainplatformforaspin-sanfrancisco-7112019\Jul2019\lunchandlearn\global-devadvgrp-sanfrancisco\sanfrancisco\unitedstates\blockchain\build-an-asset-leasing-application-using-blockchain-and-iot\coffee-supply-chain-network-hyperledger-fabric-blockchain-2&cm_mmca1=000019RS&cm_mmca2=10004805&cm_mmca3=M99938765&eventid=5d13ab047cd80a5f7ef03d6c&cvosrc=email.Events.M99938765&cvo_campaign=000019RS

About