2018-09-06 10:36:06 +00:00
|
|
|
|
syntax = "proto3";
|
2018-09-07 02:28:07 +00:00
|
|
|
|
|
2019-09-26 10:06:06 +00:00
|
|
|
|
package bdledger.api.acchain;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
|
2018-10-08 11:20:40 +00:00
|
|
|
|
import "google/protobuf/empty.proto";
|
2019-09-26 10:06:06 +00:00
|
|
|
|
import "bdledger/api/common.proto";
|
2018-09-07 04:53:15 +00:00
|
|
|
|
|
2019-09-26 10:06:06 +00:00
|
|
|
|
option go_package = "bdware.org/bdledger/sdk/api/grpc/acchain";
|
|
|
|
|
option java_package = "bdledger.api.grpc.acchain";
|
2018-09-11 13:56:25 +00:00
|
|
|
|
option java_outer_classname = "AccountingChainProto";
|
2018-09-07 04:53:15 +00:00
|
|
|
|
option java_multiple_files = true;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
|
2018-09-09 11:13:05 +00:00
|
|
|
|
service AccountingChain {
|
2019-04-23 07:22:19 +00:00
|
|
|
|
rpc ClientVersion (google.protobuf.Empty) returns (common.ClientVersionResponse);
|
2018-10-08 13:38:12 +00:00
|
|
|
|
rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse);
|
2018-10-09 07:42:25 +00:00
|
|
|
|
rpc GetBlockByNumber (GetBlockByNumberRequest) returns (Block);
|
|
|
|
|
rpc GetBlockByHash (GetBlockByHashRequest) returns (Block);
|
|
|
|
|
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (Transaction);
|
|
|
|
|
rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (Transaction);
|
|
|
|
|
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (Transaction);
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-09 11:13:05 +00:00
|
|
|
|
message Transaction {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
uint64 block_number = 1; // 事务所在的区块的区块号,当事务处于待确认状态时为`null`
|
|
|
|
|
bytes block_hash = 2; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
|
|
|
|
|
uint32 index = 3; // 事务在区块中的位置index,当事务处于待确认状态时为`null`
|
|
|
|
|
bytes hash = 4; // 事务的哈希
|
2019-04-23 07:22:19 +00:00
|
|
|
|
common.TransactionType type = 5; // 事务类型
|
2018-10-08 13:38:12 +00:00
|
|
|
|
bytes from = 6; // 发送账户地址
|
|
|
|
|
uint64 nonce = 7; // 这条事务之前发送者所发送的事务数量
|
|
|
|
|
bytes to = 8; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
|
|
|
|
|
bytes data = 9; // 数据或合约代码
|
|
|
|
|
bytes v = 10; // ECDSA recovery id
|
|
|
|
|
bytes r = 11; // ECDSA signature r
|
|
|
|
|
bytes s = 12; // ECDSA signature s
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message Block {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
uint64 number = 1; // 区块号,当区块处于待确认状态时为`null`
|
|
|
|
|
bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null`
|
|
|
|
|
bytes parent_hash = 3; // 父区块的哈希
|
2018-12-11 07:57:06 +00:00
|
|
|
|
repeated bytes witnesses = 4; // 见证者账户地址的数组
|
2018-12-26 08:09:18 +00:00
|
|
|
|
int64 timestamp = 5; // 区块产生时的UNIX时间戳
|
2018-10-08 13:38:12 +00:00
|
|
|
|
uint64 size = 6; // 区块大小的字节数
|
|
|
|
|
bytes transactions_root = 7; // 区块的事务树根
|
|
|
|
|
repeated Transaction transactions = 8; // 事务对象的数组,或为空
|
2019-04-23 10:25:47 +00:00
|
|
|
|
repeated bytes transaction_hashes = 9; // 20字节的交易哈希的数组,或为空
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message BlockNumberRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
message BlockNumberResponse {
|
2018-10-09 07:42:25 +00:00
|
|
|
|
uint64 block_number = 1;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message GetBlockByNumberRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
|
|
|
|
uint64 number = 2;
|
|
|
|
|
bool full_transaction = 3;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message GetBlockByHashRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes hash = 2;
|
|
|
|
|
bool full_transaction = 3;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-09 11:13:05 +00:00
|
|
|
|
message GetTransactionByHashRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes hash = 2;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-09 11:13:05 +00:00
|
|
|
|
message GetTransactionByBlockNumberAndIndexRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
|
|
|
|
uint64 block_number = 2;
|
|
|
|
|
uint32 index = 3;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-09 11:13:05 +00:00
|
|
|
|
message GetTransactionByBlockHashAndIndexRequest {
|
2018-10-08 13:38:12 +00:00
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes block_hash = 2;
|
|
|
|
|
uint32 index = 3;
|
2018-09-06 10:36:06 +00:00
|
|
|
|
}
|