p2p.proto 1.48 KB
Newer Older
1
2
3
4
5
6
7
8
syntax = "proto3";

package protocols.p2p;

// designed to be shared between all app protocols
message MessageData {
    // shared between all requests
    string clientVersion = 1; // client version
Aviv Eyal's avatar
Aviv Eyal committed
9
10
11
12
    int64 timestamp = 2;     // unix time
    string id = 3;           // allows requesters to use request data when processing a response
    bool gossip = 4;         // true to have receiver peer gossip the message to neighbors
    string nodeId = 5;       // id of node that created the message (not the peer that may have sent it). =base58(mh(sha256(nodePubKey)))
Aviv Eyal's avatar
Aviv Eyal committed
13
14
    bytes nodePubKey = 6;    // Authoring node Secp256k1 public key (32bytes) - protobufs serielized
    string sign = 7;         // signature of message data + method specific data by message authoring node. format: string([]bytes)
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
}

//// ping protocol

// a protocol define a set of reuqest and responses
message PingRequest {
    MessageData messageData = 1;

    // method specific data
    string message = 2;
    // add any data here....
}

message PingResponse {
    MessageData messageData = 1;

    // response specific data
    string message = 2;
    // ... add any data here
}

//// echo protocol

// a protocol define a set of reuqest and responses
message EchoRequest {
    MessageData messageData = 1;

    // method specific data
    string message = 2;
    // add any data here....
}

message EchoResponse {
    MessageData messageData = 1;

    // response specific data
    string message = 2;
    // ... add any data here
}