LogoLogo
  • 👋Introduction
    • Zion v2
  • 🏗️Zion Protocol Architecture
    • Overview
    • 🆔Decentralized Identifiers DIDs
      • DID Document
      • Service Endpoints
      • Sidetree
      • DID Universal Resource Identifier
        • Short Form URI
        • Long Form URi
      • DID Operations
        • Signing
        • Verification
      • Verifiable Credentials
    • ⚙️Decentralized Web Nodes
      • Messages
        • Basic Message
        • Signed Data
        • Authorization
        • Encrypted Data
      • DWN Requests
    • ⚡Bitcoin Lightning Network
      • Invoices
      • Payments(HTLC)
      • Taro
        • Non fungible Assets
        • Assets
        • Multi-Hop Taro Transfers
        • Asset Exchange
  • 📲Zion Social
    • Zion App
      • DID Account Creation
      • Social Profiles
      • Lightning Wallet
      • Creator Communities
      • Community Posts
    • Guide
  • 💫Web5 Interoperability
    • Why Web5?
    • Future Thoughts
    • FAQs
  • 📧Contact and Media
    • Contact Us
    • Social Media
Powered by GitBook
On this page
  • CollectionsWrite
  • CollectionsCommit
  • CollectionsDelete

Was this helpful?

  1. Zion Protocol Architecture
  2. Decentralized Web Nodes

DWN Requests

PreviousMessagesNextBitcoin Lightning Network

Last updated 2 years ago

Was this helpful?

In the Zion Aggregator, s feed messages that the user designates through the use of handlers. Data that meets certain conditions set by the user and aggregator is sent to the aggregator for indexing, and unlike traditional aggregators, permission for data can be revoked by owners at any time thus removing the aggregator's access to that data.

Currently Zion s have three types of requests. These requests are formatted as Messages. Currently, Zion DWNs utilize three types of Messages: CollectionsWrite, CollectionsCommit and CollectionsDelete.

CollectionsWrite

CollectionWrite requests are for posting a new item in a collection. The format for a CollectionsWrite request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "data": {
        "image": "...",
        "text": "Some stuff I ate for lunch",
        ... 
      }, // Base64URL String Representation of this object
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsWrite",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // the record ID you are creating
        "dataCid": "", //CID V1 of the data field
        "dataFormat": "application/json",
        "dateCreated": 123456789,
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}

CollectionsCommit

CollectionsCommit requests are for updating an existing item in a collection. This will effectively replace that item. The format for a CollectionsCommit request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "data": {
        "image": "...",
        "text": "Some stuff I ate for lunch, and a snack",
        ... 
      }, // Base64URL String Representation of this object
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsCommit",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // ID for the record looking to update
        "dataCid": "", //CID V1 of the data field
        "dataFormat": "application/json",
        "dateCreated": 123456789, // Should be the time of the original creation
        "datePublished": 123456789, // Should be now
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}

CollectionsDelete

CollectionsDelete requests are for removing an item of a collection. Once deleted an item will be unrecoverable. The format for a CollectionsDelete request is:

{  // Request Object
  "target": "did:zion:123",// Community DID
  "messages": [  // Message Objects
    {
      "descriptor": {
        "nonce": "9b9c7f1fcabfc471ee2682890b58a427ba2c8db59ddf3c2d5ad16ccc84bb3106",
        "method": "CollectionsDelete",
        "recordId": "b6464162-84af-4aab-aff5-f1f8438dfc1e", // the record for deletion
        "schema": "https://schema.org/SocialMediaPosting", // Can be a key for a hardcoded custom ZION schema
        "protocol": "zion.fyi/social-protocol/v1"
      },
        "attestation": {
        "protected": {
          "alg": "ES256K",
          "kid": "did:example:123#key-1"
        },
        "payload": "", // CID V1 of the descriptor,
        "signature": "" //JWS of (protected + payload)
      } // JWS Compact Object string
    },
  ]
}
🏗️
⚙️
DWN
DWN
DWN
Zion Aggregator Framework