cranberry
1syntax = "proto3";
2
3option go_package = "grpc/";
4
5service GossipService {
6rpc SendBlock(stream SendBlockMessage) returns (stream SendBlockMessage);
7}
8
9service CranberryService {
10rpc SendTx (SendTxRequest) returns (SendTxResponse);
11rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse);
12rpc AddPeer (AddPeerRequest) returns (AddPeerResponse);
13rpc PropagateTx(PropagateTxRequest) returns (PropagateTxResponse);
14}
15
16message SendTxRequest {
17Tx tx = 1;
18Signature signature = 2;
19bytes pubKey = 3;
20}
21
22message SendTxResponse {
23}
24
25message SendBlockMessage {
26BlockContainer blockContainer = 1;
27}
28
29message GetBlockByHeightRequest {
30uint64 height = 1;
31}
32
33message GetBlockByHeightResponse {
34BlockContainer blockContainer = 1;
35}
36
37message PropagateTxRequest {
38TxContainer txContainer = 1;
39}
40
41message PropagateTxResponse {
42}
43
44message AddPeerRequest {
45string name = 1;
46string addr = 2;
47uint32 port = 3;
48}
49
50message AddPeerResponse {
51}
52
53message BlockContainer {
54string hash = 1;
55BlockHeader header = 2;
56repeated TxContainer txs = 3;
57repeated SignatureItem validatorSignatures = 4;
58}
59
60message SignatureItem {
61string addr = 1;
62Signature signature = 2;
63}
64
65message BlockHeader {
66string merkleRoot = 1;
67string prevHash = 2;
68uint64 height = 3;
69}
70
71message TxContainer {
72Tx tx = 1;
73string hash = 2;
74optional uint64 orderInBlock = 3;
75Signature signature = 4;
76bytes pubKey = 5;
77}
78
79message Tx {
80uint64 index = 1;
81string to = 2;
82uint64 amount = 3;
83}
84
85message Signature {
86bytes r = 1;
87bytes s = 2;
88}
89
90message Account {
91string addr = 1;
92bytes pubKey = 2;
93uint64 balance = 3;
94}
95
96message Validator {
97string addr = 1;
98bytes pubKey = 2;
99}