From da8cacd5640d777450af2bf6daf200ae4f117664 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Mon, 29 Jul 2024 15:04:31 +0800 Subject: [PATCH 1/3] Add decentralize doc Signed-off-by: Quanyi Ma --- docs/decentralize.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/decentralize.md diff --git a/docs/decentralize.md b/docs/decentralize.md new file mode 100644 index 00000000..a534ab97 --- /dev/null +++ b/docs/decentralize.md @@ -0,0 +1,21 @@ +# Decentralize Open Source Collaboration + +## Decentralize Collaboration Event + +```json +{ + "kind": 111, + "id": <32-bytes lowercase hex-encoded sha256 of the serialized event data>, + "peer": <32-bytes lowercase hex-encoded public key of the event creator>, + "timestamp": , + "tags": [ + + ], + "content": , + "sig": < 64-byte lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> +} + + +``` + +## Customization of the Git Peer-to-Peer Transfer Protocol \ No newline at end of file From a72d791e9b4045795a6fa87709dfcf60fed4237a Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Mon, 29 Jul 2024 17:49:04 +0800 Subject: [PATCH 2/3] Update the decentralize.md Signed-off-by: Eli Ma --- docs/decentralize.md | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/docs/decentralize.md b/docs/decentralize.md index a534ab97..26de6917 100644 --- a/docs/decentralize.md +++ b/docs/decentralize.md @@ -2,20 +2,65 @@ ## Decentralize Collaboration Event -```json +```bash { "kind": 111, "id": <32-bytes lowercase hex-encoded sha256 of the serialized event data>, - "peer": <32-bytes lowercase hex-encoded public key of the event creator>, - "timestamp": , + "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>, + "created_at": , "tags": [ - + ["uri", /.git>], + ["action", , ], + ["commit", ], + ["ref", ], + ["title", ], + ["content", ], + ["sig", <64-byte lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the id field>] ], "content": , - "sig": < 64-byte lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field> + "sig": < 64-byte lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the id field> } +``` + +### Customization of the git P2P transfer protocol + +The original Git protocol syntax is + +```bash +[://][:]@[:]//[.git] +``` + +For a P2P Git protocol + +- could be a prefix like p2p:// to indicate the P2P protocol +- and is unnecessary for P2P protocol. In implementation. We reference the Git SSH protocol interaction commands and use the peer ID for authentication +- The usually represents the server, but in P2P, it maps to the peer ID hosting the repo. We use here to avoid confusion +- The will not be relevant for p2p networking +- The mega uses mono repo, so there are no or names, only . We could design a virtual path scheme to map directories to exposed public paths privately + +The Git version control system uses two major transfer protocols: "dumb" and "smart." The dumb protocol is simple but inefficient, requiring a series of HTTP GET requests. It is rarely used today due to its limitations in security and efficiency. On the other hand, the smart protocol is more common and efficient, as it allows for intelligent data transfer between the client and server. + +Inspired by Git's approach to having multiple transfer protocols, we add a type segment in the custom P2P Git transport protocol. This segment allows us to specify the format of the files being transferred between peers, similar to how Git's protocols specify the nature of the data transfer. Currently, the type segment supports two formats: pack and object. + +- `pack`: Indicates that the file being transferred is in Git's Pack format, efficiently transferring multiple Git objects. +- `object`: Indicates that the file being transferred is in Git's Object format, suitable for transferring individual Git objects like blobs, trees, commits, or tags. + +Finally, the P2P protocol URI looks like + +```bash +p2p://// +``` + +Example + +```bash +p2p://12D3KooWFgpUQa9WnTztcvs5LLMJmwsMoGZcrTHdt9LKYKpM4MiK/pack/mega.git +``` +or +```bash +p2p://12D3KooWFgpUQa9WnTztcvs5LLMJmwsMoGZcrTHdt9LKYKpM4MiK/object/be044281f9604305e1b41b0e800e844c2a417e52 ``` ## Customization of the Git Peer-to-Peer Transfer Protocol \ No newline at end of file From e2d2256984592b10f8ce166c811ddc1849b340e9 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Mon, 29 Jul 2024 20:56:11 +0800 Subject: [PATCH 3/3] update decentralize Signed-off-by: Quanyi Ma --- docs/decentralize.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/decentralize.md b/docs/decentralize.md index 26de6917..02566abb 100644 --- a/docs/decentralize.md +++ b/docs/decentralize.md @@ -10,11 +10,13 @@ "created_at": , "tags": [ ["uri", /.git>], - ["action", , ], - ["commit", ], - ["ref", ], - ["title", ], - ["content", ], + ["action", , ], + ["ref", ], + ["commit", ], + ["issue", ], + ["mr", ], + ["title", ], + ["content", ], ["sig", <64-byte lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the id field>] ], "content": ,