bdledger-apis/bdledger/api/tx_ledger.proto

89 lines
3.0 KiB
Protocol Buffer
Raw Normal View History

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.txledger;
2018-09-06 10:36:06 +00:00
2018-09-07 05:22:14 +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/txledger";
option java_package = "bdledger.api.grpc.txledger";
2018-09-11 13:56:25 +00:00
option java_outer_classname = "TransactionLedgerProto";
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 TransactionLedger {
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 CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse);
rpc BlockCount (BlockCountRequest) returns (BlockCountResponse);
rpc GetBlocks (GetBlocksRequest) returns (GetBlocksResponse);
2018-10-08 13:38:12 +00:00
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
2018-09-06 10:36:06 +00:00
}
message Transaction {
bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 2; // 事务在区块中的位置 index当事务处于待确认状态时为`null`
bytes hash = 3; // 事务的哈希
2019-04-23 07:22:19 +00:00
common.TransactionType type = 4; // 事务类型
bytes from = 5; // 发送账户地址
uint64 nonce = 6; // 这条事务之前发送者所发送的事务数量
bytes to = 7; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
bytes data = 8; // 数据或合约代码
bytes v = 9; // ECDSA recovery id
bytes r = 10; // ECDSA signature r
bytes s = 11; // ECDSA signature s
}
message Block {
uint64 index = 1; // 事务链本地区块索引,当区块处于待确认状态时为`null`
bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null`
repeated bytes parent_hashes = 3; // 父区块的哈希
repeated bytes witnesses = 4; // 见证者账户地址
int64 timestamp = 5; // 区块产生时的 UNIX 时间戳,单位为秒
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 CreateLedgerRequest {
2018-10-08 13:38:12 +00:00
string name = 1;
2018-09-06 10:36:06 +00:00
}
message CreateLedgerResponse {
bool ok = 1;
2018-09-06 10:36:06 +00:00
}
message GetLedgersResponse {
repeated string ledgers = 1;
2018-09-06 10:36:06 +00:00
}
message BlockCountRequest {
string ledger = 1;
}
message BlockCountResponse {
uint64 block_count = 1;
}
message GetBlocksRequest {
string ledger = 1;
uint64 from_index = 2;
uint32 count = 3; // Optional, default to 10, max value is 10
bool full_transaction = 4;
}
message GetBlocksResponse {
repeated Block blocks = 1;
}
2018-09-09 11:13:05 +00:00
message SendTransactionRequest {
2018-10-08 13:38:12 +00:00
string ledger = 1;
message Transaction {
2019-04-23 07:22:19 +00:00
common.TransactionType type = 1;
2018-10-08 13:38:12 +00:00
bytes from = 2;
bytes to = 3;
bytes data = 4;
}
Transaction transaction = 2;
2018-09-06 10:36:06 +00:00
}
2018-09-09 11:13:05 +00:00
message SendTransactionResponse {
bytes hash = 1;
2018-09-06 10:36:06 +00:00
}