Skip to content

RudraBhaskar9439/BlockChain_Drive

Repository files navigation

ChainDrive: Blockchain Drive & Image Sharing DApp

ChainDrive is a decentralized application (DApp) that lets users upload images to IPFS and securely share access to those images with other Ethereum wallet addresses. It uses a smart contract for access control and Pinata for IPFS storage. Users can upload, view, and share images in a trustless, blockchain-powered way. Screenshot 2025-06-22 at 5 20 04 PM Screenshot 2025-06-22 at 5 22 11 PM

Features

Upload Images: Upload images to IPFS via Pinata. Blockchain Access Control: Only allowed wallet addresses can view shared images. Share Images: Grant or revoke access to your images for any Ethereum address. Modern UI: Built with React and ethers.js.

Getting Started

Prerequisites

Node.js (v16+ recommended) MetaMask browser extension Git Pinata account (for your own API keys)

  1. Clone the Repository
git clone https://github.com/yourusername/BlockChain_Drive.git
cd BlockChain_Drive
  1. Install Dependencies Root (for Hardhat & contracts):
npm install

Client (React app):

cd client
npm install
  1. Configure Pinata API Keys

Replace the Pinata API keys in FileUpload.js with your own. (Optional) Use environment variables for better security.

  1. Configure Pinata API Keys Replace the Pinata API keys in FileUpload.js with your own. (Optional) Use environment variables for better security.
npx hardhat node

This starts a local Ethereum blockchain at http://127.0.0.1:8545.

  1. Deploy the Smart Contract Open a new terminal in the project root:
npx hardhat run --network localhost scripts/deploy.js

Copy the deployed contract address from the terminal output. Update the contract address in App.js (look for contractAddress).

  1. Start the React Client In the client folder:

start

npm start

The app will open at http://localhost:3000.

  1. Connect MetaMask In MetaMask, connect to the Localhost 8545 network. Import one of the accounts from the Hardhat node (use the private key shown in the Hardhat terminal).

Usage Upload: Select and upload an image (requires MetaMask connection). Share: Click "Share", enter another wallet address, and grant access. View: Enter your own or another address to view shared images.

Project Structure

BlockChain_Drive/
├── contracts/         # Solidity smart contracts
├── scripts/           # Deployment scripts
├── client/            # React frontend
│   └── src/components # React components
├── hardhat.config.js  # Hardhat config
└── ...

Notes For production, never commit your Pinata API keys or use them directly in frontend code. This project is for educational/demo purposes.

License MIT

Enjoy using ChainDrive! 🚀

About

ChainDrive is a decentralized application (DApp) that lets users upload images to IPFS and securely share access to those images with other Ethereum wallet addresses. It uses a smart contract for access control and Pinata for IPFS storage. Users can upload, view, and share images in a trustless, blockchain-powered way.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors