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.
- Features
- Tech Stack
- Prerequisites
- Installation
- Usage
- Project Structure
- Smart Contract Details
- Contributing
- License
- 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
- Smart Contract: Solidity 0.8.28
- Development Framework: Hardhat
- Testing: Chai, TypeScript
- Ethereum Interaction: Ethers.js v6
- Network: Sepolia Testnet
- 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/)
-
Clone the repository
git clone https://github.com/raushan728/Ethereum-todo-Dapp.git cd Ethereum-todo-Dapp -
Install dependencies
npm install -
Set up environment variables
cp .env.example .envEdit
.envand 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_prefixSecurity Note: Never commit your
.envfile or share your private key.
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
-
Ensure your
.envis configured with valid RPC URL and private key -
Deploy the smart contract
npx hardhat run scripts/deploy.ts --network sepolia -
Note the deployment address from the console output for future interactions
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
Functions:
createTask(string memory _content): Creates a new tasktoggleCompleted(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 createdtasks: Mapping of task IDs to Task structs
This is a learning project for blockchain development. Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.