Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Commit 7313610

Browse files
committed
feat(graphsync): include legacy protocol
1 parent ffc2f86 commit 7313610

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

block-layer/graphsync/graphsync.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ type GraphSyncNet interface {
5959

6060
## Network Messages
6161

62+
### Protocol Version 1.1.0
63+
6264
Graphsync network messages are encoded in DAG-CBOR. They have the following schema
6365

6466
```ipldsch
@@ -128,10 +130,10 @@ type GraphSyncRequest struct {
128130
}
129131
130132
type GraphSyncResponse struct {
131-
ID GraphSyncRequestID # the request id we are responding to
132-
Status GraphSyncResponseStatusCode # a status code.
133-
Metadata GraphSyncMetadata # metadata about response
134-
Extensions GraphSyncExtensions # side channel information
133+
ID GraphSyncRequestID # the request id we are responding to
134+
Status GraphSyncResponseStatusCode # a status code.
135+
Metadata GraphSyncMetadata # metadata about response
136+
Extensions GraphSyncExtensions # side channel information
135137
}
136138
137139
type GraphSyncBlock struct {
@@ -146,6 +148,41 @@ type GraphSyncMessage struct {
146148
}
147149
```
148150

151+
### Legacy Protocol Version 1.0.0
152+
153+
An earlier version of graphsync encoded messages using protobufs
154+
155+
```protobuf
156+
message GraphsyncMessage {
157+
158+
message Request {
159+
int32 id = 1; // unique id set on the requester side
160+
bytes root = 2; // a CID for the root node in the query
161+
bytes selector = 3; // ipld selector to retrieve
162+
map<string, bytes> extensions = 4; // side channel information
163+
int32 priority = 5; // the priority (normalized). default to 1
164+
bool cancel = 6; // whether this cancels a request
165+
bool update = 7; // whether this is an update to an in progress request
166+
}
167+
168+
message Response {
169+
int32 id = 1; // the request id
170+
int32 status = 2; // a status code.
171+
map<string, bytes> extensions = 3; // side channel information
172+
}
173+
174+
message Block {
175+
bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)
176+
bytes data = 2;
177+
}
178+
179+
// the actual data included in this message
180+
bool completeRequestList = 1; // This request list includes *all* requests, replacing outstanding requests.
181+
repeated Request requests = 2; // The list of requests.
182+
repeated Response responses = 3; // The list of responses.
183+
repeated Block data = 4; // Blocks related to the responses
184+
}
185+
```
149186

150187
### Extensions
151188

0 commit comments

Comments
 (0)