Introduction: The Blockchain Chore Chart

Picture of The Blockchain Chore Chart

This project is to create a working chore chart on the ethereum classic blockchain. I had an existing chore list that was used to pay out weekly for chores around the house.

This basic contract can be used for any two parties that have a semi-trusted relationship and party A needs party B to complete a task. Party B wants Party A to prove they have the money and will be able to receive it after the task is complete.

Items needed

  • Parity.io client set up for ethereum classic
  • Budget/parent account (creates tasks is the “owner”)
  • Parent (approvers) accounts (array)
  • Task to be completed for a price (Do the dishes)
  • Someone(child) to complete the task
  • Some ETC

For this project, chores are broken down into price levels: low, medium, high. This was done so that task of similar importance would be priced together. You should negotiate your own pricing while constructing the project. Prices can be changed whenever needed.

The smart contract is set up as a 'One contract per chore' model. Once a contract is initially deployed it can be completed and reset as needed.

For high priced tasks I assign the parent and fee but not the child because they will require supervision at this age. A different way to do this would be to make a different task for each child so they can each claim it when they like.

Example chores:

Low Cost

  • Take out the trash
  • walk dog
  • get the mail
  • water plants

Medium Cost

  • fold laundry
  • sweep a room
  • read to a parent
  • Dust table and counter

High Cost

  • 30 min of code/typing
  • A on report card
  • Skype or email a grand parent (max 1 per week)
  • Get a friend to use Bitcoin or ETC

Step 1: Create Accounts

Picture of Create Accounts

You will need one parent account that will be used to deploy and manage the chores and one account per child.

Add a new account by clicking "+ account" and following the prompts

You will need to fund all of the accounts created with a little ether to cover gas costs of transactions.

Step 2: Deploy a Contract

Picture of Deploy a Contract

Let's look at the functions we will need the contract to accomplish:

  • Know the parent
  • Know the child
  • Track if the task is completed
  • Allow the parent to approve
  • Store funds until the task is completed


Breaking this down further we come up with the following functions:

Setup()

  • Completed by: Parent
  • Inputs: parent address, child address, Task name
  • Outputs: none
  • About: This function sets the initial state of the task and assigns both a child and parent to it.

Deposit()

  • Completed by: Parent
  • Inputs: an amount of ETC
  • Outputs: none (consider adding a funded announcement in the future)
  • About: This allows the parent to fund the task

Approve()

  • Completed by: Parent and child
  • Inputs: none
  • Outputs: announcement event that task is complete or approved, payout if two approvals
  • About: This function is called once a child completes a task and again once the parent inspects it. After both have called this function the contract pays the child.

Abort()

  • Completed by: Parent and child
  • Inputs: none
  • Outputs: “Get real this task is not done”(parent) and “Just kidding”(child) announcement and resets approval
  • About: used to revoke approval

Refund()

  • Completed by: Parent and child
  • Inputs: none
  • Outputs: none (consider adding a “Task defunded” announcement in the future)
  • About: used to cancel the bounty on the task

Kill()


The code:

The latest version of the contract can be found at https://github.com/realcodywburns/ChoreMaster/blob...

The ABI

The latest version of the ABI can be found at: https://github.com/realcodywburns/ChoreMaster/blob...

The Bytecode

The latest version of the bytecode can be found at: https://github.com/realcodywburns/ChoreMaster/blob...

Option 1

Deploy with code:

  • Click contracts tab
  • "Develop"
  • Paste the contract code into the editor
  • Click "Deploy"

Option 2 ( the easy way)

Deploy with Bytecode:

  • Click the contract tab
  • "+ Deploy"
  • Name your chore
  • Paste the abi code
  • Paste the bytecode
  • Click "Next"

Congratulations you have created a chore!

Step 3: Set Up the Chore

Picture of Set Up the Chore

To set the chore up for the first time you will need to execute the setup function.

  • Select the chore you would like to set up
  • Click "execute" at the top right
  • Select the "Setup "function
  • Select the account that will be the "Parent"
  • Select the account that will be the "Child"
  • Post the transaction!

Step 4: Fund the Contract

Picture of Fund the Contract

Time to fund the contract:

  • Select "execute"
  • Select the "Deposit" function
  • Select the "Parent account"
  • Add the funds in the transaction field
  • Post the Transaction
  • Watch the event log to see when the task is funded

Step 5: Complete the Chore

Picture of Complete the Chore

Now that the task is funded it can be complete

Child actions

The child must complete the task in real life before submitting for approval

  • Select "execute"
  • Select "approve"
  • Select the "child account"
  • Post the transaction

Watch the event log to see when the chore is complete. If the task needs to be done multiple times, ie walking the dog every day, the child can record the 'approval' action to trigger the event and record that the task was completed.

Parent Actions

The parent can inspect the chore in real life and has two options: approve or abort

If the task was completed:

  • Select "execute"
  • Select "approve"
  • Select the "Parent account"
  • Post the transaction

The funds will automatically be released to the child

If the task was not completed:

  • Select "execute"
  • Select "abort"
  • Select the "Parent account"
  • Post the transaction

The child will get a message in the event log to try again and will not receive any funds

Don't forget to fund the chore again or kill it if you no longer need it.

Comments

Swansong (author)2017-05-02

I could really use something like this for my nephew!