Code Monkey home page Code Monkey logo

chaincodesample01's Introduction

Sample Chaincode for Predix Blockchain Service

This is a sample smart contract (chaincode) for the Predix Blockchain Service

Prerequesites

Build & Deploy

Clone this repo using Go:

go get github.com/dattnguyen82/ChaincodeSample01

Compile source

In your GO path you should have a directory called: $GOPATH/src/github.com/dattnguyen82/predix-sample-chaincode Run this command:

go build predix-blockchain-sample01.go

Deploy

To deploy your smart contract, compress the predix-sample-chaincode directory contents with tar.gz

cd $GOPATH/src/github.com/dattnguyen82/predix-sample-chaincode
tar czvf predix-sample-chaincode.tgz *

Deploy to Predix using this guide

curl -X PUT \
https://{predix-url}/v1/chaincodes/{smart-contract-name} \
-H 'authorization: bearer {token}' \
-H 'content-type: multipart/form-data;' \
-H 'predix-zone-id: {predix-zone-id}' \
-F chaincode=@{path} \
-F 'args=["{predix-zone-id}"]'

Postman Collection

A Postman collection and environment have been added for convenience.

Environment parameters

  • uaa-url - UAA base url

  • uaa-auth - UAA token retrieval authorization

  • token - Access token from UAA

  • api-url - Base URL for predix blockchain service e.g. predix-blockchain-api.run.aws-usw02-pr.ice.predix.io

  • tenant - Predix-Zone-Id from VCAP

  • user-id - new user Id

  • default-user - username from VCAP

  • default-password - onetimepassword from VCAP

  • chain-code - name of chaincode to deploy

  • tx-id - transaction id from chaincode invocation

  • deploy-arguments - chaincode deployment argument e.g. ["arg1", "arg2", "arg3" ...],

chaincodesample01's People

Watchers

James Cloos avatar Dat Nguyen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.