A decentralized platform for peer-to-peer book lending and selling, built on blockchain technology for maximum security and transparency.
BiblioChain is a web application that leverages blockchain technology to create a decentralized library system. Users can:
- Add books to the platform as NFTs (rentable or sellable)
- Borrow books by providing a deposit
- Purchase books directly from other users
- Rate books they've interacted with
- Earn rewards by returning overdue books
The application offers transparency, security, and a trustless environment for book lovers to share and trade their collections.
- Prerequisites
- Installation
- Configuration
- Usage
- Project Structure
- Development Tools
- Documentation
- Key Features
- Screenshots
- Credits
- License
- Node.js: v23.7.0 or later
- npm: v11.2.0 or later
- A Pinata account for IPFS storage: https://pinata.cloud/
- MetaMask wallet or WalletConnect compatible wallet
- Sepolia testnet ETH for transactions
- Clone the repository
git clone https://gitlab-edu.supsi.ch/dti-isin/giuliano.gremlich/opzione-blockchain-engineering/24-25/progetti-studenti/galasso.git
cd galasso/frontend
- Install dependencies
npm install
- Create a
.env
file in the frontend directory with your Pinata API credentials:
VITE_PINATA_API_KEY=your_pinata_api_key
VITE_PINATA_SECRET_API_KEY=your_pinata_secret_key
- Start the development server
npm run dev
- (Optional) Run Storybook to view UI components
npm run storybook
Then navigate to http://localhost:6006 in your browser.
- Navigate to the blockchain directory
cd galasso/blockchain
- Install dependencies
npm install --legacy-peer-deps
- Create a
.env
file in the blockchain directory:
PRIVATE_KEY=your_wallet_private_key
INFURA_API_KEY=your_infura_project_id
- Compile the smart contracts
npx hardhat compile
- Run tests (optional)
npx hardhat test
- Deploy to Sepolia testnet
npx hardhat run scripts/deploy.ts --network sepolia
The application connects to the Sepolia testnet (Chain ID: 11155111). Make sure your wallet is configured to use the Sepolia network.
To interact with the application:
- Get Sepolia testnet ETH from a faucet
- Connect your wallet (MetaMask or WalletConnect)
- Connect your wallet to the application
- Browse available books in the catalog
- Add your own books to lend or sell
- Borrow or purchase books from other users
- Return borrowed books to get your deposit back
- Rate books you've interacted with
- Earn rewards by returning overdue books
-
frontend/
- React frontend applicationsrc/
- Source codecomponents/
- Reusable UI componentscontexts/
- React contexts for state managementhooks/
- Custom React hookspages/
- Application pagesservices/
- Service classes for API interactionstypes/
- TypeScript type definitionsroutes/
- Application routingi18n/
- Internationalization
.storybook/
- Storybook configurationpublic/
- Static assets
-
blockchain/
- Smart contracts and blockchain interactioncontracts/
- Solidity smart contractsscripts/
- Deployment and utility scriptstest/
- Automated tests
-
doc/
- Project documentationDiagrams/
- Visual diagrams of system processesDoc/
- Generated frontend documentationTestReport/
- Test coverage reports
-
Storybook: View and interact with UI components in isolation
npm run storybook # Access at http://localhost:6006
-
TypeScript: Static type checking for improved code quality
-
React 19: Latest version of React for building the UI
-
Vite: Fast development server and build tool
-
React Router: For application routing
-
Ethers.js: For blockchain interactions
-
i18next: Internationalization support
-
Three.js: For 3D book visuals
The project includes comprehensive documentation:
-
System Diagrams: Located in
doc/Diagrams/
- Book Creation Flow
- Proposal Creation Process
- Proposal Voting Process
- Class Diagrams
-
Code Documentation: Generated docs available in
doc/Doc/
- View by opening
doc/Doc/index.html
in a web browser
- View by opening
-
Test Reports: Coverage information in
doc/TestReport/
- View by opening
doc/TestReport/index.html
in a web browser
- View by opening
- Multi-step Book Creation: Add books with detailed metadata, cover images, and lending/selling terms
- Transparent Transactions: All lending and purchasing is handled through smart contracts
- Decentralized Storage: Book metadata and images stored on IPFS via Pinata
- Reward System: Earn ETH by returning overdue books
- Rating System: Rate books after interactions
- Admin Controls: Platform governance with multi-signature proposals
- Responsive Design: Works on desktop and mobile devices
The BiblioChain home page featuring the hero section
Browse all available books with filtering options
Detailed view of a book with lending/purchase options
Earn section to return overdue books
User profile showing owned and borrowed books
Admin controls for platform governance
This project was entirely developed by Martina Galasso (AAAAAMAZINGGG) as a university project.
???????