官术网_书友最值得收藏!

Let's build a to-do list

Productivity is a virtue that resonates a lot with software engineers and developers alike. In the book Algorithms to Live By, Brian Christian states that:

"When the future is foggy, it turns out you don't need a calendar—just a to-do list."

Many of us have come to know that a to-do list helps to organize chaos.

So, let's create a to-do list, except with a little twist. This will be a to-do list on the blockchain, where you get others to do your work for you. Of course, you have to pay them with a token, call it TodoCoin, for their work.

You will create this app as the owner of the contract, and the inpiduals performing your tasks will be referred to as doers.

As an owner, you must be able to:

  • Create a task with a title, description, and TodoCoin reward amount 
  • Accept a completed task
  • Reject a completed task
  • Reward a doer for successful review of a completed task

As a doer, you must be able to:

  1. Start a task
  2. Finish a task
  3. Withdraw owed rewards for successful reviews of completed tasks

If this seems like a handful, worry not. You will not build all specifications of this Dapp in this chapter. For this chapter, as promised, you will build a simplified version of this Dapp. Later, see if you can slowly start building the other specifications on your own.

For this chapter, you will simply do the following:

  • Allow an owner to create the contract
  • Allow an owner to transfer a TodoCoin reward to a specified address

That's it. You will assume three things:

  • The task has been successfully completed and reviewed off-chain
  • The recipient of the reward is a valid doer
  • The reward amount is the correct amount for the task

Also, a decentralized application is not complete without a decent user interface. So, you will build a simple interface that allows the owner of a contract to enter a TodoCoin reward amount and transfer it to an address of their choice.

The final version will look like this:

What frameworks will we be using?

The only framework you will use for this chapter is Truffle, actually. This way, you can focus purely on the Truffle elements of this mini Dapp without getting muddled in implementation details of other frameworks. But don't worry, in later chapters, you will learn how to integrate Truffle with Angular, React, and Node. 

主站蜘蛛池模板: 泾阳县| 囊谦县| 波密县| 元阳县| 嵊泗县| 嘉鱼县| 新民市| 抚远县| 清丰县| 沂南县| 山东省| 罗定市| 藁城市| 香港 | 阜宁县| 安徽省| 凤城市| 丰原市| 东兴市| 深圳市| 大余县| 突泉县| 密云县| 广西| 珠海市| 镇远县| 宣化县| 云南省| 包头市| 柞水县| 突泉县| 凤阳县| 郑州市| 黄陵县| 会宁县| 金平| 调兵山市| 灌云县| 饶河县| 虎林市| 新竹市|