TBD54566975 / developer.tbd.website

Source for the TBD Developer Website
https://developer.tbd.website
Apache License 2.0
53 stars 106 forks source link

Edit Protocols docs with more context on: ParentId and ContextId #651

Open bobbilee19 opened 1 year ago

bobbilee19 commented 1 year ago

Diane...

  1. contextId:

This is a tough one to express succinctly if it hasn't already been established that records within a protocol form a number of trees. Each contextId refers to one of those trees. When a new top-level "root" record is written, it starts a new tree. The contextId is recordId of the root record. All descendants of a given root record have the same contextId.

Personally, I would just assume the reader has some knowledge that dwn protocols form trees of records and that they learned this a previous page of documentation. If this isn't covered in our docs on protocols, we should update those.

  1. parentId: Also, I'm not sure how literal you mean to get with your example values. For recordIds, we're using CIDs, specifically CBOR + SHA256. I just used this test fixture to generate one randomly.
bobbilee19 commented 1 year ago

More context from Diane...

contextId is common across an entire tree. it’s determined by the root record of the tree

a child of the root will have parentId === root.recordId === contextId

so it happens for children of the root record

parentId, contextId, and recordId are all CIDs, so they always look similar