Developing a ToDo list dApp in Ethereum

Photo by Roman Synkevych on Unsplash
Centralized System
You should now see this
  1. Launched a local Blockchain on a localhost port
  2. Changed Metamask to work on our local Blockchain
  3. And imported our private accounts
contract Todo {
uint public count = 0;
struct Task {
uint id;
string content;
bool completed;
mapping(uint => Task) public tasks;
function createTask(string memory _content) public {
count = count + 1;
tasks[count] = Task(taskCount, _content, false);
emit TaskCreated(taskCount, _content, false);
event TaskCreated(
uint id,
string content,
bool completed
event TaskCompleted(
uint id,
bool completed
function checkTask(uint _id) public {
Task memory _task = tasks[_id];
_task.completed = !_task.completed;
tasks[_id] = _task;
emit TaskCompleted(_id, _task.completed);
Code for the Solidity Smart Contract
var Todo = artifacts.require(“./Todo.sol”);
module.exports = function(deployer)
{ deployer.deploy(Todo);};
truffle migrate
truffle console
todo = await Todo.deployed()
todo.createTask(“Give me 50 claps!”)
task = await todo.tasks(1)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhinav Srivastava

Abhinav Srivastava

Building: Ignite Tournaments / Former: DeFi Alliance, Persistence, Eth India Co