In the job zip file we uploaded there is a private key to connect to the cloud server, you can connect to the server to see that. The server address is 47.237.161.142
and the User is root
.
setting
Host Fabric
HostName 47.237.161.142
User root
IdentityFile ~/.ssh/NGU.pem
https://github.com/NGU-forever/Fabric-Healthcare
Explorer: http://47.237.161.142:8080 (User:exploreradmin, Passsword:exploreradminpw)
Backend:http://47.237.161.142:8888
Fabric-Healthcare/
├── app/
│ ├── backend/ (backend)
│ ├── frontend/ (Web, GUI)
├── blockchain/
│ ├── chaincode/ (Chaincode)
│ ├── network/ (Blockchain)
├── README.md
Frank Xiong(z5503242): Blockchain architecture and framwork part
Zenglin Zhong(z5360071): Chaincode part
Danniel Deng(z5275904): Backend part
Zeyu Wang(z5453260): Frontend
Yifan Hong(z5414347): Off-chain componet
The blockchain platform used in this project is Hyperledger Fabric, the version of which is V2.5, which has better performance and stability, and the Fabric-gateway mode is used to invoke and use chaincode. The technology stack used in this blockchain is as follows: CouchDB is used to view the blockchain data status and world status, and Hyperledger explorer is used to view the blockchain node status, on-chain situation, chaincode definition, transactions, and so on. The blockchain is deployed on cloud servers throughout to ensure its stability and discharge the numerous problems that occur in virtual machines.
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker --version
docker-compose --version
wget https://golang.org/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
echo "export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH
export PATH=$GOPATH/bin:$PATH" >> ~/.profile
source ~/.profile
go version
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install 16
nvm use 16
node -v
sudo apt install jq
git clone https://github.com/NGU-forever/Fabric-Healthcare.git
unzip Fabric-Healthcare-main.zip
cd Fabric-Healthcare/blockchain
curl -sSL https://github.com/hyperledger/fabric/releases/download/v2.5.0/hyperledger-fabric-linux-amd64-2.5.0.tar.gz -o fabric-bin.tar.gz
tar -xvf fabric-bin.tar.gz
mv bin network/
cd blockchain/network
./start.sh
For ease of deployment, we wrote a special startup script to launch the blockchain.
#!/bin/bash
./stop.sh
# mysql
docker run --name fabrihealth-mysql -p 3337:3306 -e MYSQL_ROOT_PASSWORD=fabrihealth -d mysql:8
#check images and pulling
image_versions=("2.5.9")
images=("hyperledger/fabric-tools" "hyperledger/fabric-peer" "hyperledger/fabric-orderer" "hyperledger/fabric-ccenv" "hyperledger/fabric-baseos")
for image in "${images[@]}"
do
for version in "${image_versions[@]}"
do
if ! docker images -a | grep "$image" | grep "$version" &> /dev/null
then
echo "images $image:$version is none, pulling..."
docker pull "$image:$version"
fi
done
done
# blockchain up and create channels with couchdb
./network.sh up createChannel -s couchdb
# start explorer
cd explorer
export EXPLORER_CONFIG_FILE_PATH=./config.json
export EXPLORER_PROFILE_DIR_PATH=./connection-profile
export FABRIC_CRYPTO_PATH=./organizations
docker-compose down -v
cp -r ../organizations/ .
docker-compose up -d
# deploy chaincode
cd ~/Fabric-Healthcare/blockchain/network/
./network.sh deployCC -ccn mycc3 -ccp ../chaincode -ccl go
echo "-------Stopping-------"
# stop explorer
docker compose -f explorer/docker-compose.yaml down -v > /dev/null 2>&1
# stop network
./network.sh down > /dev/null 2>&1
# delete organizations
rm -rf explorer/organizations
# delete mysql image
docker rm -f fabrictrace-mysql > /dev/null 2>&1
echo "-------Closing-------"
./network.sh down
docker rm -f $(docker ps -aq)
smart_contract_addresses can check Hyperledger explorer: http://47.237.161.142:8080 (User:exploreradmin, Passsword:exploreradminpw)
cd ../chaincode
go mod vendor
Because the java file is too large, you need to manually download the jar file and add it in Fabric-Healthcare/app/backend
directory. The download link is as follows: https://drive.google.com/file/d/1-19k2ru4iJzruFTwnOXhVDGPT3rOAKCN/view?usp=sharing
cd ../../app/backend
./app.start
cd java-fabric
./app.stop
sudo apt update
sudo apt install nodejs npm
sudo npm install -g @vue/cli
cd frontend
npm run serve