This project is a decentralized application (dApp) built with the following technologies:
- Solidity: Smart contract development language for defining the logic behind the "Buy Me a Coffee" functionality.
- Hardhat: Development framework for building, testing, deploying, and debugging Ethereum smart contracts.
- Ethers.js: JavaScript library for interacting with the Ethereum blockchain from the frontend.
- Next.js: React framework for building a smooth and interactive frontend experience.
- Tailwind CSS: Utility-first CSS framework for building responsive and stylish user interfaces.
This dApp allows users to send cryptocurrency directly to the developer's wallet address as a token of appreciation for their work. The transaction is recorded on the Ethereum blockchain, ensuring transparency and immutability.
- Users can enter their name and a message to accompany their coffee purchase.
- The dApp displays a list of previous contributors with their names, messages, and timestamps.
- The smart contract safely holds the donated funds.
- Node.js (version 14 or later) and npm (or yarn) installed on your system.
- MetaMask wallet or a similar Ethereum wallet extension.
-
Clone the repository:
git clone https://github.com/mishraji874/BuyMeACoffee-dApp.git
-
Navigate to the project directory:
cd BuyMeACoffee-dApp
-
Install dependencies:
npm install
-
Create a
.env
file at the root of the project. -
Add your Ethereum wallet private address and endpoint RPC URL to the
.env
file:RPC_URL = your_endpoint_rpc_url PRIVATE_ADDRESS = your_wallet_private_address
-
Go to the
client
folder using the below command:cd client
-
Then, install all of the nextjs and tailwind dependencies:
npm i
-
Start the development environment:
npm run dev
-
Open http://localhost:3000 in your web browser to access the dApp.
If you want to build your dapp like this then you have to take the money on your account so you have to add your account and deploy the smart contract with your account in which you have to follow the below instructions:
-
First, create the
.env
file from the above given steps. -
Then, run the following command:
npx hardhat run scripts/deploy.js --network <YOUR_NETWORK_NAME>
-
After deploying the contract, copy the contract address and paste it into the
client/pages/index.js
and replace it with thecontractAddress
variable.
Note: Deploying the smart contract requires familiarity with Hardhat and a blockchain network (e.g., Ethereum Mainnet, Rinkeby Testnet).
- Configure Hardhat for your desired network.
- Compile and migrate the smart contract.
Disclaimer: Deploying to a mainnet requires real ETH for gas fees. Consider deploying to a testnet environment for development purposes.