In Balance-transfer, there are examples of the node SDK being quite complete.
The official documentation for the SDK is here: https://fabric-sdk-node.github.io/
Each configuration item in the Balance-transfer is ready, and if you need to regenerate the artifacts, make sure to modify the corresponding changes after the build Docker-compose.yaml,network-config.yaml
Start the network
After you run the./runapp.sh, you get a similar result:
Stopping peer1.org1.example.com ... donestopping peer0.org1.example.com ... donestopping peer1.org2.example.com ... Donestopping peer0.org2.example.com ... donestopping ca_peerorg1 ... donestopping ca_peerorg2 ... do Nestopping orderer.example.com ... doneremoving peer1.org1.example.com ... done doneremoving ... Removing peer1.org2.example.com ... doneremoving peer0.org2.example.com ... doneremoving ca_peerorg1 Moving ca_peerorg2 ... doneremoving orderer.example.com ... doneremoving network artifacts_default========== No containers available for deletion ==================== no images available for deletion ===========creating network "a Rtifacts_default "with the default drivercreating ca_peerorg2 ... donecreating orderer.example.com ... donecreatin G ca_peerorg1 ... donecreating peer0.org2.example.com ... donecreating peer0.org1.example.com ... donecreating pee R1.org1.example.com ... donecrEating peer1.org2.example.com ... done============== node modules installed already =============[2018-05-16 15:38:59.455] [INFO] Samplewebapp-****************** SERVER STARTED ************************[2018-05-16 15:38:59.461 ] [INFO] Samplewebapp-*************** http://localhost:4000 ******************
Run Docker PS in a new window, get
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS names5a59ea698c3f Hyperledger/fabric-peer "Peer node start" A Bout a minute ago up about a minute 0.0.0.0:8056->7051/tcp, 0.0.0.0:8058->7053/tcp peer1.org2.example.coma0838 4cc48cc Hyperledger/fabric-peer "Peer node start" about a minute ago up about a minute 0.0.0.0:7051 ->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com027c68057998 hyperledger/fabric-peer "Peer No De start "about a minute ago up about a minute 0.0.0.0:7056->7051/tcp, 0.0.0.0:7058->7053/tcp peer1.org 1.example.com6e738124e03b Hyperledger/fabric-peer "Peer node start" about a minute ago up about a min Ute 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.org2.example.combfd5f1b1fe75 hyperledger/fabric- Ca "Sh-c" fabric-ca-... " About a minute ago up about a minute 0.0.0.0:7054->7054/tcp ca_peerorg1b8d0b10740b3 Hyperledger/fabric-orderer "Orderer" about a minute ago up about a minute 0.0.0.0:7050->7050/tcp Orderer.example.com9e807c581f33 hyperledger/fabric-ca "Sh-c ' Fabric-ca-..." About a minute ago up about a minute 0.0.0.0:8054->7054/tcp ca_peerorg2
Perform tests
Run the./testapis.sh and get the following results:
POST request Enroll on Org1 ... {"Success": true, "secret": "", "message": "Jim enrolled successfully", "token": " Eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjlehaioje1mjy0oti1mzisinvzzxjuyw1lijoismltiiwib3jntmftzsi6ik9yzzeilcjpyxqioje1mjy0 Nty1mzj9.fna1tvbixd6tivcj_ofbgidd42ljuylv9zsau_hqv8m "}org1 token is Eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjlehaioje1mjy0oti1mzisinvzzxjuyw1lijoismltiiwib3jntmftzsi6ik9yzzeilcjpyxqioje1mjy0 Nty1mzj9.fna1tvbixd6tivcj_ofbgidd42ljuylv9zsau_hqv8mpost request Enroll on Org2 ... {"Success": true, "secret": "", "message": "Barry enrolled successfully", "token": " Eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjlehaioje1mjy0oti1mzqsinvzzxjuyw1lijoiqmfycnkilcjvcmdoyw1lijoit3jnmiisimlhdci6mtuy Njq1njuznh0.p3a_bcjgultujbi9u8j187au2w2mqtgfsealqnjcf-i "}ORG2 token is Eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjlehaioje1mjy0oti1mzqsinvzzxjuyw1lijoiqmfycnkilcjvcmdoyw1lijoit3jnmiisimlhdci6mtuy Njq1njuznh0.p3a_bcjgultujbi9u8j187au2w2mqtgfsealqnjcf-ipost Request Create Channel ... {"Success": true, "MessagE ":" Channel ' MyChannel ' created successfully "}post request Join Channel on org1{" Success ": TRUE," message ":" Successfully Joined peers in organization ORG1 to the Channel:mychannel "}post request Join channel on org2{" Success ": TRUE," message ":" Su Ccessfully joined peers in organization ORG2 to the Channel:mychannel "}post Install Chaincode on org1{" Success ": true," mess Age ":" Successfully install Chaincode "}post install Chaincode on org2{" Success ": TRUE," message ":" Successfully install Chaincode "}post instantiate Chaincode on Peer1 of ORG1
Main test, register user, create Channel,join channle, install Chaincode, initialize Chaincode, call Chaincode, query Chaincode
Build a RESTful API to use the fabric Node SDK to get to the outset