From 4d82f98b3c6f9c45dd6ac429daeb814f269c7e8a Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Mon, 11 Nov 2024 12:00:47 +0000 Subject: [PATCH] separate tree encoding from storage --- buds/10.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/buds/10.md b/buds/10.md index 2257abe..e30be8b 100644 --- a/buds/10.md +++ b/buds/10.md @@ -16,13 +16,8 @@ Clients MUST create a merkle tree using the chunk hashes as the leaf nodes ### Merkle tree encoding -Clients MAY choose to store the merkle tree on nostr relays using the `2001` kind event +The merkle tree MUST be in the format of `[, , ]` and be encoded using [`CBOR`](https://cbor.io/) -The merkle tree MUST be in the format of `[, , ]` - -The merkle tree MUST be stored in the events `content` as a base64 encoded [`CBOR`](https://cbor.io/) object - -Clients MUST add an `x` tag with the merkle root to the `2001` event Example: @@ -48,30 +43,34 @@ graph TD ``` [Unit8(ABCDEFG), [Unit8(ABCD), - [Unit(AB), - Unit(A), - Unit(B) + [Unit8(AB), + Unit8(A), + Unit8(B) ], - [Unit(CD), - Unit(C), - Unit(D) + [Unit8(CD), + Unit8(C), + Unit8(D) ] ], - [Unit(EFG), - [Unit(EF), - Unit(E), - Unit(F) + [Unit8(EFG), + [Unit8(EF), + Unit8(E), + Unit8(F) ], - [Unit(G), - Unit(G) + [Unit8(G), + Unit8(G) ] ] ]; ``` -### Metadata +### Merkle tree storage -Clients MAY include additional metadata tags in the `2001` event to help other clients know the filename or mime type +Clients MAY choose to store the merkle tree on nostr relays using the `2001` kind event + +The event MUST include an `x` tag with the merkle root to the `2001` event + +The event MAY include additional metadata tags to help other clients know the filename, mime type or servers to download from Metadata tags: - `name` Filename