2020-04-07 13:56:57 +00:00
# Protocol Documentation
< a name = "top" > < / a >
## Table of Contents
2024-03-06 07:37:53 +00:00
- [bdware/bdledger/api/common.proto ](#bdware_bdledger_api_common-proto )
- [Block ](#bdware-bdledger-api-Block )
- [Contract ](#bdware-bdledger-api-Contract )
- [Transaction ](#bdware-bdledger-api-Transaction )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [Contract.ContractUnitRequestType ](#bdware-bdledger-api-Contract-ContractUnitRequestType )
- [TransactionType ](#bdware-bdledger-api-TransactionType )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [bdware/bdledger/api/error_details.proto ](#bdware_bdledger_api_error_details-proto )
- [InvalidArgument ](#bdware-bdledger-api-InvalidArgument )
- [InvalidArgument.FieldViolation ](#bdware-bdledger-api-InvalidArgument-FieldViolation )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [bdware/bdledger/api/ledger.proto ](#bdware_bdledger_api_ledger-proto )
- [CreateLedgerRequest ](#bdware-bdledger-api-CreateLedgerRequest )
- [CreateLedgerResponse ](#bdware-bdledger-api-CreateLedgerResponse )
- [GetLedgersResponse ](#bdware-bdledger-api-GetLedgersResponse )
- [SendTransactionRequest ](#bdware-bdledger-api-SendTransactionRequest )
- [SendTransactionRequest.Transaction ](#bdware-bdledger-api-SendTransactionRequest-Transaction )
- [SendTransactionResponse ](#bdware-bdledger-api-SendTransactionResponse )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [Ledger ](#bdware-bdledger-api-Ledger )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [bdware/bdledger/api/node.proto ](#bdware_bdledger_api_node-proto )
- [ClientVersionResponse ](#bdware-bdledger-api-ClientVersionResponse )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [Node ](#bdware-bdledger-api-Node )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [bdware/bdledger/api/query.proto ](#bdware_bdledger_api_query-proto )
- [BlockFilter ](#bdware-bdledger-api-BlockFilter )
- [BlocksRequest ](#bdware-bdledger-api-BlocksRequest )
- [CountBlocksResponse ](#bdware-bdledger-api-CountBlocksResponse )
- [CountTransactionsResponse ](#bdware-bdledger-api-CountTransactionsResponse )
- [GetBlockByHashRequest ](#bdware-bdledger-api-GetBlockByHashRequest )
- [GetBlockByHashResponse ](#bdware-bdledger-api-GetBlockByHashResponse )
- [GetBlocksResponse ](#bdware-bdledger-api-GetBlocksResponse )
- [GetTransactionByBlockHashAndIndexRequest ](#bdware-bdledger-api-GetTransactionByBlockHashAndIndexRequest )
- [GetTransactionByBlockHashAndIndexResponse ](#bdware-bdledger-api-GetTransactionByBlockHashAndIndexResponse )
- [GetTransactionByHashRequest ](#bdware-bdledger-api-GetTransactionByHashRequest )
- [GetTransactionByHashResponse ](#bdware-bdledger-api-GetTransactionByHashResponse )
- [GetTransactionsResponse ](#bdware-bdledger-api-GetTransactionsResponse )
- [RecentBlocksRequest ](#bdware-bdledger-api-RecentBlocksRequest )
- [TransactionFilter ](#bdware-bdledger-api-TransactionFilter )
- [TransactionsRequest ](#bdware-bdledger-api-TransactionsRequest )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [IncludeTransactions ](#bdware-bdledger-api-IncludeTransactions )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [Query ](#bdware-bdledger-api-Query )
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
- [google/protobuf/empty.proto ](#google_protobuf_empty-proto )
- [Empty ](#google-protobuf-Empty )
2020-04-07 13:56:57 +00:00
- [Scalar Value Types ](#scalar-value-types )
2024-03-06 07:37:53 +00:00
< a name = "bdware_bdledger_api_common-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## bdware/bdledger/api/common.proto
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Block" > < / a >
2020-04-07 13:56:57 +00:00
### Block
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| hash | [bytes ](#bytes ) | | 区块的哈希,当区块处于待确认状态时为`null` |
2020-04-20 16:46:04 +00:00
| creator | [bytes ](#bytes ) | | 产块者账户地址 |
| nonce | [uint64 ](#uint64 ) | | 这个区块之前产块者产生的区块数量 |
2020-04-07 13:56:57 +00:00
| parent_hashes | [bytes ](#bytes ) | repeated | 父区块的哈希 |
| witnesses | [bytes ](#bytes ) | repeated | 见证者账户地址 |
| timestamp | [int64 ](#int64 ) | | 区块产生时的 UNIX 时间戳,单位为秒 |
| size | [uint64 ](#uint64 ) | | 区块大小的字节数 |
| transaction_count | [uint32 ](#uint32 ) | | 区块包含的事务数量 |
| transactions_root | [bytes ](#bytes ) | | 区块的事务默克尔树根 |
2024-03-06 07:37:53 +00:00
| transactions | [Transaction ](#bdware-bdledger-api-Transaction ) | repeated | 事务对象的数组,或为空 |
2021-07-20 01:36:57 +00:00
| transaction_hashes | [bytes ](#bytes ) | repeated | 20字节的事务哈希的数组, 或为空 |
2024-03-06 07:37:53 +00:00
| creator_signature | [bytes ](#bytes ) | | 产块者签名 |
| witness_signatures | [bytes ](#bytes ) | repeated | 见证者签名 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Contract" > < / a >
2020-04-07 13:56:57 +00:00
### Contract
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| contractName | [bytes ](#bytes ) | | 合约名称 |
| randomNum | [uint32 ](#uint32 ) | | 合约执行的节点数量 |
| operation | [bytes ](#bytes ) | | 合约方法 |
| arg | [bytes ](#bytes ) | | 合约方法参数 |
| path | [bytes ](#bytes ) | | 合约文件路径(合约在IDE工程的相对路径) |
| content | [bytes ](#bytes ) | | 合约内容(可为合约文件相对路径/合约脚本) |
| pubkey | [bytes ](#bytes ) | | 用户公钥 |
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Transaction" > < / a >
2020-04-07 13:56:57 +00:00
### Transaction
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| block_hash | [bytes ](#bytes ) | | 事务所在的区块的哈希,当事务处于待确认状态时为`null` |
2020-09-04 04:29:54 +00:00
| block_timestamp | [int64 ](#int64 ) | | 事务所在的区块产生时的 UNIX 时间戳,单位为秒 |
2020-04-07 13:56:57 +00:00
| index | [uint32 ](#uint32 ) | | 事务在区块中的位置 index, 当事务处于待确认状态时为`null` |
| hash | [bytes ](#bytes ) | | 事务的哈希 |
2024-03-06 07:37:53 +00:00
| type | [TransactionType ](#bdware-bdledger-api-TransactionType ) | | 事务类型 |
2020-04-07 13:56:57 +00:00
| from | [bytes ](#bytes ) | | 发送账户地址 |
| nonce | [uint64 ](#uint64 ) | | 这条事务之前发送者所发送的事务数量 |
| to | [bytes ](#bytes ) | | 接收账户地址,或者调用的合约地址,或者`null`如为合约创建 |
| data | [bytes ](#bytes ) | | 数据或合约代码 |
| v | [bytes ](#bytes ) | | ECDSA recovery id |
| r | [bytes ](#bytes ) | | ECDSA signature r |
| s | [bytes ](#bytes ) | | ECDSA signature s |
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Contract-ContractUnitRequestType" > < / a >
2020-04-07 13:56:57 +00:00
### Contract.ContractUnitRequestType
| Name | Number | Description |
| ---- | ------ | ----------- |
| START | 0 | |
| STOP | 1 | |
| EXECUTE | 2 | |
| REPLY | 3 | |
| REQUEST | 4 | |
| PREPREPARE | 5 | |
| PREPARE | 6 | |
| COMMIT | 7 | |
| ADDPEER | 8 | |
| DROPPEER | 9 | |
| STATESYNC | 10 | |
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-TransactionType" > < / a >
2020-04-07 13:56:57 +00:00
### TransactionType
事务类型
| Name | Number | Description |
| ---- | ------ | ----------- |
| RECORD | 0 | 通用数据记录 |
| MESSAGE | 1 | 消息 |
| CONTRACT_CREATION | 2 | 合约创建 |
| CONTRACT_INVOCATION | 3 | 合约调用 |
| CONTRACT_STATUS | 4 | 合约状态 |
2024-03-06 07:37:53 +00:00
< a name = "bdware_bdledger_api_error_details-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## bdware/bdledger/api/error_details.proto
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-InvalidArgument" > < / a >
2020-04-07 13:56:57 +00:00
### InvalidArgument
InvalidArgument indicates client specified an invalid argument.
Note that this differs from FailedPrecondition. It indicates arguments
that are problematic regardless of the state of the system
(e.g., a malformed file name).
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| field_violations | [InvalidArgument.FieldViolation ](#bdware-bdledger-api-InvalidArgument-FieldViolation ) | repeated | Describes all violations in a client request. |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-InvalidArgument-FieldViolation" > < / a >
2020-04-07 13:56:57 +00:00
### InvalidArgument.FieldViolation
A message type used to describe a single invalid field.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| field | [string ](#string ) | | A path leading to a field in the request body. The value will be a sequence of dot-separated identifiers that identify a protocol buffer field. E.g., " field_violations.field" would identify this field. |
| description | [string ](#string ) | | A description of why the request element is bad. |
2024-03-06 07:37:53 +00:00
< a name = "bdware_bdledger_api_ledger-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## bdware/bdledger/api/ledger.proto
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-CreateLedgerRequest" > < / a >
2020-04-07 13:56:57 +00:00
### CreateLedgerRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| name | [string ](#string ) | | Ledger name 账本名称 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-CreateLedgerResponse" > < / a >
2020-04-07 13:56:57 +00:00
### CreateLedgerResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| ok | [bool ](#bool ) | | Boolean value indicating if the ledger is successfully created 是否创建成功 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetLedgersResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetLedgersResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| ledgers | [string ](#string ) | repeated | List of ledger names 帐本名称列表 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-SendTransactionRequest" > < / a >
2020-04-07 13:56:57 +00:00
### SendTransactionRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| ledger | [string ](#string ) | | Ledger name 账本名称 |
| transaction | [SendTransactionRequest.Transaction ](#bdware-bdledger-api-SendTransactionRequest-Transaction ) | | Transaction info 事务信息 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-SendTransactionRequest-Transaction" > < / a >
2020-04-07 13:56:57 +00:00
### SendTransactionRequest.Transaction
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| type | [TransactionType ](#bdware-bdledger-api-TransactionType ) | | 事务类型, 目前仅支持通用数据记录, 即type为RECORD (0) |
2021-07-20 01:36:57 +00:00
| from | [bytes ](#bytes ) | | 任意20字节的地址, 用于区分使用同一节点的事务发起者 |
| nonce | [uint64 ](#uint64 ) | | 正整数, 同一from每个nonce应只使用一次, 防止重复的事务( 可以每次发送事务+ 1) |
| to | [bytes ](#bytes ) | | 对于通用数据记录不需传递,无意义 |
| data | [bytes ](#bytes ) | | 事务数据内容,字节数组 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-SendTransactionResponse" > < / a >
2020-04-07 13:56:57 +00:00
### SendTransactionResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| hash | [bytes ](#bytes ) | | Hash of the created transaction 事务哈希 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Ledger" > < / a >
2020-04-07 13:56:57 +00:00
### Ledger
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
2024-03-06 07:37:53 +00:00
| CreateLedger | [CreateLedgerRequest ](#bdware-bdledger-api-CreateLedgerRequest ) | [CreateLedgerResponse ](#bdware-bdledger-api-CreateLedgerResponse ) | Create a new ledger 创建一个新账本 |
| GetLedgers | [.google.protobuf.Empty ](#google-protobuf-Empty ) | [GetLedgersResponse ](#bdware-bdledger-api-GetLedgersResponse ) | Get all ledgers 查询所有帐本列表 |
| SendTransaction | [SendTransactionRequest ](#bdware-bdledger-api-SendTransactionRequest ) | [SendTransactionResponse ](#bdware-bdledger-api-SendTransactionResponse ) | Send a new transaction 发送一个新事务 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware_bdledger_api_node-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## bdware/bdledger/api/node.proto
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-ClientVersionResponse" > < / a >
2020-04-07 13:56:57 +00:00
### ClientVersionResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| version | [string ](#string ) | | Client version 节点客户端版本 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Node" > < / a >
2020-04-07 13:56:57 +00:00
### Node
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
2024-03-06 07:37:53 +00:00
| ClientVersion | [.google.protobuf.Empty ](#google-protobuf-Empty ) | [ClientVersionResponse ](#bdware-bdledger-api-ClientVersionResponse ) | Get BDLedger node version 查询BDLedger节点版本 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware_bdledger_api_query-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## bdware/bdledger/api/query.proto
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-BlockFilter" > < / a >
2020-04-07 13:56:57 +00:00
### BlockFilter
2021-07-20 01:36:57 +00:00
暂不支持
2020-04-07 13:56:57 +00:00
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| hash | [bytes ](#bytes ) | | |
| timestamp | [int64 ](#int64 ) | | |
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-BlocksRequest" > < / a >
2020-04-07 13:56:57 +00:00
### BlocksRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
| start_timestamp | [int64 ](#int64 ) | | 查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 查询范围结束时间戳 |
2024-03-06 07:37:53 +00:00
| filters | [BlockFilter ](#bdware-bdledger-api-BlockFilter ) | repeated | 暂不支持 |
| include_transactions | [IncludeTransactions ](#bdware-bdledger-api-IncludeTransactions ) | | 包含事务信息详细程度 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-CountBlocksResponse" > < / a >
2020-04-07 13:56:57 +00:00
### CountBlocksResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| count | [uint64 ](#uint64 ) | | 区块数量 |
| start_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围结束时间戳 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-CountTransactionsResponse" > < / a >
2020-04-07 13:56:57 +00:00
### CountTransactionsResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| count | [uint64 ](#uint64 ) | | 事务数量 |
| start_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围结束时间戳 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetBlockByHashRequest" > < / a >
2020-04-07 13:56:57 +00:00
### GetBlockByHashRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
| hash | [bytes ](#bytes ) | | 区块哈希 |
| full_transactions | [bool ](#bool ) | | 是否返回完整事务列表,而不是事务哈希列表 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetBlockByHashResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetBlockByHashResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| block | [Block ](#bdware-bdledger-api-Block ) | | 区块信息 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetBlocksResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetBlocksResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| blocks | [Block ](#bdware-bdledger-api-Block ) | repeated | 区块列表 |
2021-07-20 01:36:57 +00:00
| start_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围结束时间戳 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetTransactionByBlockHashAndIndexRequest" > < / a >
2020-04-07 13:56:57 +00:00
### GetTransactionByBlockHashAndIndexRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
| block_hash | [bytes ](#bytes ) | | 事务所属区块哈希 |
| index | [uint32 ](#uint32 ) | | 事务在区块中的位置 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetTransactionByBlockHashAndIndexResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetTransactionByBlockHashAndIndexResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| transaction | [Transaction ](#bdware-bdledger-api-Transaction ) | | 事务信息 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetTransactionByHashRequest" > < / a >
2020-04-07 13:56:57 +00:00
### GetTransactionByHashRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
| hash | [bytes ](#bytes ) | | 事务哈希 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetTransactionByHashResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetTransactionByHashResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| transaction | [Transaction ](#bdware-bdledger-api-Transaction ) | | 事务信息 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-GetTransactionsResponse" > < / a >
2020-04-07 13:56:57 +00:00
### GetTransactionsResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2024-03-06 07:37:53 +00:00
| transactions | [Transaction ](#bdware-bdledger-api-Transaction ) | repeated | 事务列表 |
2021-07-20 01:36:57 +00:00
| start_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 本次查询有效的查询范围结束时间戳 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-RecentBlocksRequest" > < / a >
2020-09-04 04:29:54 +00:00
### RecentBlocksRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
2024-03-06 07:37:53 +00:00
| offset | [int64 ](#int64 ) | | 起始值 |
2021-07-20 01:36:57 +00:00
| count | [int64 ](#int64 ) | | 查询区块数量 |
2024-03-06 07:37:53 +00:00
| include_transactions | [IncludeTransactions ](#bdware-bdledger-api-IncludeTransactions ) | | 包含事务信息详细程度 |
2020-09-04 04:29:54 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-TransactionFilter" > < / a >
2020-04-07 13:56:57 +00:00
### TransactionFilter
repeated Transaction/BlockFilters are combined by " & & " (and) operator;
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| hash | [bytes ](#bytes ) | | |
| from | [bytes ](#bytes ) | | |
| to | [bytes ](#bytes ) | | |
| timestamp | [bytes ](#bytes ) | | |
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-TransactionsRequest" > < / a >
2020-04-07 13:56:57 +00:00
### TransactionsRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
2021-07-20 01:36:57 +00:00
| ledger | [string ](#string ) | | 账本名称 |
| start_timestamp | [int64 ](#int64 ) | | 查询范围开始时间戳 |
| end_timestamp | [int64 ](#int64 ) | | 查询范围结束时间戳 |
2024-03-06 07:37:53 +00:00
| filters | [TransactionFilter ](#bdware-bdledger-api-TransactionFilter ) | repeated | 暂不支持 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-IncludeTransactions" > < / a >
2020-04-07 13:56:57 +00:00
2020-09-04 04:29:54 +00:00
### IncludeTransactions
2021-07-20 01:36:57 +00:00
包含事务信息详细程度
2020-04-07 13:56:57 +00:00
| Name | Number | Description |
| ---- | ------ | ----------- |
2021-07-20 01:36:57 +00:00
| NONE | 0 | 不包含事务数据 |
| HASH | 1 | 包含事务哈希列表 |
| FULL | 2 | 包含完整事务列表 |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "bdware-bdledger-api-Query" > < / a >
2020-04-07 13:56:57 +00:00
### Query
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
2024-03-06 07:37:53 +00:00
| GetBlockByHash | [GetBlockByHashRequest ](#bdware-bdledger-api-GetBlockByHashRequest ) | [GetBlockByHashResponse ](#bdware-bdledger-api-GetBlockByHashResponse ) | Get a block identified by its hash 查询哈希所指定的区块 |
| GetBlocks | [BlocksRequest ](#bdware-bdledger-api-BlocksRequest ) | [GetBlocksResponse ](#bdware-bdledger-api-GetBlocksResponse ) | Get blocks in a timestamp range 查询时间范围内的区块 Requirement: start_timestamp < = end_timestamp If neither ' start_timestamp' nor ' end_timestamp' is specified, then ' start_timestamp' will be set to the genesis block' s timestamp, and ' end_timestamp' will be set to (start_timestamp + query.maxDuration) (query.maxDuration is specified in go-bdledger' s config file). If only ' end_timestamp' is not specified, or (end_timestamp - start_timestamp > query.maxDuration), then ' end_timestamp' will be set to (start_timestamp + query.maxDuration). If only ' start_timestamp' is not specified, then ' start_timestamp' will be set to (end_timestamp - query.maxDuration). In all cases, ' start_timestamp' will never be earlier than the genesis block' s timestamp, and ' end_timestamp' will never be later than the current timestamp when the node process the query request. |
| CountBlocks | [BlocksRequest ](#bdware-bdledger-api-BlocksRequest ) | [CountBlocksResponse ](#bdware-bdledger-api-CountBlocksResponse ) | Count all blocks in a ledger, or blocks in a timestamp range 查询帐本中的所有区块数量,或时间范围内的区块数量 Requirement: start_timestamp < = end_timestamp If neither ' start_timestamp' nor ' end_timestamp' is specified, then count all blocks in the specified ledger. If only ' end_timestamp' is not specified, then count all blocks with timestamps later than ' start_timestamp' . If only ' start_timestamp' is not specified, then count all blocks with timestamps earlier than ' end_timestamp' . In all cases, ' start_timestamp' will never be earlier than the genesis block' s timestamp, and ' end_timestamp' will never be later than the current timestamp when the node process the query request. |
| GetRecentBlocks | [RecentBlocksRequest ](#bdware-bdledger-api-RecentBlocksRequest ) | [GetBlocksResponse ](#bdware-bdledger-api-GetBlocksResponse ) | Get recent ' count' blocks (Only support IncludeTransactions=NONE for now) 查询最新的 ' count' 个区块 |
| GetTransactionByHash | [GetTransactionByHashRequest ](#bdware-bdledger-api-GetTransactionByHashRequest ) | [GetTransactionByHashResponse ](#bdware-bdledger-api-GetTransactionByHashResponse ) | Get a transaction identified by its hash 查询哈希所指定的事务 |
| GetTransactionByBlockHashAndIndex | [GetTransactionByBlockHashAndIndexRequest ](#bdware-bdledger-api-GetTransactionByBlockHashAndIndexRequest ) | [GetTransactionByBlockHashAndIndexResponse ](#bdware-bdledger-api-GetTransactionByBlockHashAndIndexResponse ) | Get a transaction identified by hash of the block it belongs to and its index inside the block 查询所在区块的哈希与其在区块中的index所指定的事务 |
| GetTransactions | [TransactionsRequest ](#bdware-bdledger-api-TransactionsRequest ) | [GetTransactionsResponse ](#bdware-bdledger-api-GetTransactionsResponse ) | Get transactions in a timestamp range 查询时间范围内的事务 ' start_timestamp' and ' end_timestamp' follow the same requirements and rules as in ' GetBlocks' . |
| CountTransactions | [TransactionsRequest ](#bdware-bdledger-api-TransactionsRequest ) | [CountTransactionsResponse ](#bdware-bdledger-api-CountTransactionsResponse ) | Count all transactions in a ledger, or transactions in a timestamp range 查询帐本中的所有事务数量,或时间范围内的事务数量 ' start_timestamp' and ' end_timestamp' follow the same requirements and rules as in ' CountBlocks' . |
2020-04-07 13:56:57 +00:00
2024-03-06 07:37:53 +00:00
< a name = "google_protobuf_empty-proto" > < / a >
2020-04-07 13:56:57 +00:00
< p align = "right" > < a href = "#top" > Top< / a > < / p >
## google/protobuf/empty.proto
2024-03-06 07:37:53 +00:00
< a name = "google-protobuf-Empty" > < / a >
2020-04-07 13:56:57 +00:00
### Empty
A generic empty message that you can re-use to avoid defining duplicated
empty messages in your APIs. A typical example is to use it as the request
or the response type of an API method. For instance:
service Foo {
rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
}
The JSON representation for `Empty` is empty JSON object `{}` .
## Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
| < a name = "double" / > double | | double | double | float | float64 | double | float | Float |
| < a name = "float" / > float | | float | float | float | float32 | float | float | Float |
| < a name = "int32" / > int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| < a name = "int64" / > int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| < a name = "uint32" / > uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| < a name = "uint64" / > uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| < a name = "sint32" / > sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| < a name = "sint64" / > sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| < a name = "fixed32" / > fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| < a name = "fixed64" / > fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| < a name = "sfixed32" / > sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| < a name = "sfixed64" / > sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| < a name = "bool" / > bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| < a name = "string" / > string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| < a name = "bytes" / > bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |