A decentralized crowdfunding platform built using Next.js, React, Hardhat, and Tailwind CSS.
- Introduction
- Features
- Installation
- Usage
- Deployment
- Project Structure
- Smart Contract Details
- Testing
- Contributing
- License
Pledge Pulse is a decentralized application (dApp) that allows users to create and participate in crowdfunding campaigns using the Ethereum blockchain.
- Create and manage crowdfunding campaigns.
- Donate to campaigns.
- View campaign details and donation history.
-
Clone the repository:
git clone https://github.com/yourusername/pledge-pulse.git cd pledge-pulse
-
Install dependencies:
npm install
-
Install Hardhat dependencies:
npx hardhat
-
Install Tailwind CSS:
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p
-
Run the Next.js development server:
npm run dev
-
Start the Hardhat local blockchain:
npx hardhat node
-
Deploy the smart contract to the local blockchain:
npx hardhat run --network localhost scripts/deploy.js
To deploy the smart contract to a live network, update the Hardhat configuration with the network details and run the deployment script:
npx hardhat run --network <network-name> scripts/deploy.js
pledge-pulse/
├── contracts/
│ └── Crowdfunding.sol # Solidity contract
├── pages/
│ ├── index.js # Main landing page
│ └── ... # Other Next.js pages
├── public/ # Public assets
├── scripts/
│ └── deploy.js # Deployment script
├── styles/
│ └── globals.css # Global CSS file
├── tailwind.config.js # Tailwind CSS configuration
├── hardhat.config.js # Hardhat configuration
├── package.json # Project metadata and dependencies
└── README.md # Project documentation
The Crowdfunding smart contract allows users to create and participate in crowdfunding campaigns.
createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline)
: Creates a new campaign.donateToCampaign(uint256 _id)
: Allows users to donate to a campaign.getDonators(uint256 _id)
: Returns the list of donators and their donations for a campaign.getCampaigns()
: Returns the list of all campaigns.
scripts/deploy.js
This script deploys the Crowdfunding contract to the specified network.
const hre = require("hardhat");
async function main() {
const CrowdFunding = await hre.ethers.getContractFactory("CrowdFunding");
const crowdFunding = await CrowdFunding.deploy();
await crowdFunding.deployed();
console.log(`CrowdFunding deployed to ${crowdFunding.address}`);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
The test file for a sample lock contract to ensure proper deployment and functionality.
To run the tests, use the following command:
npx hardhat test
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License.