Skip to content
Shawn Wilkinson edited this page May 1, 2014 · 18 revisions

For nodes and software to be able to work together we need some common framework. We do this my establishing meta template. A meta template meta information in a a JSON format. For example, this is some meta information used on the current prototype of Metadisk.

{
    "datetime": "1398875062",
    "filehash": "b17fee6427ee665eb54159762fe03847792af1d94bf6769b82f95b95e82975d2",
    "filename": "b17fee6_WhatisStorj.pdf",
    "filesize": 337748,
    "uploads": [
        {
            "host_name": "ge_tt",
            "url": "http://ge.tt/162T7Ef1/v/0"
        },
        {
            "host_name": "gfile_ru",
            "url": "http://gfile.ru/a4WfC"
        },
        {
            "host_name": "rghost",
            "url": "http://rghost.net/54761561"
        }
    ],
    "version": "0.2"
}

All nodes on the network can view this meta information. So if you asked a Storj node, like Metadisk, for the file with the hash b17fee6427ee665eb54159762fe03847792af1d94bf6769b82f95b95e82975d2 it would retrieve this information, then retrieve the specified file for you.

We can do this through the current API: http://node2.storj.io/api/download/b17fee6427ee665eb54159762fe03847792af1d94bf6769b82f95b95e82975d2

If the information was missing fields or in the incorrect format then the nodes would not be able to function correctly. We establish a meta contract so everyone can work from a standardized format.

{
  "name": "metadisk-template-a",
  "filehash": <string>,
  "filename": <string>,
  "filesize": <int>,
  "uploads": [
    {
      "host_name": <string>,
      "url": <string>
    },
    {
      "host_name": <string>,
      "url": <string>
    },
    {
      "error": <string>,
      "url": <string>
    }
  ]
}

We send this data as a transaction to a metachain, like Datacoin. The txid of this particular template is 063c8b9695127118db22b85d3d2b7ecd19d60e518a3426760b2a07bcd6ce1387.

Now we can sent transactions to the blockchain, and reference our template so that everyone can agree on the format. The new metadata that we send to the blockchain looks something like this:

{
    "name": "metadisk-template-a",
    "template": "063c8b9695127118db22b85d3d2b7ecd19d60e518a3426760b2a07bcd6ce1387",
    "filehash": "b17fee6427ee665eb54159762fe03847792af1d94bf6769b82f95b95e82975d2",
    "filename": "b17fee6_WhatisStorj.pdf",
    "filesize": 337748,
    "uploads": [
        {
            "host_name": "ge_tt",
            "url": "http://ge.tt/162T7Ef1/v/0"
        },
        {
            "host_name": "gfile_ru",
            "url": "http://gfile.ru/a4WfC"
        },
        {
            "host_name": "rghost",
            "url": "http://rghost.net/54761561"
        }
    ],
    "version": "0.2"
}

Note that we include the txid of the template in our metadata. Once the template has been placed in the blockchain it can't be changed. Therefore nodes and software can easily process data with the same template because they will know exactly what to expect.

Clone this wiki locally