Add hyperledger with blockchain-explorer project
parent
f870b623a2
commit
4e0683f31b
|
@ -6,6 +6,8 @@ You can use the following script to install docker and start a 4-node PBFT clust
|
|||
$ bash setupPbft.sh
|
||||
```
|
||||
|
||||
## Preparation
|
||||
|
||||
## Download Images
|
||||
If you want to start it manually, follow the steps:
|
||||
|
||||
|
@ -20,6 +22,15 @@ $ docker tag yeasy/hyperledger-fabric:0.6-dp hyperledger/fabric-baseimage:latest
|
|||
$ docker tag yeasy/hyperledger-fabric:0.6-dp hyperledger/fabric-membersrvc:latest
|
||||
```
|
||||
|
||||
### Setup network
|
||||
If you want to enable the external network options in the compose files, please create two Docker networks for usage. Otherwise, just ignore.
|
||||
```sh
|
||||
$ docker network create fabric_noops
|
||||
$ docker network create fabric_pbft
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Start 4 Noops node cluster
|
||||
|
||||
```sh
|
||||
|
@ -34,9 +45,22 @@ $ cd pbft; docker-compose up
|
|||
|
||||
After the cluster is synced, you can validate by deploying, invoking or querying chaincode from the container or from the host.
|
||||
|
||||
```sh
|
||||
$ docker exec -it pbft_vp0_1 bash
|
||||
# peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
|
||||
```
|
||||
|
||||
See [hyperledger-fabric](https://github.com/yeasy/docker-hyperledger-fabric) if you've not familiar on those operations.
|
||||
|
||||
|
||||
### Start 4 PBFT node cluster with blockchain explorer
|
||||
|
||||
```sh
|
||||
$ cd pbft; docker-compose -f docker-compose-with-explorer.yml up
|
||||
```
|
||||
|
||||
Then visit the 9090 port on the host using Web.
|
||||
|
||||
### Start 4 PBFT node cluster with member service
|
||||
|
||||
```sh
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
# validating node as the root
|
||||
# vp0 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp0:
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -20,3 +23,7 @@ vp0:
|
|||
- "7050:7050"
|
||||
#- "7051:7051"
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_noops
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
membersrvc:
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
membersrvc:
|
||||
image: hyperledger/fabric-membersrvc:latest
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
|
@ -17,11 +20,11 @@ membersrvc:
|
|||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: membersrvc # this repeats the default cmd to make sure
|
||||
|
||||
# validating node as the root
|
||||
# vp0 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp0:
|
||||
# validating node as the root
|
||||
# vp0 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -41,7 +44,7 @@ vp0:
|
|||
- membersrvc
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
vp1:
|
||||
vp1:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -60,7 +63,7 @@ vp1:
|
|||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
vp2:
|
||||
vp2:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -79,7 +82,7 @@ vp2:
|
|||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
vp3:
|
||||
vp3:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -97,3 +100,8 @@ vp3:
|
|||
- membersrvc
|
||||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_noops
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
# validating node as the root
|
||||
# vp0 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp0:
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -20,8 +23,8 @@ vp0:
|
|||
- "7050:7050"
|
||||
#- "7051:7051"
|
||||
|
||||
# validating node
|
||||
vp1:
|
||||
# validating node
|
||||
vp1:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -32,8 +35,8 @@ vp1:
|
|||
links:
|
||||
- vp0
|
||||
|
||||
# validating node
|
||||
vp2:
|
||||
# validating node
|
||||
vp2:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -44,9 +47,8 @@ vp2:
|
|||
links:
|
||||
- vp0
|
||||
|
||||
|
||||
# validating node
|
||||
vp3:
|
||||
# validating node
|
||||
vp3:
|
||||
extends:
|
||||
file: peer-noops.yml
|
||||
service: vp
|
||||
|
@ -56,3 +58,8 @@ vp3:
|
|||
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
|
||||
links:
|
||||
- vp0
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_pbft
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
# This utilizes the noops as consensus
|
||||
# See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md#using-consensus-plugin for more details.
|
||||
|
||||
vp:
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
vp:
|
||||
image: hyperledger/fabric-peer:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
|
@ -25,4 +28,4 @@ vp:
|
|||
volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: peer node start # this repeats the default cmd to make sure
|
||||
# command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA
|
||||
# command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# This compose file will start a cluster with 4 hyperledger peer nodes
|
||||
# vp0: validating node as root
|
||||
# vp1: validating node as peer
|
||||
# vp2: validating node as peer
|
||||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
# blockchain-explorer
|
||||
explorer:
|
||||
image: yeasy/blockchain-explorer:latest
|
||||
restart: unless-stopped
|
||||
hostname: explorer
|
||||
environment:
|
||||
- HYP_REST_ENDPOINT=http://vp0:7050
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
# validating node as the root
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
hostname: vp0
|
||||
environment:
|
||||
- CORE_PEER_ID=vp0
|
||||
ports:
|
||||
- "7050:7050"
|
||||
#- "7051:7051"
|
||||
|
||||
# validating node
|
||||
vp1:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
hostname: vp1
|
||||
environment:
|
||||
- CORE_PEER_ID=vp1
|
||||
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
|
||||
links:
|
||||
- vp0
|
||||
|
||||
# validating node
|
||||
vp2:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
hostname: vp2
|
||||
environment:
|
||||
- CORE_PEER_ID=vp2
|
||||
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
|
||||
links:
|
||||
- vp0
|
||||
|
||||
|
||||
# validating node
|
||||
# vp3 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp3:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
hostname: vp3
|
||||
environment:
|
||||
- CORE_PEER_ID=vp3
|
||||
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
|
||||
links:
|
||||
- vp0
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_pbft
|
|
@ -8,7 +8,10 @@
|
|||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
membersrvc:
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
membersrvc:
|
||||
image: hyperledger/fabric-membersrvc:latest
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
|
@ -17,8 +20,8 @@ membersrvc:
|
|||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: membersrvc # this repeats the default cmd to make sure
|
||||
|
||||
# validating node as the root
|
||||
vp0:
|
||||
# validating node as the root
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp_sec
|
||||
|
@ -34,7 +37,7 @@ vp0:
|
|||
- membersrvc
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
vp1:
|
||||
vp1:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp_sec
|
||||
|
@ -49,7 +52,7 @@ vp1:
|
|||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
vp2:
|
||||
vp2:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp_sec
|
||||
|
@ -64,10 +67,10 @@ vp2:
|
|||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
# vp3 will be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp3:
|
||||
# vp3 will be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp3:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp_sec
|
||||
|
@ -81,3 +84,8 @@ vp3:
|
|||
- membersrvc
|
||||
- vp0
|
||||
command: sh -c "sleep 5; peer node start"
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_pbft
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
# vp3: validating node as peer
|
||||
# https://github.com/yeasy/docker-compose-files
|
||||
|
||||
# validating node as the root
|
||||
vp0:
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
# validating node as the root
|
||||
vp0:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
|
@ -17,8 +20,8 @@ vp0:
|
|||
- "7050:7050"
|
||||
#- "7051:7051"
|
||||
|
||||
# validating node
|
||||
vp1:
|
||||
# validating node
|
||||
vp1:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
|
@ -29,8 +32,8 @@ vp1:
|
|||
links:
|
||||
- vp0
|
||||
|
||||
# validating node
|
||||
vp2:
|
||||
# validating node
|
||||
vp2:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
|
@ -42,11 +45,11 @@ vp2:
|
|||
- vp0
|
||||
|
||||
|
||||
# validating node
|
||||
# vp3 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp3:
|
||||
# validating node
|
||||
# vp3 will also be used for client interactive operations
|
||||
# If you want to run fabric command on the host, then map 7051:7051 to host
|
||||
# port, or use like `CORE_PEER_ADDRESS=172.17.0.2:7051` to specify peer addr.
|
||||
vp3:
|
||||
extends:
|
||||
file: peer-pbft.yml
|
||||
service: vp
|
||||
|
@ -56,3 +59,8 @@ vp3:
|
|||
- CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051
|
||||
links:
|
||||
- vp0
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: fabric_pbft
|
|
@ -7,13 +7,17 @@
|
|||
# This utilized the pbft as consensus
|
||||
# See https://github.com/hyperledger/fabric/blob/master/docs/dev-setup/devnet-setup.md#using-consensus-plugin for more details.
|
||||
|
||||
vp:
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
vp:
|
||||
image: hyperledger/fabric-peer:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- CORE_PEER_ADDRESSAUTODETECT=true
|
||||
- CORE_PEER_NETWORKID=dev
|
||||
- CORE_LOGGING_LEVEL=info #critical, error, warning, notice, info, debug
|
||||
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_
|
||||
# The following section enables pbft consensus
|
||||
- CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft # noops, pbft
|
||||
- CORE_PBFT_GENERAL_MODE=batch # batch. classic and sieve will be not supported again.
|
||||
|
@ -21,15 +25,22 @@ vp:
|
|||
- CORE_PBFT_GENERAL_BATCHSIZE=2 # only useful when in batch mode
|
||||
- CORE_PBFT_GENERAL_TIMEOUT_REQUEST=2s
|
||||
expose:
|
||||
- "7051"
|
||||
- "7052"
|
||||
- "7053"
|
||||
- "7050" # Rest
|
||||
- "7051" # Grpc
|
||||
- "7052" # Peer CLI
|
||||
- "7053" # Peer Event
|
||||
- "7054" # eCAP
|
||||
- "7055" # eCAA
|
||||
- "7056" # tCAP
|
||||
- "7057" # eCAA
|
||||
- "7058" # tlsCAP
|
||||
- "7059" # tlsCAA
|
||||
volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: peer node start # this repeats the default cmd to make sure
|
||||
# command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA
|
||||
# command: sh -c "sleep 5; peer node start" # peer node should have booting delay with CA
|
||||
|
||||
vp_sec:
|
||||
vp_sec:
|
||||
extends:
|
||||
service: vp
|
||||
environment:
|
||||
|
|
Loading…
Reference in New Issue