WineChain is a university project developed for the Data Security course at the University of Salerno. This project leverages blockchain technology (Ethereum) to ensure the transparency and security of wine production. Administrators can create wine batches and add detailed information to the blockchain, while users can scan a QR code on the wine bottle to access the stored blockchain data. π
- Blockchain Integration: Securely stores wine batch information on the Ethereum blockchain. π
- QR Code Verification: Allows users to scan the QR code on the wine bottle to retrieve blockchain data. π±
- Admin Management: Administrators can create and manage wine batches with detailed data. π©βπ»
- User Authentication: Implements secure authentication using Better-auth with an SQLite database. π
- Modern UI: Built with Nuxt, TailwindCSS, and NuxtUI v3 for a responsive and sleek user experience. π¨
- Nuxt: Server-side rendering framework for Vue.js.
- TailwindCSS: Utility-first CSS framework.
- NuxtUI v3: UI component library for Nuxt.
- Better-auth: Lightweight authentication library using SQLite.
- Hardhat: Ethereum development environment for compiling, deploying, and testing smart contracts.
-
Clone the Repository
git clone https://github.com/OrlS15/winechain.git
Clones the WineChain repository to your local machine.
-
Install Dependencies
pnpm install
Installs all required packages and dependencies for the project.
-
Compile Smart Contracts
pnpm run hardhat:compile
Compiles the Ethereum smart contracts using Hardhat.
-
Start the Local Blockchain
pnpm run hardhat:start
Starts a local Ethereum blockchain network. The terminal will display important configuration details required for later steps.
-
Deploy Smart Contracts
pnpm run hardhat:deploy
Deploys the compiled smart contracts to the local blockchain network.
-
Run Database Migrations
pnpm run db:migrate
Executes the database migration scripts to set up the necessary schema.
-
Seed Default User
pnpm run db:seed-user
Seeds the database with a default administrative user (email:
admin@winechain.com, password:admin123). -
Create and Configure the Environment Variables
- Create a
.envfile in the root directory of the project. - Insert the necessary values (these can be taken from the output of
pnpm run hardhat:start).
Example
.envfile:### BLOCKCHAIN ### NUXT_PUBLIC_BC_URL=http://127.0.0.1:8545 NUXT_PUBLIC_BC_CONTRACT_ADDRESS= NUXT_BC_PRIVATE_KEY=
- Create a
-
Start the Development Server
pnpm run dev
Launches the Nuxt development server, making the WineChain application accessible locally.
