Crowdfunding
A crowdfunding platform on blockchain
Install / Use
/learn @hassan4702/CrowdfundingREADME
Block Fund
Block Fund is a decentralized crowdfunding platform built on the blockchain, leveraging the power of React for the frontend. This platform allows users to create and contribute to crowdfunding campaigns securely and transparently.
Table of Contents
- Introduction
- Features
- Technologies Used
- Installation
- Usage
- Project Structure
- Smart Contract
- Contributing
- License
Introduction
Block Fund is designed to provide a secure, transparent, and efficient way to raise funds for various projects. By leveraging blockchain technology, it ensures that all transactions are immutable and transparent, providing trust to both project creators and contributors.
Features
- Decentralized: Operates on a blockchain network, ensuring security and transparency.
- Smart Contracts: Utilizes smart contracts to handle campaign creation and contributions.
- User Authentication: Secure user authentication via blockchain wallets.
- Responsive Design: Fully responsive design, compatible with various devices.
- Real-time Updates: Real-time updates on campaign status and contributions.
Technologies Used
- React: Frontend framework.
- Ethereum: Blockchain platform for smart contracts.
- Solidity: Programming language for writing smart contracts.
- Web3.js: JavaScript library for interacting with the Ethereum blockchain.
- MetaMask: Browser extension for Ethereum wallet management.
Installation
To get started with Block Fund, follow these steps:
-
Clone the repository:
git clone https://github.com/hassan4702/block-fund.git cd block-fund -
Install dependencies:
npm install -
Run the development server:
npm startThe application will be available at
http://localhost:3000.
Usage
- Connecting Wallet: Users need to connect their Ethereum wallet (e.g., MetaMask) to interact with the platform.
- Creating a Campaign: Users can create new crowdfunding campaigns by specifying the goal amount and deadline.
- Contributing to a Campaign: Users can contribute to existing campaigns using their Ethereum wallet.
- Viewing Campaigns: Users can view the list of all campaigns and their details, including the amount raised and time remaining.
Project Structure
block-fund/
├── public/
│ ├── index.html
│ └── ...
├── src/
│ ├── components/
│ │ ├── CampaignCard.js
│ │ ├── CreateCampaign.js
│ │ ├── Navbar.js
│ │ └── ...
│ ├── contracts/
│ │ ├── BlockFund.sol
│ │ └── ...
│ ├── contexts/
│ │ ├── Web3Context.js
│ │ └── ...
│ ├── pages/
│ │ ├── Home.js
│ │ ├── Campaign.js
│ │ └── ...
│ ├── App.js
│ ├── index.js
│ └── ...
├── package.json
└── README.md
Smart Contract
The smart contract is written in Solidity and is located in the src/contracts/BlockFund.sol file. It handles the core functionality of the platform, including:
- Campaign creation
- Contribution management
- Fund withdrawal by campaign creators
Example Contract
pragma solidity ^0.8.0;
contract BlockFund {
struct Campaign {
address payable creator;
uint goal;
uint raisedAmount;
uint deadline;
bool completed;
}
mapping(uint => Campaign) public campaigns;
uint public campaignCount;
function createCampaign(uint _goal, uint _duration) public {
campaignCount++;
campaigns[campaignCount] = Campaign(
payable(msg.sender),
_goal,
0,
block.timestamp + _duration,
false
);
}
function contribute(uint _campaignId) public payable {
Campaign storage campaign = campaigns[_campaignId];
require(block.timestamp < campaign.deadline, "Campaign ended");
require(!campaign.completed, "Campaign completed");
campaign.raisedAmount += msg.value;
if (campaign.raisedAmount >= campaign.goal) {
campaign.completed = true;
}
}
function withdrawFunds(uint _campaignId) public {
Campaign storage campaign = campaigns[_campaignId];
require(msg.sender == campaign.creator, "Not campaign creator");
require(block.timestamp > campaign.deadline, "Campaign not ended");
campaign.creator.transfer(campaign.raisedAmount);
}
}
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature. - Make your changes and commit them:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature. - Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Related Skills
bluebubbles
348.5kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
node-connect
348.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
slack
348.5kUse when you need to control Slack from OpenClaw via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
frontend-design
109.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
