Adding tasks

The documentation states that a “specificationHash” must be added when a new task is bing added. What exactly is a specificationHash? And how are you supposed to know what specificationhash to enter? Grateful if you could please provide an example.

“When adding a task, the task must be assigned a specificationHash.”

// Add a task

await colonyClient.addTask.send({

specificationHash: ‘Qm…’,

1 Like

Just below that example in the docs there is a description for the specificationHash:

The task specification, also known as “task brief”, is a description or document that outlines the work required to be considered sufficient for a task payout. The specificationHash can be any arbitrary hash string (32 bytes) but the specificationHash was specially designed to support an IPFS content hash. See Using IPFS for more information about using an IPFS content hash.

The idea with the specificationHash is that you can customize what information you want to store as the specification. The Using IPFS link provides some more information:

A natural way to use the specificationHash and deliverableHash properties within a task is to point to a file hosted on IPFS. This leaves open the format for the task specification (the description of the work to be done) and the task deliverable (the work done) and provides the opportunity to use text files, PDFs, or other forms of media.

A simple example can be found here in the colony-example package, which creates an object with two properties (title and description) and then saves that object to IPFS (see here), and stores the IPFS hash as the specificationHash (see here).

Understood. But where it says “any hash string of 32 bytes”, does not that by default mean 32 characters? I just tried to host a file on IPFS and when i get the hash, it’s 46 characters. see below.

QmeaMAqAxn44yt7YEUGMvZ6Ey2y9v4GDGgomxgKApbPdNw

1 Like

Looks like we need to update the docs. I just checked colonyJS and we are strictly type checking for an IPFS string. In the current version, an IPFS string is the only accepted input. Thanks!

Right ok. So then let’s say I’m using Trello to record a list of all tasks that need to be done in my Colony. What’s the best way to convert a task in Trello to a IPFS string?

The simplest solution would be saving the url for the Trello card as a specification property:

const specification = {
    url: 'https://trello.com/c/xxxxxxxx/1-example-task',
}

Although, this would mean the specification could be updated in Trello without the approval of the manager and worker. If you wanted to prevent this, you could use the Trello card API to pull the card fields and then save those fields as the specification object.

See the example endpoint Trello provides. You could save this as your specification object or just the properties you see fit, which would mean the specification is locked in at the time of creation.