JokeDapp is a decentralized application where users can participate in joke contests by answering multiple-choice questions. To participate, users pay a fee in Ether, and if they answer correctly, they win rewards that can be claimed directly within the app. The platform allows for a fun, interactive experience, leveraging smart contracts deployed on the Ethereum blockchain. This project showcases my skills in full-stack blockchain development, including smart contract design, frontend integration, and the use of Next.js with Web3 tools like wagmi, viem, and React Query.
- Decentralized Joke Contests: Users answer joke questions and win rewards.
- Wallet Integration: Seamlessly connect your Ethereum wallet using MetaMask.
- Reward Claiming: Users can claim their rewards directly on the platform.
- Admin Controls: The owner can withdraw collected fees.
- Smart Contracts: Deployed on Ethereum's Sepolia testnet, ensuring trust and security.
- Real-time Updates: Dynamic updates on the number of participants, contest results, and more.
- Next.js (App Router)
- wagmi & viem for Web3 integration
- Tanstack React Query for data fetching and caching
- Solidity for writing smart contracts
- Foundry for testing and deployment
- Makefile and .env for streamlined environment management and build processes
To set up the project locally, follow these steps:
- Clone the repo:
git clone https://github.com/kilamaelie/jokes-dapp.git
cd jokes-dapp
- Install dependencies:xw
cd client
yarn dev
- Set up the environment:
- Create a .env.local file in the root directory and populate it with the following variables for client :
NEXT_PUBLIC_CONTRACT_ADDRESS=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # for example
- Create a .env file in the root directory and populate it with the following variables for contract:
RPC_URL_LOCAL=http://127.0.0.1:8545
SEPOLIA_RPC_URL=https//_____ # add yours
SEPOLIA_PRIVATE_KEY=
LOCAL_PRIVATE_KEY==
- Makefile for Build Automation:
- This project uses a Makefile to simplify various development tasks like compiling smart contracts, running tests, and more. You can use commands like:
make compile # Compile the smart contracts
make test # Run smart contract tests
make deploy-test # Deploy the contracts to the blockchain locally
make deploy-t # Deploy the contracts to the blockchain locally
make deploy-sepolia # Deploy the contracts to the blockchain remotely
- Run the app:
yarn dev
- Compile and deploy the contracts (if needed):
forge build
make deploy-sepolia
Frontend: Built with Next.js, wagmi, and viem to provide a smooth Web3 experience. Smart Contracts: Written in Solidity and deployed on the Ethereum Sepolia testnet. Data Fetching: React Query is used to efficiently fetch and cache contract data. Environment Variables: Managed through a .env file for secure configuration.
A Makefile has been provided to streamline common operations. Here are the available commands:
- make compile: Compiles the Solidity contracts using Foundry.
- make test: Runs the smart contract tests.
- make deploy-test: Deploys the smart contracts to the Sepolia testnet.
- make clean: Cleans the build artifacts.
coming soon
We welcome contributions from other developers! If you're interested in adding features, fixing bugs, or improving the overall experience, follow these steps:
Fork the repo.
- Create your feature branch (git checkout -b feature/AmazingFeature).
- Commit your changes (git commit -m 'Add some AmazingFeature').
- Push to the branch (git push origin feature/AmazingFeature).
- Open a pull request. Feel free to reach out if you have any questions or want to discuss new features!
This project is licensed under the MIT License, meaning you are free to use, modify, and distribute the code as you see fit. Any contributions made to this project will also be licensed under the same terms.
If you enjoyed working on this project or have ideas for improvements, feel free to connect with me: