This project is a full-stack decentralized application (dApp) that demonstrates a complete end-to-end Web3 development workflow. It functions as a simple, on-chain guestbook where users can connect their Ethereum wallet and write a message that is permanently and transparently stored on the Sepolia testnet blockchain.
This repository serves as a portfolio piece showcasing the integration of a smart contract backend with a modern React frontend.
- Wallet Connectivity: Connects to user's MetaMask wallet.
- On-Chain Data Reading: Fetches and displays the current message from the smart contract.
- On-Chain Data Writing: Allows users to submit a new message via a blockchain transaction.
- Real-time Transaction Feedback: Provides UI updates for pending, successful, and failed transactions.
- Solidity: For writing the smart contract logic.
- Hardhat: For the development environment, testing, and deployment scripts.
- Alchemy: For the RPC node connection to the Sepolia network.
- React.js (Vite): For building the interactive user interface.
- Ethers.js: For connecting the frontend to the user's wallet and the smart contract.
- Tailwind CSS: For utility-first styling.
- Vercel: For deployment and hosting.
To run this project locally, you will need to run the backend (Hardhat node) and the frontend (Vite server) in separate terminals.
- Node.js (v18 or later recommended)
- An Ethereum wallet browser extension like MetaMask
-
Clone the Repository
git clone [https://github.com/Omega4T/BlockChainMessage.git](https://github.com/Omega4T/BlockChainMessage.git) cd BlockChainMessage -
Set Up the Backend (Smart Contract)
# Navigate to the smart contract directory cd smart-contract # Install dependencies npm install
Create a
.envfile in this directory and add your Sepolia RPC URL and Private Key. This is needed for public testnet deployment.SEPOLIA_URL="YOUR_RPC_URL" PRIVATE_KEY="YOUR_WALLET_PRIVATE_KEY"
-
Set Up the Frontend
# Navigate to the frontend directory from the root cd frontend # Install dependencies npm install
Create a
.envfile in thisfrontenddirectory for the contract address.VITE_CONTRACT_ADDRESS=YOUR_DEPLOYED_CONTRACT_ADDRESS
-
Run the Application Locally
- Terminal 1 (Run Blockchain):
cd smart-contract npx hardhat node - Terminal 2 (Deploy Contract Locally):
(Copy the deployed address and paste it into the frontend's
cd smart-contract npx hardhat run scripts/deploy.js --network localhost.envfile) - Terminal 3 (Run Frontend):
cd frontend npm run dev
- Terminal 1 (Run Blockchain):
The smart contract is publicly deployed on the Sepolia Testnet.
