Skip to content
Dan Bolser edited this page Jul 2, 2014 · 18 revisions

For nodes and other software modules to be able to work together we need them to use some common framework. We do this by establishing a Meta Template, which is typically in 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 from the blockchain by searching for the hash. It then uses the meta information to determine the location of the target file, and pass it along to the user.

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

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 Template so the software has a standardized format from which to work.

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

We send this data as a transaction to a metachain, like Datacoin. The first transaction to the genesis address must be the template. Generally transactions matching the template of first transaction will be sent to the genesis address listed in the template. If they don't fit the template, they will be ignored by the software.

Any applications running off a metachain does not have to store the full blockchain. They simply have to store block headers for the chain, and then watch the genesis address of their application for transactions that they can act upon.

Now we can sent transactions to the blockchain, and reference our template. The txid of this particular template in the Datacoin blockchain is c42bc134e94387caf9f685a01560aa020890233a80e6d2208a1cab2f72e190bb. The new metadata that we send to the blockchain looks something like this:

{
    "name": "metadisk-template-a",
    "template": "c42bc134e94387caf9f685a01560aa020890233a80e6d2208a1cab2f72e190bb",
    "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"
        }
    ]
}

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