2018-10-09 05:49:36 +00:00
|
|
|
|
## Basic types
|
|
|
|
|
|
|
|
|
|
### ClientVersionResponse
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message ClientVersionResponse {
|
2018-10-09 08:48:14 +00:00
|
|
|
|
string version = 1; // 节点客户端版本
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2018-10-10 18:26:22 +00:00
|
|
|
|
### TransactionType
|
2018-10-09 05:49:36 +00:00
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
enum TransactionType {
|
|
|
|
|
RECORD = 0; // 通用数据记录
|
|
|
|
|
MESSAGE = 1; // 消息
|
|
|
|
|
CONTRACT_CREATION = 2; // 合约创建
|
|
|
|
|
CONTRACT_INVOCATION = 3; // 合约调用
|
2018-11-27 13:25:01 +00:00
|
|
|
|
CONTRACT_STATUS = 4; // 合约状态
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Transaction
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message Transaction {
|
|
|
|
|
uint64 block_number = 1; // 事务所在的区块的区块号,当事务处于待确认状态时为`null`
|
|
|
|
|
bytes block_hash = 2; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
|
|
|
|
|
uint32 index = 3; // 事务在区块中的位置index,当事务处于待确认状态时为`null`
|
|
|
|
|
bytes hash = 4; // 事务的哈希
|
|
|
|
|
TransactionType type = 5; // 事务类型
|
|
|
|
|
bytes from = 6; // 发送账户地址
|
|
|
|
|
uint64 nonce = 7; // 这条事务之前发送者所发送的事务数量
|
|
|
|
|
bytes to = 8; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
|
|
|
|
|
bytes data = 9; // 数据或合约代码
|
|
|
|
|
bytes v = 10; // ECDSA recovery id
|
|
|
|
|
bytes r = 11; // ECDSA signature r
|
|
|
|
|
bytes s = 12; // ECDSA signature s
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Block
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message Block {
|
|
|
|
|
uint64 number = 1; // 区块号,当区块处于待确认状态时为`null`
|
|
|
|
|
bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null`
|
|
|
|
|
bytes parent_hash = 3; // 父区块的哈希
|
|
|
|
|
bytes witness = 4; // 见证者账户地址
|
|
|
|
|
uint64 timestamp = 5; // 区块产生时的UNIX时间戳
|
|
|
|
|
uint64 size = 6; // 区块大小的字节数
|
|
|
|
|
bytes transactions_root = 7; // 区块的事务树根
|
|
|
|
|
repeated Transaction transactions = 8; // 事务对象的数组,或为空
|
|
|
|
|
repeated bytes transaction_hashes = 9; // 32字节的交易哈希的数组,或为空
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Transaction ledger API
|
|
|
|
|
|
|
|
|
|
### ClientVersion
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
google.protobuf.Empty
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
bdchain.api.ClientVersionResponse
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```
|
|
|
|
|
(empty)
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
|
|
|
|
version: 'TxLedgerGo/v0.0.1alpha/darwin/go1.11'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### CreateLedger
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message CreateLedgerRequest {
|
|
|
|
|
string name = 1;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Response
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```proto
|
|
|
|
|
message CreateLedgerResponse {
|
2018-10-09 08:48:14 +00:00
|
|
|
|
bool ok = 1;
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
name: 'test'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
ok: true
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 2
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
|
|
|
|
|
Client:
|
|
|
|
|
```yaml
|
|
|
|
|
name: null
|
|
|
|
|
```
|
|
|
|
|
On the wire:
|
|
|
|
|
```yaml
|
|
|
|
|
name: '' (defualt value)
|
|
|
|
|
```
|
|
|
|
|
|
2018-10-09 08:48:14 +00:00
|
|
|
|
**Error**
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
code: Code.InvalidArgument
|
|
|
|
|
message: 'name must not be empty'
|
2018-10-10 18:26:22 +00:00
|
|
|
|
details:
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetLedgers
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
google.protobuf.Empty
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetLedgersResponse {
|
2018-10-09 08:48:14 +00:00
|
|
|
|
repeated string ledgers = 1;
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```
|
|
|
|
|
(empty)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
|
|
|
|
ledgers:
|
|
|
|
|
- 'first'
|
|
|
|
|
- 'second'
|
2018-10-10 18:26:22 +00:00
|
|
|
|
- 'third'
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### SendTransaction
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message SendTransactionRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
message Transaction {
|
|
|
|
|
TransactionType type = 1;
|
|
|
|
|
bytes from = 2;
|
|
|
|
|
bytes to = 3;
|
|
|
|
|
bytes data = 4;
|
|
|
|
|
}
|
|
|
|
|
Transaction transaction = 2;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```proto
|
2018-10-10 18:26:22 +00:00
|
|
|
|
message SendTransactionResponse {
|
2018-10-09 08:48:14 +00:00
|
|
|
|
bytes hash = 1;
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
transaction:
|
|
|
|
|
type: TransactionType.MESSAGE
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
|
|
|
|
to: 0xfeedbabefeedbabefeedbabefeedbabefeedbabe (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
data: 0xdeadbeef (in bytes)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
|
|
|
|
hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in bytes)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 2
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
transaction:
|
|
|
|
|
type: TransactionType.MESSAGE
|
|
|
|
|
from: null (in bytes)
|
2018-10-09 13:32:13 +00:00
|
|
|
|
to: 0x50bada55 (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
data: null (in bytes)
|
|
|
|
|
```
|
|
|
|
|
|
2018-10-09 08:48:14 +00:00
|
|
|
|
**Error**
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
code: Code.InvalidArgument
|
2018-10-11 07:09:45 +00:00
|
|
|
|
message: 'Multiple invalid arguments'
|
2018-10-09 08:48:14 +00:00
|
|
|
|
details:
|
2018-10-11 07:09:45 +00:00
|
|
|
|
- field_violations: (of type InvalidArgument)
|
|
|
|
|
- field: 'transaction.from'
|
|
|
|
|
description: 'from must not be empty'
|
|
|
|
|
- field: 'transaction.to'
|
|
|
|
|
description: 'to must be a valid 32-byte address'
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Accounting chain API
|
|
|
|
|
|
|
|
|
|
### ClientVersion
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
google.protobuf.Empty
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
bdchain.api.ClientVersionResponse
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```
|
|
|
|
|
(empty)
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-10 18:26:22 +00:00
|
|
|
|
version: 'AcChainGo/v0.0.1alpha/darwin/go1.11'
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### BlockNumber
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message BlockNumberRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message BlockNumberResponse {
|
2018-10-09 08:48:14 +00:00
|
|
|
|
uint64 block_number = 1;
|
2018-10-09 05:49:36 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
|
|
|
|
block_number: 2018
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 2
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
|
|
|
|
|
Client:
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: null
|
|
|
|
|
```
|
|
|
|
|
On the wire:
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: '' (defualt value)
|
|
|
|
|
```
|
|
|
|
|
|
2018-10-09 08:48:14 +00:00
|
|
|
|
**Error**
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
code: Code.InvalidArgument
|
2018-10-14 13:21:24 +00:00
|
|
|
|
message: 'ledger must not be empty'
|
2018-10-09 08:48:14 +00:00
|
|
|
|
details:
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetBlockByNumber
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetBlockByNumberRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
uint64 number = 2;
|
|
|
|
|
bool full_transaction = 3;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
2018-10-09 08:48:14 +00:00
|
|
|
|
Block
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
number: 2018
|
|
|
|
|
full_transaction: true
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
parent_hash: 0xbabefacebabefacebabefacebabefacebabefacebabefacebabefacebabeface (in bytes)
|
2018-10-09 10:14:37 +00:00
|
|
|
|
witness: 0x1fee1bad1fee1bad1fee1bad1fee1bad1fee1bad (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
timestamp: 2018050400000
|
|
|
|
|
size: 20180504
|
2018-10-09 13:32:13 +00:00
|
|
|
|
transactions_root: 0x50bada5550bada5550bada5550bada5550bada5550bada5550bada5550bada55 (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
transactions:
|
|
|
|
|
- block_number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
index: 0
|
|
|
|
|
hash: 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
type: TransactionType.RECORD
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
nonce: 2018
|
2018-10-09 10:14:37 +00:00
|
|
|
|
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
data: 0xdeadbeef (in bytes)
|
|
|
|
|
v: 0x25 (in bytes)
|
|
|
|
|
r: 0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea (in bytes)
|
|
|
|
|
s: 0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c (in bytes)
|
|
|
|
|
- block_number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
index: 1
|
|
|
|
|
hash: 0x1313131313131313131313131313131313131313131313131313131313131313 (in bytes)
|
|
|
|
|
type: TransactionType.MESSAGE
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
nonce: 2019
|
2018-10-09 10:14:37 +00:00
|
|
|
|
to: 0xfeedbabefeedbabefeedbabefeedbabefeedbabe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
data: (empty bytes, default value)
|
|
|
|
|
v: 0x25 (in bytes)
|
|
|
|
|
r: 0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea (in bytes)
|
|
|
|
|
s: 0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c (in bytes)
|
|
|
|
|
transaction_hashes:
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 2
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
|
|
|
|
|
Client:
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
number: 2018
|
|
|
|
|
full_transaction: null
|
|
|
|
|
```
|
|
|
|
|
On the wire:
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
number: 2018
|
|
|
|
|
full_transaction: false (defualt value)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
parent_hash: 0xbabefacebabefacebabefacebabefacebabefacebabefacebabefacebabeface (in bytes)
|
2018-10-09 10:14:37 +00:00
|
|
|
|
witness: 0x1fee1bad1fee1bad1fee1bad1fee1bad1fee1bad (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
timestamp: 2018050400000
|
|
|
|
|
size: 20180504
|
2018-10-09 13:32:13 +00:00
|
|
|
|
transactions_root: 0x50bada5550bada5550bada5550bada5550bada5550bada5550bada5550bada55 (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
transactions:
|
|
|
|
|
transaction_hashes:
|
|
|
|
|
- 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
- 0x1313131313131313131313131313131313131313131313131313131313131313 (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetBlockByHash
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetBlockByHashRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes hash = 2;
|
|
|
|
|
bool full_transaction = 3;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
2018-10-09 08:48:14 +00:00
|
|
|
|
Block
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
2018-10-11 06:23:24 +00:00
|
|
|
|
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
full_transaction: false
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
parent_hash: 0xbabefacebabefacebabefacebabefacebabefacebabefacebabefacebabeface (in bytes)
|
2018-10-09 10:14:37 +00:00
|
|
|
|
witness: 0x1fee1bad1fee1bad1fee1bad1fee1bad1fee1bad (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
timestamp: 2018050400000
|
|
|
|
|
size: 20180504
|
2018-10-09 13:32:13 +00:00
|
|
|
|
transactions_root: 0x50bada5550bada5550bada5550bada5550bada5550bada5550bada5550bada55 (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
transactions:
|
|
|
|
|
transaction_hashes:
|
|
|
|
|
- 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
- 0x1313131313131313131313131313131313131313131313131313131313131313 (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetTransactionByHash
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetTransactionByHashRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes hash = 2;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
2018-10-09 08:48:14 +00:00
|
|
|
|
Transaction
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
hash: 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
block_number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
index: 0
|
|
|
|
|
hash: 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
type: TransactionType.RECORD
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
nonce: 2018
|
2018-10-09 10:14:37 +00:00
|
|
|
|
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
data: 0xdeadbeef (in bytes)
|
|
|
|
|
v: 0x25 (in bytes)
|
|
|
|
|
r: 0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea (in bytes)
|
|
|
|
|
s: 0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetTransactionByBlockNumberAndIndex
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetTransactionByBlockNumberAndIndexRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
uint64 block_number = 2;
|
|
|
|
|
uint32 index = 3;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
2018-10-09 08:48:14 +00:00
|
|
|
|
Transaction
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
|
|
|
|
block_number: 2018
|
|
|
|
|
index: 0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
block_number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
index: 0
|
|
|
|
|
hash: 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
type: TransactionType.RECORD
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
nonce: 2018
|
2018-10-09 10:14:37 +00:00
|
|
|
|
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
data: 0xdeadbeef (in bytes)
|
|
|
|
|
v: 0x25 (in bytes)
|
|
|
|
|
r: 0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea (in bytes)
|
|
|
|
|
s: 0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### GetTransactionByBlockHashAndIndex
|
|
|
|
|
|
|
|
|
|
#### Request
|
|
|
|
|
|
|
|
|
|
```proto
|
|
|
|
|
message GetTransactionByBlockHashAndIndexRequest {
|
|
|
|
|
string ledger = 1;
|
|
|
|
|
bytes block_hash = 2;
|
|
|
|
|
uint32 index = 3;
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-10-10 18:26:22 +00:00
|
|
|
|
|
2018-10-09 05:49:36 +00:00
|
|
|
|
#### Response
|
|
|
|
|
|
|
|
|
|
```
|
2018-10-09 08:48:14 +00:00
|
|
|
|
Transaction
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Test cases
|
|
|
|
|
|
|
|
|
|
##### 1
|
|
|
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
```yaml
|
|
|
|
|
ledger: 'test'
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
index: 0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Response**
|
|
|
|
|
```yaml
|
2018-10-09 08:48:14 +00:00
|
|
|
|
block_number: 2018
|
2018-10-11 06:23:24 +00:00
|
|
|
|
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
index: 0
|
|
|
|
|
hash: 0x0404040404040404040404040404040404040404040404040404040404040404 (in bytes)
|
|
|
|
|
type: TransactionType.RECORD
|
2018-10-09 10:14:37 +00:00
|
|
|
|
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
nonce: 2018
|
2018-10-09 10:14:37 +00:00
|
|
|
|
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
|
2018-10-09 08:48:14 +00:00
|
|
|
|
data: 0xdeadbeef (in bytes)
|
|
|
|
|
v: 0x25 (in bytes)
|
|
|
|
|
r: 0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea (in bytes)
|
|
|
|
|
s: 0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c (in bytes)
|
2018-10-09 05:49:36 +00:00
|
|
|
|
```
|