Developing a ToDo list dApp in Ethereum

Photo by Roman Synkevych on Unsplash
Centralized System
You should now see this
  1. Installed and launched Ganache
  2. Launched a local Blockchain on a localhost port
  3. Changed Metamask to work on our local Blockchain
  4. 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)
task.checkTask(1)

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Yam Finance presents “DAO House”

What is Elastos (A simple Summary)

Blockchain use-case for the real stock market — a blockchain-based OTC ATS decentralized…

Five Promising Applications for Blockchain Technology in Healthcare

Bamboo Joins UN Assembly to Discuss Healthcare on Blockchain

In this Bounty0x spotlight article I will be providing a Market Analysis and project report for…

A New Approach To High Availability: Validator Pairs

XY Finance Integrates and Supports Fantom Network

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

More from Medium

Taming Impulsive Shopping Urges

Life/Life balance with Hannah Kreiswirth

Daily links of Fernand0 — Enlaces diarios de Fernand0 — Issue #433

The Vivid Trio of Metaverse, Crypto and Qoomed      “Dopamine release in the mesolimbic pathway…