项目作者: entria

项目描述 :
Hyperledger Fabric GraphQL Boilerplate
高级语言: JavaScript
项目地址: git://github.com/entria/hyperledger-fabric-graphql-boilerplate.git


Hyperledger Fabric GraphQL Boilerplate

This is a boilerplate to start using hyperledger fabric blockchain with GraphQL

Hire us

You can hire us to build your next blockchain project using Hyperledger and GraphQL - Entria

How to build Go chaincode locally

Install go

  1. brew install go
  2. mkdir ~/.go

Configure GOPATH

add this to .bashrc

  1. export GOPATH="${HOME}/.go"
  2. export GOROOT="$(brew --prefix golang)/libexec"
  1. yarn go:install

then

  1. yarn go:build

Run locally with docker-compose

Clear content of deploy/local before creating new containers

  1. yarn clear
  1. docker-compose up

Test if it is running ok

go to http://localhost:7050/chain

Go to Hyperledger Explorer

go to http://localhost:9090

How to test chaincode

  1. yarn run go:test

How to interact with chain

  1. yarn repl

Query data for an entity (a and b are the valid entities for now)

  1. bl > queryEntity('a')

Transfer coins from an entity to another

  1. bl > transfer('a', 'b', 10)

How to deploy a new chaincode using GraphQL

  1. mutation deployChain {
  2. Deploy(input: {
  3. fcn:"init"
  4. args: ["a", "100", "b", "200"]
  5. clientMutationId:"1"
  6. }) {
  7. results
  8. }
  9. }