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