diff --git a/docs/n3/Advances/Neo VM instructions.md b/docs/n3/Advances/Neo VM instructions.md index 61651c2..5031833 100644 --- a/docs/n3/Advances/Neo VM instructions.md +++ b/docs/n3/Advances/Neo VM instructions.md @@ -365,11 +365,13 @@ It's used to control the running process of NeoVM, including jump, call and othe | Bytecode | 0x41 | | Fee | 0 GAS | | Function | Calls to an interop service. | + ### Stack Operation Copy, remove and swap the elements of the stack. #### DEPTH + | Instruction | DEPTH | |----------|------------------------------------------| | Bytecode | 0x43 | @@ -849,7 +851,6 @@ Copy, remove and swap the elements of the stack. | Fee | 0.00000004 GAS | | Function | Returns 0 if the input is 0. 1 otherwise. | - #### NUMEQUAL | Instruction | NUMEQUAL | @@ -906,7 +907,6 @@ Copy, remove and swap the elements of the stack. | Fee | 0.00000008 GAS | | Function | Returns the smaller of a and b. | - #### MAX | Instruction | MAX | @@ -1125,3 +1125,4 @@ It has implemented common operations for array, map, struct, etc. The operation code with \* indicates that the result of the operation is not pushed back to the `EvaluationStack` using `PUSH()`. ::: + diff --git a/docs/n3/Advances/Oracles.md b/docs/n3/Advances/Oracles.md index ca45aab..04899cd 100644 --- a/docs/n3/Advances/Oracles.md +++ b/docs/n3/Advances/Oracles.md @@ -12,7 +12,7 @@ Neo Oracle Service is an out-of-chain data access service built into Neo N3. It The commit-reveal mechanism is a sequential protocol that prevents data plagiarism for multiple Oracle nodes. -**Process** +#### Process 1. Oracle node submits ciphertext information (hash, signature, etc.) about data to other Oracle nodes and collects ciphertext information submitted by other Oracle nodes. @@ -32,7 +32,7 @@ Neo Oracle Service adopts the request-response processing mechanism, which is an ![](assets/oralce_response.png) -**Process** +#### Process 1. The user writes the smart contract to call the `Request` method of the Oracle contract. @@ -54,11 +54,11 @@ Oracle service currently supports two URL schemes, `https` and `neofs`. `https` ## Fees and rewards -- **Fees** +- ### Fees Neo Oracle Service charges the user by the number of requests, 0.5 GAS by default for each. Besides, the user has to pay additional fees for the callback function. All the fees will be paid when the Request is created. -- **Rewards** +- ### Rewards The fee paid by the user for the Request is distributed to the Oracle node in turn when executing the `PostPersist` logic. @@ -240,3 +240,4 @@ The Code field defines the status Code for Oracle responses, including the follo | `0x1a` | `ResponseTooLarge` | result size is out of limit | `byte` | | `0x1c` | `InsufficientFunds` | the fee is insufficient | `byte` | | `0xff` | `Error` | error occurs in the execution | `byte` | + diff --git a/docs/n3/Advances/neofs/topics/acl-permissions.mdx b/docs/n3/Advances/neofs/topics/acl-permissions.mdx index bb354ab..9b5dbba 100644 --- a/docs/n3/Advances/neofs/topics/acl-permissions.mdx +++ b/docs/n3/Advances/neofs/topics/acl-permissions.mdx @@ -108,7 +108,7 @@ Note, there are multiple types of attribute filter you can apply, such as filter Firstly we need two records. One for the `others` and one for our privileged key ```go -import "github.com/nspcc-dev/neofs-sdk-go/eacl" +import "github.com/nspcc-dev/neofs-sdk-go/eacl" othersRecord := eacl.NewRecord() privRecord := eacl.NewRecord() diff --git a/docs/n3/Advances/neofs/topics/objects.mdx b/docs/n3/Advances/neofs/topics/objects.mdx index 6c0ab3e..15aed50 100644 --- a/docs/n3/Advances/neofs/topics/objects.mdx +++ b/docs/n3/Advances/neofs/topics/objects.mdx @@ -37,7 +37,7 @@ fileNameAttr.SetValue(path.Base(filepath)) //path.Base(filepath) returns the las expirationEpochAttr := new(object.Attribute) expirationEpochAttr.SetKey("__NEOFS__EXPIRATION_EPOCH") // Reserved case for when the life of the object should expire -expirationEpochAttr.SetValue(strconv.Itoa(epoch))) //The epoch at which the object will expire +expirationEpochAttr.SetValue(strconv.Itoa(epoch)) //The epoch at which the object will expire attributes = append(attributes, []*object.Attribute{timeStampAttr, fileNameAttr, expirationEpochAttr}...) diff --git a/docs/n3/Advances/neons/api/getAllRecords.md b/docs/n3/Advances/neons/api/getAllRecords.md index 7a6029e..9502a4d 100644 --- a/docs/n3/Advances/neons/api/getAllRecords.md +++ b/docs/n3/Advances/neons/api/getAllRecords.md @@ -22,12 +22,12 @@ curl --request POST \ "jsonrpc": "2.0", "method": "invokefunction", "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getAllRecords", - [ - { - "type":"String","value":"flamincome.neo" - } - ], - [] + [ + { + "type":"String","value":"flamincome.neo" + } + ], + [] ], "id": 1 } @@ -38,90 +38,90 @@ Response body #1 ```json5 { - "jsonrpc": "2.0", - "id": 1, - "result": { - "script": "DA5mbGFtaW5jb21lLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", - "state": "HALT", - "gasconsumed": "725394", - "exception": null, - "stack": [ - { - "type": "InteropInterface", - "iterator": [ - { - "type": "Array", - "value": [ - { - "type": "ByteString", - "value": "c3ViMS5mbGFtaW5jb21lLm5lbw==" - }, - { - "type": "Integer", - "value": "1" - }, - { - "type": "ByteString", - "value": "MTY1LjIzLjM0LjU0" - } - ] - }, - { - "type": "Array", - "value": [ - { - "type": "ByteString", - "value": "ZmxhbWluY29tZS5uZW8=" - }, - { - "type": "Integer", - "value": "5" - }, - { - "type": "ByteString", - "value": "YWxpYXMubmVv" - } - ] - }, - { - "type": "Array", - "value": [ - { - "type": "ByteString", - "value": "ZmxhbWluY29tZS5uZW8=" - }, - { - "type": "Integer", - "value": "16" - }, - { - "type": "ByteString", - "value": "TlpIZjFOSnZ6MXR2RUxHTFdaamhwYjNOcVpKRkZVWXB4VA==" - } - ] - }, - { - "type": "Array", - "value": [ - { - "type": "ByteString", - "value": "ZmxhbWluY29tZS5uZW8=" - }, - { - "type": "Integer", - "value": "28" - }, - { - "type": "ByteString", - "value": "MjAwMToxZGI4OjA6Og==" - } - ] - } - ], - "truncated": false - } - ] - } + "jsonrpc": "2.0", + "id": 1, + "result": { + "script": "DA5mbGFtaW5jb21lLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", + "state": "HALT", + "gasconsumed": "725394", + "exception": null, + "stack": [ + { + "type": "InteropInterface", + "iterator": [ + { + "type": "Array", + "value": [ + { + "type": "ByteString", + "value": "c3ViMS5mbGFtaW5jb21lLm5lbw==" + }, + { + "type": "Integer", + "value": "1" + }, + { + "type": "ByteString", + "value": "MTY1LjIzLjM0LjU0" + } + ] + }, + { + "type": "Array", + "value": [ + { + "type": "ByteString", + "value": "ZmxhbWluY29tZS5uZW8=" + }, + { + "type": "Integer", + "value": "5" + }, + { + "type": "ByteString", + "value": "YWxpYXMubmVv" + } + ] + }, + { + "type": "Array", + "value": [ + { + "type": "ByteString", + "value": "ZmxhbWluY29tZS5uZW8=" + }, + { + "type": "Integer", + "value": "16" + }, + { + "type": "ByteString", + "value": "TlpIZjFOSnZ6MXR2RUxHTFdaamhwYjNOcVpKRkZVWXB4VA==" + } + ] + }, + { + "type": "Array", + "value": [ + { + "type": "ByteString", + "value": "ZmxhbWluY29tZS5uZW8=" + }, + { + "type": "Integer", + "value": "28" + }, + { + "type": "ByteString", + "value": "MjAwMToxZGI4OjA6Og==" + } + ] + } + ], + "truncated": false + } + ] + } } ``` @@ -137,12 +137,12 @@ curl --request POST \ "jsonrpc": "2.0", "method": "invokefunction", "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getAllRecords", - [ - { - "type":"String","value":"expired.neo" - } - ], - [] + [ + { + "type":"String","value":"expired.neo" + } + ], + [] ], "id": 1 } @@ -153,14 +153,14 @@ Response body #2 ```json5 { - "jsonrpc": "2.0", - "id": 1, - "result": { - "script": "DAtleHBpcmVkLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", - "state": "FAULT", - "gasconsumed": "622077", - "exception": "An unhandled exception was thrown. The name has expired.", - "stack": [] - } + "jsonrpc": "2.0", + "id": 1, + "result": { + "script": "DAtleHBpcmVkLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", + "state": "FAULT", + "gasconsumed": "622077", + "exception": "An unhandled exception was thrown. The name has expired.", + "stack": [] + } } ``` diff --git a/docs/n3/Advances/neons/api/getRecord.md b/docs/n3/Advances/neons/api/getRecord.md index c286b04..30da5e4 100644 --- a/docs/n3/Advances/neons/api/getRecord.md +++ b/docs/n3/Advances/neons/api/getRecord.md @@ -246,14 +246,14 @@ Response body #5 ```json5 { - "jsonrpc": "2.0", - "id": 1, - "result": { - "script": "IAwLZXhwaXJlZC5uZW8SwB8MCWdldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", - "state": "FAULT", - "gasconsumed": "1083138", - "exception": "An unhandled exception was thrown. The name has expired.", - "stack": [] - } + "jsonrpc": "2.0", + "id": 1, + "result": { + "script": "IAwLZXhwaXJlZC5uZW8SwB8MCWdldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==", + "state": "FAULT", + "gasconsumed": "1083138", + "exception": "An unhandled exception was thrown. The name has expired.", + "stack": [] + } } ``` diff --git a/docs/n3/Advances/neons/api/roots.md b/docs/n3/Advances/neons/api/roots.md index 38d538b..dc9a059 100644 --- a/docs/n3/Advances/neons/api/roots.md +++ b/docs/n3/Advances/neons/api/roots.md @@ -30,25 +30,25 @@ Response body ```json5 { - "jsonrpc": "2.0", - "id": 1, - "result": { - "script": "wh8MBXJvb3RzDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS", - "state": "HALT", - "gasconsumed": "228888", - "exception": null, - "stack": [ - { - "type": "InteropInterface", - "iterator": [ - { - "type": "ByteString", - "value": "bmVv" - } - ], - "truncated": false - } - ] - } + "jsonrpc": "2.0", + "id": 1, + "result": { + "script": "wh8MBXJvb3RzDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS", + "state": "HALT", + "gasconsumed": "228888", + "exception": null, + "stack": [ + { + "type": "InteropInterface", + "iterator": [ + { + "type": "ByteString", + "value": "bmVv" + } + ], + "truncated": false + } + ] + } } ``` diff --git a/docs/n3/Advances/neons/index.md b/docs/n3/Advances/neons/index.md index 2edf88f..c62f16a 100644 --- a/docs/n3/Advances/neons/index.md +++ b/docs/n3/Advances/neons/index.md @@ -5,7 +5,7 @@ sidebar_position: 1 # Welcome to NeoNS Documentation -### What is NeoNS +## What is NeoNS The Neo Name Service (NeoNS) is a distributed open naming system based on Neo blockchain. The main goal of NeoNS is to map names like "alice.neo" to other source identifiers such as N3 addresses, NeoFS shared link, IPV4 addresses, IPV6 addresses, and other metadata. @@ -13,10 +13,11 @@ NNS also has dot-separated hierarchical names called domains. The owner of a dom Top-level domains, like `.neo`, are owned by the Neo Committee. Users can only register domains with the registered top-level domains, such as `alice.neo` instead of `alice.eth` if the top-level domain `.eth` is not registered yet. Once the domain `alice.neo` registered users can register any subdomains ended with it, for example, `hello.alice.neo`, and configure it with records. -### Quick Start +## Quick Start NeoNS Mainnet Contract Hash: `0x50ac1c37690cc2cfc594472833cf57505d5f46de` NeoNS Magnet testnet Hash: `0xd4dbd72c8965b8f12c14d37ad57ddd91ee1d98cb` The source code can be found at [https://github.com/neo-project/non-native-contracts/tree/master/src/NameService](https://github.com/neo-project/non-native-contracts/tree/master/src/NameService). + diff --git a/docs/n3/develop/deploy/deploy.md b/docs/n3/develop/deploy/deploy.md index 481276e..62a545e 100644 --- a/docs/n3/develop/deploy/deploy.md +++ b/docs/n3/develop/deploy/deploy.md @@ -1,12 +1,12 @@ # Deploying Smart Contracts -When a smart contract is deployed on the blockchain, it can be used by other users or invoked by other contracts. This section describes how to deploy and invoke the smart contract in the Neo blockchain using Neo-CLI or Neo-GUI. The instructions in this section are generic and applicable to all contract types including NEP-17 assets. +When a smart contract is deployed on the blockchain, it can be used by other users or invoked by other contracts. This section describes how to deploy and invoke the smart contract in the Neo blockchain using Neo-CLI or Neo-GUI. The instructions in this section are generic and applicable to all contract types including NEP-17 assets. ## What contracts need to be deployed? When a smart contract needs to store data or to be invoked by another smart contract through syscall `System.Contract.Call` on the blockchain, it needs to be deployed. Contracts triggered only by the verification trigger, such as the lock contract and multi-signature contract, do not need to be deployed as they will not be invoked by other contracts. Contracts such as `return 1+1` do not need to be deployed as they do not require any input parameters. -From the programming language perspective, only when a smart contract will be used as a class library, it needs to be deployed. For example: +From the programming language perspective, only when a smart contract will be used as a class library, it needs to be deployed. For example: - When a smart contract has variable incoming parameters, it must serve as a storage. The caller or other smart contracts provide the parameters. - When a smart contract uses storage it must serve as a class library. @@ -14,14 +14,15 @@ From the programming language perspective, only when a smart contract will be us ### How to deploy? -Smart contracts are deployed by invoking APIs. Usually we use Neo-CLI or Neo-GUI to deploy smart contracts. +Smart contracts are deployed by invoking APIs. Usually we use Neo-CLI or Neo-GUI to deploy smart contracts. Deploying and invoking smart contracts cost fees. For more information, refer to [Fees](../../fees.md). ## Before you start + Make sure you have done the following: -- Confirmed that your contract should be deployed. +- Confirmed that your contract should be deployed. - Compiled a contract file (\*.nef) and a descriptive file of contract (\*.manifest.json). - Installed Neo-CLI or Neo-GUI and completed block synchronization. For more information, refer to [Neo-CLI](../../node/cli/setup.md) and [Neo-GUI](../../node/gui/install.md) @@ -31,7 +32,7 @@ In Neo-CLI run the following command to deploy your contract: `deploy [manifestFile]` -- `` : mandatory. The contract file +- `` : mandatory. The contract file - `[manifestFile]` : optional. The descriptive file of contract ### Example @@ -63,7 +64,7 @@ Signed and relayed transaction with hash=0xe03aade81fb96c44e115a1cc9cfe984a9df4a When a contract has been deployed a scripthash is generated as a unified identifier of the contract. The contract scripthash can be converted into the standard 20-byte address for receiving assets from transfer transactions. In that case the contract scripthash is used in big endian format. For example: -- Contract ScriptHash (big endian): 0xb7f4d011241ec13db16c0e3484bdd5dd9a536f26 +- Contract ScriptHash (big endian): 0xb7f4d011241ec13db16c0e3484bdd5dd9a536f26 - Corresponding address: NPRCE9me1CdXBA6StQ7kff52p61rHQqnS7 @@ -79,6 +80,6 @@ When a contract has been deployed a scripthash is generated as a unified identif ## Deploying contracts with Neo-GUI 1. In Neo-GUI click `Contract` -> `Deploy Contract`。 -2. Select the desired *.nef and *.manifest.json files. +2. Select the desired *.nef and*.manifest.json files. 3. Click `Deploy`. diff --git a/docs/n3/develop/deploy/invoke.md b/docs/n3/develop/deploy/invoke.md index 9d1530e..d424ff6 100644 --- a/docs/n3/develop/deploy/invoke.md +++ b/docs/n3/develop/deploy/invoke.md @@ -35,7 +35,7 @@ You can choose one of the following ways to invoke the contract using Neo-CLI: ### Invoking a contract using Neo-GUI -1. In Neo-GUI click `Contract `->`Invoke Contract`。 +1. In Neo-GUI click `Contract`->`Invoke Contract`。 2. Enter the contract script hash and click `Search`. @@ -45,7 +45,7 @@ You can choose one of the following ways to invoke the contract using Neo-CLI: The trial run at this step does not affect the blockchain as it is just create a NeoVM on your local computer to simulate the invocation. -4. If the trial run goes smoothly and you want to invoke it on the blockchain, click `Invoke`. +4. If the trial run goes smoothly and you want to invoke it on the blockchain, click `Invoke`. ## Cosignature @@ -64,7 +64,7 @@ invoke [contractParameters=null] [sender=null] [signer When invoking a contract in Neo-GUI, you can click `Cosignature` at the bottom of the page, choose `Public key`, and then click `Sign` to add the signature. :::note - When you invoke the transfer method of the NEP-17 contract using the transfer command, the wallet will automatically appends the signature to the from field. You don't need to add it manually. +When you invoke the transfer method of the NEP-17 contract using the transfer command, the wallet will automatically appends the signature to the from field. You don't need to add it manually. ::: ## Invoking between contracts @@ -113,7 +113,7 @@ Three fields related to the contract invocation permission are defined in the co | Fields | Type | Description | | ------------- | ----------------------------- | ------------------------------------------------------------ | | `Groups` | `ContractGroup[]` | Defines a group of trusted contracts, consisting of a public key and a signature of contract hash. | -| `Permissions` | `ContractPermission[]` | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard *. The method is the method name or wildcard *. Contracts or methods not declared in the manifest cannot be called by the contract. | +| `Permissions` | `ContractPermission[]` | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard \*. The method is the method name or wildcard \*. Contracts or methods not declared in the manifest cannot be called by the contract. | | `Trusts` | `WildcardContainer` | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. | Assuming that the contract A calls the contract B, the following table details the invoking behavior and wallet behavior of the contract in various setting scenarios. diff --git a/docs/n3/develop/network/private-chain/private-chain2.md b/docs/n3/develop/network/private-chain/private-chain2.md index 9ec2f71..950ee89 100644 --- a/docs/n3/develop/network/private-chain/private-chain2.md +++ b/docs/n3/develop/network/private-chain/private-chain2.md @@ -211,7 +211,7 @@ You can refer to the following example: ``` :::note - If the plugin RpcServer is installed, you also need to modify the port numbers in the plugin config.json file to make them different from each other and from the ports in config.json of the node. +If the plugin RpcServer is installed, you also need to modify the port numbers in the plugin config.json file to make them different from each other and from the ports in config.json of the node. ::: ## Installing consensus plugin @@ -311,7 +311,7 @@ In the genesis block of the NEO network, 100 million NEO and 30 million GAS are ![](../assets/initial-balance.png) :::note - You must create multi-party signature address in at least three wallets so as to sign the transfer transaction successfully. +You must create multi-party signature address in at least three wallets so as to sign the transfer transaction successfully. ::: #### Transferring NEO to a normal address @@ -340,4 +340,4 @@ Here we want to send NEO from the contract address to the normal address. ![image](../assets/balance.png) -Similarly, you can refer to the preceding steps to withdraw GAS from the multi-party signature address. \ No newline at end of file +Similarly, you can refer to the preceding steps to withdraw GAS from the multi-party signature address. diff --git a/docs/n3/develop/network/private-chain/solo.md b/docs/n3/develop/network/private-chain/solo.md index 40d0380..56ab02b 100644 --- a/docs/n3/develop/network/private-chain/solo.md +++ b/docs/n3/develop/network/private-chain/solo.md @@ -84,7 +84,7 @@ Here is an example: ## Starting the private chain :::note - If the node has downloaded Neo test net block files, you need to delete the Data folder before running Neo-CLI, otherwise the private chain will not be able to properly generate blocks. +If the node has downloaded Neo test net block files, you need to delete the Data folder before running Neo-CLI, otherwise the private chain will not be able to properly generate blocks. ::: To start the private chain, enter the neo-cli directory and run neo-cli.exe, or run the command line and enter `dotnet neo-cli.dll`. The private chain is set up successfully when it goes as shown below: @@ -156,7 +156,7 @@ In the genesis block of the Neo network, 100 million NEO and 30 million GAS are 6. Enter `list asset`,then you should see 100 million NEO and 30 million GAS displayed. -7. Create a new wallet using the command `create wallet ` and copy the wallet address. +7. Create a new wallet using the command `create wallet` and copy the wallet address. 8. Open the wallet `consensus.json` again and transfer NEO and GAS to the new created wallet with the `send` command. For example, `send neo NWu2gb7PzhZb4ci9LvW4gBYAQFMGb1s1o7 100000000`, `send gas NWu2gb7PzhZb4ci9LvW4gBYAQFMGb1s1o7 10000000`. diff --git a/docs/n3/develop/network/testnet.md b/docs/n3/develop/network/testnet.md index 7559b13..87af656 100644 --- a/docs/n3/develop/network/testnet.md +++ b/docs/n3/develop/network/testnet.md @@ -61,4 +61,4 @@ To access the assets, in your Neo-gui you will create a "Multi-party signed addr ## Alternatives to the TestNet -Testing your Smart Contract on the TestNet is a good idea before publishing it on the live network but earlier in your development cycle you should consider using other methods to test your Smart Contacts such as running you own private chain, for more information, refer to [Setting up private chain](private-chain/solo.md). \ No newline at end of file +Testing your Smart Contract on the TestNet is a good idea before publishing it on the live network but earlier in your development cycle you should consider using other methods to test your Smart Contacts such as running you own private chain, for more information, refer to [Setting up private chain](private-chain/solo.md). diff --git a/docs/n3/develop/tool/sdk/introduction.md b/docs/n3/develop/tool/sdk/introduction.md index a38d68a..604a0ef 100644 --- a/docs/n3/develop/tool/sdk/introduction.md +++ b/docs/n3/develop/tool/sdk/introduction.md @@ -18,9 +18,9 @@ This document is applicable to Neo N3. It is recommended you use NEO SDK in conj 1. In Visual Studio 2019, create a new .NET project -:::note -The .NET version of the project cannot be earlier than the .NET version used by the Neo SDK. -::: + :::note + The .NET version of the project cannot be earlier than the .NET version used by the Neo SDK. + ::: 2. Right-click the project and select `Manage NuGet Packages`. @@ -33,10 +33,10 @@ The .NET version of the project cannot be earlier than the .NET version used by ``` :::note - If you use SDK to construct a transaction that requires a signature, you need to ensure that the RpcClient obeject and the network it is connected to are configured the same way, or the transaction constructed by the SDK will not be validated in the blockchain. To do so, load Neo-CLI config.json when constructing the RpcClient object, for example: +If you use SDK to construct a transaction that requires a signature, you need to ensure that the RpcClient obeject and the network it is connected to are configured the same way, or the transaction constructed by the SDK will not be validated in the blockchain. To do so, load Neo-CLI config.json when constructing the RpcClient object, for example: + +RpcClient client = new RpcClient(new Uri("http://localhost:20332"), null, null, ProtocolSettings.Load("config.json")) ::: -> -> RpcClient client = new RpcClient(new Uri("http://localhost:20332"), null, null, ProtocolSettings.Load("config.json")) ## Exception handing diff --git a/docs/n3/develop/tool/sdk/rpc.md b/docs/n3/develop/tool/sdk/rpc.md index 0db36e5..d233d0d 100644 --- a/docs/n3/develop/tool/sdk/rpc.md +++ b/docs/n3/develop/tool/sdk/rpc.md @@ -4,6 +4,7 @@ The `RpcClient` encapsulates all the interfaces provided by RpcServer. You can s ## Initializing RpcClient + Before you can send RPC requests you need to initialize `RpcClient` first. Choose the RPC server port of a Neo node according to your own needs. Here is an example: Test net node: @@ -21,12 +22,13 @@ RpcClient client = new RpcClient(new Uri("http://localhost:20332"), null, null, ``` :::note - Typically, only one RpcClient instance needs to be initialized in an application, not needing in each method. +Typically, only one RpcClient instance needs to be initialized in an application, not needing in each method. ::: ## Blockchain data ### GetBestBlockHashAsync + Gets the hash of the highest block in the blockchain: ```cs @@ -36,6 +38,7 @@ UInt256 hash256 = UInt256.Parse(hexString); ``` ### GetBlockAsync + Gets the detailed block information by the block hash or block index. ```cs @@ -77,6 +80,7 @@ UInt256 hash256 = UInt256.Parse(hexString); ``` ### Get the block header information + Get the specific block header information by the block hash or block index: ```cs @@ -104,6 +108,7 @@ string serializedBlockHeader = await client.GetBlockHeaderHexAsync("10000").Conf ``` ### GetContractStateAsync + Gets the contract information from the contract hash or contract ID ```cs @@ -115,6 +120,7 @@ ContractState contractState = client.GetContractState(-1); ``` ### GetRawMempoolAsync + Gets hash list of the confirmed transactions in the memory. ```cs @@ -165,6 +171,7 @@ string value = await client.GetStorageAsync("03febccf81ac85e3d795bc5cbd4e84e9078 ``` ### GetTransactionHeightAsync + Gets the block height of the specified transaction by transaction ID: ```cs @@ -172,6 +179,7 @@ uint height = await client.GetTransactionHeightAsync("f4250dab094c38d8265acc15c3 ``` ### GetNextBlockValidatorsAsync + Gets the consensus nodes information and voting status in the current network. ```cs @@ -195,6 +203,7 @@ string[] committees = await client.GetCommitteeAsync().ConfigureAwait(false); ## Node ### GetConnectionCount + Gets the number of nodes connected to this node. ```cs @@ -202,6 +211,7 @@ int connectionCount = await client.GetConnectionCountAsync().ConfigureAwait(fals ``` ### GetPeersAsync + Gets a list of currently connected / unconnected nodes for this node, including IP address and port. ```cs @@ -217,6 +227,7 @@ if (connected.Length > 0) ``` ### GetVersionAsync + Gets the version of the node receiving the RPC request: ```cs @@ -225,6 +236,7 @@ string version = rpcVersion.UserAgent; ``` ### SendRawTransactionAsync + Sends and broadcasts the serialized transaction. ```cs @@ -238,6 +250,7 @@ UInt256 txHash = await client.SendRawTransactionAsync(transaction).ConfigureAwai ``` ### SubmitBlockAsync + Sends and broadcasts the serialized block: ```cs @@ -247,6 +260,7 @@ UInt256 blockHash = await client.SubmitBlockAsync("00000000000000000000000000000 ## Smart contract ### InvokeFunctionAsync + Invokes the specific method of the smart contract through the specified smart contract script hash, method name, and parameters, and returns the result after running in the virtual machine. ```cs @@ -286,6 +300,7 @@ long gasConsumed = rpcInvokeResult.GasConsumed; ``` ### InvokeScriptAsync + Returns the result after running the specified script in the virtual machine. ```cs @@ -306,6 +321,7 @@ string address = unclaimedGas.Address; ## Tools ### ListPluginsAsync + Lists all the plugins loaded in the node. ```cs @@ -318,6 +334,7 @@ foreach (var item in rpcPlugins) ``` ### ValidateAddressAsync + Validates if the specified address is a valid Neo address. ```cs @@ -327,6 +344,7 @@ bool isValid = result.IsValid; ``` ## Wallets + The node local wallet interface contains the function of accessing the local wallet file. Before using the methods described in this section, you need to open the wallet using the openwallet method. This method is disabled by default in the node configuration file for preventing high security risks. @@ -342,6 +360,7 @@ bool result = await client.OpenWalletAsync(path, password).ConfigureAwait(false) ``` ### CloseWalletAsync + Closes the wallet and clears the wallet information in memory. ```cs @@ -349,6 +368,7 @@ bool result = await client.CloseWalletAsync().ConfigureAwait(false); ``` ### DumpPrivKeyAsync + Exports the private key of the specified address. ```cs @@ -356,6 +376,7 @@ string wif = await client.DumpPrivKeyAsync("NVVwFw6XyhtRCFQ8SpUTMdPyYt4Vd9A1XQ") ``` ### GetBalanceAsync + Returns balance of the specified asset in the wallet by the asset id. This method is applicable to the native contract assets and NEP-17 compliant assets. ```cs @@ -363,6 +384,7 @@ BigDecimal balance = await client.GetWalletBalanceAsync(NativeContract.NEO.Hash. ``` ### GetNewAddressAsync + Creates a new account in the wallet and returns the corresponding address. ```cs @@ -370,6 +392,7 @@ string address = await client.GetNewAddressAsync().ConfigureAwait(false); ``` ### GetUnclaimedGasAsync + Displays amount of the unclaimed GAS in the wallet. ```cs @@ -377,6 +400,7 @@ BigInteger amount = await client.GetWalletUnclaimedGasAsync().ConfigureAwait(fal ``` ### ImportPrivKeyAsync + Imports the private key into the wallet. ```cs @@ -385,6 +409,7 @@ RpcAccount account = await client.ImportPrivKeyAsync(wif).ConfigureAwait(false); ``` ### ListAddressAsync + Lists all the addresses in the wallet. ```cs @@ -392,6 +417,7 @@ List acoounts = await client.ListAddressAsync().ConfigureAwait(false ``` ### SendFromAsync + Transfers asset from a specified address to another address. ```cs @@ -401,6 +427,7 @@ string toAddress= "NZs2zXSPuuv9ZF6TDGSWT1RBmE8rfGj7UW"; string amount = "100"; JObject result = await client.SendFromAsync(assetId, fromAddress, toAddress, amount).ConfigureAwait(false); ``` + If the JSON transaction information is returned the transaction was sent successfully, or the transaction failed to be sent. If the signature is incomplete transaction to be signed is returned. @@ -408,6 +435,7 @@ If the signature is incomplete transaction to be signed is returned. If the balance is insufficient an error is returned. ### SendManyAsync + Transfers assets to multiple addresses. You can specify the sending address. ```cs @@ -426,6 +454,7 @@ outs.Add(new RpcTransferOut }); JObject result = await client.SendManyAsync("", outs).ConfigureAwait(false); ``` + If the JSON transaction information is returned the transaction was sent successfully, or the transaction failed to be sent. If the signature is incomplete transaction to be signed is returned. @@ -433,6 +462,7 @@ If the signature is incomplete transaction to be signed is returned. If the balance is insufficient an error is returned. ### SendToAddressAsync + Transfers asset to the specified address. ```cs @@ -441,6 +471,7 @@ string toAddress = "NZs2zXSPuuv9ZF6TDGSWT1RBmE8rfGj7UW"; string amount = "100"; JObject result = await client.SendToAddressAsync(assetId, toAddress, amount).ConfigureAwait(false); ``` + If the JSON transaction information is returned the transaction was sent successfully, or the transaction failed to be sent. If the signature is incomplete transaction to be signed is returned. @@ -450,6 +481,7 @@ If the balance is insufficient an error is returned. ## Plugins ### GetApplicationLogAsync + Gets the contract log by the specific transaction ID. The plugin ApplicationLogs is required for invoking this method. ```cs @@ -474,6 +506,7 @@ RpcNep17Balances balances = await client.GetNep17BalancesAsync(address).Configur ``` ### GetNep17TransfersAsync + Returns all NEP-17 transaction records at the specific address. The plugin TokensTracker is required for invoking this method. If start and end timestamps are specified, transactions occurred in the time range is returned. diff --git a/docs/n3/develop/tool/sdk/transaction.md b/docs/n3/develop/tool/sdk/transaction.md index 24ad327..408a32a 100644 --- a/docs/n3/develop/tool/sdk/transaction.md +++ b/docs/n3/develop/tool/sdk/transaction.md @@ -3,10 +3,11 @@ `RpcClient` encapsulates the transaction construction module, which allows you to construct transactions in Neo N3 with specific parameters and methods to personalize your functions. This document introduces the relevant methods. :::note - If you use SDK to construct a transaction that requires a signature, you need to ensure that the RpcClient object and the network it is connected to are configured the same way, or the transaction constructed by the SDK will not be validated in the blockchain. To do so, load Neo-CLI config.json when constructing the RpcClient object, for example: +If you use SDK to construct a transaction that requires a signature, you need to ensure that the RpcClient object and the network it is connected to are configured the same way, or the transaction constructed by the SDK will not be validated in the blockchain. To do so, load Neo-CLI config.json when constructing the RpcClient object, for example: + +RpcClient client = new RpcClient(new Uri("http://localhost:20332"), null, null, ProtocolSettings.Load("config.json")) ::: -> -> RpcClient client = new RpcClient(new Uri("http://localhost:20332"), null, null, ProtocolSettings.Load("config.json")) + ## Transaction construction process @@ -18,7 +19,7 @@ byte[] script = scriptHash.MakeScript("transfer", sender, receiver, 1,"data"); ``` -2. Construct `TransactionManagerFactory` with the parameter `RpcClient `; Construct `TransactionManager` with the parameters `Script` and`Signers`: +2. Construct `TransactionManagerFactory` with the parameter `RpcClient`; Construct `TransactionManager` with the parameters `Script` and`Signers`: ```cs TransactionManager txManager = await new TransactionManagerFactory(client) @@ -33,6 +34,7 @@ // add signature for the transaction with sendKey txManager.AddSignature(sendKey); ``` + - multiple signatures ```cs @@ -40,6 +42,7 @@ txManager.AddMultiSig(key1, 2, receiverKey.PublicKey, key2.PublicKey, key3.PublicKey); txManager.AddMultiSig(key2, 2, receiverKey.PublicKey, key2.PublicKey, key3.PublicKey); ``` + - multi-signature contract The nature of multi-signature comes from multi-signature contracts. You need to construct a multi-signature contract before you can obtain the multi-signature address and transfer assets. The following example uses 3 accounts to create a multi-signature contract which requires at least 2 account signatures for signing. @@ -51,7 +54,7 @@ UInt160 multiAccount = multiContract.Script.ToScriptHash(); ``` -5. Verify signatures and add `Witness` to the transaction body. +4. Verify signatures and add `Witness` to the transaction body. If there are not enough signatures or fees an exception will be thrown. diff --git a/docs/n3/develop/tool/sdk/wallet.md b/docs/n3/develop/tool/sdk/wallet.md index f13f83f..6e994c2 100644 --- a/docs/n3/develop/tool/sdk/wallet.md +++ b/docs/n3/develop/tool/sdk/wallet.md @@ -122,6 +122,7 @@ using (wallet.Unlock(password)) ## Using WalletAPI ### Initialization + Initializing `WalletAPI`: ```cs @@ -133,7 +134,7 @@ WalletAPI walletAPI = new WalletAPI(client); ### Inquiring balance :::note - The type of account balance is usually BigInteger, which is a representation after rounding the decimal part. It needs to be divided by Factor to get the actual Token amount. +The type of account balance is usually BigInteger, which is a representation after rounding the decimal part. It needs to be divided by Factor to get the actual Token amount. ::: Inquiry NEP-17 asset balance using the string parameter: @@ -176,6 +177,7 @@ In Neo N3 GAS is automatically claimed when NEO is transferred. You can construc string address = "NZs2zXSPuuv9ZF6TDGSWT1RBmE8rfGj7UW"; decimal gasAmount = await walletAPI.GetUnclaimedGasAsync(address).ConfigureAwait(false); ``` + or use ScriptHash of the account to check: ```cs @@ -191,6 +193,7 @@ In Neo N3 GAS is automatically claimed when NEO is transferred. You can construc string wif = "L1rFMTamZj85ENnqNLwmhXKAprHuqr1MxMHmCWCGiXGsAdQ2dnhb"; Transaction transaction = await walletAPI.ClaimGasAsync(wif).ConfigureAwait(false); ``` + or use `KeyPair`: ```cs @@ -217,6 +220,7 @@ WalletAPI neoAPI = new WalletAPI(client); await neoAPI.WaitTransactionAsync(transaction) .ContinueWith(async (p) => Console.WriteLine($"Transaction vm state is {(await p).VMState}")); ``` + or use `KeyPair` and `UInt160` (ScriptHash): ```cs diff --git a/docs/n3/develop/write/1_dotnet.md b/docs/n3/develop/write/1_dotnet.md index 4913402..807e65e 100644 --- a/docs/n3/develop/write/1_dotnet.md +++ b/docs/n3/develop/write/1_dotnet.md @@ -168,4 +168,4 @@ Contract template for community maintenance: - [Neo3.SmartContract.Templates](https://www.nuget.org/packages/Neo3.SmartContract.Templates) by: shuaishuimen -- [NeoEvents.SmartContract.Templates](https://www.nuget.org/packages/NeoEvents.SmartContract.Templates) by: cschuchardt \ No newline at end of file +- [NeoEvents.SmartContract.Templates](https://www.nuget.org/packages/NeoEvents.SmartContract.Templates) by: cschuchardt diff --git a/docs/n3/develop/write/basics.md b/docs/n3/develop/write/basics.md index abdd9f3..de063ca 100644 --- a/docs/n3/develop/write/basics.md +++ b/docs/n3/develop/write/basics.md @@ -208,7 +208,7 @@ public class Contract1 : SmartContract - `DisplayName`: The name of the nef and manifest.json files generated by the compiler, and the DisplayName is also written to the name field of manifest.json. - `SupportedStandards`: The NEP standards the contract conform to, such as NEP-17, a token standard on Neo. -- `ContractPermission` : The permission requested by the contract, and `ContractTrust` indicates which contracts trust the contract to call itself. See [invocation-permission](... /deploy/invoke.html#invocation-permission). +- `ContractPermission` : The permission requested by the contract, and `ContractTrust` indicates which contracts trust the contract to call itself. See [invocation-permission](../deploy/invoke.md#invocation-permission). - `ContractAuthor`: The author field, which can be filled with the author's name and email address. It will output to the extra json object in manifest.json. - `ContractEmail`: The email field. It will be output to the extra json object in manifest.json. - `ContractSourceCode`: The URL of the contract source code. It will be output to the extra json object in manifest.json. diff --git a/docs/n3/develop/write/difference.md b/docs/n3/develop/write/difference.md index d5261f6..f81cfd0 100644 --- a/docs/n3/develop/write/difference.md +++ b/docs/n3/develop/write/difference.md @@ -38,6 +38,7 @@ using Neo.SmartContract.Framework; using Neo.SmartContract.Framework.Services.Neo; using System; ``` + Neo N3: ```cs @@ -77,7 +78,7 @@ static readonly UInt160 Owner = default; | | Neo Legacy | Neo N3 | | ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | main | | Removed. Developers no longer need to write the redundant main method for contract method jumping | -| Verify | Determined in the Main method, for example:
public static object Main(string method, object[] args)
{
if (Runtime.Trigger == TriggerType.Verification)
{
return IsOwner();
)
} | Independent method:
`public static bool Verify() => IsOwner();` | +| Verify | Determined in the Main method, for example:
public static object Main(string method, object[] args)
{
if (Runtime.Trigger == TriggerType.Verification)
{
return IsOwner();
)
} | Independent method:
`public static bool Verify() => IsOwner();` | | Method Name | To make the method name conform to the smart contract naming rules, the method is declared like this:
[DisplayName("balanceOf")]
public static BigInteger BalanceOf(byte[] account) | The first letter of the method name is automatically compiled to lowercase, so developers no longer have to use DisplayName, but DisplayName is still acceptable. | | Deployment | Initialization variables are placed into a separate method that is called manually after deployment. | The method `_deploy` is added, which is executed automatically after deployment. | | Update and destroy | You need to write the Update and Destroy methods by yourself. | Update and Destroy methods are built in the contract template | @@ -114,6 +115,7 @@ Neo N3 adds a new security method. You can execute the contract in a read-only m Neo N3 introduces a large number of native contracts, moving massive interoperable services from Neo Legacy to native contracts. The major changes are as follows. - Upgraded the Blockchain class to a Ledger native contract, e.g. `Blockchain.GetBlock()` changed to `Ledger.GetBlock()`. + - Added the ContractManagement native contract to query contracts and manage their updating and destruction. - Moved the contract part of the Blockchain class to the ContractManagement native contract, e.g. `Blockchain.GetContract()` changed to `ContractManagement .GetContract()`. @@ -133,8 +135,8 @@ Neo N3 introduces a large number of native contracts, moving massive interoperab - The Transaction class has been extensively updated to fit the data structure of Neo N3 transactions. - Added a new Crypto class and moved some of the methods provided by the SmartContract class to this class. - Moved a number of classes: - - Account - - Asset + - Account + - Asset - Header - InvocationTransaction - TransactionAttribute diff --git a/docs/n3/develop/write/manifest.md b/docs/n3/develop/write/manifest.md index 3355f08..a85c293 100644 --- a/docs/n3/develop/write/manifest.md +++ b/docs/n3/develop/write/manifest.md @@ -32,7 +32,7 @@ The Manifest file includes the following fields. | Groups | ContractGroup[] Consisting of a public key and a signature on the contract hash | Defines a group of trusted contracts. Contracts in a group trusts each other and can be invoked by each other, without prompting the user any warnings. For example, a series of contracts that call each other for a DeFi project. A group is identified by a public key and must has a signature for the contract hash to prove that the contract is included in the group. | | SupportedStandards | string[] | Supported NEP standard, equivalent to NEP-10 in Neo Legacy.x | | Abi | ContractAbi | NEP-14 (NeoContract ABI) Description of smart contract methods (name, parameters, return value, offset, safe or not), events (name, parameters) | -| Permissions | ContractPermission[] Consisting of the contract and its method names | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard *. The method is the method name or wildcard *. Contracts or methods not declared in the manifest cannot be called by the contract. | +| Permissions | ContractPermission[] Consisting of the contract and its method names | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard \*. The method is the method name or wildcard \*. Contracts or methods not declared in the manifest cannot be called by the contract. | | Trusts | WildcardContainer | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. | | Extra | object | Other user-defined data, such as developer, email, URL, contract profile, etc. | diff --git a/docs/n3/develop/write/nep11.md b/docs/n3/develop/write/nep11.md index 6a5b4a4..59e3649 100644 --- a/docs/n3/develop/write/nep11.md +++ b/docs/n3/develop/write/nep11.md @@ -130,7 +130,7 @@ By now we have completed a simple NFT contract. The base class `Nep11Token` also provides the following methods and events: -#### NEP-11 methods +### NEP-11 methods | Name | Parameters | Returns | Description | | ----------- | ---------------------------------------------- | ---------------- | ------------------------------------------------------------ | @@ -144,13 +144,13 @@ The base class `Nep11Token` also provides the following methods and events: | tokensOf | Hash160(owner) | InteropInterface | Returns all of the token ids owned by the specified address | | transfer | Hash160(to) ByteArray(tokenId) Any(data) | Boolean | It transfers an amount of NFT with TokenId. This method requires the signature of NFT owner. | -#### Events +### Events | Name | Parameters | Returns | Description | | -------- | ------------------------------------------------------------ | --------------- | ------------------------------------------------------------ | | transfer | Hash160(from) Hash160(to) Integer(amount) ByteArray(tokenId) | Transfer event | When the `from` address is set to `null` tokens are created; When the `to` address set to `null`tokens are burned. | -#### Compatibility check +### Compatibility check Compatibility checks will be activated for any contract that includes the `[SupportedStandards("NEP-17")]` or `[SupportedStandards("NEP-11")]` attribute. The Compatibility Check reviews method names, parameters, return values, events, and similar elements to ensure they comply with the standard, and alerts about any failures in the check. diff --git a/docs/n3/develop/write/nep17.md b/docs/n3/develop/write/nep17.md index 87098ca..b21d7b4 100644 --- a/docs/n3/develop/write/nep17.md +++ b/docs/n3/develop/write/nep17.md @@ -6,7 +6,7 @@ NEP17 assets are recorded in the contract storage area, through updating account In the method definitions below, we provide both the definitions of the functions as they are defined in the contract as well as the invoke parameters. -**totalSupply** +## totalSupply { "name": "totalSupply", @@ -16,7 +16,7 @@ In the method definitions below, we provide both the definitions of the function Returns the total token supply deployed in the system. -**symbol** +## symbol { "name": "symbol", @@ -30,7 +30,7 @@ This string MUST be valid ASCII, MUST NOT contain whitespace or control characte This method MUST always return the same value every time it is invoked. -**decimals** +## decimals { "name": "decimals", @@ -42,7 +42,7 @@ Returns the number of decimals used by the token - e.g. `8`, means to divide the This method MUST always return the same value every time it is invoked. -**balanceOf** +## balanceOf { "name": "balanceOf", @@ -61,7 +61,7 @@ The parameter `account` MUST be a 20-byte address. If not, this method SHOULD `t If the `account` is an unused address, this method MUST return `0`. -**transfer** +## transfer { "name": "transfer", @@ -102,7 +102,7 @@ If the transfer is not processed, the function MUST return `false`. If the receiver is a deployed contract, the function MUST call `onNEP17Payment` method on receiver contract with the `data` parameter from `transfer` AFTER firing the `Transfer` event. If the receiver doesn't want to receive this transfer it MUST call `ABORT`. -**Transfer Event** +## Transfer Event { "name": "Transfer", @@ -274,7 +274,6 @@ This section summaries NEP-17 changes compared to the previous NEP-5 protocol. - The TokenSale contract should implement the `onNEP17Payment` method to receive assets and modify the Manifest file to trust the received asset contract. - ### name method The name method is moved to the manifest file, and you need to add `[DisplayName("Token Name")]` when writing the contract. @@ -308,4 +307,5 @@ The ability of the contract to receive assets has been changed from a fixed cons ### Compatibility check Compatibility checks will be activated for any contract that includes the `[SupportedStandards("NEP-17")]` or `[SupportedStandards("NEP-11")]` attribute. -The Compatibility Check reviews method names, parameters, return values, events, and similar elements to ensure they comply with the standard, and alerts about any failures in the check. \ No newline at end of file +The Compatibility Check reviews method names, parameters, return values, events, and similar elements to ensure they comply with the standard, and alerts about any failures in the check. + diff --git a/docs/n3/develop/write/update.md b/docs/n3/develop/write/update.md index 5dcd04b..2b654de 100644 --- a/docs/n3/develop/write/update.md +++ b/docs/n3/develop/write/update.md @@ -7,6 +7,7 @@ Smart contracts support to be updated or destroyed after release. Before you can In some cases you want to upgrade the smart contracts deployed on the blockchain or migrate the storage of a contract into another new contract, you need to update smart contracts. Neither the contract hash nor the storage is changed when the contract is upgraded. ### Implementing the Update interface + To enable the update function, you need to implement the `Update` method in the contract. In the contract template this method has been implemented by default, as follows: ```cs @@ -22,6 +23,7 @@ public static void Update(ByteString nefFile, string manifest) If you want to update the contract later, you must implement the `update` method in the contract prior to deployment. For more information, refer to [Deploying and Invoking Smart Contracts](../deploy/deploy.md). ### Updating the contract + 1. Get the compiled NEF file and Manifest file of the new contract ready 2. Base64-encode the NEF file with the tool like [File to Base64 online](https://www.hitoy.org/tool/file_base64.php) diff --git a/docs/n3/exchange/client.md b/docs/n3/exchange/client.md index 48356fe..3b1ee43 100644 --- a/docs/n3/exchange/client.md +++ b/docs/n3/exchange/client.md @@ -3,11 +3,11 @@ sidebar_label: 'Using Neo-CLI' sidebar_position: 2 --- -## Using Neo-CLI +# Using Neo-CLI The Neo-CLI client works as a node in the P2P network and meanwhile a cross-platform wallet handling various assets transactions. -### Neo-CLI Security Policies +## Neo-CLI Security Policies :::caution @@ -23,7 +23,7 @@ Neo-CLI does not provide the function to remotely switching on/off the wallet, a | P2P | 10333 | 20333 | | websocket | 10334 | 20334 | -### About Neo-CLI +## About Neo-CLI Neo-CLI is a command-line client (wallet) for developers. Developers have two ways to interact with it: @@ -59,7 +59,7 @@ Neo-CLI provides the following features: - Provides transaction information of NEP-17 assets. -### Creating a Wallet +## Creating a Wallet The exchange needs to create an online wallet to manage the deposit addresses of users. A wallet is used to store the information of the accounts (both public keys and private keys) and the contracts. It is the most important proof that the user holds. Users must keep the wallet files and the wallet passwords secure. They must not lose or disclose these data. Exchanges do not have to create a wallet for every address. An online wallet usually keeps all deposit addresses of users. A cold wallet (offline wallet) is another storage option which provides better security. @@ -76,7 +76,7 @@ To create a wallet, do the following: 2. Set a password for the wallet. -### Generating Deposit Addresses +## Generating Deposit Addresses A wallet can store multiple addresses. The exchange needs to generate a deposit address for each user. @@ -94,4 +94,4 @@ There are two methods to generate deposit addresses: :::note Either way, the exchange must import the addresses into the database and distribute them to users. It is generally recommend the exchange use the second way, so as to reduce the external controls and run the wallet more stably. -::: \ No newline at end of file +::: diff --git a/docs/n3/exchange/deploynode.md b/docs/n3/exchange/deploynode.md index 954d2e2..03bbb65 100644 --- a/docs/n3/exchange/deploynode.md +++ b/docs/n3/exchange/deploynode.md @@ -38,6 +38,7 @@ install RpcNep17Tracker - The RpcServer plug-in must be installed before you can use the RpcNep17Tracker plug-in. - You must install the plugins ApplicationLogs and RpcNep17Tracker before synchronizing the Neo client, otherwise the log in the blocks synchronized before will be lost. + ::: ## Modifying configuration files @@ -47,4 +48,4 @@ Before running Neo-CLI, you need to make necessary configurations in the Neo-CLI :::caution Be cautious to enable automatic opening of wallet. Before you do that, make sure your firewall is open and safe as Password specified in the file is in clear text. -::: \ No newline at end of file +::: diff --git a/docs/n3/exchange/gas.md b/docs/n3/exchange/gas.md index cd0160a..6392f84 100644 --- a/docs/n3/exchange/gas.md +++ b/docs/n3/exchange/gas.md @@ -18,8 +18,10 @@ In Neo N3 every time a NEO transfer transaction occurs in the address, GASs gene Claimed *GAS = f(neo_amount, Δt_const)* Δt_const = t_end - t_start -- t_end = the current time that Neo is transferred into or out of the address. -- t_start = the last time that Neo was transferred into or out of the address. + +- t_end = the current time that Neo is transferred into or out of the address. + +- t_start = the last time that Neo was transferred into or out of the address. Δt_const is fixed, thus the claimed Gas is of a fixed amount too. And this amount depends on the amount of Neo held by the user and the duration between the moments that the user transferred this amount of Neo into and out of his or her address. diff --git a/docs/n3/exchange/general.md b/docs/n3/exchange/general.md index 34fb592..7d8888f 100644 --- a/docs/n3/exchange/general.md +++ b/docs/n3/exchange/general.md @@ -16,4 +16,4 @@ This document contains the following topics: :::note Different versions of Neo-CLI are different in ways of interfacing with exchanges. Please note the version behavior differences before upgrading your client version. -::: \ No newline at end of file +::: diff --git a/docs/n3/exchange/transaction.md b/docs/n3/exchange/transaction.md index b4aabee..4b41989 100644 --- a/docs/n3/exchange/transaction.md +++ b/docs/n3/exchange/transaction.md @@ -376,10 +376,10 @@ The parameters related to a transaction in the file are the following: - from account: The first object in the array is the account address where the asset is transferred from. Its type "bytearray" and the value "uXtKzX+CD2HS1NT5rqXrUEmN31U=“ can be decoded to "NcphtjgTye3c3ZL5J5nDZhsf3UJMGAjd7o" with base64. :::note - + In Neo, hexadecimal strings are processed in big-endian order if they are preceded by 0x, or little-endian order if they are not. ::: - + ```json { "type": "ByteString", @@ -422,11 +422,11 @@ The exchange can choose one of the following way to send assets to users: ### Neo-CLI Command: send -##### Syntax +#### Syntax `send
|all [from=null] [signerAccounts=null]` -##### Parameters +#### Parameters - `id|alias`: asset ID or asset abbreviations, e.g. neo, gas - `address`: address to transfer assets to @@ -437,7 +437,7 @@ The exchange can choose one of the following way to send assets to users: This command verifies the wallet password. -##### Example +#### Example Transfer 100 Neo to the address NYxb4fSZVKAz8YsgaPK2WkT3KcAE9b3Vag: diff --git a/docs/n3/fees.md b/docs/n3/fees.md index f18d9b3..3e0aaab 100644 --- a/docs/n3/fees.md +++ b/docs/n3/fees.md @@ -23,7 +23,6 @@ System fees include: - CPU processing fee for native contracts - Storage fee - ### Instruction fee | Fee(GAS) | OpCode | diff --git a/docs/n3/foundation/Blocks.md b/docs/n3/foundation/Blocks.md index 01475bc..fc53cfd 100644 --- a/docs/n3/foundation/Blocks.md +++ b/docs/n3/foundation/Blocks.md @@ -52,4 +52,4 @@ At present, there can be up to 512 transactions per block. :::note When a block persistent, it stores a hash list of the block's transaction, and the transaction data is stored separately to facilitate queries. -::: \ No newline at end of file +::: diff --git a/docs/n3/foundation/Cryptography/MerkleTree.md b/docs/n3/foundation/Cryptography/MerkleTree.md index 2e793c0..5a86317 100644 --- a/docs/n3/foundation/Cryptography/MerkleTree.md +++ b/docs/n3/foundation/Cryptography/MerkleTree.md @@ -18,4 +18,4 @@ Transaction001's validity can be verified by comparing original Top Hash value w - Builds a Merkle tree root when constructing a block header - Verifies the block data using SPV wallets. -- As a data structure, generates a stateRoot for Neo blocks. This is used in cross-chain and light node scenarios for quickly verifying the validity of blocks. \ No newline at end of file +- As a data structure, generates a stateRoot for Neo blocks. This is used in cross-chain and light node scenarios for quickly verifying the validity of blocks. diff --git a/docs/n3/foundation/Cryptography/encode_algorithm.md b/docs/n3/foundation/Cryptography/encode_algorithm.md index 2b80d8d..7d7f9c7 100644 --- a/docs/n3/foundation/Cryptography/encode_algorithm.md +++ b/docs/n3/foundation/Cryptography/encode_algorithm.md @@ -1,6 +1,6 @@ # Encoding Algorithm -## Base58 +## Base58 Base58 is a group of encoding/decoding schemes used to switch data between binary format (hexdecimal) and alphanumeric text format (ASCII). Base58 enables data compressing, is easy to identify, and is suitable for constructing encoding mechanism of transmission system that is anti-auto-monitoring. However, lack of verification makes it not able to detect error during transmission. Thus for Base58Check, an improved scheme is required. @@ -24,23 +24,23 @@ Interface definition: **Encoding Steps**: -1. Add 0x00 before byte[] data to generate a new byte array, and then reverse its order (little endian) +1. Add 0x00 before byte[] data to generate a new byte array, and then reverse its order (little endian) -2. Convert array data to a BigInteger object +2. Convert array data to a BigInteger object -3. Convert the BigInteger format number to 58-based number according to Base58 alphabet +3. Convert the BigInteger format number to 58-based number according to Base58 alphabet -4. Count the number of 0x00 in original byte array format data. At the head of the Base58 format data generated in step 3, for each 0x00, add a letter '1', which is the first character in Base58 alphabet +4. Count the number of 0x00 in original byte array format data. At the head of the Base58 format data generated in step 3, for each 0x00, add a letter '1', which is the first character in Base58 alphabet **Decoding Steps**: -1. Convert the input string into BigInteger format according to Base58 alphabet. +1. Convert the input string into BigInteger format according to Base58 alphabet. -2. Convert from BigInteger format to byte[] format and then reverse the order to big endian. +2. Convert from BigInteger format to byte[] format and then reverse the order to big endian. -3. If byte[] format data's length is more than 1 & byte[0] = 0 & byte[1] >= 0x80, start from byte[1], otherwise start from byte[0] to get the decoded result. +3. If byte[] format data's length is more than 1 & byte[0] = 0 & byte[1] >= 0x80, start from byte[1], otherwise start from byte[0] to get the decoded result. -4. Count the number of the first letter of Base58 alphabet in original input data as count and remove leading zeros from the decoded data. +4. Count the number of the first letter of Base58 alphabet in original input data as count and remove leading zeros from the decoded data. Example: @@ -73,9 +73,9 @@ Interface definition: **Encoding Steps**: -1. Encode input byte array twice with Sha256 to get a hashed byte array. Take the first 4 bytes of the hash as checksum and append it to the end of original byte array. +1. Encode input byte array twice with Sha256 to get a hashed byte array. Take the first 4 bytes of the hash as checksum and append it to the end of original byte array. -2. Use Base58 to encode the byte array including checksum to get corresponding encoded result. +2. Use Base58 to encode the byte array including checksum to get corresponding encoded result. **Decoding Steps**: @@ -101,4 +101,4 @@ Scenarios: - Switch between contract script hash and address -- Import / export NEP2 format secret key \ No newline at end of file +- Import / export NEP2 format secret key diff --git a/docs/n3/foundation/Cryptography/encryption_algorithm.md b/docs/n3/foundation/Cryptography/encryption_algorithm.md index 1e88155..c4d6641 100644 --- a/docs/n3/foundation/Cryptography/encryption_algorithm.md +++ b/docs/n3/foundation/Cryptography/encryption_algorithm.md @@ -117,7 +117,6 @@ Example:    +"da04fe4405fc021e4ca5ca956b263828e99d4ce2a342b2cbdc919baddbe178ae"   ---->"a8158a64c1e9d776e12582d8c63553ee0c7687bd8e374f79c766e7459577f547" - 2. passphrase-protected msg,key----->msg   Ciphertext + (password: 256-bit hash of "l love coding") diff --git a/docs/n3/foundation/Cryptography/hash_algorithm.md b/docs/n3/foundation/Cryptography/hash_algorithm.md index 409fb91..7aaf483 100644 --- a/docs/n3/foundation/Cryptography/hash_algorithm.md +++ b/docs/n3/foundation/Cryptography/hash_algorithm.md @@ -6,7 +6,7 @@ Two different hash functions are used widely in the Neo system: SHA256 and RIPEM In addition, the block will also use a hash structure called a Merkle Tree. It computes the hash of each transaction and combines one with the next and then hashes again, repeating this process until there is only one root hash (Merkle Root). -### RIPEMD160 +## RIPEMD160 RIPEMD is a cryptographic hash function published by Hans Dobbertin, Antoon Bosselaers Bart Prenee from COSIC research team, University of Leuven in 1996. @@ -24,7 +24,7 @@ Scenarios: To generate contract hash. -### SHA256 +## SHA256 SHA256 is a kind of SHA-2 algorithm. SHA-2 is a cryptographic hash function algorithm standard produced by NSA. It belongs to SHA family. It is a successor of SHA-1. SHA-2 has 6 different algorithm standards, including SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. @@ -46,7 +46,7 @@ Scenarios: - db3、NEP6 wallet secret key storage, export & validation. -### Murmur32 +## Murmur32 Murmur is kind of non-cryptographic hash algorithm and suits for general hash indexing. It is proposed by Austin Appleby in 2008. Later several derived versions are released. Compared with other popular hash functions, Murmur's random distribution performance is better for keys with high regularity. @@ -70,7 +70,7 @@ Scenarios: - leveldb storage -### Scrypt +## Scrypt Scrypt is a kind of secure-cryptographic algorithm based on PBKDF2-HMAC-SHA-256 algorithm. It's developed by Colin Percival, a famous FreeBSD hacker, for his backup service Tarsnap. The original design was to reduce CPU load, minimize CPU reliance, and use CPU idle time for calculations. Therefore, scrypt not only takes a long time to calculate, but also consumes a lot of memory, making it difficult to calculate multiple digests in parallel. So it is more difficult to use the rainbow table for brute-force-attacks. diff --git a/docs/n3/foundation/Native tokens.md b/docs/n3/foundation/Native tokens.md index e4ef25f..99e7833 100644 --- a/docs/n3/foundation/Native tokens.md +++ b/docs/n3/foundation/Native tokens.md @@ -5,7 +5,7 @@ sidebar_position: 2 # NEO Token Models -### Native Token +## Native Token There are 2 kinds of native tokens defined in the Neo system: NEO and NeoGas (GAS). @@ -18,7 +18,7 @@ The Neo N3 Genesis block will mint the exact amount of GAS token needed to accou To read more about GAS generation rate and distribution refer to the [Governance and Incentives](./governance). -### NEP17 Assets (Tokens) +## NEP17 Assets (Tokens) NEP17 tokens need to be issued and managed through smart contract. Their information is stored in a smart contract's storage. Account model is used. For detailed information, refer to [NEP-17](/docs/n3/develop/write/nep17). diff --git a/docs/n3/foundation/Transactions.md b/docs/n3/foundation/Transactions.md index 342076a..a2aeada 100644 --- a/docs/n3/foundation/Transactions.md +++ b/docs/n3/foundation/Transactions.md @@ -103,10 +103,10 @@ In Neo all variable-length integer types except IP addresses and port numbers ar | `systemFee` | - | | `networkFee` | - | | `validUntilBlock` | - | -| `signers` | Need to serializes `WriteVarInt(length) `first and then other elements of the array | +| `signers` | Need to serializes `WriteVarInt(length)` first and then other elements of the array | | `attributes` | Need to serializes `WriteVarInt(length)` first and then other elements of the array | -| `script` | Need to serializes `WriteVarInt(length) `first and then the byte array | -| `witnesses` | Need to serializes `WriteVarInt(length) `first and then other elements of the array | +| `script` | Need to serializes `WriteVarInt(length)` first and then the byte array | +| `witnesses` | Need to serializes `WriteVarInt(length)` first and then other elements of the array | :::note diff --git a/docs/n3/foundation/Wallets.md b/docs/n3/foundation/Wallets.md index 3cd6110..cf3eab8 100644 --- a/docs/n3/foundation/Wallets.md +++ b/docs/n3/foundation/Wallets.md @@ -78,11 +78,11 @@ The address script in Neo N3 has changed not using the Opcode.CheckSig and OpCod ![Account Address](images/wallets/account_address_script_checksign.png) -2. Calculate script hash of the contract (20 bytes, make once SHA256 and RIPEMD160 of the script). +1. Calculate script hash of the contract (20 bytes, make once SHA256 and RIPEMD160 of the script). -3. Add the version prefix in the hash (Currently, the Neo protocol version is 53 and the corresponding byte is `0x35`). +2. Add the version prefix in the hash (Currently, the Neo protocol version is 53 and the corresponding byte is `0x35`). -4. Make Base58Check encoding for the above byte data. +3. Make Base58Check encoding for the above byte data. Example: @@ -202,36 +202,37 @@ An NEP6 wallet file complies with the NEP6 standard, and the file name extension ```json { - "name": null, - "version": "3.0", - "scrypt": { - "n": 16384, - "r": 8, - "p": 8 - }, - "accounts": [ - { - "address": "Nf8iN8CABre87oDaDrHSnMAyVoU9jYa2FR", - "label": null, - "isdefault": false, - "lock": false, - "key": "6PYM9DxRY8RMhKHp512xExRVLeB9DSkW2cCKCe65oXgL4tD2kaJX2yb9vD", - "contract": { - "script": "DCEDYgBftumtbwC64LbngHbZPDVrSMrEuHXNP0tJzPlOdL5BdHR2qg==", - "parameters": [ - { - "name": "signature", - "type": "Signature" - } - ], - "deployed": false - }, - "extra": null - } - ], - "extra": null + "name": null, + "version": "3.0", + "scrypt": { + "n": 16384, + "r": 8, + "p": 8 + }, + "accounts": [ + { + "address": "Nf8iN8CABre87oDaDrHSnMAyVoU9jYa2FR", + "label": null, + "isdefault": false, + "lock": false, + "key": "6PYM9DxRY8RMhKHp512xExRVLeB9DSkW2cCKCe65oXgL4tD2kaJX2yb9vD", + "contract": { + "script": "DCEDYgBftumtbwC64LbngHbZPDVrSMrEuHXNP0tJzPlOdL5BdHR2qg==", + "parameters": [ + { + "name": "signature", + "type": "Signature" + } + ], + "deployed": false + }, + "extra": null + } + ], + "extra": null } ``` + In this example the password is 1 | Field | Description | @@ -265,17 +266,17 @@ An NEP6 wallet uses scrypt algorithm as the core method of wallet encryption and 2. Calculate a `derivedkey` by the scrypt algorithm, and divide the 64-byte data into two halves as `derivedhalf1` and `derivedhalf2` Scrypt uses the following parameters: - ciphertext: The entered password (UTF-8 format) - - salt: address hash - - n: 16384 - - r: 8 - - p: 8 - - length: 64 + - salt: address hash + - n: 16384 + - r: 8 + - p: 8 + - length: 64 3. Do xor operation on the private key and `derivedhalf1`, and then get `encryptedkey` by using AES256 to encrypt it with `derivedhalf2` 4. Concatenate data according to the following format and obtain `NEP2Key` by using Base58Check encoding of it - `0x01` + `0x42` + `0xe0` + address hash + `encryptedkey` + `0x01` + `0x42` + `0xe0` + address hash + `encryptedkey` **Decryption steps**: @@ -340,18 +341,18 @@ Example: | Function Name | Description | | ---------------- | ------------------------------------------------------------ | | Import wallet file | Import the account information from the specified wallet file | -| Export wallet file | Store the account information (including private key, password, address, etc.) in the specified wallet file such as db3 wallet file, nep6 json file. | +| Export wallet file | Store the account information (including private key, password, address, etc.) in the specified wallet file such as db3 wallet file, nep6 json file. | | Unlock wallet | Verify user password to prevent leaks | -| Create private key | Recommend safe random generator | +| Create private key | Recommend safe random generator | | Import private key | Add new private key to the wallet with wif format or digital certificate | -| Export private key | Export accounts' private key | +| Export private key | Export accounts' private key | | Generate public key | Obtain public key by ECC algorithm with private key | | Generate address | Generate address based on private key | -| Import address | Add new address to the wallet | +| Import address | Add new address to the wallet | | Export address | Export accounts' address | | Import offline data | Load block data in `chain.acc` file to reduce synchronization time | -| Export offline data | Export block data in `chain.acc` file | -| Synchronize block data | | +| Export offline data | Export block data in `chain.acc` file | +| Synchronize block data | | | Transfer | Transfer to other addresses | | Sign | Sign data, such as transactions | | Claim Gas | Claim the newly allocated gas from the neo held by the account | diff --git a/docs/n3/foundation/consensus/consensus_algorithm.md b/docs/n3/foundation/consensus/consensus_algorithm.md index 40e6988..77f7007 100644 --- a/docs/n3/foundation/consensus/consensus_algorithm.md +++ b/docs/n3/foundation/consensus/consensus_algorithm.md @@ -51,7 +51,7 @@ A normal algorithm flow is shown below. ![](../images/consensus/3.png) -##### 1) Initialize local consensus information +#### 1) Initialize local consensus information 1. Initialize consensus context @@ -61,9 +61,9 @@ A normal algorithm flow is shown below. 4. Broadcast the Recovery Request message to acquire the current consensus context if consensus is newly started. -##### 2) Validators listen to the network and collect transactions until timeout +#### 2) Validators listen to the network and collect transactions until timeout -##### 3) Start consensus +#### 3) Start consensus - For speaker: @@ -75,7 +75,7 @@ A normal algorithm flow is shown below. - For delegates: - - In case of receiving Prepare Request from the speaker before timeout: + - In case of receiving Prepare Request from the speaker before timeout: 1. Verify the validity of the message and whether it conforms to the local consensus context @@ -87,7 +87,7 @@ A normal algorithm flow is shown below. 5. Ask for transactions not found in step 4 from other nodes - - Otherwise, attempt to change view + - Otherwise, attempt to change view ##### 4) Broadcast Prepare Response @@ -101,35 +101,35 @@ A normal algorithm flow is shown below. - Otherwise, attempt to change view -##### 5) Collect Prepare Response and broadcast Commit +#### 5) Collect Prepare Response and broadcast Commit - For the speaker and delegates who have received Prepare Request, if Prepare Response messages from M different delegates are received before timeout: - - For each Prepare Response message received: + - For each Prepare Response message received: 1. Verify the validity of the message and whether it conforms to the local consensus context 2. Prolong local timeout by ![](../images/consensus/5.png) - - Broadcast Commit message + - Broadcast Commit message - Otherwise, attempt to change view -##### 6) Collect Commit message and create new block +#### 6) Collect Commit message and create new block - For each validator already having all transactions required in Prepare Request message, in case of Commit messages from M different validators received: - - For each Commit message received: + - For each Commit message received: 1. Verify the validity of the message and whether it conforms to the local consensus context 2. Prolong local timeout by ![](../images/consensus/6.png) - - Create and broadcast the new block + - Create and broadcast the new block - Otherwise, broadcast the Recovery Message, and set the timeout to 2*Tblock -##### 7) Go back to step 1 to start a new round of consensus. +#### 7) Go back to step 1 to start a new round of consensus ### Change View Request diff --git a/docs/n3/foundation/consensus/consensus_protocol.md b/docs/n3/foundation/consensus/consensus_protocol.md index c5934a0..7db8388 100644 --- a/docs/n3/foundation/consensus/consensus_protocol.md +++ b/docs/n3/foundation/consensus/consensus_protocol.md @@ -103,7 +103,7 @@ There are 3 kinds of `InventoryType`: ## Consensus Message Process -### Verification +### Verification 1. Ignore the message if `ValidBlockStart` is lower than `ValidBlockEnd`. diff --git a/docs/n3/foundation/consensus/dbft.md b/docs/n3/foundation/consensus/dbft.md index 788ef6b..d8ecaeb 100644 --- a/docs/n3/foundation/consensus/dbft.md +++ b/docs/n3/foundation/consensus/dbft.md @@ -32,7 +32,7 @@ We identify each consensus node with a number, starting from 0, the last node is A new block will be generated with each round of consensus, with at least N − F signatures from bookkeeping nodes. Upon the generation of a block, a new round of consensus making shall begin, resetting v=0. -### General Procedures +### General Procedures ![](../images/consensus/1.png) diff --git a/docs/n3/foundation/introduction.md b/docs/n3/foundation/introduction.md index 1b6c2d4..aad2f5c 100644 --- a/docs/n3/foundation/introduction.md +++ b/docs/n3/foundation/introduction.md @@ -6,8 +6,8 @@ sidebar_position: 0 # Introduction to Neo -## Neo is an open-source community driven blockchain platform. +## Neo is an open-source community driven blockchain platform Neo is the most feature-complete blockchain platform for building decentralized applications. Neo enables developers to digitize and automate the management of assets through smart contracts. Multi-language support (including C#, Python, Go, TypeScript, and Java) makes it easy for developers to build on the platform in the language they are most comfortable with. Neo also provides powerful native infrastructures such as decentralized storage, oracles, and domain name service, creating a solid foundation for the Next-Gen Internet. -[Read more about Neo](https://neo.org/about) \ No newline at end of file +[Read more about Neo](https://neo.org/about) diff --git a/docs/n3/foundation/neovm.md b/docs/n3/foundation/neovm.md index a8c8360..94c1f90 100644 --- a/docs/n3/foundation/neovm.md +++ b/docs/n3/foundation/neovm.md @@ -12,7 +12,7 @@ With the help of NeoCompiler, source code written in Java, C# or other high-leve In addition, NeoVM is highly decoupled from the upper-level code and customizable by using techniques such as interop services. NeoVM can be used by simply creating an instance, incredibly easy to use, and can be applied to various blockchain and non-blockchain scenarios. -## Infrastructure and Execution Process +## Infrastructure and Execution Process ### Infrastructure @@ -28,7 +28,7 @@ ExecutionEngine is the core of NeoVM, mainly responsible for loading scripts and NeoVM is a stack-based virtual machine. NeoVM has three types of stack: InvocationStack, EvaluationStack, and ResultStack. -- InvocationStack is used to store all execution contexts of current NeoVM, which are isolated from each other in the stack. Context switching is performed based on the current context and entry context. The current context points to the top element of invocation stack, which is ExecutionContext0 in the architecture figure. And the entry context points to the tail element of invocation stack, which is ExecutionContextN in the architecture figure. +- InvocationStack is used to store all execution contexts of current NeoVM, which are isolated from each other in the stack. Context switching is performed based on the current context and entry context. The current context points to the top element of invocation stack, which is ExecutionContext0 in the architecture figure. And the entry context points to the tail element of invocation stack, which is ExecutionContextN in the architecture figure. - EvaluationStack is for storing the data used by the instruction in execution process. Each execution context has its own evaluation stack. - ResultStack is used to store execution result after all scripts are executed. @@ -52,4 +52,4 @@ A complete execution process is as follows: 2. Execution engine of NeoVM loads the bytecode file, and then constructs the bytecodes together with the related parameters in the file as an execution context and finally pushes it into invocation stack. 3. Each time execution engine takes an instruction from current context, and then executes corresponding operations according to the instruction. The data generated in execution process will be stored in the evaluation stack and alt stack of current context. 4. For accessing external data, encrypting data, zero-knowledge proof and other operations, the interoperation interfaces will be invoked. -5. After all scripts are executed, the result will be stored in the result stack. \ No newline at end of file +5. After all scripts are executed, the result will be stored in the result stack. diff --git a/docs/n3/gettingstarted/develop.md b/docs/n3/gettingstarted/develop.md index 4e086f2..68705ea 100644 --- a/docs/n3/gettingstarted/develop.md +++ b/docs/n3/gettingstarted/develop.md @@ -81,9 +81,9 @@ In comparison with Neo Legacy, the Neo N3 NEP17 sample has the following changes - Implemented onNEP17Payment to automatically execute the smart contract when NEP17 assets are received. -- Major changes occurred in smart contract framework. For details refer to [Smart Contract API](https://docs.neo.org/docs/en-us/reference/scapi/interop.html) +- Major changes occurred in smart contract framework. For details refer to [Smart Contract API](../reference/scapi/interop.md) -For more information refer to [NEP-17](https://docs.neo.org/docs/en-us/develop/write/nep17.html) . +For more information refer to [NEP-17](../develop/write/nep17.md) . ## Compiling contract file diff --git a/docs/n3/gettingstarted/prerequisites.md b/docs/n3/gettingstarted/prerequisites.md index 38a3782..64507fe 100644 --- a/docs/n3/gettingstarted/prerequisites.md +++ b/docs/n3/gettingstarted/prerequisites.md @@ -12,4 +12,4 @@ You are recommended to run Neo-CLI in the following environments that we have te ### Download Neo-CLI -Refer to [Neo-CLI Setup](../node/cli/setup.md) to download and install Neo-CLI package from GitHub. \ No newline at end of file +Refer to [Neo-CLI Setup](../node/cli/setup.md) to download and install Neo-CLI package from GitHub. diff --git a/docs/n3/glossary.md b/docs/n3/glossary.md index b68a938..b7d777d 100644 --- a/docs/n3/glossary.md +++ b/docs/n3/glossary.md @@ -4,27 +4,27 @@ sidebar_label: 'Glossary' # Glossary -#### Block +## Block A block in a Blockchain contains a number of transaction records. Blocks are paired up with the previous block according to the timestamp and the cryptographic hash of the previous block contained in each block header, thereby creating a chain of blocks, or a blockchain. -#### Wallet +## Wallet A wallet is a cryptographic public/private key pair which is used to sign and authenticate database transactions that occur on the Neo network. -#### Account (Address) +## Account (Address) Similar to your bank account, a blockchain account is used to transfer or receive assets in a transaction. The address is generated by the script hash through some operations, and can be converted back to the script hash. In Neo Legacy, the address starts with A, and in Neo N3, the address starts with N. -#### Private Key/Public Key +## Private Key/Public Key The private key is a 256-bit random number that is kept by users themselves, without disclosing to others. It is a proof of the user's right to use the account and ownership of assets in the account. Each private key has a public key paired with it. -#### Transaction +## Transaction A Neo transaction is a signed data package with an instruction for the network, for example a user indicating that he wants to transfer assets to another address. Each Neo block in the blockchain ledger contains one or more transactions, making each block a transaction batch. -#### Script +## Script A script is a piece of code that consists of opcodes and operands. Each account is a contract with a script. A standard account script is composed of the public key and the OpCode that verifies the signature. The format is as follows @@ -33,39 +33,39 @@ PUSHDATA1 03ac765294075da6f7927c96bfe3d3f64ae3680c5eb50f82f55170a9f1bea59dad SYSCALL Neo.Crypto.VerifyWithECDsaSecp256r1 ``` -#### Script Hash +## Script Hash The script hash is generated from the smart contract script with the RIPEMD-160 algorithm. Each script has a unique script hash. Any change made in the script of the contract will cause the script hash to change. The script hash length is 20 bytes (160 bits). The script hash is generated unidirectionally by the script, and cannot be reversed to the script. The script hash and address can be converted to each other. -#### Opcode +## Opcode Opcodes are similar to instructions in assembly language. For all OpCode, refer to [OpCode source](https://github.com/neo-project/neo/blob/master/src/Neo.VM/OpCode.cs). -#### Cryptographic private key +## Cryptographic private key Cryptographic private key refers to the encryption of the private key through the wallet password, which is more secure than the plaintext private key. In this way, you can write the cryptographic private key on paper and keep the password in your mind. -#### Smart Contract +## Smart Contract From the blockchain perspective, a smart contract is a set of promises, specified in digital form, including protocols within which the parties perform on these promises. -#### NEP-17 +## NEP-17 The NEP-17 proposal outlines a token standard for the Neo blockchain that will provide systems with a generalized interaction mechanism for tokenized smart contracts. -#### SysCall +## SysCall The system call is a special operation code, through which you can call the interoperable service layer interface. By calling the interoperable service layer interface, NeoVM can access data such as block, transaction , contract, and asset information that are required for running smart contracts. For more information refer to the files in [Neo smart contract module](https://github.com/neo-project/neo/tree/master/src/Neo/SmartContract) starting with `ApplicationEngine.` , such as `ApplicationEngine.Contract.cs`, `ApplicationEngine.Blockchain.cs`. -#### Dynamic Call +## Dynamic Call A special system call that invokes another contract within a contract. It can be wrote as `Contract.Call(scriptHash, method, params)`. For more information refer to [Invoking Smart Contracts](develop/deploy/invoke). -#### Storage +## Storage Each smart contract deployed on the Neo blockchain has a private storage area for storing application data. When creating a smart contract or transaction to use this contract, the contract code needs to read and write its storage. Each contract can declare a storage area. For more information refer to [Storage](reference/scapi/framework/services/Storage.md). -#### NEF +## NEF NEF is short for Neo Executable Format. The smart contract compiler compiles the source code and eventually generate NEF files and Manifest files (see below). diff --git a/docs/n3/node/Introduction.md b/docs/n3/node/Introduction.md index 2e4400c..6b9601a 100644 --- a/docs/n3/node/Introduction.md +++ b/docs/n3/node/Introduction.md @@ -4,6 +4,7 @@ sidebar_position: 0 --- # Neo Node Introduction + Nodes that store all of the blockchain are called “full-nodes”. They are connected to the blockchain through a P2P network. All the nodes in the blockchain network are equal, they act both as a client interface and as a server. There are two full-node programs: diff --git a/docs/n3/node/cli/cli.md b/docs/n3/node/cli/cli.md index f589a82..f15339d 100644 --- a/docs/n3/node/cli/cli.md +++ b/docs/n3/node/cli/cli.md @@ -17,7 +17,7 @@ All the commands described in this document conform with these conventions: - `|` separates multiple parameters where any one of them can be used at your choice. - `=` indicates the default value of the optional parameter without an input. -#### Console commands +### Console commands | Command | Description | | ------- | --------- | @@ -27,7 +27,7 @@ All the commands described in this document conform with these conventions: | clear | Clear screen | | exit | Exit program | -#### Wallet commands +### Wallet commands | Command | Parameters | Description | | ------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------ | @@ -55,7 +55,7 @@ The commands listed in the table below requires you to open the wallet before in | [sign](#sign) | `` | Signs the transaction. The parameter is the json string that records the transaction information. | | [cancel](#cancel) | `` [sender=null] [signerAccounts=null] | Cancel unconfirmed transactions (in memory pool) | -#### Contract commands +### Contract commands | Command | Parameters | Description | | ----------------- | ------------------------------------------------------------ | ------------------ | @@ -64,14 +64,14 @@ The commands listed in the table below requires you to open the wallet before in | [update](#update) | `` `` `` `` \[signerAccounts=null] | Upgrade a contract | -#### Node commands +### Node commands | Command | Parameters | Description | | ---------- | --------------- | ------------------------------------------------------------ | | show state | | Displays the current status of blockchain synchronization. | | show pool | [verbose=False] | Displays the transactions in the memory pool (These transactions are in the state of zero confirmation). | -#### Nep17 commands +### Nep17 commands | Command | Parameters | Description | | ----------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | @@ -81,13 +81,13 @@ The commands listed in the table below requires you to open the wallet before in | [totalsupply](#totalsupply) | `` | Queries the total supply of specified token | | [transfer](#transfer) | `` `` `` \[from=null] \[data=null] \[signersAccounts=null] | Invokes the transfer method to transfer the specified token | -#### Native contract commands +### Native contract commands | Command | Parameters | Description | | ------------------------------------------- | ---------- | -------------------------------------------------- | | [list nativecontract](#list-nativecontract) | | Lists all the native contract names and scripthash | -#### Network commands +### Network commands | Command | Parameters | Description | | --------------- | ------------------- | ------------------------------------------------------------ | @@ -100,7 +100,7 @@ The commands listed in the table below requires you to open the wallet before in | [broadcast inv](#broadcast-inv) | `` `` | Broadcasts the inventory data | | [broadcast transaction](#broadcast-transaction) | `` | Broadcasts a transaction | -#### Plugin commands +### Plugin commands | Command | Parameters | Description | | ----------------------------- | ------------- | ---------------------------------------- | @@ -116,7 +116,7 @@ The commands listed in the table below requires you to open the wallet before in | [get proof](#get-proof) | `` `` `` | Gets proof with root hash, contract hash, and storage key. | | [verify proof](#verify-proof) | `` `` | Verifies with root hash and proof. | -#### Voting commands +### Voting commands | Command | Parameters | Description | | --------------------------------------------- | ----------------------------- | ----------------------------------------------------------- | @@ -129,7 +129,7 @@ The commands listed in the table below requires you to open the wallet before in | [vote](#vote) | `` `` | Votes for candidates | | [unvote](#unvote) | `` | Cancel the voting | -#### Block Commands +### Block Commands | Command | Parameters | Description | | ------------------------------- | -------------------------------------- | ------------------------------------------------------------ | @@ -138,7 +138,7 @@ The commands listed in the table below requires you to open the wallet before in | [show contract](#show-contract) | `` | Output contract details by contract name or contract hash. | | [show tx](#show-tx) | `` | Output transaction details via transaction hash. | -#### Log Commands +### Log Commands | Command | Description | | ------------------- | -------------------------------------- | @@ -151,11 +151,11 @@ The commands listed in the table below requires you to open the wallet before in Converts the input string into various supported data formats. -##### Syntax +#### Syntax > parse `` -##### Example +#### Example ``` neo> parse NcphtjgTye3c3ZL5J5nDZhsf3UJMGAjd7o @@ -180,11 +180,11 @@ If you see messy codes that is because some data types cannot be converted. You Creates a wallet file in the .db3 or .json format. A wallet password is required to be specified during the process. -##### Syntax +#### Syntax `create wallet ` -##### Example +#### Example ``` neo> create wallet test.json @@ -201,11 +201,11 @@ The wallet file is generated under the neo-cli root directory. If you want to se Delete an address from wallet. -##### Syntax +#### Syntax `delete address
` -##### Example +#### Example ``` neo> delete address NL4zw2c1MdaXYmGt4NWTPXFcyuNjCQrpNL @@ -218,11 +218,11 @@ Address 0xde6b70cbd0989167094b60b474e8f6658233b501 deleted. Opens the wallet file at the specified path. The wallet password is required to be entered when opening the wallet. -##### Syntax +#### Syntax `open wallet ` -##### Example +#### Example ``` neo> open wallet test.json @@ -233,11 +233,11 @@ password: * Changes the wallet password. -##### Syntax +#### Syntax `change password` -##### Example +#### Example ``` neo> change password @@ -251,11 +251,11 @@ Password changed successfully Upgrades the old .db3 wallet file into the .json format. -##### Syntax +#### Syntax `upgrade wallet ` -##### Example +#### Example ``` neo> upgrade wallet test.db3 @@ -266,11 +266,11 @@ Wallet file upgrade complete. New wallet file has been auto-saved at: test.json lists all the unclaimed GAS in the current wallet. -##### Syntax +#### Syntax `show gas` -##### Example +#### Example ``` neo> show gas @@ -278,7 +278,7 @@ unclaimed gas: 16.7367406 ``` :::note - This command does not show the GAS that has been claimed. Use `list asset` instead. +This command does not show the GAS that has been claimed. Use `list asset` instead. ::: On Neo N3, The GAS in an account is claimed automatically every time when the number of Neo in the account changes. @@ -287,7 +287,7 @@ On Neo N3, The GAS in an account is claimed automatically every time when the nu Creates a new address. One can also enter `create address 100` to create 100 new addresses in batches; Addresses are automatically exported to the address.txt file. -##### Syntax +#### Syntax `create address [n]` @@ -295,7 +295,7 @@ Creates a new address. One can also enter `create address 100` to create 100 new `n`: Number of addresses to create. n is an integer and defaults to 1. -##### Example +#### Example ``` neo> create address 3 @@ -308,7 +308,7 @@ Export addresses to address.txt Queries the balance of specified token at the specified address -##### Syntax +#### Syntax `balanceof
` @@ -318,7 +318,7 @@ Queries the balance of specified token at the specified address - `address`: The address to query -##### Example +#### Example ``` neo> balanceof 0xd2c270ebfc2a1cdd3e470014a4dff7c091f699ec NcphtjgTye3c3ZL5J5nDZhsf3UJMGAjd7o @@ -334,7 +334,7 @@ Result Stack: [{"type":"Integer","value":"1998380000000000"}] Queries the precision of specified token -##### Syntax +#### Syntax `decimals ` @@ -342,7 +342,7 @@ Queries the precision of specified token `tokenHash`: The token hash -##### Example +#### Example ``` neo> decimals 0xd2c270ebfc2a1cdd3e470014a4dff7c091f699ec @@ -357,7 +357,7 @@ Result : 8 Queries the name of specified token -##### Syntax +#### Syntax `name ` @@ -365,7 +365,7 @@ Queries the name of specified token `tokenHash`: The token hash -##### Example +#### Example ``` neo> name 0xd2a4cff31913016155e38e474a2c06d08be276cf @@ -379,7 +379,7 @@ Result: GasToken Queries the total supply of specified token -##### Syntax +#### Syntax `totalsupply ` @@ -387,7 +387,7 @@ Queries the total supply of specified token `tokenHash`: The token hash -##### Example +#### Example ``` neo> totalsupply 0xd2a4cff31913016155e38e474a2c06d08be276cf @@ -409,7 +409,7 @@ Result: 100000000 Invokes the transfer method to transfer the specified token. -##### Syntax +#### Syntax `transfer [from=null] [data=null] [signersAccounts=null]` @@ -422,7 +422,7 @@ Invokes the transfer method to transfer the specified token. - `data`:The additional parameter. The default value is null. - `signersAccounts`: The signer's address -##### Example +#### Example ``` neo> transfer 0xd2c270ebfc2a1cdd3e470014a4dff7c091f699ec Nhe4mzfQRoKojkXhqxJHjANvBMT7BYAXDv 6000 NNU67Fvdy3LEQTM374EJ9iMbCRxVExgM8Y transferdata NNU67Fvdy3LEQTM374EJ9iMbCRxVExgM8Y @@ -435,12 +435,12 @@ Signed and relayed transaction with hash=0x0d82a59ca2106c93e6383893d86a098d1a9fb Lists all the native contract names and scripthash. -##### Syntax +#### Syntax `list nativecontract` -##### Example +#### Example ``` neo> list nativecontract @@ -460,7 +460,7 @@ neo> list nativecontract Gets the latest voting information of the specific account, including the address it voted, the amount of votes cast and the block height at the time of voting. -##### Syntax +#### Syntax `get accountstate
` @@ -468,7 +468,7 @@ Gets the latest voting information of the specific account, including the addres `address`:The address you want to query the voting information. -##### Example +#### Example ``` neo> get accountstate NNz4ppADL3mke7HT8RvRr5nX8zTAbNdWjv @@ -486,11 +486,11 @@ Block: 9774 Gets candidates' public keys and votes -##### Syntax +#### Syntax `get candidates` -##### Example +#### Example ``` neo> get candidates @@ -506,11 +506,11 @@ Candidates: Gets the committee member's public key -##### Syntax +#### Syntax `get committee` -##### Example +#### Example ``` neo> get committee @@ -526,11 +526,11 @@ Committee: Gets the next validator's public key -##### Syntax +#### Syntax `get next validators` -##### Example +#### Example ``` neo> get next validators @@ -546,7 +546,7 @@ Next validators: Registers the candidate -##### Syntax +#### Syntax `register candidate [maxGas=1010]` @@ -556,7 +556,7 @@ Registers the candidate `maxGas`: The maximum GAS can be consumed. Default is 1010, where the registration fee is 1000 GAS. -##### Example +#### Example ``` neo> register candidate NUNtEBBbJkmPrmhiVSPN6JuM7AcE8FJ5sE @@ -572,7 +572,7 @@ Signed and relayed transaction with hash=0xc30ecd2e30d2d3347e389dbdb205c6a38a663 Unregisters the candidate -##### Syntax +#### Syntax `unregister candidate ` @@ -580,7 +580,7 @@ Unregisters the candidate `account`: The account to unregister candidate -##### Example +#### Example ``` neo> unregister candidate NUNtEBBbJkmPrmhiVSPN6JuM7AcE8FJ5sE @@ -596,7 +596,7 @@ Signed and relayed transaction with hash=0xa799e315956e120a51bf5b5804d9518754a84 Votes for candidates -##### Syntax +#### Syntax `vote ` @@ -605,7 +605,7 @@ Votes for candidates - `senderAccount`: The account used to vote - `publickey`: The public key of the account you vote for -##### Example +#### Example ``` neo> vote Nhiuh11SHF4n9FE6G5LuFHHYc7Lgws9U1z 02344389a36dfc3e95e05ea2adc28cf212c0651418cfcf39e69d19d18b567b221d @@ -622,7 +622,7 @@ Signed and relayed transaction with hash=0x8083633ecc4827b7967ba8b0a30f02992dc52 Cancel the voting -##### Syntax +#### Syntax `unvote ` @@ -630,7 +630,7 @@ Cancel the voting `senderAccount`: The account to unvote -##### Example +#### Example ``` neo> unvote 0x39edfd1534af1ab7e91bab25fcee9a3b93bfae21 @@ -646,7 +646,7 @@ Signed and relayed transaction with hash=0x78f83fd1e0607f078fa0964a97b9972d3f484 Exports private key of the address to the specified file. The command also requires the verification of the wallet password. -##### Syntax +#### Syntax `export key [address] [path]` @@ -655,7 +655,7 @@ Exports private key of the address to the specified file. The command also requi - `address`: Address to export private key. - `path`: Path to the file used to store the private key. -##### Example +#### Example Exports the key to the console: @@ -684,7 +684,7 @@ password: ******** Imports a private key, or a file with a number of private keys. -##### Syntax +#### Syntax `import key ` @@ -692,7 +692,7 @@ Imports a private key, or a file with a number of private keys. `wif | path`: The key to import or the file path. -##### Example +#### Example ``` neo> import key L4q37aCJzjEXhAUJ6npdxbjGGbyTXuWhpgYxkb2NWPmzXv4DdxiD @@ -710,7 +710,7 @@ If there is a specified file, the file is in the private key format. Refer to ex Creates a multi-party signed address. -##### Syntax +#### Syntax `import multisigaddress m pubkeys...` @@ -719,7 +719,7 @@ Creates a multi-party signed address. - `m`: m is the minimal number of signatures. For example, creating a multi-party signed address with two public keys, m can be 1 or 2. - `pubkeys`: Public keys of multiple parties involved. -##### Example +#### Example ``` neo> import multisigaddress 2 03fadbc9b25d1b6827124665c50801e602240c9d8ebdda2bae49de6683f8f86af9 02ff249d06faaf0b5ba865e1531bfabe07f89aef39ab59082e3bc140be0318055d @@ -730,7 +730,7 @@ Multisig. Addr.: NN58k4Ei4nUzWxrgksHZPantyuDxWgouod Imports the watch-only address, e.g contract account. -##### Syntax +#### Syntax `import watchonly scriptHash` @@ -738,7 +738,7 @@ Imports the watch-only address, e.g contract account. `addressOrFile`:account address, hash, contract hash, or files storing these data -##### Example +#### Example ``` neo> import watchonly 0xbfe215933f29b29dacf0e8383722a62974ac8aa6 @@ -749,7 +749,7 @@ Address: Nb6ZUp9h5aCKkNADpdUD5TbuJGP6wyRvE8 Transfers the asset to the specified address. The command requires the verification of the wallet password. -##### Syntax +#### Syntax `send
[from=null] [data=null] [signerAccounts=null]` @@ -762,7 +762,7 @@ Transfers the asset to the specified address. The command requires the verificat - `data`: the additional transaction information, which defaults to null. - `signerAccounts`: signer's address -##### Example +#### Example Transfer 100 Neo to the address Ni5iS2XHazKZtXfzLJbdyDk8UUcGBZGePR: @@ -803,7 +803,7 @@ TXID: 0x174bab85eb004a07ae5b411f23cb6d3128346f9249305a768c286707938b4727 This command is used to sign ContractParametersContext. The translation can be broadcasted only after signing is completed. -##### Syntax +#### Syntax `sign ` @@ -811,7 +811,7 @@ This command is used to sign ContractParametersContext. The translation can be b `jsonObjectToSign`: The json string that records the transaction information. -##### Example +#### Example ``` neo> sign {"type":"Neo.Network.P2P.Payloads.Transaction","hex":"AFhJmTC0i5cAAAAAAHwNhQAAAAAA12oAAAK\u002BqHRB6GdCJbuT4Xv76Od/eEbFVAD4JGXeIikja1DoxoxIKrkYu6bW7AEAVwsaDBS\u002BqHRB6GdCJbuT4Xv76Od/eEbFVAwU\u002BCRl3iIpI2tQ6MaMSCq5GLum1uwUwB8MCHRyYW5zZmVyDBT1Y\u002BpAvCg9TQ4FxI6jBbPyoHNA70FifVtSOQ==","items":{"0x54c546787fe7e8fb7be193bb254267e84174a8be":{"script":"DCECF5VDAAGEeB5UR7Pw\u002B6zmZOqSt\u002BMSJ8jnG8Tnza/M245BdHR2qg==","parameters":[{"type":"Signature","value":"gyzhpmI0KRkAJmd8cWtv7PdFLRlS\u002BHqykL0oH/S84Te4DGwRd9ja/TfKW2\u002BHTSrdfUdnN/K8CF0kf0UywcTKCw=="}],"signatures":{"02179543000184781e5447b3f0fbace664ea92b7e31227c8e71bc4e7cdafccdb8e":"gyzhpmI0KRkAJmd8cWtv7PdFLRlS\u002BHqykL0oH/S84Te4DGwRd9ja/TfKW2\u002BHTSrdfUdnN/K8CF0kf0UywcTKCw=="}},"0xecd6a6bb18b92a488cc6e8506b232922de6524f8":{"script":"FQwhAwIkKx3O1j4b9\u002BsUh29\u002B8Ca3lWf5xb6D3hlD3Rhewo5oDCECDfiFi2b/TXsKamjRHd7cx9kNKmT/os0IfExdq/QVC0AMIQIXlUMAAYR4HlRHs/D7rOZk6pK34xInyOcbxOfNr8zbjgwhAl6ElJA7k9w2nwiivX4iH1dMddlnVZHwSQfLqdruuD0QDCEDhBXQvo3BK2HT47drmPRk36t/3e50Jxw14t5iS7UQI6YMIQPJscicbi1KvWKaLbi30DrO1RilZ5O8kPSYXvftPxtIGgwhA\u002BirUYbh3qvNEOwOUJ3tT/\u002Bt5v3fU0rD4FBiaLrj/USmF0F7zmyl","parameters":[{"type":"Signature"},{"type":"Signature"},{"type":"Signature"},{"type":"Signature"},{"type":"Signature"}],"signatures":{"02179543000184781e5447b3f0fbace664ea92b7e31227c8e71bc4e7cdafccdb8e":"/3oqPLUuFig8B66JNnlyVsA9klLm10LLA5sV/oDr9uzCAPh\u002BDL0yJWx2PfEd\u002BIWijBk/re90CHyJ3w1WkB71eQ=="}}}} @@ -826,11 +826,11 @@ The signed json string is returned. If the signature is complete, you can broadc Cancel unconfirmed transactions (in memory pool). Only transactions in the memory pool can be canceled, e.g. if you send two identical transactions, you can cancel one of them in a short time (before the consensus node confirms it). -##### Syntax +#### Syntax `cancel [sender=null] [signerAccounts=null]` -##### Example +#### Example ``` neo> cancel 0x38d11429a6d34d2ed86213a2a020eece795f48e569b5d05a0ef3616778b03a78 @@ -844,7 +844,7 @@ Signed and relayed transaction with hash: Deploys a contract on the blockchain. -##### Syntax +#### Syntax `deploy [manifestFile]` @@ -853,7 +853,7 @@ Deploys a contract on the blockchain. - `nefFilePath`: Path to the executable file (.nef) of NeoVM. - `manifestFile`: Path to the file manifest.json, which records each interface information and configuration content of the contract. -##### Example +#### Example ``` neo> deploy Template.nef Template.manifest.json @@ -867,7 +867,7 @@ Signed and relayed transaction with hash=0xab6dd63ea36a7c95580b241f34ba756e62c76 Invokes a contract. -##### Syntax +#### Syntax `invoke [contractParameters=null] [sender=null] [signerAccounts=null][maxGas]` @@ -892,13 +892,14 @@ Invokes a contract. - `maxGas`: The maximum GAS can be consumed. -##### Example 1 +#### Example 1 Input: ``` invoke 0xb7f4d011241ec13db16c0e3484bdd5dd9a536f26 symbol ``` + Output: ``` @@ -911,8 +912,8 @@ relay tx(no|yes): ``` - `VM State`: there are two states: - - `HALT` : the virtual machine executes successfully. - - `FAULT` : the virtual machine exits during execution due to an exception. + - `HALT` : the virtual machine executes successfully. + - `FAULT` : the virtual machine exits during execution due to an exception. - `Gas Consumed`: the system fees consumed for smart contract invocation. - `Evaluation Stack`: shows the result of contract execution, where the value is encoded with Base64. @@ -955,7 +956,8 @@ Evaluation Stack: [{"type":"Integer","value":"9999999900000000"}] relay tx(no|yes): no ``` -##### Example 3 + +#### Example 3 Input: @@ -971,14 +973,14 @@ Output: :::note - After entering the invoke command, the node invokes the `operation` method, and passes `operation` and `contractParameters` as arguments. If `operation` and `contractParameters` are not processed in the contract, the expected result will not be returned. +After entering the invoke command, the node invokes the `operation` method, and passes `operation` and `contractParameters` as arguments. If `operation` and `contractParameters` are not processed in the contract, the expected result will not be returned. ::: -### update +### update Upgrades a contract. -##### Syntax +#### Syntax `update [signerAccounts=null]` @@ -991,7 +993,7 @@ Upgrades a contract. - `sender`: The transaction sender that pays for GAS - `signerAccounts`: An array of co-signed addresses and only supports standard accounts (single address). After filling in Neo-CLI will append signatures of all addresses in the array to the invocation transaction. -##### Example +#### Example ``` update 0x3096fb5cd0a2a95b29e8e92692f0be77c4cce06f NEP17.nef NEP17.manifest.json 0xf6a3f0fda46abdeacac9eda4600a354d0687c420 @@ -1008,7 +1010,7 @@ Signed and relayed transaction with hash=0x4587846a2cbc8574e16ce04e95e8c73d76b88 After signing completed, this command can be used to broadcast the transaction information. -##### Syntax +#### Syntax `relay ` @@ -1016,7 +1018,7 @@ After signing completed, this command can be used to broadcast the transaction i `jsonObjectToSign`: The json string that records the transaction information. -##### Example +#### Example ``` neo> relay {"type":"Neo.Network.P2P.Payloads.Transaction","hex":"AFhJmTC0i5cAAAAAAHwNhQAAAAAA12oAAAK\u002BqHRB6GdCJbuT4Xv76Od/eEbFVAD4JGXeIikja1DoxoxIKrkYu6bW7AEAVwsaDBS\u002BqHRB6GdCJbuT4Xv76Od/eEbFVAwU\u002BCRl3iIpI2tQ6MaMSCq5GLum1uwUwB8MCHRyYW5zZmVyDBT1Y\u002BpAvCg9TQ4FxI6jBbPyoHNA70FifVtSOQ==","items":{"0x54c546787fe7e8fb7be193bb254267e84174a8be":{"script":"DCECF5VDAAGEeB5UR7Pw\u002B6zmZOqSt\u002BMSJ8jnG8Tnza/M245BdHR2qg==","parameters":[{"type":"Signature","value":"gyzhpmI0KRkAJmd8cWtv7PdFLRlS\u002BHqykL0oH/S84Te4DGwRd9ja/TfKW2\u002BHTSrdfUdnN/K8CF0kf0UywcTKCw=="}],"signatures":{"02179543000184781e5447b3f0fbace664ea92b7e31227c8e71bc4e7cdafccdb8e":"gyzhpmI0KRkAJmd8cWtv7PdFLRlS\u002BHqykL0oH/S84Te4DGwRd9ja/TfKW2\u002BHTSrdfUdnN/K8CF0kf0UywcTKCw=="}},"0xecd6a6bb18b92a488cc6e8506b232922de6524f8":{"script":"FQwhAwIkKx3O1j4b9\u002BsUh29\u002B8Ca3lWf5xb6D3hlD3Rhewo5oDCECDfiFi2b/TXsKamjRHd7cx9kNKmT/os0IfExdq/QVC0AMIQIXlUMAAYR4HlRHs/D7rOZk6pK34xInyOcbxOfNr8zbjgwhAl6ElJA7k9w2nwiivX4iH1dMddlnVZHwSQfLqdruuD0QDCEDhBXQvo3BK2HT47drmPRk36t/3e50Jxw14t5iS7UQI6YMIQPJscicbi1KvWKaLbi30DrO1RilZ5O8kPSYXvftPxtIGgwhA\u002BirUYbh3qvNEOwOUJ3tT/\u002Bt5v3fU0rD4FBiaLrj/USmF0F7zmyl","parameters":[{"type":"Signature","value":"QYZ4LuSpqSWZ8RzowvPZ8U0o3HjwhPlDf2jmOV3Rglq4Rm4KvMpIqfmuLdrEkecHe1MSP1AcEvE/c2FhdZ98UQ=="},{"type":"Signature","value":"DhhX8mwnLRVVU9hRjdGJ/Pdq10ytpn8xJUOXWqy3I8cE/Midc6s3dvzMt1QH\u002BPn2xDGjkzNNcczI34reE\u002BaCpA=="},{"type":"Signature","value":"/3oqPLUuFig8B66JNnlyVsA9klLm10LLA5sV/oDr9uzCAPh\u002BDL0yJWx2PfEd\u002BIWijBk/re90CHyJ3w1WkB71eQ=="},{"type":"Signature","value":"cUmlfjxdWmPTSpHsJHqr8lLllclJNGroOmStMLXzOI4fcO3D5/JKru/rU/OC029il\u002B8sVteUmL0rEaLnldKMrQ=="},{"type":"Signature","value":"T0PQ9vQNDtDnpa3f9UtN3\u002B22SOFbVG8NBwvu3tq6YchsMbF4OmlBFtNa\u002BZuqT3fxP0r/naAYgnwHMDG8DXAeSQ=="}],"signatures":{"02179543000184781e5447b3f0fbace664ea92b7e31227c8e71bc4e7cdafccdb8e":"/3oqPLUuFig8B66JNnlyVsA9klLm10LLA5sV/oDr9uzCAPh\u002BDL0yJWx2PfEd\u002BIWijBk/re90CHyJ3w1WkB71eQ==","0302242b1dced63e1bf7eb14876f7ef026b79567f9c5be83de1943dd185ec28e68":"T0PQ9vQNDtDnpa3f9UtN3\u002B22SOFbVG8NBwvu3tq6YchsMbF4OmlBFtNa\u002BZuqT3fxP0r/naAYgnwHMDG8DXAeSQ==","020df8858b66ff4d7b0a6a68d11ddedcc7d90d2a64ffa2cd087c4c5dabf4150b40":"cUmlfjxdWmPTSpHsJHqr8lLllclJNGroOmStMLXzOI4fcO3D5/JKru/rU/OC029il\u002B8sVteUmL0rEaLnldKMrQ==","025e8494903b93dc369f08a2bd7e221f574c75d9675591f04907cba9daeeb83d10":"DhhX8mwnLRVVU9hRjdGJ/Pdq10ytpn8xJUOXWqy3I8cE/Midc6s3dvzMt1QH\u002BPn2xDGjkzNNcczI34reE\u002BaCpA==","038415d0be8dc12b61d3e3b76b98f464dfab7fddee74271c35e2de624bb51023a6":"QYZ4LuSpqSWZ8RzowvPZ8U0o3HjwhPlDf2jmOV3Rglq4Rm4KvMpIqfmuLdrEkecHe1MSP1AcEvE/c2FhdZ98UQ=="}}}} @@ -1028,11 +1030,11 @@ Data relay success, the hash is shown as follows: Broadcasts the IP address of a block. -##### Syntax +#### Syntax `broadcast addr ` -##### Example +#### Example ``` neo> broadcast addr 127.0.0.1 10332 @@ -1043,13 +1045,13 @@ neo> Broadcasts a block. -##### Syntax +#### Syntax -`broadcast block ` +`broadcast block ` -`broadcast block ` +`broadcast block ` -##### Example +#### Example ``` neo> broadcast block 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1062,11 +1064,11 @@ neo> Broadcasts the getblocks request. -##### Syntax +#### Syntax -`broadcast getblocks ` +`broadcast getblocks ` -##### Example +#### Example ``` neo> broadcast getblocks 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1077,11 +1079,11 @@ neo> Broadcasts the getheaders request. -##### Syntax +#### Syntax -`broadcast getheaders ` +`broadcast getheaders ` -##### Example +#### Example ``` neo> broadcast getheaders 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1092,11 +1094,11 @@ neo> Broadcasts the getdata request. -##### Syntax +#### Syntax -`broadcast getdata ` +`broadcast getdata ` -##### Example +#### Example ``` neo> broadcast getdata Block 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1111,11 +1113,11 @@ neo> Broadcasts inventory data. -##### Syntax +#### Syntax -`broadcast inv ` +`broadcast inv ` -##### Example +#### Example ``` neo> broadcast inv Block 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1130,11 +1132,11 @@ neo> Broadcasts a transaction. -##### Syntax +#### Syntax -`broadcast transaction ` +`broadcast transaction ` -##### Example +#### Example ``` neo> broadcast transaction 0xd57bbbadee0b8ff283961f886cdc6d455ab8b5301ccdf5359d7316f209064052 @@ -1145,11 +1147,11 @@ neo> Shows all the loaded plugins. -##### Syntax +#### Syntax `plugins` -##### Example +#### Example ``` neo> plugins @@ -1184,7 +1186,7 @@ For information about all plugins refer to [Install Plug-ins](config.md). Exports all or the specified state data. -##### Syntax +#### Syntax `dump storage ` @@ -1192,27 +1194,27 @@ Exports all or the specified state data. Exports the block data from the specified block height. The output can be used for offline synchronization. -##### Syntax +#### Syntax `export blocks ` ##### Parameters -` `: The height of the starting block from which the data is exported. +``: The height of the starting block from which the data is exported. ### show blocks Output block details via block height or block hash. -##### Syntax +#### Syntax `show block ` ##### Parameters -` `: The index or height of the block. +``: The index or height of the block. -##### Example +#### Example ``` neo> show block 332 @@ -1248,15 +1250,15 @@ neo> show block 332 Output contract details by contract name or contract hash. -##### Syntax +#### Syntax `show contract ` ##### Parameters -` `: The name or hash of the contract. +``: The name or hash of the contract. -##### Example +#### Example ``` neo> show contract 0xd2a4cff31913016155e38e474a2c06d08be276cf @@ -1324,15 +1326,15 @@ neo> show contract 0xd2a4cff31913016155e38e474a2c06d08be276cf Output transaction details via transaction hash. -##### Syntax +#### Syntax `show tx ` ##### Parameters -` `: The transaction hash of transaction. +``: The transaction hash of transaction. -##### Example +#### Example ``` neo> show tx 0xf5a0bc050795ae0cf2bea36655d65585dc72246464ec27f79e919ed6f301a843 @@ -1391,13 +1393,13 @@ Stops Oracle. This command requires installation of the OracleService plugin. Queries the state root with index. This command requires installation of the StateService plugin. -##### Syntax +#### Syntax `state root ` ##### Parameters -` `: The block index +``: The block index ``` neo> state root 20000 @@ -1408,15 +1410,15 @@ neo> state root 20000 Gets proof with root hash, contract hash, and storage key. -##### Syntax +#### Syntax `get proof