From bd820047c545b742a6c4f7d8bd2e2d4d5b76aad3 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 5 Nov 2020 14:34:48 +0800 Subject: [PATCH 1/7] update rpc api --- .../zh-cn/reference/rpc/latest-version/api.md | 2 + .../latest-version/api/calculatenetworkfee.md | 38 ++++++++++++++ .../rpc/latest-version/api/getcommittee.md | 51 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md create mode 100644 docs/zh-cn/reference/rpc/latest-version/api/getcommittee.md diff --git a/docs/zh-cn/reference/rpc/latest-version/api.md b/docs/zh-cn/reference/rpc/latest-version/api.md index d538bb1b2..5009159ca 100644 --- a/docs/zh-cn/reference/rpc/latest-version/api.md +++ b/docs/zh-cn/reference/rpc/latest-version/api.md @@ -30,6 +30,7 @@ JSON-RPC 服务器启动后,会监听 TCP 端口,默认端口如下。P2P | [getstorage](api/getstorage.md) | \ \ | 根据合约脚本散列和存储的 key,返回存储的 value | | [gettransactionheight](api/gettransactionheight.md) | \ | 根据交易哈希获取交易所在的区块高度 | | [getvalidators](api/getvalidators.md) | | 查看当前共识节点的信息 | +| [getcommittee](api/getcommittee.md) | | 获取委员会成员公钥列表 | ### 节点 @@ -66,6 +67,7 @@ JSON-RPC 服务器启动后,会监听 TCP 端口,默认端口如下。P2P | [getnewaddress](api/getnewaddress.md) | | 创建一个新的地址 | | [getwalletunclaimedgas](api/getwalletunclaimedgas.md) | | 显示钱包中未提取的 GAS 数量 | | [importprivkey](api/importprivkey.md) | \ | 导入私钥到钱包 | +| [calculatenetworkfee](api/calculatenetworkfee.md) | \ | 计算指定交易的网络费GAS | | [listaddress](api/listaddress.md) | | 列出当前钱包内的所有地址 | | [openwallet](api/openwallet.md) | \ \ | 打开指定钱包 | | [sendfrom](api/sendfrom.md) | \\\\ | 从指定地址,向指定地址转账 | diff --git a/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md b/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md new file mode 100644 index 000000000..e353fb9f5 --- /dev/null +++ b/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md @@ -0,0 +1,38 @@ +# calculatenetworkfee 方法 + +计算指定交易的网络费GAS。 + +> [!Note] +> +> - 执行此命令前需要 RPC 调用 openwallet 方法来打开钱包。 +> - 此方法由插件提供,需要安装 [RpcServer](https://github.com/neo-project/neo-modules/releases) 插件才可以调用。 + +## 参数说明 + +tx :交易信息Base64编码的字符串。 + +## 调用示例 + +请求正文: + +```json +{ + "jsonrpc": "2.0", + "method": "calculatenetworkfee", + "params": ["AAzUzgl2c4kAAAAAAMhjJAAAAAAAmRQgAAKDHlc9J/rM4KzhpixYX/fRkt2q8ACBubhEJKzaXrq9mt5PesW40qC01AEAXQMA6HZIFwAAAAwUgx5XPSf6zOCs4aYsWF/30ZLdqvAMFIG5uEQkrNpeur2a3k96xbjSoLTUE8AMCHRyYW5zZmVyDBS8r0HWhMfUrW7g2Z2pcHudHwyOZkFifVtSOAJCDED0lByRy1/NfBDdKCFLA3RKAY+LLVeXAvut42izfO6PPsKX0JeaL959L0aucqcxBJfWNF3b+93mt9ItCxRoDnChKQwhAuj/F8Vn1i8nT+JHzIhKKmzTuP0Nd5qMWFYomlYKzKy0C0GVRA14QgxAMbiEtF4zjCUjGAzanxLckFiCY3DeREMGIxyerx5GCG/Ki0LGvNzbvPUAWeVGvbL5TVGlK55VfZECmy8voO1LsisRDCEC6P8XxWfWLydP4kfMiEoqbNO4/Q13moxYViiaVgrMrLQRC0ETje+v"], + "id": 1 +} +``` + +响应正文: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "networkfee": 2384840 + } +} + +``` diff --git a/docs/zh-cn/reference/rpc/latest-version/api/getcommittee.md b/docs/zh-cn/reference/rpc/latest-version/api/getcommittee.md new file mode 100644 index 000000000..3264ec82c --- /dev/null +++ b/docs/zh-cn/reference/rpc/latest-version/api/getcommittee.md @@ -0,0 +1,51 @@ +# getcommittee 方法 + +获取当前 NEO 委员会成员公钥列表。 +> [!Note] +> +> 此方法由插件提供,需要安装 [RpcServer](https://github.com/neo-project/neo-modules/releases) 插件才可以调用。 + +## 调用示例 + +请求正文: + +```json +{ + "jsonrpc": "2.0", + "method": "getcommittee", + "params": [], + "id": 1 +} +``` + +响应正文: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": [ + "020f2887f41474cfeb11fd262e982051c1541418137c02a0f4961af911045de639", + "03204223f8c86b8cd5c89ef12e4f0dbb314172e9241e30c9ef2293790793537cf0", + "0222038884bbd1d8ff109ed3bdef3542e768eef76c1247aea8bc8171f532928c30", + "0226933336f1b75baa42d42b71d9091508b638046d19abd67f4e119bf64a7cfb4d", + "023a36c72844610b4d34d1968662424011bf783ca9d984efa19a20babf5582f3fe", + "03409f31f0d66bdc2f70a9730b66fe186658f84a8018204db01c106edc36553cd0", + "02486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a70", + "024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d", + "02504acbc1f4b3bdad1d86d6e1a08603771db135a73e61c9d565ae06a1938cd2ad", + "03708b860c1de5d87f5b151a12c2a99feebd2e8b315ee8e7cf8aa19692a9e18379", + "0288342b141c30dc8ffcde0204929bb46aed5756b41ef4a56778d15ada8f0c6654", + "02a62c915cf19c7f19a50ec217e79fac2439bbaad658493de0c7d8ffa92ab0aa62", + "02aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e", + "03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c", + "03b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a", + "03c6aa6e12638b36e88adc1ccdceac4db9929575c3e03576c617c49cce7114a050", + "02ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba554", + "02cd5a5547119e24feaa7c2a0f37b8c9366216bab7054de0065c9be42084003c8a", + "03cdcea66032b82f5c30450e381e5295cae85c5e6943af716cc6b646352a6067dc", + "03d281b42002647f0113f36c7b8efb30db66078dfaaa9ab3ff76d043a98d512fde", + "02df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093" + ] +} +``` \ No newline at end of file From 906eef7165707dce4ad0e1b35d2bc13ea740d60c Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 5 Nov 2020 14:48:28 +0800 Subject: [PATCH 2/7] fix --- .../reference/rpc/latest-version/api/calculatenetworkfee.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md b/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md index e353fb9f5..669b66c6d 100644 --- a/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md +++ b/docs/zh-cn/reference/rpc/latest-version/api/calculatenetworkfee.md @@ -4,7 +4,6 @@ > [!Note] > -> - 执行此命令前需要 RPC 调用 openwallet 方法来打开钱包。 > - 此方法由插件提供,需要安装 [RpcServer](https://github.com/neo-project/neo-modules/releases) 插件才可以调用。 ## 参数说明 From 92f5d4332fb4f8093b67bf546c5b9bcf15c3cf0f Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 5 Nov 2020 17:37:44 +0800 Subject: [PATCH 3/7] update sc api --- docs/zh-cn/reference/scapi/api/System.md | 32 ++++++++++- docs/zh-cn/reference/scapi/api/neo.md | 71 +++++++++++++++++++----- 2 files changed, 89 insertions(+), 14 deletions(-) diff --git a/docs/zh-cn/reference/scapi/api/System.md b/docs/zh-cn/reference/scapi/api/System.md index b7afce9e6..8e71f279f 100644 --- a/docs/zh-cn/reference/scapi/api/System.md +++ b/docs/zh-cn/reference/scapi/api/System.md @@ -6,8 +6,12 @@ | API | 说明 | |--|--| -| System.Binary.Base64Decode| 将栈元素解码为字节数组 | +| System.Binary.Base64Decode| 将Base64编码的字符串解码为字节数组 | | System.Binary.Base64Encode | 将字节数组编码为Base64字符串 | +| System.Binary.Serialize| 将栈元素序列化为字节数组 | +| System.Binary.Deserialize | 将字节数组反序列化为栈元素 | +| System.Binary.Base58Decode | 将Base58编码的字符串解码为字节数组 | +| System.Binary.Base58Encode| 将字节数组编码为Base58字符串 | **BlockChain API**: @@ -20,6 +24,15 @@ |System.Blockchain.GetTransactionFromBlock|根据区块中交易ID获取交易| |System.Blockchain.GetContract|根据合约哈希获取合约| +**Callback API**: + +| API | 说明 | +|--|--| +|System.Callback.Create|根据栈指针创建回调服务| +|System.Callback.CreateFromMethod|创建指定合约指定方法的回调服务| +|System.Callback.CreateFromSyscall|创建系统调用的回调服务| +|System.Callback.Invoke|调用回调方法| + **Contract API**: | API | 说明 | @@ -30,6 +43,18 @@ |System.Contract.Call|调用合约| |System.Contract.CallEx|根据Flag调用合约| |System.Contract.IsStandard|判断合约是否为标准的单签或多签合约| +|System.Contract.GetCallFlags|获取当前上下文的执行权限| + +**Crypto API**: + +| API | 说明 | +|--|--| +|System.Crypto.RIPEMD160|计算栈元素的RIPEMD160哈希值| +|System.Crypto.SHA256|计算栈元素的Sha256哈希值| +|System.Crypto.VerifyWithECDsaSecp256r1|使用Secp256r1曲线验证单签| +|System.Crypto.VerifyWithECDsaSecp256k1|使用Secp256k1曲线验证单签| +|System.Crypto.CheckMultisigWithECDsaSecp256r1|使用Secp256r1曲线验证多签| +|System.Crypto.CheckMultisigWithECDsaSecp256k1|使用Secp256k1曲线验证多签| **Enumerator API**: @@ -64,9 +89,14 @@ |System.Runtime.Platform|获取当前执行智能合约的平台信息| |System.Runtime.GetTrigger|获取该智能合约的触发条件| |System.Runtime.GetTime|获取当前区块的时间戳| +|System.Runtime.GetScriptContainer|获得该智能合约的脚本容器(最开始的触发者)| +|System.Runtime.GetExecutingScriptHash|获得该智能合约执行的脚本散列| +|System.Runtime.GetCallingScriptHash|获得该智能合约的调用者的脚本散列| +|System.Runtime.GetEntryScriptHash|获得该智能合约的入口点(合约调用链的起点)的脚本散列| |System.Runtime.CheckWitness|验证调用该合约的容器是否被指定账户脚本哈希签名| |System.Runtime.GetInvocationCounter|获取当前合约的调用次数| |System.Runtime.Log|记录合约日志信息| +|System.Runtime.Notify|记录合约通知信息| |System.Runtime.GetNotifications|获取某合约执行的所有通知| |System.Runtime.GasLeft|获取剩余未消耗的GAS数| diff --git a/docs/zh-cn/reference/scapi/api/neo.md b/docs/zh-cn/reference/scapi/api/neo.md index 077beb45d..6180c9366 100644 --- a/docs/zh-cn/reference/scapi/api/neo.md +++ b/docs/zh-cn/reference/scapi/api/neo.md @@ -7,6 +7,7 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 | API | 说明 | | -- | --| |Neo.Native.Deploy|部署并初始化所有原生合约| +|Neo.Native.Call|调用原生合约|
@@ -17,7 +18,7 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 说明 - Neo.Native.Tokens.NEO + Neo.Native.Tokens.NEO name 获取名称, 即:NEO @@ -41,21 +42,33 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 Transfer 转账 + + SetGasPerBlock + 设置每出一个区块所产生的GAS数 + + + GetGasPerBlock + 获取当前每个区块可产生的GAS数 + - RegisterValidator - 注册为验证人 + RegisterCandidate + 注册为候选人 + + + UnregisterCandidate + 取消注册为候选人 Vote 投票 - GetRegisteredValidators - 获取已注册的验证人列表 + GetCandidates + 获取候选人列表 - GetValidators - 获取验证人列表 + GetCommittee + 获取委员会成员列表 UnclaimedGas @@ -111,7 +124,7 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 说明 - Neo.Native.Policy + Neo.Native.Policy GetMaxTransactionsPerBlock 获取每区块最大交易数 @@ -119,16 +132,25 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 GetMaxBlockSize 获取最大的区块大小 + + GetMaxBlockSystemFee + 获取区块最大的系统费 + GetFeePerByte 获取每字节手续费 + + IsBlocked + 验证是否为黑名单账户 + setMaxBlockSize 设置最大的区块大小 - GetBlockedAccounts - 获取黑名单账户 + + SetMaxBlockSystemFee + 设置区块最大的系统费 SetMaxTransactionsPerBlock 设置每区块最大交易数 @@ -136,16 +158,39 @@ NEO命名空间提供了原生合约操作以及数字签名验证的API。 SetFeePerByte 设置每字节手续费 - BlockAccount + + BlockAccount 设置黑名单账户 - UnblockAccount + + UnblockAccount 解除黑名单账户 + + + + + + + + + + + + + + + + + + + +
API方法名说明
Neo.Native.OracleFinish在获取Oracle响应后调用回调函数
Request发起Oracle请求
Verify验证Oracle响应交易的合法性
+ > [!Note] -> 以上 API 部分用于给Validator调用, 普通用户会在验签过程中失败 +> 以上 API 部分用于给Committee调用, 普通用户会在验签过程中失败 > 以上 API 的源码位于 NEO 项目中的 (https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/PolicyContract.cs) 文件。 **Crypto API**: From b5e8d20afda8cc0d896e6ce96929be3e28b3c403 Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Fri, 6 Nov 2020 17:09:50 +0800 Subject: [PATCH 4/7] update sc framework --- .../zh-cn/reference/rpc/latest-version/api.md | 1 - docs/zh-cn/reference/scapi/fw/dotnet/neo.md | 6 ++- .../reference/scapi/fw/dotnet/neo/Contract.md | 8 +-- .../reference/scapi/fw/dotnet/neo/Gas.md | 29 +++++++++++ .../scapi/fw/dotnet/neo/Gas/BalanceOf.md | 34 +++++++++++++ .../scapi/fw/dotnet/neo/Gas/TotalSupply.md | 28 ++++++++++ .../scapi/fw/dotnet/neo/Gas/Transfer.md | 38 ++++++++++++++ .../reference/scapi/fw/dotnet/neo/Json.md | 2 +- .../reference/scapi/fw/dotnet/neo/Native.md | 21 -------- .../scapi/fw/dotnet/neo/Native/GAS.md | 36 ------------- .../scapi/fw/dotnet/neo/Native/NEO.md | 36 ------------- .../scapi/fw/dotnet/neo/Native/Policy.md | 32 ------------ .../reference/scapi/fw/dotnet/neo/Neo.md | 38 ++++++++++++++ .../scapi/fw/dotnet/neo/Neo/BalanceOf.md | 34 +++++++++++++ .../scapi/fw/dotnet/neo/Neo/GetCandidates.md | 28 ++++++++++ .../scapi/fw/dotnet/neo/Neo/GetCommittee.md | 28 ++++++++++ .../scapi/fw/dotnet/neo/Neo/GetGasPerBlock.md | 28 ++++++++++ .../dotnet/neo/Neo/GetNextBlockValidators.md | 28 ++++++++++ .../fw/dotnet/neo/Neo/RegisterCandidate.md | 35 +++++++++++++ .../scapi/fw/dotnet/neo/Neo/SetGasPerBlock.md | 33 ++++++++++++ .../scapi/fw/dotnet/neo/Neo/TotalSupply.md | 28 ++++++++++ .../scapi/fw/dotnet/neo/Neo/Transfer.md | 38 ++++++++++++++ .../fw/dotnet/neo/Neo/UnRegisterCandidate.md | 35 +++++++++++++ .../scapi/fw/dotnet/neo/Neo/UnclaimedGas.md | 35 +++++++++++++ .../reference/scapi/fw/dotnet/neo/Neo/Vote.md | 37 ++++++++++++++ .../reference/scapi/fw/dotnet/neo/Oracle.md | 25 +++++++++ .../scapi/fw/dotnet/neo/Oracle/Request.md | 51 +++++++++++++++++++ .../reference/scapi/fw/dotnet/neo/Policy.md | 30 +++++++++++ .../fw/dotnet/neo/Policy/BlockAccount.md | 34 +++++++++++++ .../fw/dotnet/neo/Policy/GetFeePerByte.md | 28 ++++++++++ .../fw/dotnet/neo/Policy/GetMaxBlockSize.md | 28 ++++++++++ .../dotnet/neo/Policy/GetMaxBlockSystemFee.md | 28 ++++++++++ .../neo/Policy/GetMaxTransactionsPerBlock.md | 28 ++++++++++ .../scapi/fw/dotnet/neo/Policy/IsBlocked.md | 34 +++++++++++++ .../fw/dotnet/neo/Policy/SetFeePerByte.md | 32 ++++++++++++ .../fw/dotnet/neo/Policy/SetMaxBlockSize.md | 32 ++++++++++++ .../dotnet/neo/Policy/SetMaxBlockSystemFee.md | 34 +++++++++++++ .../neo/Policy/SetMaxTransactionsPerBlock.md | 32 ++++++++++++ .../fw/dotnet/neo/Policy/UnblockAccount.md | 34 +++++++++++++ 39 files changed, 1014 insertions(+), 132 deletions(-) create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/BalanceOf.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/TotalSupply.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/Transfer.md delete mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Native.md delete mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/GAS.md delete mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/NEO.md delete mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/Policy.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/BalanceOf.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCandidates.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCommittee.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetGasPerBlock.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetNextBlockValidators.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/RegisterCandidate.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/SetGasPerBlock.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/TotalSupply.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Transfer.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnRegisterCandidate.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnclaimedGas.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Vote.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle/Request.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/BlockAccount.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetFeePerByte.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSize.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSystemFee.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxTransactionsPerBlock.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/IsBlocked.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetFeePerByte.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSize.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSystemFee.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxTransactionsPerBlock.md create mode 100644 docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/UnblockAccount.md diff --git a/docs/zh-cn/reference/rpc/latest-version/api.md b/docs/zh-cn/reference/rpc/latest-version/api.md index 5009159ca..cbd397914 100644 --- a/docs/zh-cn/reference/rpc/latest-version/api.md +++ b/docs/zh-cn/reference/rpc/latest-version/api.md @@ -29,7 +29,6 @@ JSON-RPC 服务器启动后,会监听 TCP 端口,默认端口如下。P2P | [getrawtransaction](api/getrawtransaction.md) | \ [verbose=0] | 根据指定的散列值,返回对应的交易信息 | | [getstorage](api/getstorage.md) | \ \ | 根据合约脚本散列和存储的 key,返回存储的 value | | [gettransactionheight](api/gettransactionheight.md) | \ | 根据交易哈希获取交易所在的区块高度 | -| [getvalidators](api/getvalidators.md) | | 查看当前共识节点的信息 | | [getcommittee](api/getcommittee.md) | | 获取委员会成员公钥列表 | ### 节点 diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo.md index 85d1fbe7c..075f73987 100644 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo.md +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo.md @@ -25,14 +25,18 @@ NEO 命名空间是 NEO 区块链所提供的 API,提供了访问区块链账 | [Runtime](neo/Runtime.md) | 提供智能合约运行时的一些方法 | | [Storage](neo/Storage.md) | 提供了持久化存储区的插入、查询、删除的方法 | | [StorageContext](neo/StorageContext.md) | 用来表示私有存储区存储上下文的类 | -| [StorageFlags](neo/StorageFlags.md) | 表明了写入数据的属性 | | [StorageMap](neo/StorageMap.md) | 表示给定存储上下文中指定前缀的key-value存储区 | | [Transaction](neo/Transaction.md) | 用来表示交易的基类 | +| [NEO](neo/Neo.md) | | +| [GAS](neo/Gas.md) | 用来表示交易的基类 | +| [Policy](neo/Policy.md) | | +| [Oracle](neo/Oracle.md) | | ## 枚举 | 枚举 | 说明 | | ---------------------------------------- | ------------------------- | | [CallFlags](neo/CallFlags.md) | 定义调用合约方法时的模式| +| [StorageFlags](neo/StorageFlags.md) | 表明了写入数据的属性 | | [TriggerType](neo/TriggerType.md) | 定义了触发器类型 | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Contract.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Contract.md index a8be78212..fe7749a1f 100644 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Contract.md +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Contract.md @@ -26,10 +26,10 @@ public class Contract | 名称 | 说明 | | ---------------------------------------- | --------------- | -| [Call(byte[] scriptHash, string method, object[] arguments)](Contract/Call.md) | 调用智能合约 | -| [CallEx(byte[] scriptHash, string method, object[] arguments, CallFlags flag)](Contract/CallEx.md) | 根据调用权限 Flag 调用合约 | -| [Create(byte[] script, string manifest)](Contract/Create.md) | 新建智能合约 | -| [Update(byte[] script, string manifest)](Contract/Update.md) | 更新智能合约 | +| [Call(byte\[\] scriptHash, string method, object\[\] arguments)](Contract/Call.md) | 调用智能合约 | +| [CallEx(byte\[\] scriptHash, string method, object\[\] arguments, CallFlags flag)](Contract/CallEx.md) | 根据调用权限 Flag 调用合约 | +| [Create(byte\[\] script, string manifest)](Contract/Create.md) | 新建智能合约 | +| [Update(byte\[\] script, string manifest)](Contract/Update.md) | 更新智能合约 | | [Destroy()](Contract/Destroy.md) | 销毁智能合约 | | [GetCallFlags()](Contract/GetCallFlags.md) | 获取合约的调用权限 Flag | | [CreateStandardAccount()](Contract/CreateStandardAccount.md) | 根据公钥创建标准账户 | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas.md new file mode 100644 index 000000000..c21c668aa --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas.md @@ -0,0 +1,29 @@ +# GAS 类 + +提供了原生合约GasToken的一系列属性与方法。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public class GAS +``` + +## 属性 + +| 名称 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Name | 获取名称, GAS | +| Symbol | 获取符号, 即: gas | +| Decimals | 获取精度 | + +## 方法 + +| 名称 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [TotalSupply()](Gas/TotalSupply.md) | 获取GAS总发行量 | +| [BalanceOf(byte\[\] account)](Gas/BalanceOf.md) | 获取余额 | +| [Transfer(byte\[\] from, byte\[\] to, BigInteger amount)](Gas/Transfer.md) | 转账 | \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/BalanceOf.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/BalanceOf.md new file mode 100644 index 000000000..9df0d95e8 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/BalanceOf.md @@ -0,0 +1,34 @@ +# BalanceOf 方法 (byte[]) + +获取账户的GAS余额。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger BalanceOf(byte[] account); +``` + +参数: + +- account: 所查询账户的脚本哈希 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + + public static object Main() + { + BigInteger result = GAS.BalanceOf(account); + return result; + } +} +``` + +[返回上级](../Gas.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/TotalSupply.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/TotalSupply.md new file mode 100644 index 000000000..fa3760589 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/TotalSupply.md @@ -0,0 +1,28 @@ +# TotalSupply 方法 () + +获取GAS总发行量。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger TotalSupply(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + BigInteger result = GAS.TotalSupply(); + return result; + } +} +``` + +[返回上级](../Gas.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/Transfer.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/Transfer.md new file mode 100644 index 000000000..041708acb --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Gas/Transfer.md @@ -0,0 +1,38 @@ +# Transfer 方法 (byte[], byte[], BigInteger) + +GAS转账。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool Transfer(byte[] from, byte[] to, BigInteger amount); +``` + +参数: + +- from: 转出账户的脚本哈希; +- to: 转入账户的脚本哈希; +- amount: 要转账的金额。 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] from = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + private static readonly byte[] to = "NXjtqYERuvSWGawjVux8UerNejvwdYg7eE".ToScriptHash(); + + public static object Main() + { + BigInterger value = 1000; + bool result = GAS.Transfer(from, to, value); + return result; + } +} +``` + +[返回上级](../Gas.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Json.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Json.md index fe42be50d..7026f8c7e 100644 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Json.md +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Json.md @@ -12,7 +12,7 @@ public static class Json ``` -## 属性 +## 方法 | 名称 | 说明 | | ---------------------------------------- | -------------------------- | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native.md deleted file mode 100644 index e2849000e..000000000 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native.md +++ /dev/null @@ -1,21 +0,0 @@ -# Native 类 - -表示Neo区块链中的原生合约类。 - -命名空间:[Neo.SmartContract.Framework.Services.Neo](../neo.md) - -程序集:Neo.SmartContract.Framework - -## 语法 - -```c# -public class Native -``` - -## 属性 - -| 名称 | 说明 | -| ---------------------------------------- | -------------------------- | -| [NEO(string method, object\[\] arguments)](Native/NEO.md) | 原生合约NeoToken | -| [GAS(string method, object\[\] arguments)](Native/GAS.md) | 原生合约GasToken | -| [Policy(string method, object\[\] arguments)](Native/Policy.md) | 原生合约PolicyContract | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/GAS.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/GAS.md deleted file mode 100644 index 76319bfe6..000000000 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/GAS.md +++ /dev/null @@ -1,36 +0,0 @@ -# Native.GAS 方法 (string, object[]) - -根据方法名与方法参数调用GAS合约中的方法。 - -命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) - -程序集:Neo.SmartContract.Framework - -## 语法 - -```c# -public static extern object GAS(string method, object[] arguments); -``` - -参数: - -- method: 方法名称; -- arguments: 方法参数。 - -## 示例 - -```c# -public class Contract1 : SmartContract.Framework.SmartContract -{ - public static object Main() - { - byte[] from = "NZs2zXSPuuv9ZF6TDGSWT1RBmE8rfGj7UW".ToScriptHash(); - byte[] to = "NUo4WsPRJCrSLriRhKwduWvoG2CxHwsdfi".ToScriptHash(); - BigInterger value = new BigInteger(1000); - bool result = Native.GAS("transfer", new Object[]{from, to, value.AsByteArray()}); - return result; - } -} -``` - -[返回上级](../Native.md) diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/NEO.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/NEO.md deleted file mode 100644 index a5a853c39..000000000 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/NEO.md +++ /dev/null @@ -1,36 +0,0 @@ -# Native.NEO 方法 (string, object[]) - -根据方法名与方法参数调用NEO合约中的方法。 - -命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) - -程序集:Neo.SmartContract.Framework - -## 语法 - -```c# -public static extern object NEO(string method, object[] arguments); -``` - -参数: - -- method: 方法名称; -- arguments: 方法参数。 - -## 示例 - -```c# -public class Contract1 : SmartContract.Framework.SmartContract -{ - public static object Main() - { - byte[] from = "NZs2zXSPuuv9ZF6TDGSWT1RBmE8rfGj7UW".ToScriptHash(); - byte[] to = "NUo4WsPRJCrSLriRhKwduWvoG2CxHwsdfi".ToScriptHash(); - BigInterger value = new BigInteger(1000); - bool result = Native.NEO("transfer", new Object[]{from, to, value.AsByteArray()}); - return result; - } -} -``` - -[返回上级](../Native.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/Policy.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/Policy.md deleted file mode 100644 index a97a7227b..000000000 --- a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Native/Policy.md +++ /dev/null @@ -1,32 +0,0 @@ -# Native.Policy 方法 (string, object[]) - -根据方法名与方法参数调用Policy合约中的方法。 - -命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) - -程序集:Neo.SmartContract.Framework - -## 语法 - -```c# -public static extern object Policy(string method, object[] arguments); -``` - -参数: - -- method: 方法名称; -- arguments: 方法参数。 - -## 示例 - -```c# -public class Contract1 : SmartContract.Framework.SmartContract -{ - public static object Main() - { - BigInteger feeByte = (BigInteger)Native.Policy("getFeePerByte", new object[]{}); - } -} -``` - -[返回上级](../Native.md) diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo.md new file mode 100644 index 000000000..9d62ac763 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo.md @@ -0,0 +1,38 @@ +# Neo 类 + +提供了原生合约NeoToken的一系列属性与方法。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public class NEO +``` + +## 属性 + +| 名称 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Name | 获取名称, 即:NEO | +| Symbol | 获取符号, 即: neo | +| Decimals | 获取精度 | + +## 方法 + +| 名称 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [TotalSupply()](Neo/TotalSupply.md) | 获取NEO总发行量 | +| [BalanceOf(byte\[\] account)](Neo/BalanceOf.md) | 获取余额 | +| [Transfer(byte\[\] from, byte\[\] to, BigInteger amount)](Neo/Transfer.md) | 转账 | +| [SetGasPerBlock(BigInteger gasPerBlock)](Neo/SetGasPerBlock.md) | 设置每出一个区块所产生的GAS数 | +| [GetGasPerBlock()](Neo/GetGasPerBlock.md) | 获取当前每个区块可产生的GAS数 | +| [UnclaimedGas(byte\[\] account, uint end)](Neo/UnclaimedGas.md) | 获取未领取的Gas数 | +| [RegisterCandidate(byte\[\] pubkey)](Neo/RegisterCandidate.md) | 注册为候选人 | +| [UnRegisterCandidate(byte\[\] pubkey)](Neo/UnRegisterCandidate.md) | 取消注册为候选人 | +| [Vote(byte\[\] account, byte\[\] voteTo)](Neo/Vote.md) | 投票 | +| [GetCandidates()](Neo/GetCandidates.md) | 获取候选人列表 | +| [GetCommittee()](Neo/GetCommittee.md) | 获取委员会成员列表 | +| [GetNextBlockValidators()](Neo/GetNextBlockValidators.md) | 获取下个区块的验证人列表 | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/BalanceOf.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/BalanceOf.md new file mode 100644 index 000000000..5ae27daa6 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/BalanceOf.md @@ -0,0 +1,34 @@ +# BalanceOf 方法 (byte[]) + +获取账户的NEO余额。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger BalanceOf(byte[] account); +``` + +参数: + +- account: 所查询账户的脚本哈希 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + + public static object Main() + { + BigInteger result = NEO.BalanceOf(account); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCandidates.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCandidates.md new file mode 100644 index 000000000..574a15705 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCandidates.md @@ -0,0 +1,28 @@ +# GetCandidates 方法 () + +获取候选人列表。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern (string, BigInteger)[] GetCandidates(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + (string, BigInteger)[] result = NEO.GetCandidates(); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCommittee.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCommittee.md new file mode 100644 index 000000000..e8ad43f97 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetCommittee.md @@ -0,0 +1,28 @@ +# GetCommittee 方法 () + +获取委员会成员列表。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern string[] GetCommittee(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + string[] result = NEO.GetCommittee(); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetGasPerBlock.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetGasPerBlock.md new file mode 100644 index 000000000..b24dbf780 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetGasPerBlock.md @@ -0,0 +1,28 @@ +# GetGasPerBlock 方法 () + +获取当前每个区块可产生的GAS数。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger GetGasPerBlock(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + BigInteger result = NEO.GetGasPerBlock(); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetNextBlockValidators.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetNextBlockValidators.md new file mode 100644 index 000000000..c28ead9ed --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/GetNextBlockValidators.md @@ -0,0 +1,28 @@ +# GetNextBlockValidators 方法 () + +获取下个区块的验证人列表。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern string[] GetNextBlockValidators(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + string[] result = NEO.GetNextBlockValidators(); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/RegisterCandidate.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/RegisterCandidate.md new file mode 100644 index 000000000..092146815 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/RegisterCandidate.md @@ -0,0 +1,35 @@ +# RegisterCandidate 方法 (byte[]) + +注册成为候选人。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool RegisterCandidate(byte[] pubkey); +``` + +参数: + +- pubkey: 要注册账户的公钥。 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] pubkey = new byte[] { 0x02, 0xe8, 0xff, 0x17, 0xc5, 0x67, 0xd6, 0x2f, 0x27, 0x4f, 0xe2, + 0x47, 0xcc, 0x88, 0x4a, 0x2a, 0x6c, 0xd3, 0xb8, 0xfd, 0x0d, 0x77, 0x9a, 0x8c, 0x58, 0x56, 0x28, 0x9a, 0x56, 0x0a, 0xcc, 0xac, 0xb4 }; + + public static object Main() + { + bool result = NEO.RegisterCandidate(pubkey); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/SetGasPerBlock.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/SetGasPerBlock.md new file mode 100644 index 000000000..6d68b13f9 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/SetGasPerBlock.md @@ -0,0 +1,33 @@ +# SetGasPerBlock 方法 (BigInteger) + +设置每出一个区块所产生的GAS数。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool SetGasPerBlock(BigInteger gasPerBlock); +``` + +参数: + +- gasPerBlock: 每区块所产生的GAS数 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + BigInteger gasPerBlock = 10; + bool result = NEO.SetGasPerBlock(gasPerBlock); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/TotalSupply.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/TotalSupply.md new file mode 100644 index 000000000..4e4c976d8 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/TotalSupply.md @@ -0,0 +1,28 @@ +# TotalSupply 方法 () + +获取NEO总发行量。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger TotalSupply(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + BigInteger result = NEO.TotalSupply(); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Transfer.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Transfer.md new file mode 100644 index 000000000..3cddd1ca8 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Transfer.md @@ -0,0 +1,38 @@ +# Transfer 方法 (byte[], byte[], BigInteger) + +NEO转账。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool Transfer(byte[] from, byte[] to, BigInteger amount); +``` + +参数: + +- from: 转出账户的脚本哈希; +- to: 转入账户的脚本哈希; +- amount: 要转账的金额。 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] from = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + private static readonly byte[] to = "NXjtqYERuvSWGawjVux8UerNejvwdYg7eE".ToScriptHash(); + + public static object Main() + { + BigInterger value = 1000; + bool result = NEO.Transfer(from, to, value); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnRegisterCandidate.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnRegisterCandidate.md new file mode 100644 index 000000000..c709137b4 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnRegisterCandidate.md @@ -0,0 +1,35 @@ +# UnRegisterCandidate 方法 (byte[]) + +取消注册为候选人。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool UnRegisterCandidate(byte[] pubkey); +``` + +参数: + +- pubkey: 要取消账户的公钥。 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] pubkey = new byte[] { 0x02, 0xe8, 0xff, 0x17, 0xc5, 0x67, 0xd6, 0x2f, 0x27, 0x4f, 0xe2, + 0x47, 0xcc, 0x88, 0x4a, 0x2a, 0x6c, 0xd3, 0xb8, 0xfd, 0x0d, 0x77, 0x9a, 0x8c, 0x58, 0x56, 0x28, 0x9a, 0x56, 0x0a, 0xcc, 0xac, 0xb4 }; + + public static object Main() + { + bool result = NEO.UnRegisterCandidate(pubkey); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnclaimedGas.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnclaimedGas.md new file mode 100644 index 000000000..6833f9bd6 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/UnclaimedGas.md @@ -0,0 +1,35 @@ +# UnclaimedGas 方法 (byte[], uint) + +获取未领取的Gas数. + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger UnclaimedGas(byte[] account, uint end); +``` + +参数: + +- account: 所查询账户的脚本哈希; +- end:截止到的区块高度 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + + public static object Main() + { + BigInteger result = NEO.UnclaimedGas(account, 100); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Vote.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Vote.md new file mode 100644 index 000000000..ff15ba21b --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Neo/Vote.md @@ -0,0 +1,37 @@ +# Vote 方法 (byte[], byte[]) + +投票。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool Vote(byte[] account, byte[] voteTo); +``` + +参数: + +- account: 投票账户的脚本哈希; +- voteTo: 目标账户的公钥。 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + private static readonly byte[] voteTo = new byte[] { 0x02, 0xe8, 0xff, 0x17, 0xc5, 0x67, 0xd6, 0x2f, 0x27, 0x4f, 0xe2, + 0x47, 0xcc, 0x88, 0x4a, 0x2a, 0x6c, 0xd3, 0xb8, 0xfd, 0x0d, 0x77, 0x9a, 0x8c, 0x58, 0x56, 0x28, 0x9a, 0x56, 0x0a, 0xcc, 0xac, 0xb4 }; + + public static object Main() + { + bool result = NEO.Vote(account, voteTo); + return result; + } +} +``` + +[返回上级](../Neo.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle.md new file mode 100644 index 000000000..ee734b033 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle.md @@ -0,0 +1,25 @@ +# Oracle 类 + +提供了原生合约Oracle的一系列方法。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public class Oracle +``` + +## 属性 + +| 名称 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Name | 合约名称 | + +## 方法 + +| 名称 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [Request(string url, string filter, string callback, object userData, long gasForResponse)](Oracle/Request.md) | 发起Oracle请求 | \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle/Request.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle/Request.md new file mode 100644 index 000000000..1f81315ae --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Oracle/Request.md @@ -0,0 +1,51 @@ +# Request 方法 (string, string, string, object, long) + +发起Oracle请求。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern void Request(string url, string filter, string callback, object userData, long gasForResponse); +``` + +参数: + +- url: 请求的Url; +- filter: 过滤器,可用于过滤无用数据; +- callback:回调函数; +- userData: 用户提供的额外数据; +- long: 获取响应所需的费用 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static void Main() + { + string url = "http://127.0.0.1:8080/test"; + string filter = "$.value"; // JSONPath, { "value": "hello world" } + string callback = "callback"; + object userdata = "userdata"; // arbitrary type + long gasForResponse = 10000000; // minimum fee + + Oracle.Request(url, filter, callback, userdata, gasForResponse); + } + + public static void Callback(string url, string userdata, int code, string result) + { + object ret = Json.Deserialize(result); // [ "hello world" ] + object[] arr = (object[])ret; + string value = (string)arr[0]; + + Runtime.Log("userdata: " + userdata); + Runtime.Log("response value: " + value); + } +} +``` + +[返回上级](../Oracle.md) diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy.md new file mode 100644 index 000000000..72887e047 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy.md @@ -0,0 +1,30 @@ +# Policy 类 + +提供了原生合约Policy的一系列方法。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public class Policy +``` + +## 方法 + +| 名称 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| Name() | 合约名称 | +| [GetMaxTransactionsPerBlock()](Policy/GetMaxTransactionsPerBlock.md) | 获取每区块最大交易数 | +| [GetMaxBlockSize()](Policy/GetMaxBlockSize.md) | 获取区块最大大小 | +| [GetMaxBlockSystemFee()](Policy/GetMaxBlockSystemFee.md) | 获取区块最大的系统费 | +| [GetFeePerByte()](Policy/GetFeePerByte.md) | 获取每字节手续费 | +| [IsBlocked(byte\[\] account)](Policy/IsBlocked.md) | 验证是否为黑名单账户 | +| [SetMaxBlockSize(uint value)](Policy/SetMaxBlockSize.md) | 设置最大区块大小 | +| [SetMaxTransactionsPerBlock(uint value)](Policy/SetMaxTransactionsPerBlock.md) | 设置每区块最大交易数 | +| [SetMaxBlockSystemFee(long value)](Policy/SetMaxBlockSystemFee.md) | 设置区块最大系统手续费 | +| [SetFeePerByte(long value)](Policy/SetFeePerByte.md) | 设置每字节手续费 | +| [BlockAccount(byte\[\] account)](Policy/BlockAccount.md) | 将指定账户加入黑名单 | +| [UnblockAccount(byte\[\] account)](Policy/UnblockAccount.md) | 将指定账户解除黑名单 | diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/BlockAccount.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/BlockAccount.md new file mode 100644 index 000000000..aa6db0ac6 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/BlockAccount.md @@ -0,0 +1,34 @@ +# BlockAccount 方法 (byte[]) + +将指定账户加入黑名单。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool BlockAccount(byte[] account); +``` + +参数: + +- account: 待加入黑名单的账户脚本哈希 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NirHUAteaMr6CqWuAAMaEUScPcS3FDKebM".ToScriptHash(); + + public static object Main() + { + bool result = Policy.BlockAccount(account); + return result; + } +} +``` + +[返回上级](../Policy.md) diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetFeePerByte.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetFeePerByte.md new file mode 100644 index 000000000..855041fa5 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetFeePerByte.md @@ -0,0 +1,28 @@ +# GetFeePerByte 方法 () + +获取每字节手续费。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern BigInteger GetFeePerByte(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + BigInteger result = Policy.GetFeePerByte(); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSize.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSize.md new file mode 100644 index 000000000..dd1e05e73 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSize.md @@ -0,0 +1,28 @@ +# GetMaxBlockSize 方法 () + +获取区块最大大小。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern uint GetMaxBlockSize(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + uint result = Policy.GetMaxBlockSize(); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSystemFee.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSystemFee.md new file mode 100644 index 000000000..adfb80a55 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxBlockSystemFee.md @@ -0,0 +1,28 @@ +# GetMaxBlockSystemFee 方法 () + +获取区块最大的系统费。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern long GetMaxBlockSystemFee(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + long result = Policy.GetMaxBlockSystemFee(); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxTransactionsPerBlock.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxTransactionsPerBlock.md new file mode 100644 index 000000000..57b2d8218 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/GetMaxTransactionsPerBlock.md @@ -0,0 +1,28 @@ +# GetMaxTransactionsPerBlock 方法 () + +获取每区块最大交易数。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern uint GetMaxTransactionsPerBlock(); +``` + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + uint result = Policy.GetMaxTransactionsPerBlock(); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/IsBlocked.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/IsBlocked.md new file mode 100644 index 000000000..697b0b1d8 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/IsBlocked.md @@ -0,0 +1,34 @@ +# IsBlocked 方法 (byte[]) + +验证是否为黑名单账户。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern string[] IsBlocked(byte[] account); +``` + +参数: + +- account: 待验证账户的脚本哈希 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash(); + + public static object Main() + { + string[] result = Policy.IsBlocked(account); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetFeePerByte.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetFeePerByte.md new file mode 100644 index 000000000..dff670f66 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetFeePerByte.md @@ -0,0 +1,32 @@ +# SetFeePerByte 方法 (long) + +设置每字节手续费。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool SetFeePerByte(long value); +``` + +参数: + +- value: 待设置的每字节手续费 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + bool result = Policy.SetFeePerByte(1200); + return result; + } +} +``` + +[返回上级](../Policy.md) diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSize.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSize.md new file mode 100644 index 000000000..4c9777676 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSize.md @@ -0,0 +1,32 @@ +# SetMaxBlockSize 方法 (uint) + +设置最大区块大小。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool SetMaxBlockSize(uint value); +``` + +参数: + +- value: 待设置的区块大小值 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + bool result = Policy.SetMaxBlockSize(1024); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSystemFee.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSystemFee.md new file mode 100644 index 000000000..50e65db4f --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxBlockSystemFee.md @@ -0,0 +1,34 @@ +# SetMaxBlockSystemFee 方法 (uint) + +设置区块最大系统手续费。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool SetMaxBlockSystemFee(long value); +``` + +参数: + +- value: 待设置的区块最大系统手续费 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + bool result = Policy.SetMaxBlockSystemFee(4007800L); + return result; + } +} +``` + +[返回上级](../Policy.md) + +>注:设置的手续费值应不小于4007600。 \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxTransactionsPerBlock.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxTransactionsPerBlock.md new file mode 100644 index 000000000..7af61ea71 --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/SetMaxTransactionsPerBlock.md @@ -0,0 +1,32 @@ +# SetMaxTransactionsPerBlock 方法 (uint) + +设置每区块最大交易数。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool SetMaxTransactionsPerBlock(uint value); +``` + +参数: + +- value: 待设置的最大交易数 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + public static object Main() + { + bool result = Policy.SetMaxTransactionsPerBlock(1024); + return result; + } +} +``` + +[返回上级](../Policy.md) \ No newline at end of file diff --git a/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/UnblockAccount.md b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/UnblockAccount.md new file mode 100644 index 000000000..25b3756fc --- /dev/null +++ b/docs/zh-cn/reference/scapi/fw/dotnet/neo/Policy/UnblockAccount.md @@ -0,0 +1,34 @@ +# UnblockAccount 方法 (byte[]) + +将指定账户解除黑名单。 + +命名空间:[Neo.SmartContract.Framework.Services.Neo](../../neo.md) + +程序集:Neo.SmartContract.Framework + +## 语法 + +```c# +public static extern bool UnblockAccount(byte[] account); +``` + +参数: + +- account: 待解除黑名单的账户脚本哈希 + +## 示例 + +```c# +public class Contract1 : SmartContract.Framework.SmartContract +{ + private static readonly byte[] account = "NirHUAteaMr6CqWuAAMaEUScPcS3FDKebM".ToScriptHash(); + + public static object Main() + { + bool result = Policy.UnblockAccount(account); + return result; + } +} +``` + +[返回上级](../Policy.md) From 2b0d9ab19fa5b0528ed2aea852cb991bddc0789b Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Mon, 9 Nov 2020 10:41:08 +0800 Subject: [PATCH 5/7] update fee --- docs/zh-cn/reference/fees.md | 120 +++++++++++++++++++++++++---------- 1 file changed, 85 insertions(+), 35 deletions(-) diff --git a/docs/zh-cn/reference/fees.md b/docs/zh-cn/reference/fees.md index 546dc8b0f..14e3ab579 100644 --- a/docs/zh-cn/reference/fees.md +++ b/docs/zh-cn/reference/fees.md @@ -14,18 +14,27 @@ |--|--| | System.Binary.Serialize | 0.00100000 | | System.Binary.Deserialize| 0.00500000 | +| System.Binary.Base64Encode| 0.00100000 | +| System.Binary.Base64Decode| 0.00100000 | +| System.Binary.Base58Encode| 0.00100000 | +| System.Binary.Base58Decode| 0.00100000 | | System.Blockchain.GetHeight | 0.00000400 | | System.Blockchain.GetBlock | 0.02500000 | | System.Blockchain.GetTransaction | 0.01000000 | | System.Blockchain.GetTransactionHeight | 0.01000000 | | System.Blockchain.GetTransactionFromBlock | 0.01000000 | | System.Blockchain.GetContract | 0.01000000 | -| System.Contract.Create | (Script.Size + Manifest.Size) * GasPerByte | -| System.Contract.Update | (Script.Size + Manifest.Size) * GasPerByte | +| System.Callback.Create | 0.00000400 | +| System.Callback.CreateFromMethod | 0.01000000 | +| System.Callback.CreateFromSyscall | 0.00000400 | +| System.Callback.Invoke | 0.01000000 | +| System.Contract.Create | 0 | +| System.Contract.Update | 0 | | System.Contract.Destroy | 0.01000000 | | System.Contract.Call | 0.01000000 | | System.Contract.CallEx | 0.01000000 | | System.Contract.IsStandard | 0.00030000 | +| System.Contract.GetCallFlags | 0.00030000 | | System.Enumerator.Create | 0.00000400 | | System.Enumerator.Next | 0.01000000 | | System.Enumerator.Value | 0.00000400 | @@ -55,20 +64,17 @@ | System.StorageContext.AsReadOnly| 0.00000400 | | System.Storage.Get| 0.01000000 | | System.Storage.Find| 0.01000000 | -| System.Storage.Put| 参见 [1] | -| System.Storage.PutEx| 参见 [1] | -| System.Storage.Delete| 1 * GasPerByte | +| System.Storage.Put| 0 | +| System.Storage.PutEx| 0 | +| System.Storage.Delete| 1 * StoragePrice | | Neo.Native.Deploy| 0 | -| Neo.Crypto.ECDsaVerify| 0.01000000 | -| Neo.Crypto.ECDsaCheckMultiSig| 0.01000000 * n | - -> [!Note] -> -> [1] 向数据库中写入Key和Value时, -> -> - 如果新的键值对字节数大于旧的键值对,则 fee = [(newKey.Size +newValue.Size) - (oldKey.Size + oldValue.Size)] * GasPerByte -> - 如果新的键值对字节数小于等于旧的键值对,则 fee = 1 * GasPerByte -> - 如果数据库中不存在旧的键值对,则 fee = (key.Size + value.Size) * GasPerByte +| Neo.Native.Call| 0 | +| Neo.Crypto.RIPEMD160| 0.01000000 | +| Neo.Crypto.SHA256| 0.01000000 | +| Neo.Crypto.VerifyWithECDsaSecp256r1| 0.01000000 | +| Neo.Crypto.VerifyWithECDsaSecp256k1| 0.01000000 | +| Neo.Crypto.CheckMultisigWithECDsaSecp256r1| 0 | +| Neo.Crypto.CheckMultisigWithECDsaSecp256k1| 0 | @@ -77,7 +83,7 @@ - + @@ -101,24 +107,41 @@ - - + + - + + + + + + + + + + + + + + + + + - + - - + + - - + + - - + + +
费用 (GAS)
Neo.Native.Tokens.NEONeo.Native.Tokens.NEO name 0
transfer 0.08000000
registerValidator
setGasPerBlock 0.05000000
getGasPerBlock0.05000000
unclaimedGas0.03000000
registerCandidate0.05000000
unregisterCandidate0.05000000
vote5.000000000.08000000
getRegisteredValidators
GetCandidates 1.00000000
getValidators
getCommittee 1.00000000
unclaimedGas0.03000000
getNextBlockValidators1.00000000
@@ -166,7 +189,7 @@ 费用 (GAS) - Neo.Native.Policy + Neo.Native.Policy getMaxTransactionsPerBlock 0.01000000 @@ -175,30 +198,57 @@ 0.01000000 - getFeePerByte + GetMaxBlockSystemFee 0.01000000 - setMaxBlockSize - 0.03000000 + GetFeePerByte + 0.01000000 - getBlockedAccounts + IsBlocked 0.01000000 - setMaxTransactionsPerBlock + SetMaxBlockSize + 0.03000000 + + SetMaxTransactionsPerBlock + 0.03000000 + + SetMaxBlockSystemFee 0.03000000 - setFeePerByte + SetFeePerByte 0.03000000 - blockAccount + BlockAccount 0.03000000 - unblockAccount + UnblockAccount 0.03000000 + + + + + + + + + + + + + + + + + + + +
互操作服务方法名费用 (GAS)
Neo.Native.Oraclefinish0
request0.50000000
verify0.01000000
+ 关于表格中API的含义,请参见 [NEO命名空间](../reference/scapi/api/neo.md)。 ### 指令费用 From e73616478eb2e0ce3fa4dbb5eaee5a09571a03fb Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 12 Nov 2020 14:34:54 +0800 Subject: [PATCH 6/7] some updates in develop --- docs/zh-cn/develop/deploy/Parameter.md | 44 +++++++++++++++----------- docs/zh-cn/develop/deploy/deploy.md | 6 ++-- docs/zh-cn/develop/deploy/invoke.md | 6 ++-- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/docs/zh-cn/develop/deploy/Parameter.md b/docs/zh-cn/develop/deploy/Parameter.md index ab2ff3e7f..4446be4da 100644 --- a/docs/zh-cn/develop/deploy/Parameter.md +++ b/docs/zh-cn/develop/deploy/Parameter.md @@ -8,36 +8,42 @@ /// public enum ContractParameterType : byte { + Any = 0x00, + + Boolean = 0x10, /// - /// 签名 + /// 整数 /// - Signature = 0, - Boolean = 1, + Integer = 0x11, /// - /// 整数 + /// 字节数组 /// - Integer = 2, + ByteArray = 0x12, + String = 0x13, /// /// 160位散列值 /// - Hash160 = 3, + Hash160 = 0x14, /// /// 256 位散列值 /// - Hash256 = 4, + Hash256 = 0x15, + PublicKey = 0x16, /// - /// 字节数组 + /// 签名 /// - ByteArray = 5, - PublicKey = 6, - String = 7, - - /// - /// 对象数组 - /// - Array = 10, - InteropInterface = 0xf0, + Signature = 0x17, + + /// + /// 对象数组 + /// + Array = 0x20, + Map = 0x22, + + InteropInterface = 0x30, + Void = 0xff + } ``` @@ -53,6 +59,6 @@ public class Lock : SmartContract } ``` -通过上表可查到,int 为 2,bool 为 1,公钥字节数组为 6,签名字节数组为 0。 +通过上表可查到,int 为 0x11,bool 为 0x10,公钥字节数组为 0x16,签名字节数组为 0x17。 -在 NEO-GUI 客户端发布智能合约填写参数时,每个参数用两位 16 进制字符表示,所以上面的智能合约的形参列表表示为:02010600,返回值为:01。 \ No newline at end of file +在 NEO-GUI 客户端发布智能合约填写参数时,每个参数用两位 16 进制字符表示,所以上面的智能合约的形参列表表示为:11101617,返回值为:10。 \ No newline at end of file diff --git a/docs/zh-cn/develop/deploy/deploy.md b/docs/zh-cn/develop/deploy/deploy.md index 081ec33d7..0f4ab975a 100644 --- a/docs/zh-cn/develop/deploy/deploy.md +++ b/docs/zh-cn/develop/deploy/deploy.md @@ -4,15 +4,15 @@ ## 为什么需要部署? -当一个智能合约需要在区块链上存储数据或被其它智能合约调用(称为 appcall)时,需要部署。而仅由合约账户鉴权触发的合约,如锁仓合约、多方签名合约,不会被其它合约调用,所以无需部署。像 `return 1+1` 这样的合约,因为没有任何需要输入的参数,也无需部署。 +当一个智能合约需要在区块链上存储数据或被其它智能合约调用(通过syscall `System.Contract.Call`)时,需要部署。而仅由合约账户鉴权触发的合约,如锁仓合约、多方签名合约,不会被其它合约调用,所以无需部署。像 `return 1+1` 这样的合约,因为没有任何需要输入的参数,也无需部署。 从编程语言的角度来说,当智能合约要作为一个类库使用时,才需要被部署。比如以下情况: -- 当一个智能合约有可变的传入参数,此时它必须作为一个类库,由调用者(Invocation 交易)或者其它的智能合约提供参数。 +- 当一个智能合约有可变的传入参数,此时它必须作为一个类库,由调用者或者其它的智能合约提供参数。 - 当一个智能合约使用存储区(Storage)时,必须作为一个类库。 - 当一个智能合约实现了 NEP-5(合约资产)时,需要将该合约部署到区块链上。 -智能合约的部署是通过 Invocation 交易调用 API 来部署。通常的做法是通过 Neo-CLI 或 Neo-GUI 的智能合约发布功能来部署合约。 +智能合约的部署是通过交易调用 API 来部署。通常的做法是通过 Neo-CLI 或 Neo-GUI 的智能合约发布功能来部署合约。 部署智能合约以及调用智能合约均会产生费用,详情请参见 [系统手续费](../../reference/fees.md)。 diff --git a/docs/zh-cn/develop/deploy/invoke.md b/docs/zh-cn/develop/deploy/invoke.md index 8c3df6615..aa4816e1b 100644 --- a/docs/zh-cn/develop/deploy/invoke.md +++ b/docs/zh-cn/develop/deploy/invoke.md @@ -4,7 +4,7 @@ ## 合约详情查询 -使用 Neo-CLI 或 Neo-GUI 可以查询合约的详细信息,如合约的基本信息、入口点、方法、通知等。 +使用 Neo-CLI 或 Neo-GUI 可以查询合约的详细信息,如合约的基本信息、方法、通知等。 ### 使用 Neo-CLI 查询 @@ -26,7 +26,7 @@ Neo-GUI 中会更直观地显示合约信息,也能查看 manifest 和 nef 文 - 使用 invoke 命令调用智能合约,命令如下: ``` - invoke [contractParameters=null] [witnessAddress=null] + invoke [contractParameters=null] [sender=null] [signerAccounts=null] ``` 详情请参考 [invoke](../../node/cli/cli.md#invoke) 命令。 @@ -58,7 +58,7 @@ Neo-GUI 中会更直观地显示合约信息,也能查看 manifest 和 nef 文 在 Neo-CLI 中,我们可以通过 `invoke` 命令附加签名。 ``` -invoke [contractParameters=null] [witnessAddress=null] +invoke [contractParameters=null] [sender=null] [signerAccounts=null] ``` 在 Neo-GUI 中,在调用合约时,可以点击下方的 `附加签名`,选择 `公钥` 然后点击 `签名` 来进行附加签名。 From 8ebe60276435e4179fd9e0179b41d9221ddd162a Mon Sep 17 00:00:00 2001 From: bettybao1209 Date: Thu, 12 Nov 2020 14:40:53 +0800 Subject: [PATCH 7/7] update opcode fee --- docs/zh-cn/reference/fees.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/zh-cn/reference/fees.md b/docs/zh-cn/reference/fees.md index 14e3ab579..fa730fd68 100644 --- a/docs/zh-cn/reference/fees.md +++ b/docs/zh-cn/reference/fees.md @@ -311,7 +311,7 @@ |REVERSE4|0.00000060| |REVERSEN|0.00000400| |INITSSLOT|0.00000400| -|INITSLOT|0.00000800| +|INITSLOT|0.00001600| |LDSFLD0\~LDSFLD6|0.00000060| |LDSFLD|0.00000060| |STSFLD0\~STSFLD6|0.0000006| @@ -334,8 +334,8 @@ |AND|0.00000200| |OR|0.00000200| |XOR|0.00000200| -|EQUAL|0.00000200| -|NOTEQUAL|0.00000200| +|EQUAL|0.00001000| +|NOTEQUAL|0.00001000| |SIGN|0.00000100| |ABS|0.00000100| |NEGATE|0.00000100| @@ -361,8 +361,8 @@ |MIN|0.00000200| |MAX|0.00000200| |WITHIN|0.00000200| -|PACK|0.00007000| -|UNPACK|0.00007000| +|PACK|0.00015000| +|UNPACK|0.00015000| |NEWARRAY0|0.00000400| |NEWARRAY|0.00015000| |NEWARRAY_T|0.00015000| @@ -372,11 +372,11 @@ |SIZE|0.00000150| |HASKEY|0.00270000| |KEYS|0.00000500| -|VALUES|0.00007000| +|VALUES|0.00270000| |PICKITEM|0.00270000| -|APPEND|0.00015000| +|APPEND|0.00270000| |SETITEM|0.00270000| -|REVERSEITEMS|0.00000500| +|REVERSEITEMS|0.00270000| |REMOVE|0.00000500| |CLEARITEMS|0.00000400| |ISNULL|0.00000060|