Crowdchain

Summary

CrowdChain is a decentralized crowdfunding platform built on the Ethereum blockchain. It allows users to create and contribute to various campaigns, with the option to set up milestones for the campaigns. Users can donate any of the supported ERC20 tokens, including Ether.

CrowdChain is a blockchain-based crowdfunding platform that enables transparent, secure, and decentralized fundraising campaigns. Built with smart contract technology, it provides an environment where creators can raise funds and donors can contribute.

Live: https://crowdchain-two.vercel.app/

Technical Architecture

Smart Contracts (Solidity)

The platform's core functionality is implemented through different smart contracts:

  • CampaignBase Contract: An abstract contract that serves as the foundation, handling campaign creation and core campaign management functionality.

  • CampaignDonation Contract: Extends CampaignBase to manage financial transactions, including:

    • Processing donations

    • Handling refund requests

    • Managing fund withdrawals

  • CampaignUpdates Contract: Built on top of CampaignDonation, enabling:

    • Campaign progress updates

    • Milestone tracking

    • Donor communications

  • Crowdfunding Contract: The main deployable contract that inherits all the functionality from its parent contracts.

The prices of supported ERC20 tokens are gotten through the ChainLink price feed aggregator.

All smart contracts are thoroughly tested using Foundry. ERC20 tokens and their prices are mocked locally.

Frontend (Next.js)

The user interface is built with Next.js, providing:

  • Responsive design with TailwindCSS

  • Wallet and blockchain integration with Wagmi, Viem, and ConnectKit

  • Easy donation process

  • Real-time campaign tracking

  • Campaign search through different categories

Backend (Express.js)

An Express.js server handles:

  • IPFS integration through Pinata for decentralized storage of campaign images

  • Results caching (with Redis) for improved performance, including:

    • Total campaigns created

    • Aggregate fundraising statistics

    • Campaign search results

    • Supported token listings

    • Total refunds processed

Key Features

  1. Decentralized Campaign Management

    • Create and manage fundraising campaigns

    • Set funding goals and deadlines

    • Track campaign progress

  2. Secure Financial Transactions

    • Transparent fund management

    • Automated refund mechanism

    • Secure withdrawal process

  3. Campaign Updates

    • Post progress updates

    • Maintain donor communication

  4. Performance Optimization

    • Cached results for frequent queries

    • Efficient IPFS image handling

    • Optimized smart contract interactions

What I Learned

By building this full-stack crowdfunding project, I learned about:

  • Working with ERC20 tokens

  • Protecting against reentrancy attack

  • Optimizing gas in solidity

  • Getting off-chain data, especially price feeds

  • Using blockchain events as a database

  • Communicate with blockchain on the client and server

Technical Stack

  • Blockchain: Ethereum

  • Smart Contracts: Solidity

  • Testing Framework: Foundry

  • Frontend: TypeScript, Next.js, TailwindCss, ConnectKit, Viem, Wagmi

  • Backend: Express.js, Reddis, MongoDB

  • Storage: IPFS (Pinata)

  • State Management: Zustand