|
1 | 1 | # What is block-listener
|
2 |
| -block-listener.go will connect to a peer and recieve blocks. For every transaction in the block, it will test the ErrorCode field and print success/failure. |
| 2 | +block-listener.go will connect to a peer and receive blocks. For every transaction in the block, it will test the ErrorCode field and print success/failure. |
3 | 3 |
|
4 | 4 | # To Run
|
| 5 | +```sh |
5 | 6 | 1. go build
|
6 | 7 |
|
7 | 8 | 2. ./block-listener -events-address=< event address >
|
| 9 | +``` |
8 | 10 |
|
9 | 11 | # Example with PBFT
|
10 | 12 |
|
11 | 13 | ## Run 4 docker peers with PBFT
|
| 14 | +```sh |
12 | 15 | docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true -e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft hyperledger/fabric-peer peer node start
|
13 | 16 |
|
14 | 17 | docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp1 -e CORE_PEER_ADDRESSAUTODETECT=true -e CORE_PEER_DISCOVERY_ROOTNODE=172.17.0.2:30303 -e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft hyperledger/fabric-peer peer node start
|
15 | 18 |
|
16 | 19 | docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp2 -e CORE_PEER_ADDRESSAUTODETECT=true -e CORE_PEER_DISCOVERY_ROOTNODE=172.17.0.2:30303 -e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft hyperledger/fabric-peer peer node start
|
17 | 20 |
|
18 | 21 | docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp3 -e CORE_PEER_ADDRESSAUTODETECT=true -e CORE_PEER_DISCOVERY_ROOTNODE=172.17.0.2:30303 -e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft hyperledger/fabric-peer peer node start
|
| 22 | +``` |
19 | 23 |
|
20 | 24 | ## Attach event client to a Peer
|
| 25 | +```sh |
21 | 26 | ./block-listener -events-address=172.17.0.2:31315
|
| 27 | +``` |
22 | 28 |
|
23 | 29 | Event client should output "Event Address: 172.17.0.2:31315" and wait for events.
|
24 | 30 |
|
25 | 31 | ## Create a deploy transaction
|
26 | 32 | Submit a transaction to deploy chaincode_example02.
|
27 | 33 |
|
| 34 | +```sh |
28 | 35 | CORE_PEER_ADDRESS=172.17.0.2:30303 peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
|
| 36 | +``` |
29 | 37 |
|
30 | 38 | Notice success transaction in the events client.
|
31 | 39 |
|
32 | 40 | ## Create an invoke transaction - good
|
33 | 41 | Send a valid invoke transaction to chaincode_example02.
|
34 | 42 |
|
| 43 | +```sh |
35 | 44 | CORE_PEER_ADDRESS=172.17.0.2:30303 peer chaincode invoke -n 1edd7021ab71b766f4928a9ef91182c018dffb86fef7a4b5a5516ac590a87957e21a62d939df817f5105f524abddcddfc7b1a60d780f02d8235bd7af9db81b66 -c '{"Function":"invoke", "Args": ["a","b","10"]}'
|
| 45 | +``` |
36 | 46 |
|
37 | 47 | Notice success transaction in events client.
|
38 | 48 |
|
39 | 49 | ## Create an invoke transaction - bad
|
40 | 50 | Send an invoke transaction with invalid parameters to chaincode_example02.
|
41 | 51 |
|
| 52 | +```sh |
42 | 53 | CORE_PEER_ADDRESS=172.17.0.2:30303 peer chaincode invoke -n 1edd7021ab71b766f4928a9ef91182c018dffb86fef7a4b5a5516ac590a87957e21a62d939df817f5105f524abddcddfc7b1a60d780f02d8235bd7af9db81b66 -c '{"Function":"invoke", "Args": ["a","b"]}'
|
| 54 | +``` |
43 | 55 |
|
44 | 56 | Notice error transaction in events client.
|
0 commit comments