forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neutrino.proto
246 lines (186 loc) · 5.74 KB
/
neutrino.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
syntax = "proto3";
package neutrinorpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc";
/*
* Comments in this file will be directly parsed into the API
* Documentation as descriptions of the associated method, message, or field.
* These descriptions should go right above the definition of the object, and
* can be in either block or // comment format.
*
* An RPC method can be matched to an lncli command by placing a line in the
* beginning of the description in exactly the following format:
* lncli: `methodname`
*
* Failure to specify the exact name of the command will cause documentation
* generation to fail.
*
* More information on how exactly the gRPC documentation is generated from
* this proto file can be found here:
* https://github.com/lightninglabs/lightning-api
*/
// NeutrinoKit is a service that can be used to get information about the
// current state of the neutrino instance, fetch blocks and add/remove peers.
service NeutrinoKit {
/* lncli: `neutrino status`
Status returns the status of the light client neutrino instance,
along with height and hash of the best block, and a list of connected
peers.
*/
rpc Status (StatusRequest) returns (StatusResponse);
/* lncli: `neutrino addpeer`
AddPeer adds a new peer that has already been connected to the server.
*/
rpc AddPeer (AddPeerRequest) returns (AddPeerResponse);
/* lncli: `neutrino disconnectpeer`
DisconnectPeer disconnects a peer by target address. Both outbound and
inbound nodes will be searched for the target node. An error message will
be returned if the peer was not found.
*/
rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse);
/* lncli: `neutrino isbanned`
IsBanned returns true if the peer is banned, otherwise false.
*/
rpc IsBanned (IsBannedRequest) returns (IsBannedResponse);
/* lncli: `neutrino getblockheader`
GetBlockHeader returns a block header with a particular block hash.
*/
rpc GetBlockHeader (GetBlockHeaderRequest) returns (GetBlockHeaderResponse);
/*
GetBlock returns a block with a particular block hash.
*/
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse);
/* lncli: `neutrino getcfilter`
GetCFilter returns a compact filter from a block.
*/
rpc GetCFilter (GetCFilterRequest) returns (GetCFilterResponse);
/*
Deprecated, use chainrpc.GetBlockHash instead.
GetBlockHash returns the header hash of a block at a given height.
*/
rpc GetBlockHash (GetBlockHashRequest) returns (GetBlockHashResponse) {
option deprecated = true;
}
}
message StatusRequest {
}
message StatusResponse {
// Indicates whether the neutrino backend is active or not.
bool active = 1;
// Is fully synced.
bool synced = 2;
// Best block height.
int32 block_height = 3;
// Best block hash.
string block_hash = 4;
// Connected peers.
repeated string peers = 5;
}
message AddPeerRequest {
// Peer to add.
string peer_addrs = 1;
}
message AddPeerResponse {
}
message DisconnectPeerRequest {
// Peer to disconnect.
string peer_addrs = 1;
}
message DisconnectPeerResponse {
}
message IsBannedRequest {
// Peer to lookup.
string peer_addrs = 1;
}
message IsBannedResponse {
bool banned = 1;
}
message GetBlockHeaderRequest {
// Block hash in hex notation.
string hash = 1;
}
message GetBlockHeaderResponse {
// The block hash (same as provided).
string hash = 1;
// The number of confirmations.
int64 confirmations = 2;
// The block size excluding witness data.
int64 stripped_size = 3;
// The block size (bytes).
int64 size = 4;
// The block weight as defined in BIP 141.
int64 weight = 5;
// The block height or index.
int32 height = 6;
// The block version.
int32 version = 7;
// The block version.
string version_hex = 8;
// The merkle root.
string merkleroot = 9;
// The block time in seconds since epoch (Jan 1 1970 GMT).
int64 time = 10;
// The nonce.
uint32 nonce = 11;
// The bits in hex notation.
string bits = 12;
// The number of transactions in the block.
int32 ntx = 13;
// The hash of the previous block.
string previous_block_hash = 14;
// The raw hex of the block.
bytes raw_hex = 15;
}
message GetBlockRequest {
// Block hash in hex notation.
string hash = 1;
}
message GetBlockResponse {
// The block hash (same as provided).
string hash = 1;
// The number of confirmations.
int64 confirmations = 2;
// The block size excluding witness data.
int64 stripped_size = 3;
// The block size (bytes).
int64 size = 4;
// The block weight as defined in BIP 141.
int64 weight = 5;
// The block height or index.
int32 height = 6;
// The block version.
int32 version = 7;
// The block version.
string version_hex = 8;
// The merkle root.
string merkleroot = 9;
// List of transaction ids.
repeated string tx = 10;
// The block time in seconds since epoch (Jan 1 1970 GMT).
int64 time = 11;
// The nonce.
uint32 nonce = 12;
// The bits in hex notation.
string bits = 13;
// The number of transactions in the block.
int32 ntx = 14;
// The hash of the previous block.
string previous_block_hash = 15;
// The raw hex of the block.
bytes raw_hex = 16;
}
message GetCFilterRequest {
// Block hash in hex notation.
string hash = 1;
}
message GetCFilterResponse {
// GCS filter.
bytes filter = 1;
}
message GetBlockHashRequest {
// The block height or index.
int32 height = 1;
}
message GetBlockHashResponse {
// The block hash.
string hash = 1;
}