Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release neo3 #945

Merged
merged 14 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/zh-cn/assets/system_fee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 28 additions & 52 deletions docs/zh-cn/reference/rpc/latest-version/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,6 @@

`dotnet neo-cli.dll /rpc`

## 修改配置文件

若要通过 HTTPS 的方式访问 RPC 服务器,需要在启动节点前修改配置文件 `config.json`,并设置域名、证书和密码:

```json
{
"ApplicationConfiguration": {
"Paths": {
"Chain": "Chain"
},
"P2P": {
"Port": 10333,
"WsPort": 10334
},
"RPC": {
"Port": 10331,
"SslCert": "YourSslCertFile.xxx",
"SslCertPassword": "YourPassword"
}
...
```

如果要调用与钱包相关的 API,也需要先修改配置文件 `config.json`,将 unlockwallet 改为 true 的状态,并填写对象钱包的文件名和密码,如下所示:

```json
...
"UnlockWallet": {
"Path": "YourWallet.json",
"Password": "YourPassword",
"StartConsensus": false,
"IsActive": true
}
...
```

完成配置后打开 NEO-CLI,客户端会在同步到最新区块后自动打开已配置的钱包并进行钱包索引同步。

## 监听端口

JSON-RPC 服务器启动后,会监听 TCP 端口,默认端口如下。P2P 和 WebSocket 的端口详见 [NEO 节点介绍](../../../node/introduction.md)。
Expand All @@ -52,43 +15,56 @@ JSON-RPC 服务器启动后,会监听 TCP 端口,默认端口如下。P2P

## 命令列表

> [!Note]
>
> **NEO3 变更**:
>
> 调用方式更新:getblockheader,getrawmempool
>
> 返回结果更新:getblock,getblockheader,getrawtransaction,getversion,getcontractstate

| 方法 | 参数 | 说明 | 备注 |
| ---------------------------------------- | ---------------------------------------- | ---------------------------- | -------- |
| [dumpprivkey](api/dumpprivkey.md) | \<address> | 导出指定地址的私钥 | 需要打开钱包 |
| [getapplicationlog](api/getapplicationlog.md) | \<txid> | 根据指定的 NEP-5 交易 ID 获取合约日志。 | |
| [getbalance](api/getbalance.md) | \<asset_id> | 根据指定的资产编号,返回钱包中对应资产的余额信息 | 需要打开钱包 |
| [getbestblockhash](api/getbestblockhash.md) | | 获取主链中高度最大的区块的散列 | |
| [getblock](api/getblock.md) | \<hash> [verbose=0] | 根据指定的散列值,返回对应的区块信息 | |
| [getblock](api/getblock2.md) | \<index> [verbose=0] | 根据指定的索引,返回对应的区块信息 | |
| | \<index> [verbose=0] | 根据指定的索引,返回对应的区块信息 | |
| [getblockcount](api/getblockcount.md) | | 获取主链中区块的数量 | |
| [getblockhash](api/getblockhash.md) | \<index> | 根据指定的索引,返回对应区块的散列值 | |
| [getblockheader](api/getblockheader.md) | \<hash> [verbose=0] | 根据指定的散列值,返回对应的区块头信息。 | |
| | \<index> [verbose=0] | 根据指定的索引,返回对应的区块头信息。 | |
| [getblocksysfee](api/getblocksysfee.md) | \<index> | 根据指定的索引,返回截止到该区块前的系统手续费 | |
| [getconnectioncount](api/getconnectioncount.md) | | 获取节点当前的连接数 | |
| [getcontractstate](api/getcontractstate.md) | \<script_hash> | 根据合约脚本散列,查询合约信息 | |
| [getmetricblocktimestamp](api/getmetricblocktimestamp.md) | \<blocks numbers> \<endHeight> | 返回指定区块高度及之前 n 个区块的 timestamp。 | |
| [getnep5balances](api/getnep5balances.md) | \<address> | 返回指定地址内的所有 NEP-5 资产余额。 | |
| [getnep5transfers](api/getnep5transfers.md) | \<address> | 返回指定地址内的所有 NEP-5 交易记录。 | |
| [getnewaddress](api/getnewaddress.md) | | 创建一个新的地址 | 需要打开钱包 |
| [getrawmempool](api/getrawmempool.md) | | 获取内存中未确认的交易列表 | |
| [getpeers](api/getpeers.md) | | 获得该节点当前已连接/未连接的节点列表 | |
| [getrawmempool](api/getrawmempool.md) | [shouldGetUnverified=0] | 获取内存中未确认的交易列表 | |
| [getrawtransaction](api/getrawtransaction.md) | \<txid> [verbose=0] | 根据指定的散列值,返回对应的交易信息 | |
| [getstorage](api/getstorage.md) | \<script_hash> \<key> | 根据合约脚本散列和存储的 key,返回存储的 value | |
| [gettransactionheight](api/gettransactionheight.md) | \<txid> | 获取交易高度。 | |
| [getpeers](api/getpeers.md) | | 获得该节点当前已连接/未连接的节点列表 | |
| [getunclaimedgas](api/getunclaimedgas.md) | | 显示钱包中未提取的 GAS 数量。 | 需要打开钱包 |
| [getversion](api/getversion.md) | | 获取查询节点的版本信息 | |
| [getvalidators](api/getvalidators.md) | | 查看当前共识节点的信息 | |
| [importprivkey](api/importprivkey.md) | | 导入私钥到钱包 | 需要打开钱包 |
| [getversion](api/getversion.md) | | 获取查询节点的版本信息 | |
| [invokefunction](api/invokefunction.md) | \<script_hash> \<operation> \<params> | 以指定的脚本散列值调用智能合约,传入操作及参数 | |
| [invokescript](api/invokescript.md) | \<script> | 通过虚拟机运行脚本并返回结果 | |
| [listaddress](api/listaddress.md) | | 列出当前钱包内的所有地址 | 需要打开钱包 |
| [listplugins](api/listplugins.md) | | 列出节点已加载的所有插件。 | |
| [sendrawtransaction](api/sendrawtransaction.md) | \<hex> | 广播交易 | |
| [sendfrom](api/sendfrom.md) | \<asset_id> \<from>\<to> \<value> [fee=0] | 从指定地址,向指定地址转账 | 需要打开钱包 |
| [sendtoaddress](api/sendtoaddress.md) | \<asset_id> \<address> \<value> [fee=0] | 向指定地址转账 | 需要打开钱包 |
| [sendmany](api/sendmany.md) | \<outputs_array> \[fee=0] \[change_address] | 批量转账命令 | 需要打开钱包 |
| [submitblock](api/submitblock.md) | \<hex> | 提交新的区块 | 需要成为共识节点 |
| [validateaddress](api/validateaddress.md) | \<address> | 验证地址是否是正确的 NEO 地址 | |
| [validateaddress](api/validateaddress.md) | \<address> | 验证地址是否是正确的 Neo 地址 | |

## RpcWallet 插件

| 方法 | 参数 | 说明 | 备注 |
| ----------- | ---------- | ------------- | -------- |
| [dumpprivkey ](api/rpcwallets/dumpprivkey.md) | \<address> | 导出指定地址的私钥 | |
| [getbalance](api/rpccwallets/getbalance.md) | \<asset_id> | 查询资产余额 | |
| [getnewaddress](/api/rpcwallets/getnewaddress.md) | | 创建一个新的地址 | |
| [getunclaimedgas](/api/rpcwallets/getunclaimedgas.md) | | 显示钱包中未提取的 GAS 数量 | |
| [importprivkey](/api/rpcwallets/importprivkey.md) | \<key> | 导入私钥到钱包 | |
| [listaddress](/api/rpcwallets/listaddress.md) | | 列出当前钱包内的所有地址 | |
| [sendfrom](/api/rpcwallets/sendfrom.md) | \<asset_id>\<from>\<to>\<value> | 从指定地址,向指定地址转账 | |
| [sendmany](/api/rpcwallets/sendmany.md) | \<outputs_array> | 在一笔交易中向指定地址发起多笔转账 | |
| [sendtoaddress](/api/rpcwallets/sendtoaddress.md) | \<asset_id>\<address>\<value> | 向指定地址转账 | |


## GET 请求示例
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# getbestblockhash 方法
# getbestblockhash 方法

获取主链中高度最大的区块的散列。

Expand Down Expand Up @@ -28,4 +28,3 @@
响应说明:

result:主链中高度最大的区块的散列。

99 changes: 56 additions & 43 deletions docs/zh-cn/reference/rpc/latest-version/api/getblock.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# getblock 方法
# getblock 方法

根据指定的散列值,返回对应的区块信息。

## 参数说明
```json
{
"jsonrpc": "2.0",
"method": "getblock",
"params": [hash, verbose],
"id": 1
}
```
### 参数说明

hash:区块散列值
* hash:区块散列值

verbose:可选参数,verbose 默认值为 0,verbose 为 0 时返回的是区块的序列化后的信息,用 16 进制字符串表示,如果从中获取详细信息需要调用 SDK 来进行反序列化。verbose 为 1 时返回的是对应区块的详细信息,用 Json 格式字符串表示。
* verbose:可选参数,verbose 默认值为 0
* verbose = 0:返回的是区块序列化后的信息,用 16 进制字符串表示,如果从中获取详细信息需要调用 SDK 来进行反序列化。
* verbose = 1:返回的是对应区块的详细信息,用 Json 格式字符串表示。

## 调用示例

Expand All @@ -16,7 +26,7 @@ verbose:可选参数,verbose 默认值为 0,verbose 为 0 时返回的是
{
"jsonrpc": "2.0",
"method": "getblock",
"params": ["773dd2dae4a9c9275290f89b56e67d7363ea4826dfd4fc13cc01cf73a44b0d0e"],
"params": ["479d71eae26a817647a373381f21de06c5e4bf3ee7717c948f006ce8e25441be"],
"id": 1
}
```
Expand All @@ -27,7 +37,7 @@ verbose:可选参数,verbose 默认值为 0,verbose 为 0 时返回的是
{
"jsonrpc": "2.0",
"id": 1,
"result": "000000002deadfa82cbc4682f5800ec72a8d8bd6afa469af5b2de83a51d28795a893222816f8081bf1054136cca420f807f844a958b2dea482dfc99d2538ef9c77d13320f9263659d4220f00878f40bd841c552a59e75d652b5d3827bf04c165bbe9ef95cca4bf5501fd450140b514d8562ad3badac0e097a502a43c58e23c75029dad8ccdb3b1ce221067d73d5612950e38c7565d6b166ef62894399a6f152c38a1bdb8c7d3715f75f20c1c7340e443f55108c5eefd99f954e06b21e97a4f0cf64dbd4e52426c27f7046cd880d6a7b1a507131c39afa48b9cac16411d6f84ec2f0b5d9977e5f1e3ce760a127b31409b8a52714b37a3b0970a19b4fb2669d2aa41ea85e05e68dfb03a197d505282dd53846ca58b1457504c65759a9ceb8f84f5148dec71727e9c743e986092728174401862c08611338be8e352b9110b2bb6d11ce0485286d857162deb417f1cb920d6727f8e6edbe1b7fce8d9b122523d5b45cfd02ab1ca002a58e28c8903ad764a84409dfcbda69cef1164936212e8e5d91965c8a976dc8dbcb5ea7d2f2d2f0105dadb902924559fede016a1f76a2c7ab0ff89a6446b0c19c88375906c8b9eccb61bc1f1552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae010000878f40bd00000000"
"result": "0000000000000000000000000000000000000000000000000000000000000000000000008e29af06ec157a3d85717b1eb7317c3ef4049a7222d76c6dd4d5a24598c6571665fc885700000000f071d5fc6d2e2978a45842f05b1ac970e87d197700015102001dac2b7c0000000000000000000568123e7fe8da1745e9b549bd0bfa1a569971c77eba30cd5a4b000000000000000000000000000000000000000000000151"
}
```

Expand All @@ -39,7 +49,7 @@ verbose = 1,返回 JSON 格式的结果。
{
"jsonrpc": "2.0",
"method": "getblock",
"params": ["773dd2dae4a9c9275290f89b56e67d7363ea4826dfd4fc13cc01cf73a44b0d0e", 1],
"params": ["479d71eae26a817647a373381f21de06c5e4bf3ee7717c948f006ce8e25441be", 1],
"id": 1
}
```
Expand All @@ -48,42 +58,45 @@ verbose = 1,返回 JSON 格式的结果。

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hash": "0x773dd2dae4a9c9275290f89b56e67d7363ea4826dfd4fc13cc01cf73a44b0d0e",
"size": 686,
"version": 0,
"previousblockhash": "0x282293a89587d2513ae82d5baf69a4afd68b8d2ac70e80f58246bc2ca8dfea2d",
"merkleroot": "0x2033d1779cef38259dc9df82a4deb258a944f807f820a4cc364105f11b08f816",
"time": 1496721145,
"index": 991956,
"nonce": "2a551c84bd408f87",
"nextconsensus": "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR",
"script": {
"invocation": "40b514d8562ad3badac0e097a502a43c58e23c75029dad8ccdb3b1ce221067d73d5612950e38c7565d6b166ef62894399a6f152c38a1bdb8c7d3715f75f20c1c7340e443f55108c5eefd99f954e06b21e97a4f0cf64dbd4e52426c27f7046cd880d6a7b1a507131c39afa48b9cac16411d6f84ec2f0b5d9977e5f1e3ce760a127b31409b8a52714b37a3b0970a19b4fb2669d2aa41ea85e05e68dfb03a197d505282dd53846ca58b1457504c65759a9ceb8f84f5148dec71727e9c743e986092728174401862c08611338be8e352b9110b2bb6d11ce0485286d857162deb417f1cb920d6727f8e6edbe1b7fce8d9b122523d5b45cfd02ab1ca002a58e28c8903ad764a84409dfcbda69cef1164936212e8e5d91965c8a976dc8dbcb5ea7d2f2d2f0105dadb902924559fede016a1f76a2c7ab0ff89a6446b0c19c88375906c8b9eccb61bc1",
"verification": "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae"
},
"tx": [
{
"txid": "0x2033d1779cef38259dc9df82a4deb258a944f807f820a4cc364105f11b08f816",
"size": 10,
"type": "MinerTransaction",
"jsonrpc": "2.0",
"id": "1",
"result": {
"hash": "0x479d71eae26a817647a373381f21de06c5e4bf3ee7717c948f006ce8e25441be",
"size": 164,
"version": 0,
"attributes": [],
"vin": [],
"vout": [],
"sys_fee": "0",
"net_fee": "0",
"scripts": [],
"nonce": 3175124871
}
],
"confirmations": 20,
"nextblockhash": "0x0b08e2eeed05c70f27293521c47f7f60dfc29f9f299ae9909a8552a4a87db7a2"
}
"previousblockhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"merkleroot": "0x1657c69845a2d5d46d6cd722729a04f43e7c31b71e7b71853d7a15ec06af298e",
"time": 1468595301,
"index": 0,
"nextconsensus": "AdhEBzaBZujuj5kEiwvKmMVy5ydqj3AC3V",
"witness": {
"invocation": "",
"verification": "51"
},
"consensus_data": {
"primary": 0,
"nonce": "000000007c2bac1d"
},
"tx": [
{
"txid": "0xdd4372964d52e800e07b7d1c536a0ad29022edbf506603c01a4efa6cc0b4e1c6",
"size": 55,
"version": 0,
"nonce": 0,
"script": "68123e7fe8",
"sender": "Abf2qMs1pzQb8kYk9RuxtUb9jtRKJVuBJt",
"gas": "0",
"net_fee": "0",
"valid_until_block": 0,
"attributes": [ ],
"witness": {
"invocation": "",
"verification": "51"
}
}
],
"confirmations": 6180,
"nextblockhash": "0x1c00023b24ba5328918f4a0adc35607c8f97913fdda88b4eb4c571e7bc613bf4"
}
}
```



Loading