Protocol Documentation

Table of Contents

Top

relay/relay.proto

ChunkRequest

A request for chunks within a specific blob. Requests are fulfilled in all-or-nothing fashion. If any of the requested chunks are not found or are unable to be fetched, the entire request will fail.

FieldTypeLabelDescription
by_indexChunkRequestByIndexRequest chunks by their individual indices.
by_rangeChunkRequestByRangeRequest chunks by a range of indices.

ChunkRequestByIndex

A request for chunks within a specific blob. Each chunk is requested individually by its index.

FieldTypeLabelDescription
blob_keybytesThe blob key.
chunk_indicesuint32repeatedThe index of the chunk within the blob.

ChunkRequestByRange

A request for chunks within a specific blob. Each chunk is requested a range of indices.

FieldTypeLabelDescription
blob_keybytesThe blob key.
start_indexuint32The first index to start fetching chunks from.
end_indexuint32One past the last index to fetch chunks from. Similar semantics to golang slices.

GetBlobReply

The reply to a GetBlobs request.

FieldTypeLabelDescription
blobbytesThe blob requested.

GetBlobRequest

A request to fetch one or more blobs.

FieldTypeLabelDescription
blob_keybytesThe key of the blob to fetch.

GetChunksReply

The reply to a GetChunks request.

FieldTypeLabelDescription
databytesrepeatedThe chunks requested. The order of these chunks will be the same as the order of the requested chunks. data is the raw data of the bundle (i.e. serialized byte array of the frames)

GetChunksRequest

Request chunks from blobs stored by this relay.

FieldTypeLabelDescription
chunk_requestsChunkRequestrepeatedThe chunk requests. Chunks are returned in the same order as they are requested.
operator_idbytesIf this is an authenticated request, this should hold the ID of the operator. If this is an unauthenticated request, this field should be empty. Relays may choose to reject unauthenticated requests.
timestampuint32Timestamp of the request in seconds since the Unix epoch. If too far out of sync with the server's clock, request may be rejected.
operator_signaturebytesIf this is an authenticated request, this field will hold a BLS signature by the requester on the hash of this request. Relays may choose to reject unauthenticated requests.

The following describes the schema for computing the hash of this request This algorithm is implemented in golang using relay.auth.HashGetChunksRequest().

All integers are encoded as unsigned 4 byte big endian values.

Perform a keccak256 hash on the following data in the following order: 1. the length of the operator ID in bytes 2. the operator id 3. the number of chunk requests 4. for each chunk request: a. if the chunk request is a request by index: i. a one byte ASCII representation of the character "i" (aka Ox69) ii. the length blob key in bytes iii. the blob key iv. the start index v. the end index b. if the chunk request is a request by range: i. a one byte ASCII representation of the character "r" (aka Ox72) ii. the length of the blob key in bytes iii. the blob key iv. each requested chunk index, in order 5. the timestamp (seconds since the Unix epoch encoded as a 4 byte big endian value) |

Relay

Relay is a service that provides access to public relay functionality.

Method NameRequest TypeResponse TypeDescription
GetBlobGetBlobRequestGetBlobReplyGetBlob retrieves a blob stored by the relay.
GetChunksGetChunksRequestGetChunksReplyGetChunks retrieves chunks from blobs stored by the relay.

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)