bdledger-apis/bdledger/api/common.proto

70 lines
2.6 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
}
2020-04-03 12:57:08 +00:00
message Contract {
bytes contractName = 1; //合约名称
uint32 randomNum =2; //合约执行的节点数量
bytes operation = 3; //合约方法
bytes arg = 4; //合约方法参数
bytes path = 5; //合约文件路径(合约在IDE工程的相对路径)
bytes content = 6; //合约内容(可为合约文件相对路径/合约脚本)
bytes pubkey = 7; //用户公钥
enum ContractUnitRequestType{
START = 0;
STOP = 1;
EXECUTE = 2;
REPLY = 3;
REQUEST = 4;
PREPREPARE = 5;
PREPARE = 6;
COMMIT = 7;
ADDPEER = 8;
DROPPEER = 9;
STATESYNC = 10;
}
}
message Block {
2020-04-05 03:40:37 +00:00
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字节的交易哈希的数组或为空
}