51 lines
1.3 KiB
Protocol Buffer
51 lines
1.3 KiB
Protocol Buffer
|
syntax = "proto3";
|
||
|
package proto;
|
||
|
|
||
|
// A BlockID message contains identifiers to select a block: a height or a
|
||
|
// hash. If the hash is present it takes precedence.
|
||
|
message BlockID {
|
||
|
uint64 height = 1;
|
||
|
bytes hash = 2;
|
||
|
}
|
||
|
|
||
|
// BlockRange technically allows ranging from hash to hash etc but this is not
|
||
|
// currently intended for support, though there is no reason you couldn't do
|
||
|
// it. Further permutations are left as an exercise.
|
||
|
message BlockRange {
|
||
|
BlockID start = 1;
|
||
|
BlockID end = 2;
|
||
|
}
|
||
|
|
||
|
// A TxFilter contains the information needed to identify a particular
|
||
|
// transaction: either a block and an index, or a direct transaction hash.
|
||
|
message TxFilter {
|
||
|
BlockID block = 1;
|
||
|
uint64 index = 2;
|
||
|
bytes hash = 3;
|
||
|
}
|
||
|
|
||
|
message FullTransaction {
|
||
|
TxFilter txID = 1;
|
||
|
bytes data = 2;
|
||
|
}
|
||
|
|
||
|
message SentTransaction {
|
||
|
bytes data = 1;
|
||
|
}
|
||
|
|
||
|
message SendResponse {
|
||
|
int32 errorCode = 1;
|
||
|
string errorMessage = 2;
|
||
|
}
|
||
|
|
||
|
// Empty placeholder. Someday we may want to specify e.g. a particular chain fork.
|
||
|
message ChainSpec {}
|
||
|
|
||
|
service CompactTxStreamer {
|
||
|
rpc GetLatestBlock(ChainSpec) returns (BlockID) {}
|
||
|
rpc GetBlock(BlockID) returns (CompactBlock) {}
|
||
|
rpc GetBlockRange(BlockRange) returns (stream CompactBlock) {}
|
||
|
rpc GetTransaction(TxFilter) returns (FullTransaction) {}
|
||
|
rpc SendTransaction(RawTransaction) returns (SendResponse) {}
|
||
|
}
|