Trace is a Vermont-based blockchain-enabled seed-to-sale tracking solution for the hemp industry. Trace is also one of the first technology startups in the nation to be incorporated as a Blockchain LLC using the State of Vermont’s new blockchain law, of which Trace was an integral contributor.
Trace wanted to create a blockchain-powered application management and tracking dashboard that would include:
Trace needed smart contracts to store data, including:
Additionally, Trace wanted smart contracts to manage read and write access to the data. For example, allowing only certain people to mark produce as transferred from a test center to a retailer.
Trace already had an iOS app with a backend featuring blockchain on an Ethereum testnet and smart contracts regulating relations between the participants of the system and storing hemp lot data.
The problem was that legal regulations for the hemp industry change rapidly. Therefore, for each change in regulations, there should be a change in the data about each lot. But you can’t just update a smart contract — because of the blockchain’s immutability, you have to create a new smart contract for each change.
The immutability of blockchain works to your benefit only if you have a one-time deal. If you have a constant relationship with one or more parts of a supply chain and that smart contract contains legal information about how those parts should interact and that legal information constantly changes, it’s very likely you will need to change deal conditions and add or remove people who have access to deal data.
Trace approached us with a task: to make their smart contracts upgradeable.
There are several workarounds for the immutability problem on the Ethereum platform. You can create one main smart contract for the system, but the logic of that smart contract is governed by another smart contract that you replace with a new one when needed.
This approach has a couple of drawbacks:
For that reason, we excluded ZeppelinOS from the final solution. In its place, we rethought how the contract system works. We understood that every lot has a terminal state (after the produce has been delivered to the end customer) and there is no point in supporting and upgrading these outdated contracts according to new regulations. So, we changed the connection between the contracts in a way that we could:
In other words, we reshaped the initial problem from upgrading existing smart contracts to developing an upgrade mechanism for the whole system behavior by introducing new contracts and switching business flow to them.
Project Stack:
Communication Stack:
We’ve been working with Trace for some time, and they are happy with our results. Since then, we have finished making the smart contracts upgradeable and have switched to developing a Node.js backend for Trace’s web application. They have also entrusted us with their iOS app for maintenance and occasional tweaking.