A hyperledger fabric based blockchain backend storage.
- Golang 1.22.5+
- In linux, please consult go version manager to manage go version.
- jq
- Docker
- docker-compose (for older version docker)
- In linux, add current user to the docker group to avoid privilege issue:
sudo usermod -a -G docker $USER
sudo apt-get install git curl jq -y
Start docker with
sudo systemctl start docker
brew install git curl jq go
Start docker with Docker Desktop.
- Clone this repo to the destination of your choice, make sure you have make and docker/docker compose installed.
The following commands are assumed to initiated from the FabricBackend/ directory.
- Run
make check-prerequisiteto check prerequisites. - Run
make installto install the necessary components, including fabric, docker images, and chaincode. - Use
make drp_couchdb_deployto bring up the test network and deploy the contract.
This may fail at contract installation in rare occasions, simply trying the command again should resolve the problem.
- Use
make api_serverto bring up the api service
Navigate to FabricBackend/data-import-helper and use go run import_file.go to put the data in ds1.csv to the ledger.
This helper relies on the api server.
- Use
make downto turn the network down - Use
make cleanto clean up the downloaded repos and docker images.
By default all the data will be cleaned when the network is down.
The default api server address is http://localhost:6999
GETapi/record/all
Return all records in standard JSON
GETapi/record/{droneID}
Return all records for {droneID} in standard JSON
POSTapi/record/create
Create a record with the JSON. The JSON needs to be formatted as the sample data.
| Name | Type | Ports |
|---|---|---|
| API server | Go | 6999 |
| orderer | Docker | 7050 |
| peer0.org1 | Docker | 7051 |
| peer0.org2 | Docker | 9051 |
| dev-peer.org1 | Docker | - |
| dev-peer.org2 | Docker | - |
| CouchDB0 | Docker | 5984 |
| CouchDB1 | Docker | 7984 |
For live demo, please check the instructions.