diff --git a/bdchain/api/ac_chain.proto b/bdchain/api/ac_chain.proto index 4f946e6..aa270f0 100644 --- a/bdchain/api/ac_chain.proto +++ b/bdchain/api/ac_chain.proto @@ -40,7 +40,7 @@ message Block { bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null` bytes parent_hash = 3; // 父区块的哈希 repeated bytes witnesses = 4; // 见证者账户地址的数组 - uint64 timestamp = 5; // 区块产生时的UNIX时间戳 + int64 timestamp = 5; // 区块产生时的UNIX时间戳 uint64 size = 6; // 区块大小的字节数 bytes transactions_root = 7; // 区块的事务树根 repeated Transaction transactions = 8; // 事务对象的数组,或为空 diff --git a/bdchain/api/tx_ledger.proto b/bdchain/api/tx_ledger.proto index 389b2e9..f285fe0 100644 --- a/bdchain/api/tx_ledger.proto +++ b/bdchain/api/tx_ledger.proto @@ -20,27 +20,27 @@ service TransactionLedger { } message Transaction { - bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null` - uint32 index = 2; // 事务在区块中的位置index,当事务处于待确认状态时为`null` - bytes hash = 3; // 事务的哈希 + 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 + 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; // 见证者账户地址 - uint64 timestamp = 5; // 区块产生时的UNIX时间戳 - uint64 size = 6; // 区块大小的字节数 - bytes transactions_root = 7; // 区块的事务树根 + 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; // 事务对象的数组,或为空 repeated bytes transaction_hashes = 9; // 32字节的交易哈希的数组,或为空 } diff --git a/test.md b/test.md index b54009c..3e1d2b1 100644 --- a/test.md +++ b/test.md @@ -1,3 +1,5 @@ +# Test + ## Basic types ### ClientVersionResponse @@ -24,17 +26,17 @@ enum TransactionType { ```proto message Transaction { - bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null` - uint32 index = 2; // 事务在区块中的位置index,当事务处于待确认状态时为`null` - bytes hash = 3; // 事务的哈希 + 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 + 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 } ``` @@ -61,13 +63,13 @@ message Transaction { ```proto message Block { - uint64 index = 1; // 事务链本地区块索引,当区块处于待确认状态时为`null` - bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null` - repeated bytes parent_hashes = 3; // 父区块的哈希 - bytes witnesses = 4; // 见证者账户地址 - uint64 timestamp = 5; // 区块产生时的UNIX时间戳 - uint64 size = 6; // 区块大小的字节数 - bytes transactions_root = 7; // 区块的事务树根 + 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; // 事务对象的数组,或为空 repeated bytes transaction_hashes = 9; // 32字节的交易哈希的数组,或为空 } @@ -81,7 +83,7 @@ message Block { bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null` bytes parent_hash = 3; // 父区块的哈希 repeated bytes witnesses = 4; // 见证者账户地址的数组 - uint64 timestamp = 5; // 区块产生时的UNIX时间戳 + int64 timestamp = 5; // 区块产生时的UNIX时间戳 uint64 size = 6; // 区块大小的字节数 bytes transactions_root = 7; // 区块的事务树根 repeated Transaction transactions = 8; // 事务对象的数组,或为空 @@ -112,11 +114,13 @@ bdchain.api.ClientVersionResponse ##### 1 **Request** + ``` (empty) ``` **Response** + ```yaml version: 'TxLedgerGo/v0.0.1alpha/darwin/go1.11' ``` @@ -146,11 +150,13 @@ message CreateLedgerResponse { ##### 1 **Request** + ```yaml name: 'test' ``` **Response** + ```yaml ok: true ``` @@ -160,15 +166,19 @@ ok: true **Request** Client: + ```yaml name: null ``` + On the wire: + ```yaml name: '' (defualt value) ``` **Error** + ```yaml code: Code.InvalidArgument message: 'name must not be empty' @@ -198,11 +208,13 @@ message GetLedgersResponse { ##### 1 **Request** + ``` (empty) ``` **Response** + ```yaml ledgers: - 'first' @@ -235,11 +247,13 @@ message BlockCountResponse { ##### 1 **Request** + ```yaml ledger: 'test' ``` **Response** + ```yaml block_count: 2018 ``` @@ -249,15 +263,19 @@ block_count: 2018 **Request** Client: + ```yaml ledger: null ``` + On the wire: + ```yaml ledger: '' (defualt value) ``` **Error** + ```yaml code: Code.InvalidArgument message: 'ledger must not be empty' @@ -292,6 +310,7 @@ message GetBlocksResponse { ##### 1 **Request** + ```yaml ledger: 'test' from_index: 2018 @@ -300,6 +319,7 @@ full_transactions: true ``` **Response** + ```yaml blocks: - index: 2018 @@ -344,12 +364,14 @@ blocks: ##### 2 **Request** + ```yaml ledger: 'test' from_index: 2018 ``` **Response** + ```yaml blocks: - index: 2018 @@ -506,7 +528,7 @@ blocks: - 0x0404040404040404040404040404040404040404 (in bytes) - 0x1313131313131313131313131313131313131313 (in bytes) - index: 2027 - hash: 0x1010101010101010101010101010101010101010101010101010101010101010 (in bytes) + hash: 0x1010101010101010101010101010101010101010 (in bytes) parent_hashes: - 0x0404040404040404040404040404040404040404 (in bytes) - 0x1313131313131313131313131313131313131313 (in bytes) @@ -556,6 +578,7 @@ message SendTransactionResponse { ##### 1 **Request** + ```yaml ledger: 'test' transaction: @@ -566,6 +589,7 @@ transaction: ``` **Response** + ```yaml hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in bytes) ``` @@ -573,6 +597,7 @@ hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in byt ##### 2 **Request** + ```yaml ledger: 'test' transaction: @@ -583,6 +608,7 @@ transaction: ``` **Error** + ```yaml code: Code.InvalidArgument message: 'Multiple invalid arguments' @@ -617,11 +643,13 @@ bdchain.api.ClientVersionResponse ##### 1 **Request** + ``` (empty) ``` **Response** + ```yaml version: 'AcChainGo/v0.0.1alpha/darwin/go1.11' ``` @@ -651,11 +679,13 @@ message BlockNumberResponse { ##### 1 **Request** + ```yaml ledger: 'test' ``` **Response** + ```yaml block_number: 2018 ``` @@ -665,15 +695,19 @@ block_number: 2018 **Request** Client: + ```yaml ledger: null ``` + On the wire: + ```yaml ledger: '' (defualt value) ``` **Error** + ```yaml code: Code.InvalidArgument message: 'ledger must not be empty' @@ -705,6 +739,7 @@ Block ##### 1 **Request** + ```yaml ledger: 'test' number: 2018 @@ -712,6 +747,7 @@ full_transaction: true ``` **Response** + ```yaml number: 2018 hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -756,12 +792,15 @@ transaction_hashes: **Request** Client: + ```yaml ledger: 'test' number: 2018 full_transaction: null ``` + On the wire: + ```yaml ledger: 'test' number: 2018 @@ -769,6 +808,7 @@ full_transaction: false (defualt value) ``` **Response** + ```yaml number: 2018 hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -811,6 +851,7 @@ Block ##### 1 **Request** + ```yaml ledger: 'test' hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -818,6 +859,7 @@ full_transaction: false ``` **Response** + ```yaml number: 2018 hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -859,12 +901,14 @@ Transaction ##### 1 **Request** + ```yaml ledger: 'test' hash: 0x0404040404040404040404040404040404040404 (in bytes) ``` **Response** + ```yaml block_number: 2018 block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -905,6 +949,7 @@ Transaction ##### 1 **Request** + ```yaml ledger: 'test' block_number: 2018 @@ -912,6 +957,7 @@ index: 0 ``` **Response** + ```yaml block_number: 2018 block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -952,6 +998,7 @@ Transaction ##### 1 **Request** + ```yaml ledger: 'test' block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) @@ -959,6 +1006,7 @@ index: 0 ``` **Response** + ```yaml block_number: 2018 block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)