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.

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.
Node.js (v16+ recommended) MetaMask browser extension Git Pinata account (for your own API keys)
- Clone the Repository
git clone https://github.com/yourusername/BlockChain_Drive.git
cd BlockChain_Drive- Install Dependencies Root (for Hardhat & contracts):
npm installClient (React app):
cd client
npm install- Configure Pinata API Keys
Replace the Pinata API keys in FileUpload.js with your own. (Optional) Use environment variables for better security.
- Configure Pinata API Keys Replace the Pinata API keys in FileUpload.js with your own. (Optional) Use environment variables for better security.
npx hardhat nodeThis starts a local Ethereum blockchain at http://127.0.0.1:8545.
- Deploy the Smart Contract Open a new terminal in the project root:
npx hardhat run --network localhost scripts/deploy.jsCopy the deployed contract address from the terminal output. Update the contract address in App.js (look for contractAddress).
- Start the React Client In the client folder:
start
npm startThe app will open at http://localhost:3000.
- 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! 🚀