Driving safety and payments in a milk supply chain with Oracle Blockchain and OriginTrail Decentralized Knowledge Graph

Trace Labs
Published in
7 min readSep 24, 2020


A farmers’ payment process optimized with Oracle Blockchain and OriginTrail Decentralized Network (ODN) using verified traceability and laboratory data

Milk payment is a complex process and the price of milk paid to a farmer depends on multiple factors. The quality of the milk, the quantity of the shipment, farm size, and negotiated margins all play a part in every single delivery that farmers make. Additionally, these deliveries are taken in and processed by different organizations, like farmers, agricultural cooperatives, dairies, and testing laboratories. All of this means that the current way of handling payments towards the farmers still involves significant manual effort to verify all inputs and ensure the right process is respected.

The OriginTrail Decentralized Knowledge Graph (DKG), together with the smart contract capabilities of Oracle Hyperledger Fabric, promises to improve this process end-to-end and provide a trusted compensation solution. An implementation of this trusted compensation solution was carried out as a part of the largest EU project focusing on digitizing the agrifood sector, the SmartAgriHubs (SAH project). As part of the Flagship Innovation Experiment #28 (FIE) “Decentralized Trust in Agri-Food Supply Chains,” the solution showcases how blockchain-based technologies can improve efficiency, safety, and trust in food supply chains without interrupting the existing business process. The aim of the SAH project is to unleash the innovation potential for the digital transformation of the European agri-food sector.

Enhancing the integrity of a cross-organizational process

The team at Trace Labs has been increasing trust in food supply chains since 2013 and the majority of the organization’s projects have focused on delivering trust towards the end consumer, thus providing better positioning for companies on the market. In this particular case, we are diving deeper into the peculiarities of a dairy supply chain, enhancing trust in the processes among the supply chain partners and utilizing OriginTrail DKG as a middle ground for handling key compensation inputs with integrity. Extending the trust from inputs to the compensation calculations as well, Oracle Blockchain is taking the trusted inputs from OriginTrail and using them to calculate payments for each farmer within a smart contract, a self-executing program running on a blockchain. This ensures full accountability and transparency of the compensation process to all supply chain partners across multiple organizations.

Trace Labs — core developers of OriginTrail — have been working on establishing end-to-end visibility in a dairy supply chain since 2013, giving consumers a complete overview of milk production. Now, using the OriginTrail DKG for trusted data and the Oracle Blockchain Platform, payments to farmers can be done more efficiently, minimizing the chance of human error.

As mentioned in the beginning, however, the current process of handling payments in the dairy industry utilizes multiple existing IT systems that need to seamlessly connect in creating such a trusted compensation solution. Let’s take a closer look at the main user in the FIE #28 — Agricultural Cooperative Šaleška Dolina (KZŠD), an agricultural cooperative with 200+ member farmers delivering milk to one of the largest dairies in the region.

In today’s payment process, it is the dairy that calculates the price of milk based on laboratory test results and shares that input with the cooperative together with the laboratory test results. The cooperative then manually validates the input received from the dairy before entering the inputs into their ERP. After that, the terms for each farmer are validated with the contract provisions, the cooperative’s margin is deducted, and the final compensation is created. Although the cooperative has the data on milk volumes and receives the laboratory test results, they lack a fully trusted and automated system that would perform verifiable calculations and produce an integrity-assured data provenance log. This creates a trust gap among the farmers, the cooperative, and the dairy. A gap that can be effectively overcome with decentralized technology, based on the OriginTrail DKG and Oracle Hyperledger Fabric.

Using the two systems, the milk payment mechanism we are developing enables the automatic calculation of payments that the cooperative KZ Šaleška dolina needs to make to each farmer based on the trusted milk data stored on the ODN and the contractual data stored in a Hyperledger Fabric smart contract deployed using Oracle Blockchain Platform (OBP).

Trusted oracle framework for public and private data

Creating a trusted payment solution for the dairy sector that effectively addresses the challenges above requires the characteristics of both — the integrity of the public network and the confidentiality of the private. Using Trace Labs’ nOS, we are able to respect that requirement through the flexible usage of OriginTrail DKG and Oracle Hyperledger Fabric.

As shown in the scheme above, the new system in no way changes the current IT landscape, nor the existing business process. Rather, it treats both as key data sources and a starting point for improvement. Each of the involved IT systems (the dairy ERP, the cooperative ERP, and the cooperative contractual data) exports data in its existing format towards the nOS. Once it reaches the nOS, data gets restructured for interoperability and prepared for publishing on the OriginTrail DKG. Since a lot of the included data is very business-sensitive, data access control and permissioning is handled with great care, keeping critical data in the secure private store of the OriginTrail node with only key integrity-assuring data points published to the public DKG (metadata for indexing and cryptographic proofs for data validation). As data leaves nOS, each organization uses its OriginTrail node to store sensitive data and connect with the network to publish the public set of metadata and proofs.

Example of dairy test result data, structured according to the W3C Verifiable Credentials data standard.

Trusted calculation using smart contracts

nOS has clearly defined data permissioning settings, including allowing relevant smart contracts deployed on the blockchain to access key data points in the permissioned and public stores of the OriginTrail DKG to perform required trusted computation. Oracle Blockchain Platform allows for the easy and quick set-up of a Hyperledger Fabric permissioned blockchain, which is the right choice for such a consortium-focused use case. Integrating nOS with the Oracle Blockchain Platform instance is seamless and done with a secure connection. Smart contracts that have been deployed can include all required business rules to be able to perform trusted computation as they are not publicly accessible outside the consortium. Most importantly, the smart contract can query and access the OriginTrail DKG trusted data, as determined by settings described in the previous step. This way, OrginTrail DKG effectively acts as an oracle, providing trusted data that has been published by relevant organizations in the form of verifiable credentials. Once the cooperative is ready to make the payment, nOS takes the required payment data out of Oracle Hyperledger Fabric blockchain and restructures it into a payment file that can be uploaded for issuing SEPA payments with the bank.

Combining all components, we have been able to entirely automate the payment system by simultaneously increasing the integrity level of the entire process and the accountability of each supply chain partner for the parts that they are responsible for. As the pilot is being run under the European Commission-funded project SmartAgriHubs, we are closely monitoring the total savings that this automated system will deliver to the dairy supply chain.

About SmartAgriHubs

SmartAgriHubs is a EUR 20 million EU project under the Horizon 2020 instrument and brings together a consortium of well over 160 partners in the European agri-food sector. The project aims to realize the digitization of European agriculture by fostering an agricultural innovation ecosystem dedicated to excellence, sustainability, and success.

About Trace Labs

Trace Labs is a blockchain company developing enterprise solutions for trusted data exchange across the supply chain. Their solutions enable forward-thinking organizations to gain the most knowledge possible and make better decisions based on interconnected data from their supply chains. Trace Labs is also the core development company of the open-source OriginTrail protocol for blockchain-based data exchange.

Founded in 2013, Trace Labs has built award-winning enterprise solutions for supply chains, including those for traceability and verifiable claims. In 2017, Trace Labs received an award from the Walmart Food Safety Collaboration Center. Trace Labs believes sustainable supply chains are only possible when all organizations, big or small, are allowed to benefit from trusted data exchanges.

For more information about Trace Labs, please visit: tracelabs.io.
For more information about OriginTrail, please visit: origintrail.io.

This project has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement No 818182.

👇 More about OriginTrail 👇

Web | Twitter | Facebook | Telegram | LinkedIn | GitHub | Discord



Trace Labs

Trusted network applications for business communities of the future. Core development company of the @origin_trail protocol. #connectthedots