Breaking down Decentralised Web Nodes

Photo by Sigmund on Unsplash

Breaking down Decentralised Web Nodes

A Decentralised Web Node (DWN) is a data storage and message relay mechanism that entities (individuals, organisations and abstract entities) can use to locate public or private permission-ed data related to a given DID.

Data types such as texts, images are JSONs are stored in DWNs as records.

DWN can be considered as a personal data store because you can:

  • Own your data

    Since you can decide where host your DWN and control it's access.

  • Back up your data

    By hosting multiple DWNs in different places while keep them in-sync such that of one goes down your data is not lost.

  • Send and Receive data

    Thanks to the DID we are able to implement messaging between DWNs.

DWNs Authorisation Mechanisms

There are two mechanisms to allow read,write or delete of data on DWN:

  • Permissions

    Allow someone access to read, write, or delete specific data records on your node.

  • Protocols

    They define data types and authorisation for a decentralised web app.

Data Models

The application layer makes sure that data types follow a certain structure which makes applications to work together easily.

Messaging Between DWNs

In communication between DWNs, messages are just JSON objects but Web5 helps to send such messages but also resolving the recipient's DID in order to locate the recipient's DWN. A message can install protocols, grant permissions, and read, write, update, query, or delete a record. For example a message can look like this;

{  // Request Object
  "messages": [  // Message Objects
    {
      "recordId": GENERATED_CID_STRING,
      "data": BASE64URL_STRING,
      "descriptor": {
        "method": INTERFACE_METHOD_STRING,
        "dataCid": DATA_CID_STRING,
        "dataFormat": DATA_FORMAT_STRING,
      },
      "processing": {
        "nonce": "4572616e48616d6d65724c61686176",
        "author": "did:example:alice",
        "recipient": "did:example:bob",
      }
    },
    {...}
  ]
}

For more info on DWNs and it's practices in code

Source