Trace

Case Study: Developing an Ethereum-powered application management and tracking dashboard for hemp industry

$50k - $100k
Project size
2018 – Ongoing
Project length
Trace

Trace background

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.

Client’s Objective

Trace wanted to create a blockchain-powered application management and tracking dashboard that would include:

  • An easy online application submission process for licensees;
  • A blockchain-powered mobile app for farmers, extractors, testing facilities;
  • A blockchain-powered roadside verification tool for law enforcement;
  • A business one-stop dashboard for state government users that connects necessary data across multiple agencies, displaying recreational, medical, and hemp cannabis activities in a single view.
Trace case image 1

Our Objective

Trace needed smart contracts to store data, including:

  • the amount of produce,
  • when it was transferred to a test center,
  • the results of quality tests,
  • when and how it was transferred to retailer,
  • how the retailer packed it.

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.

Trace case image 2

Process

  • We chose ZeppelinOS, a platform for developing upgradeable smart contracts on Ethereum, as our initial technology.
  • We started work by creating two demos: first a demo of how ZeppelinOS works, second a simplified solution of how ZeppelinOS can be integrated into Trace’s smart contracts.
  • After benchmarking the operational cost for the implementation which used ZeppelinOS, we found that solution cost would be more expensive for the customer than they would like it to be.
  • After reviewing the original problem, which was the need to alter smart contract behavior, we came up with a custom solution. We presented it to the customer, and they agreed it would work better.
  • Having implemented the custom solution, our blockchain team switched to maintenance mode, while our backend specialists moved to the next Trace’s milestone, creating a web regulator for hemp farmers.
Trace case image 3

Feature challenges

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:

  • adding new smart contracts adds extra fees for the business process;
  • you have to follow some rules inherent to the inner design of the Ethereum Virtual Machine.

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:

  • Change the logic of creating contracts to create new lots with new versions of those contracts.
  • Guarantee backward compatibility of contracts, i.e. an older contract will never refer to a newer contract with an incompatible interface. The interaction between contracts within the system has a direction, meaning that newer contracts can interact with older contracts, but the older contracts never interact with newer contracts.

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.

Stack

Project Stack:

  • Developing Ethereum Smart-Contracts: Solidity, Truffle, Ganache, Nodejs/Web3js (for deploying)
  • Developing Backend: Nodejs, Express/Apollo, Mongo/Mongoose

Communication Stack:

  • Slack
  • Jira

Results

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.