Giter Site home page Giter Site logo

dubento / tracer Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 118.67 MB

Blockchain for Supply Chain Traceability and Governance (DAO)

License: Apache License 2.0

Solidity 34.55% TypeScript 62.21% JavaScript 3.11% CSS 0.13%
blockchain dao ethereum supplychain agri-food decentralized-autonomous-organization ipfs traceability

tracer's Introduction

Tracer

Blockchain for Supply Chain Traceability and Governance in the Agri-food Sector

Description:

Tracer provides a transparent, secure, and decentralized ledger of transactions recorded throughout the supply chain. It also incorporates an external file system to record large artifacts of product information, e.g. images, aiding consumers in making a more informed purchase decision. The reliability of our system makes for efficient product identification in the event of a food safety incident. Our proposal introduces a Decentralized Autonomous Organization (DAO) as the regulatory body of our system. This DAO allows for decentralized decision-making while maintaining regulatory oversight, setting it apart from other traceability systems. Moreover, the system offers user-friendly interfaces, including a consumer-oriented timeline design accessed via QR codes on product packaging.

Demo

Demo.mp4

Paper

Instructions:

Blockchain

  • Install: $npm i
  • Node: $npx hardhat node
  • Deploy: $npx hardhat run scripts/deploy.ts --network localhost

Frontend

  • Install: $npm i
  • ENV: $cp .env.example .env and fill necessary values
  • Server: $npm start dev

IPFS

  • Kubo (server): $(cd ipfs; docker-compose up -d)
  • Interact: $cp FILE ipfs/ipfs_staging; docker exec ipfs ipfs add /export/FILE

Report

Gas report

  • hardhat gas-reporter: run test npx hardhat test

Comparing DAO with Openzeppelin Governance Release v0.2-dev with DAO improvements and simplifications v0.3-dev

Deployment cost improvement of around 59%.
Not considering TraceabilityContractFactory contract for cost calculations (cost has increased but is unrelated with DAO).

Calculations on 28/07/2023 with: avg gas 15 gwei/gas and 1540 eur/eth:
(Considering only contracts from OpenZeppelin governance and their conterpart version made by us)
All values considerer deployment with compiler optimizations on (1000 runs).

- old deployment cost: 8,335,718 gas (192.55 euros).
- new deployment cost: 2,337,982 gas (54.01 euros)
- 71% difference

Method gas comparison:
50% decrease in execution costs when considering a typical governance workflow.

Resources

DAO:


Technologies

Blockchain

Hardhat as development framework, using extensions:

  • hardhat-ethers, for integration with ethersjs
  • hardhat-deploy, for deployment scripts
  • gas-reporter, for reports on gas cost (usage and deployment)

Smart contracts written in Solidity. Scripts and tests written in Typescript.

Developed for EVM compatible blockchains (Ethereum).

Frontend

Next.js as development framework, using:

  • React, library for building frontend
  • TailwindCSS, a CSS styling framework
  • Ethers, a library for interacting with Ethereum and Ethereum-like blockchains.
  • swr, a React library for remote data fetching and caching.
  • react-hot-toast, a toast notification library for React.

All files written with Typescript.

IPFS

  • For development, using a Docker container running Kubo (default IPFS implementation in Go)
  • For production or other, possible to use external pining services and gateways like pinata

Acknowledgments:

I'd like to thank @susmonteiro for her invaluable support, and especially for sharing some of her creativity and design insights with me.

tracer's People

Contributors

dubento avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

tracer's Issues

Feature: Frontend for supply chain

  • check smartcontract address is available in the network
  • notification system (react-hot-toast)
  • changes queue (had a waiting component at the end of page, let user still interact with page)
  • newBatch page needs to wait for batchID
  • provide input form for external data and upload said data to externalFS

DAO improvements

Mainly deployment gas reductions.
Moving from Openzeppelin contracts to custom version.

QRcode

  • Supporting GS1 Digital Link standard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.