https://github.com/esumit/trace-fruits
TraceFruits is a conceptual demonstration designed to visualize fruit supply chain events stored in an immutable ledger. Leveraging Splunk for data analysis, the project utilizes Hyperledger Fabric's blockchain ledgers to create an informative and transparent overview of the fruit supply chain process.
https://github.com/esumit/trace-fruits
blockchain chaincode hyperledger hyperledger-fabric smart-contracts splunk-application
Last synced: 11 days ago
JSON representation
TraceFruits is a conceptual demonstration designed to visualize fruit supply chain events stored in an immutable ledger. Leveraging Splunk for data analysis, the project utilizes Hyperledger Fabric's blockchain ledgers to create an informative and transparent overview of the fruit supply chain process.
- Host: GitHub
- URL: https://github.com/esumit/trace-fruits
- Owner: esumit
- License: mit
- Created: 2021-06-27T10:30:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-11-08T06:22:37.000Z (3 months ago)
- Last Synced: 2025-11-08T08:23:10.305Z (3 months ago)
- Topics: blockchain, chaincode, hyperledger, hyperledger-fabric, smart-contracts, splunk-application
- Language: Go
- Homepage:
- Size: 15.9 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 40
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trace Fruits
###### About
 
Trace Fruits is a conceptual demo designed to visualize fruit supply chain events stored in an immutable ledger. It utilizes Splunk to analyze data generated from Hyperledger Fabric's blockchain ledgers.
This demo is inspired by the GS1 Global Traceability Standard, which provides guidelines for fresh fruit and vegetable traceability. The major supply chain events for traceability include:
- Harvesting - The producer harvests the crop and packs the products into cases.
- Packing/Repacking - The packer/repacker transforms ungraded commodities into retail-ready products.
- Shipping - The packer/repacker palletizes the cases of product.
- Transporting - The carrier arrives and loads the pallets onto the truck.
- Receiving - The pallets arrive at the retailer or foodservice operator's distribution center.
- Selling or Consumption - The products have arrived at the retail store and have been placed on the shelves.

By leveraging blockchain technology and data analysis, Trace Fruits aims to provide better transparency and traceability throughout the entire fruit supply chain process.
_harvesting-traceability event as stored in ledger_
````
{
"_id": "0e8a4c14-02f2-42b5-939c-a8de8d2c7db6",
"_rev": "1-c1b69236a1b423ec7806837549c32c8c",
"attributes": {
"event-when": "2021-05-24 18:47:22.151667 +1000 AEST",
"event-where": "Johannesburg, South Africa",
"event-why": "harvesting-traceability",
"expiration-datetime": "2021-12-24 18:47:22.1515 +1000 AEST",
"fruit-name": "Apricots",
"fruit-type": "deciduous",
"quantity": 313,
"weight": 212
},
"header": {
"batch-lot": "AB-123",
"event-id": "0e8a4c14-02f2-42b5-939c-a8de8d2c7db6",
"gln": "9501101530911",
"gln-location-type": "planting",
"gtin": "09501101530003",
"gtin-trade-id-type": "crate-trade-id",
"trace-id": "11111111"
},
"metaInfo": {
"createdAt": "2021-06-26T18:45:04.140564684Z",
"docType": "harvesting"
},
"~version": "\u0000CgMBBAA="
}
````
A trace-id is unique for set of product's supply chain events.
#### Tracefruit Blockchain Network

#### Demo Recording
https://tinyurl.com/trace-fruits-demo
#### How conceptually it works ?

- At every logical step of the fruit supply chain, a fresh fruit supply chain event with a unique trace-id is inserted into the blockchain ledger (e.g., harvesting event or shipping event). This event contains crucial information to identify and verify the supply chain event.
- The inserted unique trace-ids correspond to a batch of fruit products, and the trace-id is inserted for each event from start to finish for that batch of fruit products (e.g., from harvesting to retail).
- A complete audit trail of events from start to finish can be queried from the ledger using the trace-id.
- Individual events can also be queried from the ledger.
- Events are inserted along the supply chain process.
#### How To
##### Step-1 : Clone this repository to linux flavour machine e.g. Ubuntu 20.04.2 LTS
##### Step-2 : Install Prerequisites of hyperledger fabric
##### Step-3 : Install Samples, Binaries, and Docker Images
Execute the command to pull down the binaries and images
```
curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.6 1.4.6 0.4.18
```
- hyperledger/fabric-baseos 0.4.18
- hyperledger/fabric-ca 1.4.6
- hyperledger/fabric-orderer 1.4.6
- hyperledger/fabric-peer 1.4.6
##### Step-5 : Setup network, necessary dockers , orgs, peer , channels , Splunk
Inside this repo, call start shell script. It will setup necessary dockers images e.g. couch,
Splunk, fabric network, orgs, peers, channels
```
./start.sh
```

##### Step-6 : Run init ledgers from command line
````
./init_ledgers.sh
````
It will insert 18 supply events into the via trace_fruits_cc chaincode to the ledgers.

##### Step-7 : Open couchdb Fauxton , a native web-based interface built into CouchDB :
````
http://:5984/_utils/
````
Click on databases
Click on fruitsreceiver_trace_fruits_cc



##### Step-9 : Run Send Txns to continuously send events to Trace Fruits ledgers
````
./send_txns.sh
````

##### Step-10 : Open splunk enterprise :
```
http://:8000/en-US/account/login
username : admin
Password : changeme
if local then ip address is 127.0.0.1
```
Open Splunk App for Hyperledger Fabric
Click on Trace Fruits On the Side Bar




###### To shutdown the environment
`./stop.sh`.

##### Note
- .checkpoints is an empty file -> ./.checkpoints:/usr/src/app/.checkpoints in docker-compose-splunk.yaml
- splunk-apps is an empty dir -> - ./splunk-apps:/opt/splunk/etc/apps in docker-compose-splunk.yaml
- trace-fruits-apps contains trace-fruits splunk app available tar.gz, and a regular folder
- trace-fruits chaincode available in trace-fruits-cc directory
- trace-fruits-splunk-app.tar.gz also available in s3 https://trace-fruits.s3.ap-southeast-2.amazonaws.com/trace-fruits-splunk-app.tar.gz
- Audit trail query is not implemented yet
- Tar file of Trace-Fruits-1 doesn't work if created from mac,
#### References
- https://hyperledger-fabric.readthedocs.io/en/release-2.2/
- https://github.com/splunk/fabric-logger
- https://github.com/splunk/fabric-logger/tree/master/examples/vaccine-demo
- https://splunkbase.splunk.com/app/4605/
- https://www.splunkdlt.com/