From 0fcc71b5f3e8c70162ba8748ee17c1082b0946f4 Mon Sep 17 00:00:00 2001 From: ccorley Date: Mon, 11 May 2020 14:41:02 -0500 Subject: [PATCH] Revert "Adding readme and env script" This reverts commit ca7ba771ec525ff6e01c1a07773921f1b7be96d3. --- hyperledger-fabric/first-network/README.md | 96 +------------------ .../first-network/scripts/env.sh | 7 -- 2 files changed, 4 insertions(+), 99 deletions(-) delete mode 100755 hyperledger-fabric/first-network/scripts/env.sh diff --git a/hyperledger-fabric/first-network/README.md b/hyperledger-fabric/first-network/README.md index 9e372c23..6d9e2543 100644 --- a/hyperledger-fabric/first-network/README.md +++ b/hyperledger-fabric/first-network/README.md @@ -1,95 +1,7 @@ -## Distributed Ledger Support for FHIR Resources +## Build Your First Network (BYFN) -Distributed Ledger support for FHIR resources is derived from the Hyperledger Fabric [first network](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html) in [hyperledger/fabric-samples](https://github.com/hyperledger/fabric-samples). The provided fhir-data smart contract supports storage of FHIR patient resources in the blockchain. +The directions for using this are documented in the Hyperledger Fabric +["Build Your First Network"](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html) tutorial. -### Deploy the blockchain network and contract +*NOTE:* After navigating to the documentation, choose the documentation version that matches your version of Fabric -Navigate to the hyperledger fabric directory -``` -fabric-emr-demo/hyperledger-fabric/first-network -``` - -Set environment variables -``` -. ./env.sh -``` - -Bring up the blockchain and deploy the FHIR contract -``` -./byfn.sh up -c channel1 -l javascript -p "../../fabric-samples/chaincode/fhir-data" -m fhir-data -e 1 -``` - -### Send FHIR transactions - -Exec into the CLI container -``` -docker exec -it cli sh -``` - -Navigate to the scripts directory -``` -cd scripts -``` - -Set environment variables -``` -. ./env.sh -``` - -Operate as org1 -``` -. ./org1.sh -``` - -Send a test transaction -``` -peer chaincode invoke -o orderer.example.com:7050 --isInit --tls true --cafile $CAFILE -C channel1 -n fhir-data --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles $ORG1TLS --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles $ORG2TLS -c '{"function":"initLedger","Args":[]}' --waitForEvent -``` -You should see the following result -``` -INFO 003 Chaincode invoke successful. result: status:200 -``` - -Post a patient resource -``` -peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile $CAFILE -C $CHANNEL_NAME -n fhir-data --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles $ORG1TLS --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles $ORG2TLS -c '{"function":"addPatient","Args":["001","{\"resourceType\":\"Patient\",\"id\":\"001\",\"text\":{\"status\":\"generated\",\"div\":\"\"},\"active\":\"true\",\"name\":[{\"use\":\"official\",\"family\":\"Donald\",\"given\":[\"Duck\"]}],\"gender\":\"male\",\"organization\":{\"reference\":\"Organization\/1\",\"display\":\"Walt Disney Corp\"}}"]}' --waitForEvent -``` -You should see the following result -``` -INFO 003 Chaincode invoke successful. result: status:200 -``` - -Query for the patient resource you just posted -``` -peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile $CAFILE -C $CHANNEL_NAME -n fhir-data --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles $ORG1TLS --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles $ORG2TLS -c '{"function":"queryPatient","Args":["001"]}' --waitForEvent -``` -You should see the following result -``` -INFO 003 Chaincode invoke successful. result: status:200 payload:"{\"resourceType\":\"Patient\",\"id\":\"001\",\"text\":{\"status\":\"generated\",\"div\":\"\"},\"active\":\"true\",\"name\":[{\"use\":\"official\",\"family\":\"Donald\",\"given\":[\"Duck\"]}],\"gender\":\"male\",\"organization\":{\"reference\":\"Organization/1\",\"display\":\"Walt Disney Corp\"}}" -``` - -Replace the patient record -``` -peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile $CAFILE -C $CHANNEL_NAME -n fhir-data --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles $ORG1TLS --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles $ORG2TLS -c '{"function":"replacePatient","Args":["001","{\"resourceType\":\"Patient\",\"id\":\"001\",\"text\":{\"status\":\"generated\",\"div\":\"\"},\"active\":\"true\",\"name\":[{\"use\":\"official\",\"family\":\"Duck\",\"given\":[\"Donald\"]}],\"gender\":\"male\",\"organization\":{\"reference\":\"Organization\/1\",\"display\":\"Walt Disney Corp\"}}"]}' --waitForEven -``` -You should see the following result -``` -INFO 003 Chaincode invoke successful. result: status:200 -``` - -Update the patient record by adding a new JSON section -``` -peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile $CAFILE -C $CHANNEL_NAME -n fhir-data --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles $ORG1TLS --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles $ORG2TLS -c '{"function":"updatePatient","Args":["001","{\"contact\":[{\"relationship\":[{\"coding\":[{\"system\":\"http:\/\/terminology.hl7.org\/CodeSystem\/v2-0131\",\"code\":\"E\"}]}]}]}"]}' --waitForEvent -``` -You should see the following result -``` -INFO 003 Chaincode invoke successful. result: status:200 -``` - -When you are finished running transactions, type `exit` to exit the CLI container. - -To bring down the Hyperledger Fabric network -``` -./byfn.sh down -c channel1 -``` -Note: Bringing down the network will cause you to lose the transactions you have submitted. \ No newline at end of file diff --git a/hyperledger-fabric/first-network/scripts/env.sh b/hyperledger-fabric/first-network/scripts/env.sh deleted file mode 100755 index 21e10362..00000000 --- a/hyperledger-fabric/first-network/scripts/env.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -export CHANNEL_NAME=channel1 -export CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -export ORG1TLS=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt -export ORG2TLS=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -