Commit 21604207 authored by vicotor's avatar vicotor

add base struct.

parent 0f5a4ffc
# MetaProtocol
Protocol Buffer
Define base protocol-buffer.
\ No newline at end of file
syntax = "proto3";
package protocol.metadata;
option go_package = ".;metadata";
// base data struct for tx.
message TxWithFrom {
bytes From = 1;
bytes TxData = 2;
}
message NeuronTx {
repeated bytes BatchHash = 1;
repeated TxWithFrom Txs = 2;
}
syntax = "proto3";
package protocol.metaservice;
option go_package = ".;";
// base data struct for tx.
message TxWithFrom {
bytes From = 1;
bytes TxData = 2;
}
message NeuronTx {
repeated bytes BatchHash = 1;
repeated TxWithFrom Txs = 2;
}
// CheckTx module message and service.
// checktx between MetaRing and Validator
message RecoverTxRequest {
repeated bytes TxDatas = 1;
}
message RecoverTxResponse {
repeated TxWithFrom Txs = 1;
}
message CheckTxRequest {
repeated bytes TxDatas = 1;
}
message CheckTxResponse {
repeated TxWithFrom Txs = 1;
repeated bool Valids = 2;
}
service TxCheckerService {
rpc RecoverTx(RecoverTxRequest) returns (RecoverTxResponse);
rpc BatchCheckTx(CheckTxRequest) returns (CheckTxResponse);
}
// P2P module message and service
// broadcast tx and request tx between peer.
message BroadCastTxRequest {
NeuronTx BroadTx = 1;
}
message BroadCastTxResponse {
int32 PeerCount = 1;
}
message RequestNeuronTx {
bytes Hash = 1;
}
message ResponseNeuronTx {
TxWithFrom Tx = 1;
}
// service and interface define
service P2PService {
rpc BroadCastTx(BroadCastTxRequest) returns (BroadCastTxResponse);
rpc FetchNeuronTx(RequestNeuronTx) returns (ResponseNeuronTx);
}
// p2p connect and ping-pong protocol.
message MessageData {
// shared between all requests
string clientVersion = 1; // client version
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(multihash(nodePubKey))
bytes nodePubKey = 6; // Authoring node Secp256k1 public key (32bytes) - protobufs serielized
bytes sign = 7; // signature of message data + method specific data by message authoring node.
}
message PingRequest {
MessageData messageData = 1;
// method specific data
string message = 2;
}
message PingResponse {
MessageData messageData = 1;
// response specific data
string message = 2;
}
// ConsensusClient module message and service
message SubscribeRequest {
int32 Chainid = 1;
}
message SubscribeResponse {
int32 Subid = 1;
}
// encoded block data.
message BlockData {
bytes Block = 1;
}
message CallContractRequest {
string Method = 1;
bytes Input = 2;
}
message CallContractResponse {
bytes Result = 1;
}
message SendContractTxRequest {
string Method = 1;
bytes Input = 2;
}
message SendContractTxResponse {
bytes Result = 1;
}
service ConsensusClientService {
rpc SubscribeBlock(SubscribeRequest) returns(SubscribeResponse);
rpc CallContract(CallContractRequest) returns(CallContractResponse);
rpc ContractTx(SendContractTxRequest) returns(SendContractTxResponse);
}
// MetaNebula service interface
service NebulaService {
rpc GetBalance(Account) returns (BigIntValue);
rpc GetNonce(Account) returns (BigIntValue);
}
message BigIntValue {
string Value = 1;
}
message Account {
bytes Addr = 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment