Nika Crowdfunding dApp
Nika CrowdFunding dapp for web3 developers and startups. Its smart contract allows users to create and donate to campaigns.
This is a decentralized crowdfunding platform built on Ethereum blockchain. The platform allows users to create and support crowdfunding campaigns.
Github Link: https://github.com/anajembaedwin/nika-crowdfunding-dapp
Production Link: https://nika-crowdfunding-dapp.vercel.app/
Edwin - Initial work
Github Link: https://github.com/anajembaedwin
Clone the repository
git clone https://github.com/anajembaedwin/nika-crowdfunding-dapp.git
cd into the Client Folder
cd nika-crowdfunding-dapp && cd client
Install the dependencies
npm install
Start the development server
npm run dev
Port to Run the Website
http://localhost:3000
or any other port available to view it in the browser.
-
No required input/output files.
-
Ensure you are using the
Goerli Test Network
on yourmetamask wallet
or any other wallet when connecting.
The smart contract was deployed at:
https://thirdweb.com/goerli/0xE6ac95DE3f96C6FCAFd1Ae8462A56ffB1A4B8A44/sources
With this address:
0xE6ac95DE3f96C6FCAFd1Ae8462A56ffB1A4B8A44
On the GOERLI TESTNET
.
build
: This script runs thedetect
command from the Thirdweb CLI to build the project.deploy
: This script runs thedeploy
command from the Thirdweb CLI to deploy the built contracts to the specified network.release
: This script runs therelease
command from the Thirdweb CLI to release the built contracts to the specified package registry.
Campaign
: This struct stores information about a campaign, including its owner, title, description, target amount, deadline, amount collected, image, an array of donators, and an array of donation amounts.
campaigns
: This mapping stores all the campaigns using their campaign ID as the key.
numberOfCampaigns
: This variable stores the number of campaigns that have been created.
createCampaign
: This function allows a user to create a new campaign with the given information: owner, title, description, target amount, deadline, and image. It returns the ID of the created campaign.
donateToCampaign
: This function allows a user to donate the value of msg.value to the specified campaign. It also updates the array of donators and the array of donation amounts for the campaign. If the donation is successful, it also increases the amountCollected for the campaign by the donated amount.
getDonators
: This function returns the arrays of donators and donation amounts for the specified campaign.
getCampaigns
: This function returns an array of all the campaigns.
payable
: This modifier indicates that the function can receive ether.
None.
hardhat
: This is a development environment for Ethereum smart contracts.@thirdweb-dev/contracts
: This is a package containing the contracts for the project.dotenv
: This is a zero-dependency package for loading environment variables from a .env file.
None.
This package.json file is used to manage the dependencies and scripts for a client project built with Thirdweb, React, and Vite.
dev
: This script runs the Vite development server.build
: This script builds the project for production with Vite.preview
: This script previews the built project.deploy
: This script builds the project and uploads the built files to Thirdweb.
@thirdweb-dev/react
: This is a package containing the React components for the project.@thirdweb-dev/sdk
: This is a package containing the SDK for interacting with the Thirdweb platform.ethers
: This is a library for interacting with Ethereum.react
: This is a JavaScript library for building user interfaces.react-dom
: This is a package that provides DOM-specific methods for React.react-router-dom
: This is a package that provides routing functionality for React applications.
@vitejs/plugin-react
: This is a Vite plugin for React.autoprefixer
: This is a tool that adds vendor prefixes to CSS.postcss
: This is a tool for transforming styles with JavaScript.tailwindcss
: This is a CSS framework.vite
: This is a web development build tool.
- Thirdweb (Web3 Framework)
- Hardhat (Smart Contract development environment)
- Vite (React Framework)
- Run
npx thirdweb@latest create --contract
to create a new contract project. - Install
dotenv
withnpm install dotenv
. - Get the private key from your MetaMask account.
- Find the endpoint for the network you want to use (e.g. Goerli). You can find the endpoint at https://www.ankr.com/rpc/eth/eth_goerli/.
- Add the following code to your
hardhat.config.js
file:
defaultNetwork: 'goerli',
networks: {
hardhat: {},
goerli: {
url: 'https://rpc.ankr.com/eth_goerli',
accounts: [0x${process.env.PRIVATE_KEY}]
}
},
- Run
npm run deploy
to deploy the contracts to the network.
- Run
npx thirdweb@latest create --app
to create a new client project. - Choose the app name with
./
. - Select EVM (or Solana as needed).
- Select Vite to replace using
create-react-app
for React. - Select JavaScript (or TypeScript as needed).
- Install
react-router-dom
withnpm install react-router-dom
. - Run
npm run dev
to check your build so far. - Delete the
src
folder. - Create a new
src
folder and anindex.js
file. - Create a new
App.js
file with a React function component using therafce
snippet (ES7). - Convert
index.js
tomain.jsx
andApp.js
toApp.jsx
. - Install Tailwind CSS with Vite by running
npm install -D tailwindcss postcss autoprefixer
. - Run
npx tailwindcss init -p
to create the configuration files for Tailwind CSS. - Add the following code to your
tailwind.config.cjs
file:
/** @type {import('tailwindcss').Config} /
module.exports = {
content: [
"./index.html",
"./src/**/.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
This project is licensed under Grandida License - see the LICENSE.md file for details.
Some parts of the code were adapted from Thirweb
DO NOT USE WITHOUT THE PERMISSION OF GRANDIDA