Skip to content

Instantly share code, notes, and snippets.

@arcolife
Created June 23, 2018 19:18
Show Gist options
  • Save arcolife/707573556f26eec41fd18a0027b02fd1 to your computer and use it in GitHub Desktop.
Save arcolife/707573556f26eec41fd18a0027b02fd1 to your computer and use it in GitHub Desktop.
truechain proto
syntax = "proto3";
package fastchain;
//Interface exposed by pbft committee nodes
service FastChain {
//RPC service that responds whether the node is the leader
rpc CheckLeader (CheckLeaderReq) returns (CheckLeaderResp) {}
//Send new transaction to presumed leader node
rpc NewTxnRequest (Request) returns (GenericResp) {}
}
//Interface exposed by client
service Client {
//RPC service that responds whether the node is the leader
rpc CheckLeader (CheckLeaderReq) returns (CheckLeaderResp) {}
//Send new transaction to presumed leader node
rpc NewTxnRequest (Transaction) returns (GenericResp) {}
}
message Request {
message Inner {
int32 id = 1;
int32 seq = 2;
int32 view = 3;
string type = 4;
PbftBlock block = 5;
int32 timestamp = 6;
}
message MsgSignature {
int64 r = 1;
int64 s = 2;
}
Inner inner = 1;
bytes dig = 2;
MsgSignature sig = 3;
bytes outer = 4;
}
message History {
repeated Request req = 1;
}
message CheckLeaderReq {}
message CheckLeaderResp {
bool message = 1;
}
message Nodes {
repeated PbftNode nodes = 1;
}
message TxnData {
uint64 AccountNonce = 1; // Nonce
int64 Price = 2; // Gas Price
int64 GasLimit = 3; // start gas??
bytes Recipient = 4; // to
int64 Amount = 5; // value
bytes Payload = 6; // data
int64 V = 7;
int64 R = 8;
int64 S = 9;
bytes Hash = 10; // ??
}
message Transaction {
TxnData data = 1;
}
message Transactions {
repeated Transaction txns = 1;
}
message PbftBlockHeader {
int64 Number = 1;
int64 GasLimit = 2;
int64 GasUsed = 3;
int64 Time = 4;
}
message PbftBlock {
PbftBlockHeader header = 1;
Transactions txns = 2;
repeated string signs = 3;
}
message Blocks {
repeated PbftBlock;
}
message TruePbftNode {
string addr = 1;
string pubkey = 2;
string privkey = 3;
message TrueChain {
Blocks blocks = 1;
PbftBlockHeader lastHeader = 2;
}
message GenericResp {
string msg = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment