Skip to content

Ethereum Todo DApp - A decentralized Todo List application built on Ethereum blockchain. Create, manage, and track tasks securely using Solidity smart contracts with Hardhat and TypeScript.

License

Notifications You must be signed in to change notification settings

raushan728/Ethereum-todo-Dapp

Repository files navigation

Ethereum Todo DApp

Solidity Hardhat TypeScript License: MIT

A decentralized Todo List application built on Ethereum blockchain using Solidity smart contracts. This project demonstrates the fundamentals of blockchain development, including contract deployment, testing, and interaction with Ethereum networks.

Table of Contents

Features

  • Create Tasks: Add new todo items to the blockchain
  • Toggle Completion: Mark tasks as completed or incomplete
  • Task Tracking: Automatic task ID assignment and counting
  • Comprehensive Testing: Unit tests with 100% coverage
  • Easy Deployment: Deploy to Ethereum testnets with one command
  • Secure: Built with audited Solidity patterns

Tech Stack

  • Smart Contract: Solidity 0.8.28
  • Development Framework: Hardhat
  • Testing: Chai, TypeScript
  • Ethereum Interaction: Ethers.js v6
  • Network: Sepolia Testnet

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn package manager
  • Git
  • A crypto wallet (MetaMask recommended)
  • Sepolia ETH for deployment (obtain from Sepolia Faucet: https://sepoliafaucet.com/)

Installation

  1. Clone the repository

    git clone https://github.com/raushan728/Ethereum-todo-Dapp.git
    cd Ethereum-todo-Dapp
    
  2. Install dependencies

    npm install
    
  3. Set up environment variables

    cp .env.example .env
    

    Edit .env and add your configuration:

    SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID
    SEPOLIA_PRIVATE_KEY=your_64_character_private_key_without_0x_prefix
    

    Security Note: Never commit your .env file or share your private key.

Usage

Running Tests

Execute the comprehensive test suite to verify contract functionality:

npx hardhat test

Expected output includes passing tests for:

  • Contract deployment with default task
  • Task creation functionality
  • Task completion toggling

Deploying to Sepolia

  1. Ensure your .env is configured with valid RPC URL and private key

  2. Deploy the smart contract

    npx hardhat run scripts/deploy.ts --network sepolia
    
  3. Note the deployment address from the console output for future interactions

Project Structure

Ethereum-todo-Dapp/
├── contracts/
│   └── TodoList.sol          # Main smart contract
├── scripts/
│   └── deploy.ts             # Deployment script
├── test/
│   └── TodoList.test.ts      # Unit tests
├── .env.example              # Environment template
├── hardhat.config.ts         # Hardhat configuration
├── package.json              # Dependencies and scripts
├── README.md                 # Project documentation
└── tsconfig.json             # TypeScript configuration

Smart Contract Details

TodoList Contract

Functions:

  • createTask(string memory _content): Creates a new task
  • toggleCompleted(uint _taskId): Toggles task completion status

Events:

  • TaskCreated(uint id, string content, bool completed)
  • TaskCompleted(uint id, bool completed)

State Variables:

  • taskCount: Total number of tasks created
  • tasks: Mapping of task IDs to Task structs

Contributing

This is a learning project for blockchain development. Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Ethereum Todo DApp - A decentralized Todo List application built on Ethereum blockchain. Create, manage, and track tasks securely using Solidity smart contracts with Hardhat and TypeScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published