bdledger-apis/bdledger/api/common.proto

46 lines
1.9 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
package bdledger.api;
2018-09-07 04:53:15 +00:00
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
2019-09-26 10:06:06 +00:00
option java_package = "bdledger.api.grpc.common";
2018-09-11 13:56:25 +00:00
option java_outer_classname = "CommonProto";
2018-09-07 04:53:15 +00:00
option java_multiple_files = true;
2018-09-06 10:36:06 +00:00
2018-10-08 11:20:40 +00:00
2018-09-09 11:13:05 +00:00
/* 事务类型 */
enum TransactionType {
2018-10-08 13:38:12 +00:00
RECORD = 0; // 通用数据记录
MESSAGE = 1; // 消息
CONTRACT_CREATION = 2; // 合约创建
CONTRACT_INVOCATION = 3; // 合约调用
2018-11-27 13:13:44 +00:00
CONTRACT_STATUS = 4; // 合约状态
2018-09-06 10:36:06 +00:00
}
message Transaction {
bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 2; // 事务在区块中的位置 index当事务处于待确认状态时为`null`
bytes hash = 3; // 事务的哈希
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 {
bytes hash = 1; // 区块的哈希,当区块处于待确认状态时为`null`
repeated bytes parent_hashes = 2; // 父区块的哈希
repeated bytes witnesses = 3; // 见证者账户地址
int64 timestamp = 4; // 区块产生时的 UNIX 时间戳,单位为秒
uint64 size = 5; // 区块大小的字节数
uint32 transaction_count = 6; // 区块包含的事务数量
bytes transactions_root = 7; // 区块的事务默克尔树根
repeated Transaction transactions = 8; // 事务对象的数组,或为空
repeated bytes transaction_hashes = 9; // 20字节的交易哈希的数组或为空
}