Starter Application for Hyperledger Fabric
Create a network to jump start development of your decentralized application on Hyperledger Fabric platform.
The network is run by docker containers and can be deployed to one host for development or to multiple hosts for testing or production.
Scripts of this starter generate crypto material and config files, start the network and deploy your chaincodes. Developers can use REST API to invoke and query chaincodes, explore blocks and transactions.
What's left is to develop your chaincodes and place them into the chaincode folder, and user interface as a single page web app that you can serve by by placing the sources into the www folder.
See also
- fabric-starter-rest REST API server and client built with NodeJS SDK
- fabric-starter-web Starter web application to work with the REST API
- chaincode-node-storage Base class for node.js chaincodes with CRUD functionality
Blockchain network deployment
The following sections describe Fabric Starter possibilites in more details:
- Prerequisites
- Network with 1 organization (and orderer) for development
- Several organizations on one (local) host in multiple docker containers.
- REST API to query and invoke chaincodes.
- Getting closer to production. Multiple hosts deployment with
docker-machine
. Deployment to clouds. - Join to an External Network
- Network Governance. Invite-based and Majority-based Governance
- Consensus Types. RAFT consensus algorithm
- Development\Release cycle
Install
See Prerequisites
Using a particular version of Hyperledger Fabric
To deploy network with a particular version of HL Fabric export desired version in the
FABRIC_VERSION environment variable. The latest
docker image tag is used by default.
export FABRIC_VERSION=1.2.0
Create a network with 1 organization for development
See One Org Network
Create a local network of 3 organizations
Use REST API to query and invoke chaincodes
See Use REST Api
Multi host deployment
Join to an External Network
For invite-based
blockchain-networks (see next chapter) new organization can be added to the consortium by a member of this network.
The new organization need to obtain the BOOTSRAP_IP (currently it's the IP of the orderer node) and deploy its own node with this IP.
export BOOTSTRAP_IP=192.168.0.1
#ORG=... DOMAIN=... docker-compose up
Then the new organization passes the ip address of the newly deployed node to the network's member and this member adds the organization to Consortium by it's administration dashboard. After that the new organization can create own channels, add other organizations to the own channels and even invite more organizations to the network itself.
Network Governance. Invite-based and Majority-based Governance
So now our network can be governed by itself (or to say it right by the network's members).
The first type of network-governance is Invite-based
. With this type of deployment
any organization ((and not a central system administrator)) - member of the blockchain network can add new organization to consortium.
To deploy such type of network export environment variable
export CONSORTIUM_CONFIG=InviteConsortiumPolicy
Start orderer:
WWW_PORT=81 WORK_DIR=./ docker-compose -f docker-compose-orderer.yaml -f docker-compose-orderer-multihost.yaml up -d
Then start an organization
MY_IP=192.168.99.yy BOOTSTRAP_IP=192.168.99.xx ORG=org1 MULTIHOST=true WORK_DIR=./ docker-compose -f docker-compose.yaml -f docker-compose-multihost.yaml -f docker-compose-api-port.yaml up -d
Majority
type of governance is coming.
Consensus Types. RAFT consensus algorithm. By default Fabric Starter uses Solo type of consensus. To use RAFT consensus see instructions in Start Raft Ordering Service
Releases\Snapshots cycle
As this project doesn't have a defined release cycle yet we create
snapshot-{version}-{fabric-version}
branches
when we see code is stable enough or before introducing major changes\new features.
Note
, the Hyperledger Fabric version which the snapshot depends on is defined in the .env
file.
Also this project uses olegabu/fabric-starter-rest docker image which has
the same versioning approach but even updated docker image with the same label (e.g. latest)
won't be pulled automatically if it exists in the local docker registry.
You have to remove the old image manually (by docker rmi -f olegabu/fabric-starter-rest
).
The master
branch as well as potentially feature branches
are used for development.
Master
is assigned to the latest
version of Fabric.
Currently issued branches are:
- master(development)
- snapshot-0.5-1.4
- new org auto connect for invite type consortium
- new orgs dns register functionality
- use fabric-starter-rest:snapshot-0.4-1.4
- snapshot-0.4-1.4
- auto-generate crypto configuration
- Invite type consortium
- BOOTSTRAP_IP for new node joining
- snapshot-0.3-1.4
- use fabric-starter-rest:snapshot-0.3-1.4
- snapshot-0.2-1.4
- use fabric-starter-rest:snapshot-0.2-1.4
- snapshot-0.1-1.4
- start snapshot branching