Skip to content

Commit

Permalink
modify api.md and console documents && add crypto.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Nov 9, 2020
1 parent b7a4a58 commit 37ad68b
Show file tree
Hide file tree
Showing 13 changed files with 1,261 additions and 152 deletions.
314 changes: 261 additions & 53 deletions docs/api.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/enterprise_tools/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jsonrpc_listen_port=8546
generator的模板文件夹如下图所示:

```bash
├── applicationContext.xml # sdk配置文件模板
├── config.toml # sdk配置文件模板
├── config.ini # 节点配置文件模板
├── config.ini.gm # 国密节点配置文件模板
├── group.i.genesis # 群组创世区块模板
Expand Down
9 changes: 8 additions & 1 deletion docs/enterprise_tools/operation.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ $./generator --download_fisco ./meta --cdn

## download_console

使用--download_console可以指定的目录下下载并配置控制台,国内用户可以使用`--cdn`命令从cdn下载
使用--download_console可以指定的目录下下载并配置控制台,其支持`--console_version`选项指定下载的控制台版本,默认下载最新版本控制台; 也支持`--cdn`命令从cdn下载控制台,推荐国内用户使用`--cdn`命令从cdn下载。

使用示例:

Expand All @@ -279,6 +279,13 @@ $./generator --download_console ./meta
$./generator --download_console ./meta --cdn
```

指定下载`1.2.0`版本控制台的使用示例如下:

```bash
$./generator --download_console ./meta --console_version 1.2.0 --cdn
```


执行完成后会在./meta文件夹下根据`node_deployment.ini`完成对控制台的配置

## get_sdk_file
Expand Down
114 changes: 112 additions & 2 deletions docs/manual/console_of_java_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ exception unwrapping private key - java.security.InvalidKeyException: Illegal ke
* generateGroupFromFile Generate group according to the specified file
* getAccountStatus GetAccountStatus of the account
* getAvailableConnections Get the connection information of the nodes connected with the sdk
* getBatchReceiptsByBlockHashAndRange Get batched transaction receipts according to block hash and the transaction range
* getBatchReceiptsByBlockNumberAndRange Get batched transaction receipts according to block number and the transaction range
* getBlockByHash Query information about a block by hash
* getBlockByNumber Query information about a block by number
* getBlockHashByNumber Query block hash by block number
Expand All @@ -335,8 +337,8 @@ exception unwrapping private key - java.security.InvalidKeyException: Illegal ke
* getGroupList Query group list
* getGroupPeers Query nodeId list for sealer and observer nodes
* getNodeIDList Query nodeId list for all connected nodes
* getNodeInfo Query the specified node information.
* getNodeVersion Query the current node version
* getNodeInfo Query the specified node information.
* getObserverList Query nodeId list for observer nodes.
* getPbftView Query the pbft view of node
* getPeers Query peers currently connected to the client
Expand Down Expand Up @@ -380,12 +382,15 @@ exception unwrapping private key - java.security.InvalidKeyException: Illegal ke
* queryCommitteeMemberWeight Query the committee member weight
* queryGroupStatus Query the status of the specified group of the specified node
* queryThreshold Query the threshold
* queryVotesOfMember Query votes of a committee member.
* queryVotesOfThreshold Query votes of updateThreshold operation
* recoverGroup Recover the specified group of the specified node
* registerCNS RegisterCNS information for the given contract
* removeGroup Remove the specified group of the specified node
* removeNode Remove a node
* revokeCNSManager Revoke permission for CNS by address
* revokeCommitteeMember Revoke the account from committee member
* revokeContractStatusManager Revoke contract authorization to the user
* revokeContractWritePermission Revoke the account the contract write permission
* revokeDeployAndCreateManager Revoke permission for deploy contract and create user table by address
* revokeNodeManager Revoke permission for node configuration by address
Expand Down Expand Up @@ -1818,7 +1823,6 @@ Account: 0x61d88abf7ce4a7f8479cff9cc1422bef2dac9b9a Weight: 1
}
```


### grantOperator

添加运维账号,运维角色拥有部署合约、创建用户表和管理CNS的权限,治理委员会委员可以添加运维,如果当前没有委员,则不限制。参数:
Expand Down Expand Up @@ -1859,6 +1863,26 @@ Account: 0x61d88abf7ce4a7f8479cff9cc1422bef2dac9b9a Weight: 1
---------------------------------------------------------------------------------------------
```

### queryVotesOfThreshold

查询updateThreshold的投票情况:

```bash
[group:1]> queryVotesOfThreshold
The votes of the updateThreshold operation : {"0.100000":[{"block_limit":"10002","origin":"0x2eb1be0f52c0d00f9594a021240ea7fb027d7485"}]}
```
### queryVotesOfMember

查询指定账户被选举为委员的投票情况,若没有任何委员投票,则返回`null`:

- 账户地址: 被查询的账户地址

```bash
[group:1]> queryVotesOfMember 0xc398d318662aa19487c405a45267ecd60115adec
queried account: 0xc398d318662aa19487c405a45267ecd60115adec
votes:{"grant":[{"block_limit":"10003","origin":"0x2eb1be0f52c0d00f9594a021240ea7fb027d7485"}]}
```

### **freezeAccount**
运行freezeAccount,对指定账号进行冻结操作。对没有发送过交易的账号,冻结操作将提示该账号地址不存在。参数:

Expand Down Expand Up @@ -2144,4 +2168,90 @@ GroupStatus{
# 获取127.0.0.1:20200的当前群组列表, 新增了群组2
[group:1]> getGroupList 127.0.0.1:20200
[1, 2]
```

### getBatchReceiptsByBlockNumberAndRange

指定块高和交易回执范围,获取指定区块高度、指定范围的交易回执:

- `blockNumber`: 请求获取的交易回执所在的区块高度
- `from`: 请求的批量回执的起始索引,可不填,默认值为0
- `count`: 请求的批量回执数目,可不填,默认值为-1,设置为-1时,返回区块内所有交易回执

```bash
[group:1]> getBatchReceiptsByBlockNumberAndRange 1
TransactionReceiptsInfo{
blockInfo=BlockInfo{
receiptRoot='0x67182babfe1500a8ec442a8b9548e7d0d912af4943c3d549bdf9ed0c76fe8c11',
blockNumber='0x1',
blockHash='0x5eb495f6fa457dbcaf6323630a257a65a7085e01087421b7191d8efec69da0c0',
receiptsCount='0x1'
},
transactionReceipts=[
TransactionReceipt{
transactionHash='0xa3ce50e3f03d3282e21248172efd1345b9eb15b281791b499f2e6c7bbe464667',
transactionIndex='0x0',
root='null',
blockNumber='null',
blockHash='null',
from='0x2eb1be0f52c0d00f9594a021240ea7fb027d7485',
to='0x0000000000000000000000000000000000001008',
gasUsed='0x589b',
contractAddress='0x0000000000000000000000000000000000000000',
logs=[

],
logsBloom='null',
status='0x0',
statusMsg='null',
input='null',
output='0x0000000000000000000000000000000000000000000000000000000000000001',
txProof=null,
receiptProof=null
}
]
}
```

### getBatchReceiptsByBlockHashAndRange

指定区块哈希和交易回执范围,获取指定区块哈希、指定范围的交易回执:

- `blockHash`: 请求获取的交易回执所在的区块哈希
- `from`: 请求的批量回执的起始索引,可不填,默认值为0
- `count`: 请求的批量回执数目,可不填,默认值为-1,设置为-1时,返回区块内所有交易回执

```bash
[group:1]> getBatchReceiptsByBlockHashAndRange 0x5eb495f6fa457dbcaf6323630a257a65a7085e01087421b7191d8efec69da0c0
TransactionReceiptsInfo{
blockInfo=BlockInfo{
receiptRoot='0x67182babfe1500a8ec442a8b9548e7d0d912af4943c3d549bdf9ed0c76fe8c11',
blockNumber='0x1',
blockHash='0x5eb495f6fa457dbcaf6323630a257a65a7085e01087421b7191d8efec69da0c0',
receiptsCount='0x1'
},
transactionReceipts=[
TransactionReceipt{
transactionHash='0xa3ce50e3f03d3282e21248172efd1345b9eb15b281791b499f2e6c7bbe464667',
transactionIndex='0x0',
root='null',
blockNumber='null',
blockHash='null',
from='0x2eb1be0f52c0d00f9594a021240ea7fb027d7485',
to='0x0000000000000000000000000000000000001008',
gasUsed='0x589b',
contractAddress='0x0000000000000000000000000000000000000000',
logs=[

],
logsBloom='null',
status='0x0',
statusMsg='null',
input='null',
output='0x0000000000000000000000000000000000000000000000000000000000000001',
txProof=null,
receiptProof=null
}
]
}
```
26 changes: 8 additions & 18 deletions docs/manual/distributed_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ mysql依次从/etc/mysql/my.cnf,/etc/my.cnf,~/.my.cnf中加载配置。依
```
max_allowed_packet = 1024M
sql_mode =STRICT_TRANS_TABLES
ssl=0
default_authentication_plugin = mysql_native_password
```

### 重启mysql-sever,验证参数。
Expand Down Expand Up @@ -104,7 +106,7 @@ FISCO BCOS在2.0.0-rc3之后,支持节点通过连接池直连MySQL,相对
```bash
mkdir -p ~/fisco && cd ~/fisco
# 获取build_chain.sh脚本
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.6.0/build_chain.sh && chmod u+x build_chain.sh
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.7.0/build_chain.sh && chmod u+x build_chain.sh
```
#### 生成配置文件
```bash
Expand Down Expand Up @@ -237,27 +239,15 @@ info|2019-05-28 16:26:40.498838|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generat
#### 准备依赖
```bash
cd ~/fisco;
curl -#LO https://github.com/FISCO-BCOS/console/releases/download/v1.1.0/download_console.sh && bash download_console.sh
cp -n console/conf/applicationContext-sample.xml console/conf/applicationContext.xml
curl -#LO https://github.com/FISCO-BCOS/console/releases/download/v2.7.0/download_console.sh && bash download_console.sh
cp -n console/conf/config-example.toml console/conf/config-example.toml
cp nodes/127.0.0.1/sdk/* console/conf/
```
#### 修改配置文件
~/fisco/console/conf/applicationContext.xml修改为如下配置(部分信息)
~/fisco/console/conf/config.toml修改为如下配置(部分信息)
```bash
<bean id="groupChannelConnectionsConfig" class="org.fisco.bcos.channel.handler.GroupChannelConnectionsConfig">
<property name="allChannelConnections">
<list>
<bean id="group1" class="org.fisco.bcos.channel.handler.ChannelConnections">
<property name="groupId" value="1" />
<property name="connectionsStr">
<list>
<value>127.0.0.1:20200</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
[network]
peers=["127.0.0.1:20300", "127.0.0.1:20301"] # The peer list to connect
```
#### 启用控制台
```bash
Expand Down
85 changes: 85 additions & 0 deletions docs/sdk/java_sdk/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,27 @@ Java SDK为区块链应用开发者提供了Java API接口,按照功能,Java

**返回值**
- List<PermissionInfo>: 运维管理员列表。


#### queryVotesOfMember

查询指定账户被选举为委员账户的投票情况

**参数**
- `account`: 被查询的账户地址

**返回值**
- `String`: 返回该账户被选举为委员账户的投票情况;若没有任何委员选举该账户,则返回null字符串

#### queryVotesOfThreshold

查询updateThreshold的投票情况

**参数**
-

**返回值**
- String: updateThreshold的投票情况,当没有任何委员更新threshold时,返回null字符串。

#### freezeAccount
冻结指定账户,被冻结的账户不能部署和调用合约。
Expand Down Expand Up @@ -1006,3 +1027,67 @@ Java SDK为区块链应用开发者提供了Java API接口,按照功能,Java

**返回值**
- String: 查询到的合约地址。


### getBatchReceiptsByBlockNumberAndRange

根据区块高度和交易范围,批量返回群组内的交易回执信息。

#### **参数**

- `blockNumber`: 请求获取的回执信息所在的区块高度;
- `from`: 需要获取的回执起始索引;
- `count`: 需要批量获取的回执数目,当设置为-1时,返回区块内所有回执信息;

#### **返回值**

- `BcosTransactionReceiptsDecoder`: 包含压缩编码信息的交易回执数据,调用`decodeTransactionReceiptsInfo`方法可将压缩的交易回执转换为`TransactionReceiptsInfo`对象,并可通过该对象获取交易回执具体信息

**示例:**

```java
// 获取最新区块高度的所有交易回执信息(cient初始化过程省略,详细可以参考快速入门)
BcosTransactionReceiptsDecoder bcosTransactionReceiptsDecoder =
client.getBatchReceiptsByBlockNumberAndRange(
client.getBlockNumber().getBlockNumber(), "0", "-1");
// 解码交易回执信息
BcosTransactionReceiptsInfo.TransactionReceiptsInfo receiptsInfo = bcosTransactionReceiptsDecoder.decodeTransactionReceiptsInfo();
// 获取回执所在的区块信息
BcosTransactionReceiptsInfo.BlockInfo blockInfo = receiptsInfo.getBlockInfo();
// 获取交易回执列表
List<TransactionReceipt> receiptList = receiptsInfo.getTransactionReceipts();

```

### getBatchReceiptsByBlockHashAndRange

根据区块哈希和交易范围,批量返回群组内的交易回执信息。

#### **参数**

- `blockHash`: 请求获取的回执信息所在的区块哈希;
- `from`: 需要获取的回执起始索引;
- `count`: 需要批量获取的回执数目,当设置为-1时,返回区块内所有回执信息;

#### **返回值**

- `BcosTransactionReceiptsDecoder`: 包含压缩编码信息的交易回执数据,调用`decodeTransactionReceiptsInfo`方法可将压缩的交易回执转换为`TransactionReceiptsInfo`对象,并可通过该对象获取交易回执具体信息

**示例:**

```java
// 获取最新区块的所有交易回执信息(cient初始化过程省略,详细可以参考快速入门)
BcosTransactionReceiptsDecoder bcosTransactionReceiptsDecoder =
client.getBatchReceiptsByBlockHashAndRange(
client.getBlockHashByNumber(client.getBlockNumber().getBlockNumber())
.getBlockHashByNumber(),
"0",
"-1");
// 解码交易回执信息
BcosTransactionReceiptsInfo.TransactionReceiptsInfo receiptsInfo = bcosTransactionReceiptsDecoder.decodeTransactionReceiptsInfo();
// 获取回执所在的区块信息
BcosTransactionReceiptsInfo.BlockInfo blockInfo = receiptsInfo.getBlockInfo();
// 获取交易回执列表
List<TransactionReceipt> receiptList = receiptsInfo.getTransactionReceipts();

```

0 comments on commit 37ad68b

Please sign in to comment.