CharityChain eliminates the trust problem in charitable giving. Every donation is recorded immutably on-chain β no intermediaries, no black boxes, full accountability.
Traditional charity platforms suffer from:
- Opacity β donors have no visibility into where their funds go
- Intermediaries β multiple parties handle funds before reaching beneficiaries
- Trust dependency β donors must trust the organization's internal processes
CharityChain replaces all of that with code you can verify.
| Feature | Description |
|---|---|
| π Trustless Donations | Smart contract enforces fund distribution rules β no human override |
| π On-Chain Transparency | Every donation, campaign creation, and withdrawal is publicly verifiable |
| ποΈ Campaign Management | Charity organizations can create and manage campaigns with defined goals |
| π MetaMask Integration | Seamless wallet connection for donors and campaign managers |
| β‘ Real-time Updates | UI reflects blockchain state live β no stale data |
| π Permissionless | Anyone with an Ethereum wallet can donate β no KYC, no gatekeeping |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js) β
β pages/ β components/ β styles/ β lib/ (Web3 hooks) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β ethers.js / web3.js
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MetaMask (Browser Wallet) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β JSON-RPC
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Ethereum Network (Testnet / Mainnet) β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CharityChain Smart Contract β β
β β β’ createCampaign() β’ donate() β β
β β β’ withdrawFunds() β’ getCampaigns() β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Solidity β smart contract logic
- Hardhat / Truffle β compile, test, deploy
- Ethereum β target blockchain
- Next.js β React framework with SSR/SSG
- ethers.js / web3.js β blockchain interaction layer
- MetaMask β wallet provider
- CSS Modules β component-scoped styling
- Netlify β frontend deployment
- IPFS / Alchemy / Infura β RPC node provider
- Node.js v16+
- Yarn
- MetaMask browser extension
- An Ethereum testnet account with test ETH (Sepolia faucet)
git clone https://github.com/ryzen-xp/Charity_Chain.git
cd Charity_Chain
yarn installcp .env.example .env.localEdit .env.local:
NEXT_PUBLIC_CONTRACT_ADDRESS=your_deployed_contract_address
NEXT_PUBLIC_CHAIN_ID=11155111 # Sepolia testnet
NEXT_PUBLIC_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEYcd smart-contract
yarn install
npx hardhat compile
npx hardhat run scripts/deploy.js --network sepoliaCopy the deployed contract address into your .env.local.
# Back in project root
yarn devOpen http://localhost:3000 β connect MetaMask and start donating.
Charity_Chain/
βββ components/ # Reusable React components
β βββ CampaignCard/ # Campaign display component
β βββ DonateModal/ # Donation flow UI
β βββ Navbar/ # Wallet connection + navigation
βββ pages/ # Next.js pages (routing)
β βββ index.js # Home β campaign listings
β βββ create.js # Create new campaign
β βββ campaign/[id].js # Individual campaign detail
βββ lib/ # Utilities & Web3 hooks
β βββ contract.js # Contract ABI + address config
β βββ web3.js # Wallet connection helpers
βββ smart-contract/ # Solidity contracts + deploy scripts
β βββ contracts/ # CharityChain.sol
β βββ scripts/ # Deployment scripts
β βββ test/ # Contract unit tests
βββ public/ # Static assets
βββ styles/ # Global & module CSS
The CharityChain contract is the heart of the platform. Key functions:
// Create a new charity campaign
function createCampaign(
string memory title,
string memory description,
uint256 target,
uint256 deadline,
address beneficiary
) external returns (uint256 campaignId);
// Donate ETH to a campaign
function donate(uint256 campaignId) external payable;
// Withdraw raised funds (only beneficiary, only if goal met or deadline passed)
function withdrawFunds(uint256 campaignId) external;
// Query all campaigns
function getCampaigns() external view returns (Campaign[] memory);All state changes emit events for off-chain indexing and UI reactivity.
- Access control β only campaign beneficiaries can withdraw funds
- Deadline enforcement β withdrawals blocked before the campaign deadline unless target is reached
- Reentrancy protection β fund transfers follow the checks-effects-interactions pattern
- No admin keys β no privileged owner address that can drain funds
- Multi-token donations (ERC-20 support)
- Campaign verification / KYC tier for trusted NGOs
- Donor NFT receipts as proof of contribution
- DAO-based governance for platform parameters
- Subgraph (The Graph) integration for faster data indexing
- Layer 2 deployment (Polygon / Arbitrum) for lower gas fees
Contributions are welcome! Please open an issue first to discuss what you'd like to change.
# Fork the repo, then:
git checkout -b feature/your-feature-name
git commit -m "feat: add your feature"
git push origin feature/your-feature-name
# Open a Pull RequestSandeep (@ryzen-xp)
Blockchain & Web3 developer with experience in Solidity, Rust, TypeScript, and Soroban/Stellar. Open to remote opportunities.
MIT Β© ryzen-xp