How Blockchain Can Revolutionize Cannabis Traceability: Part 4 (This is the final one!)

Cannabis Traceability: Implementing Cantrak Seed-to-Sale and Blockchain Technology using Streamlit.

Shivek Sachdev
Coinmonks
Published in
5 min readApr 16, 2023

--

Welcome to the final part of our blog series on Cantrak and blockchain integration. In the previous parts, we discussed the benefits of blockchain technology for traceability, and how we implemented each algorithms to write data onto the blockchain. In case you missed it, here’s your chance to read it:

In this part, we will discuss the development of our prototype application using Streamlit and also give you a glimpse of how the application works.

Our prototype application is designed to provide an easy-to-use interface (UI) for users to verify data from the following 4 processes cultivation, harvesting, production, and sales of cannabis — which is fetched from Cantrak (Seed-to-Sale System), and then write that data onto the Polygon blockchain (using Testnet for prototyping).

The application has four sections, one for each process mentioned above, with a simple web form for users to verify data. Once the data is submitted, the application calls the API to write the data onto the blockchain. Time elapsed, number of succesful writes to the blockchain and approximate Gas Fee is also displayed on the screen.

The application also displays the status of the transaction, whether it was successful or not, along with a hash ID in case the transaction was written successfully onto the smart contract.

Example #1: Writing Cultivation (Grow) data onto the blockchain.

Upon a successful request to write the cultivation data onto the blockchain, we will be presented with a Hash ID along with the status message (in this case: Success!). Also — noticed that we have another API to fetch the estimated Gas Fee of ETH & MATIC (Polygon).

Now — to verify this, we can go to PolygonScan (Mumbai Testnet) and search using this transaction hash. Here’s the result.

Example #2: Writing Harvest data onto the blockchain.

By querying using the Transaction ID — you will be able to fetch data directly from the blockchain and display it on the web browser.

Example #3: Here’s a the UI of the Streamlit App for fetching data from the blockchain.

Once the data is written onto the blockchain, it can be retrieved using the transaction ID. Each transaction ID is unique and can be used to retrieve the data associated with that transaction. This makes it easy to trace the origin of the cannabis and ensures that it has been grown, harvested, produced, and sold in a transparent and traceable manner.

What is Streamlit and its Advantages?

Streamlit is a popular open-source Python library that enables developers to quickly build interactive web applications without needing to know HTML, CSS, or JavaScript. It is designed to streamline the application development process, making it easy to create and share data-driven apps with colleagues, customers, and other stakeholders.

You can find more details about Streamlit here: https://streamlit.io/

Benefits of Using Streamlit for the Project

Using Streamlit for our prototype application provided several benefits, including:

  • Speed: Streamlit’s fast development cycle allowed us to quickly iterate and refine the application based on feedback from users.
  • Simplicity: Streamlit’s simple API allowed us to focus on the functionality of the application without worrying about the complexities of web development.
  • Integration: Streamlit’s seamless integration with other Python libraries made it easy to incorporate data analysis and visualization into the application.

Benefits of Blockchain Integration for Cannabis Seed-to-Sale Data, how does it enhance traceability?

Integration of Cannabis data on the blockchain provides several benefits, including:

  • Traceability: The blockchain allows for a permanent and immutable record of the cannabis, making it easy to trace its origin and ensure that it has been grown, harvested, produced, and sold in a transparent and traceable manner.
  • Transparency: By displaying the data on the blockchain, all stakeholders can access the information and ensure that it meets the necessary standards for safety and quality.

In conclusion, the integration of Cantrak with blockchain technology and the development of the prototype using Streamlit has shown promising results for cannabis traceability.

By utilizing Cantrak’s comprehensive Seed-to-Sale Solution and the immutable ledger of the blockchain, stakeholders in the cannabis industry can ensure transparency and accountability throughout the supply chain.

The benefits of this technology are vast, from ensuring patient safety and providing accurate information to consumers to meeting regulatory compliance and improving business operations.

As the cannabis industry continues to grow, implementing Cantrak and blockchain technology will become increasingly crucial for success. As for future improvements, continued development of the user interface, and exploring the use of smart contracts and decentralized applications can enhance the functionality and accessibility of the system. Ultimately, the implementation of Cantrak and blockchain technology is a significant step towards creating a safer, more transparent, and trustworthy cannabis industry.

--

--

Shivek Sachdev
Coinmonks

Based in Bangkok, Thailand | Senior Consultant at Thai Informatic Systems