Skip to content

Repository files navigation

To-Do List Blockchain

A simple Ethereum decentralized application (dApp) for managing to-do tasks using a Solidity smart contract, Truffle migrations, and a browser frontend connected through MetaMask.

Overview

This project demonstrates end-to-end dApp flow:

  • Smart contract stores tasks on-chain
  • Frontend reads and updates tasks via Web3
  • MetaMask signs transactions
  • Truffle handles compile, deploy, and testing

Tech Stack

  • Solidity 0.5.x
  • Truffle 5.0.2
  • Web3.js
  • @truffle/contract
  • Ganache (local blockchain)
  • MetaMask
  • Lite Server
  • Bootstrap + jQuery

Project Structure

To-Do-List-Blockchain/
	contracts/
		TodoList.sol
		Migrations.sol
	migrations/
		1_initial_migration.js
		2_deploy_contracts.js
	src/
		index.html
		app.js
		css/
		TodoList.json
	test/
		TodoList.test.js
	truffle-config.js
	bs-config.json
	package.json
	README.md

Smart Contract Features

Contract: TodoList.sol

  • Stores tasks in a mapping
  • Tracks taskCount
  • Creates tasks with createTask(string _content)
  • Toggles completion with toggleCompleted(uint _id)
  • Emits events:
    • TaskCreated(uint id, string content, bool completed)
    • TaskToggled(uint id, bool completed)

Default constructor task:

  • Check out Forbes.com

Prerequisites

  • Node.js and npm
  • Ganache running on 127.0.0.1:7545
  • MetaMask browser extension

Installation

npm install

Configure Local Blockchain

This project is configured for Ganache in truffle-config.js:

  • Host: 127.0.0.1
  • Port: 7545
  • Network ID: *

Start Ganache first, then continue.

Compile and Deploy Contract

truffle compile
truffle migrate --reset

After migration, make sure contract artifact is available to frontend in:

  • build/contracts/TodoList.json

Run Frontend

npm run dev

Then open:

  • http://localhost:3000

MetaMask Setup

  1. Connect MetaMask to local Ganache network.
  2. Import a Ganache account using its private key.
  3. Approve account access when the app requests connection.

The connected wallet address appears in the UI under Account.

Usage

  • Add a task from input field
  • Toggle task completion via checkbox
  • Transactions are written to blockchain and reflected in UI

Testing

Run Truffle tests:

truffle test

The test suite validates:

  • Contract deployment
  • Initial default task
  • Task creation
  • Task completion toggling

Notes

  • The npm test script in package.json contains a typo (sexit) and does not run contract tests.
  • Use truffle test directly for now.
  • Frontend expects TodoList.json artifact to be available when lite-server runs.

Author

Suprit Raj

About

Ethereum-based to-do list dApp with Solidity smart contract, Truffle deployment, and MetaMask-connected web interface for on-chain task management.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages