From 1786a18f878963ebb1f6dae5c67a4827185516b7 Mon Sep 17 00:00:00 2001 From: Celia18305 <32253925+Celia18305@users.noreply.github.com> Date: Fri, 14 Feb 2020 11:11:27 +0800 Subject: [PATCH] 0213fixes (#999) * fix issues * updated * minor updates --- docs/en-us/sc/gettingstarted/deploy.md | 6 ++-- docs/en-us/sc/gettingstarted/develop.md | 16 +++++------ docs/en-us/sc/gettingstarted/enviroment.md | 4 +-- docs/en-us/sc/gettingstarted/introduction.md | 20 ++++++------- docs/en-us/sc/gettingstarted/prerequisites.md | 22 ++++++--------- docs/zh-cn/network/private-chain/solo.md | 4 +-- docs/zh-cn/sc/deploy/deploy.md | 2 ++ .../sc/devenv/getting-started-csharp-mac.md | 3 ++ .../devenv/getting-started-csharp-ubuntu.md | 2 +- docs/zh-cn/sc/fees.md | 2 +- docs/zh-cn/sc/gettingstarted/deploy.md | 6 ++-- docs/zh-cn/sc/gettingstarted/develop.md | 12 ++++---- docs/zh-cn/sc/gettingstarted/enviroment.md | 6 ++-- docs/zh-cn/sc/gettingstarted/introduction.md | 28 ++++++++++--------- docs/zh-cn/sc/gettingstarted/prerequisites.md | 21 ++++++-------- docs/zh-cn/sc/sample/verify.md | 4 +++ 16 files changed, 80 insertions(+), 78 deletions(-) diff --git a/docs/en-us/sc/gettingstarted/deploy.md b/docs/en-us/sc/gettingstarted/deploy.md index 8a20bfc7f1..026f89aa91 100644 --- a/docs/en-us/sc/gettingstarted/deploy.md +++ b/docs/en-us/sc/gettingstarted/deploy.md @@ -4,7 +4,7 @@ Next we deploy the NEP-5 contract we have created previously. ## Deploying contract -We may use NEO-GUI to deploy the newly generated contract file. +We may use Neo-GUI to deploy the newly generated contract file. 1. Open 0.json wallet file, click `advance` -> `deploy contracts`. @@ -50,9 +50,9 @@ Now you may invoke the smart contract released just recently. ## Viewing contract assets -Click `advance`-> `options` in NEO-GUI and fill in the scripthash of the recently deployed assets. The NEP-5 assets will show up in your asset page. +Click `advance`-> `options` in Neo-GUI and fill in the scripthash of the recently deployed assets. The NEP-5 assets will show up in your asset page. ![3_check_nep5](assets/3_check_nep5.png) -You have successfully released a smart contract on NEO private chain. Congratulations! +You have successfully released a smart contract on Neo private chain. Congratulations! diff --git a/docs/en-us/sc/gettingstarted/develop.md b/docs/en-us/sc/gettingstarted/develop.md index e946ea0725..ef583792eb 100644 --- a/docs/en-us/sc/gettingstarted/develop.md +++ b/docs/en-us/sc/gettingstarted/develop.md @@ -1,6 +1,6 @@ # Compiling a contract sample -So far, we have learned how to build a private chain and connect nodes to the chain. The following part will proceed to environment configuration, NEO smart contract coding and compilation and NEO smart contract deployment and invocation on private chain using C# and Windows 10. +So far, we have learned how to build a private chain and connect nodes to the chain. The following part will proceed to environment configuration, Neo smart contract coding and compilation and Neo smart contract deployment and invocation on private chain using C# and Windows 10. We will complete the following tasks in this section: @@ -18,7 +18,7 @@ Download and install [Visual Studio 2017](https://www.visualstudio.com/products/ ### Install NeoContractPlugin -Open Visual Studio 2017 and click `tool` -> `extensions and Updates`,click `online`on the left column, search NEO and install NeoContractPlugin (the process must be completed online). +Open Visual Studio 2017 and click `tool` -> `extensions and Updates`,click `online`on the left column, search Neo and install NeoContractPlugin (the process must be completed online). ![3_download_and_install_smart_contract_plugin](assets/3_download_and_install_smart_contract_plugin.jpg) @@ -64,9 +64,9 @@ After the path is added, run CMD or PowerShell for testing purpose (if CMD start ![3_1545037391347](assets/3_1545037391347.png) -## Creating a NEO contract project +## Creating a Neo contract project -Upon completion of the previous steps, you may start to create NEO smart contract project in Visual Studio 2017 (no specific requirement for .NET Framework version): +Upon completion of the previous steps, you may start to create Neo smart contract project in Visual Studio 2017 (no specific requirement for .NET Framework version): 1. Click `file` -> `create` -> `project`. 2. Select `NeoContract` in the list and change settings where necessary, then click `confirm`. @@ -81,11 +81,11 @@ Nevertheless, the above only demonstrates a simple data storage method - to stor ## Editing NEP-5 code -Many developers are curious about how to release their own contract assets on NEO public chain. Now let's walk through the process on private chain. +Many developers are curious about how to release their own contract assets on Neo public chain. Now let's walk through the process on private chain. 1. Download the NEP-5 template from [Github](https://github.com/neo-project/examples). -2. Create a NEO smart contract project in Visual Studio 2017 and name it NEP5. +2. Create a Neo smart contract project in Visual Studio 2017 and name it NEP5. 3. Open NEP5.cs @@ -93,7 +93,7 @@ Many developers are curious about how to release their own contract assets on NE > [!NOTE] > - > If there are red underlines under the code warning that the system is unable to find NEO name space and there is "!" in project references, you may take the following steps: + > If there are red underlines under the code warning that the system is unable to find Neo name space and there is "!" in project references, you may take the following steps: > > Right click the solution file in VS, click `manage NuGet package` and update the Neo.SmartContract.Framework to the latest official version in a new page. If the red underlines still exist when program update is completed, you may try double clicking the "!". If the problem remains unsolved, you may resort to the solutions below: > @@ -248,7 +248,7 @@ Click `generate`->`generate solutions` (hotkeys: Ctrl + Shift + B) in the menu t ![](assets/compile.png) -When the compilation is done, NEO smart contract file named`NEP5.avm` is generated in the `bin/Debug` directory of the project. +When the compilation is done, Neo smart contract file named`NEP5.avm` is generated in the `bin/Debug` directory of the project. ![](assets/contractfile.png) diff --git a/docs/en-us/sc/gettingstarted/enviroment.md b/docs/en-us/sc/gettingstarted/enviroment.md index a864aaa61c..525bf31909 100644 --- a/docs/en-us/sc/gettingstarted/enviroment.md +++ b/docs/en-us/sc/gettingstarted/enviroment.md @@ -2,11 +2,11 @@ ## Setting up a private chain -NEO Official provides a test net for development, debugging and testing purposes. Besides, users may also choose to set up their own private chain where they can operate more flexibly with plenty of test tokens. You can choose one of the following way to set up your private chain: +Neo Official provides a test net for development, debugging and testing purposes. Besides, users may also choose to set up their own private chain where they can operate more flexibly with plenty of test tokens. You can choose one of the following way to set up your private chain: - [Set up a private chain using virtual machines](../../network/private-chain/private-chain.md) - [Set up a private chain on a Windows host](../../network/private-chain/private-chain2.md) -- [Set up a private chain with one node](../../network/private-chain/solo.md) (Applicable to NEO-CLI 2.10.2 and the later) +- [Set up a private chain with one node](../../network/private-chain/solo.md) (Applicable to Neo-CLI 2.10.2 and the later) Refer to the instructions at above links to set up your private chain and withdraw NEO and GAS from genesis block. diff --git a/docs/en-us/sc/gettingstarted/introduction.md b/docs/en-us/sc/gettingstarted/introduction.md index e97e9e7ec2..eb17a13c9c 100644 --- a/docs/en-us/sc/gettingstarted/introduction.md +++ b/docs/en-us/sc/gettingstarted/introduction.md @@ -1,20 +1,20 @@ -# NEO Smart Contract Introduction +# Neo Smart Contract Introduction ## What is a smart contract? A smart contract is a set of commitments that are defined in digital form, including the agreement on how contract participants shall fulfill these commitments. Blockchain technology gives us a decentralized, non-tampering, highly reliable system in which smart contracts are extremely useful. Smart contracts is one of the most important characteristics of blockchain technologies and the reason why blockchains can be called disruptive technology. It is increasing the efficiency of our social structure by each passing day. -## What are the characteristics of NEO smart contracts? +## What are the characteristics of Neo smart contracts? -The NEO Smart Contract 2.0 includes the following features: certainty, high performance, and expandability. The contract types include: validation contracts, function contracts, and application contracts. +The Neo Smart Contract 2.0 includes the following features: certainty, high performance, and expandability. The contract types include: validation contracts, function contracts, and application contracts. -From the performance point of view, NEO uses the lightweight NeoVM (NEO Virtual Machine) as its intelligent contract execution environment. It starts very fast and takes up a small amount of resources and is suitable for smart contracts such as short procedures. Static compilation and caching of hotspot contracts can be significantly enhanced by JIT (real-time compiler) technology. The instructional setup of the NEO virtual machine provides a series of cryptographic instructions to optimize the execution efficiency of cryptographic algorithms in smart contracts. In addition, data manipulation instructions provide support for arrays and complex data structures directly. All of the above will enhance performance in NEO Smart Contract 2.0. +From the performance point of view, Neo uses the lightweight NeoVM (Neo Virtual Machine) as its intelligent contract execution environment. It starts very fast and takes up a small amount of resources and is suitable for smart contracts such as short procedures. Static compilation and caching of hotspot contracts can be significantly enhanced by JIT (real-time compiler) technology. The instructional setup of the Neo virtual machine provides a series of cryptographic instructions to optimize the execution efficiency of cryptographic algorithms in smart contracts. In addition, data manipulation instructions provide support for arrays and complex data structures directly. All of the above will enhance performance in Neo Smart Contract 2.0. -NEO Smart Contract 2.0 achieves a scalable approach through a combination of high concurrency and dynamic partitioning, combined with its low-coupling design. The low coupling contract procedure is executed in a virtual machine (NEO virtual machine) and communicates with the outside through the interactive service layer. Therefore, the vast majority of upgrades to the smart contract function can be achieved through API of the interactive service layer. +Neo Smart Contract 2.0 achieves a scalable approach through a combination of high concurrency and dynamic partitioning, combined with its low-coupling design. The low coupling contract procedure is executed in a virtual machine (Neo virtual machine) and communicates with the outside through the interactive service layer. Therefore, the vast majority of upgrades to the smart contract function can be achieved through API of the interactive service layer. ## Write smart contracts in any language -From the language point of view, the difference between NEO Smart Contract 2.0 and Ethereum is more intuitive: unlike the original Solidity language in Ethereum, the NEO smart contract can be used directly by almost any high-level programming language. The first supported languages ​​are C#, VB.Net, F#, Java, and Kotlin. NEO provides compilers and plug-ins for these languages, which are used to compile high-level languages ​​into instruction sets supported by NEO virtual machines. The first compiler will be for MSIL (Microsoft intermediate language), so theoretically any .Net language and any language that can be translated into MSIL will be immediately supported. +From the language point of view, the difference between Neo Smart Contract 2.0 and Ethereum is more intuitive: unlike the original Solidity language in Ethereum, the Neo smart contract can be used directly by almost any high-level programming language. The first supported languages ​​are C#, VB.Net, F#, Java, and Kotlin. Neo provides compilers and plug-ins for these languages, which are used to compile high-level languages ​​into instruction sets supported by Neo virtual machines. The first compiler will be for MSIL (Microsoft intermediate language), so theoretically any .Net language and any language that can be translated into MSIL will be immediately supported. The languages that are currently supported are: @@ -29,9 +29,9 @@ The languages that we plan to support include: - C, C++ -With multiple-language support, more than 90% of developers can directly participate in the development of an NEO smart contract without the need to learn a new language. Existing business system code might even be directly ported to the blockchain. We envision that this will greatly increase the overall popularity of the future blockchain. +With multiple-language support, more than 90% of developers can directly participate in the development of an Neo smart contract without the need to learn a new language. Existing business system code might even be directly ported to the blockchain. We envision that this will greatly increase the overall popularity of the future blockchain. -Additionally, traditional smart contracts are difficult to debug and test given lack of tool supports and access to clear instructions. NEO, however, provides major support for debugging at the NEO virtual machine level, allowing you to develop NEO Smart Contract 2.0 both easier and faster. If you need TestNet GAS, feel free to ask openly and it will be provided for development purposes. +Additionally, traditional smart contracts are difficult to debug and test given lack of tool supports and access to clear instructions. Neo, however, provides major support for debugging at the Neo virtual machine level, allowing you to develop Neo Smart Contract 2.0 both easier and faster. If you need TestNet GAS, feel free to ask openly and it will be provided for development purposes. ## Smart contract triggers @@ -42,7 +42,7 @@ There are two ways to trigger smart contracts: ## NeoVM -NeoVM is the virtual machine that executes the NEO smart contract code. We are talking about the concept of virtual machine in the narrow sense, not in reference to operating systems or programs that can simulate them such as VMware or Hyper-V. +NeoVM is the virtual machine that executes the Neo smart contract code. We are talking about the concept of virtual machine in the narrow sense, not in reference to operating systems or programs that can simulate them such as VMware or Hyper-V. For example, in the Java JVM or .NET CLR, source code will be compiled into the relevant bytecode and then run on the corresponding virtual machine. The JVM or CLR will run the bytecode, which is similar to running instructions on a real physical machine. Notably, the corresponding binary instructions are still run on a physical machine. The physical machine fetches instructions from memory, transfers it to the CPU via the bus, then decodes, executes, and stores the result. @@ -65,7 +65,7 @@ public static bool Main () Here the return value of the contract is always true, indicating that anyone can spend the contract address of the assets (can be understood as money). -The NEO wallet client has a function for deleting an asset. When you delete an asset, the asset is sent to a specified address being the contract address generated by the above smart contract. Anyone can spend the assets in the address. The assets in the address are assets that others do not want. +The Neo wallet client has a function for deleting an asset. When you delete an asset, the asset is sent to a specified address being the contract address generated by the above smart contract. Anyone can spend the assets in the address. The assets in the address are assets that others do not want. ```c# public static bool Main () diff --git a/docs/en-us/sc/gettingstarted/prerequisites.md b/docs/en-us/sc/gettingstarted/prerequisites.md index 65aff33d79..82e6101674 100644 --- a/docs/en-us/sc/gettingstarted/prerequisites.md +++ b/docs/en-us/sc/gettingstarted/prerequisites.md @@ -1,43 +1,39 @@ # Before You Begin -In the sections that follow, we will work you through an example of how to release an NEP-5 asset on NEO blockchain, which includes the tasks of development environment set-up and configuration, smart contract compilation, smart contract deployment, and smart contract invocation on private chain. +In the sections that follow, we will work you through an example of how to release an NEP-5 asset on Neo blockchain, which includes the tasks of development environment set-up and configuration, smart contract compilation, smart contract deployment, and smart contract invocation on private chain. -This tutorial is based on the usage of the two full-node NEO clients: NEO-GUI and NEO-CLI. NEO-CLI will be used to set up a private chain accessible by nodes and NEO-GUI will be used to release smart contracts. Detailed information about the clients can be found in [NEO Node Introduction](../../node/introduction.md). +This tutorial is based on the usage of the two full-node Neo clients: Neo-GUI and Neo-CLI. Neo-CLI will be used to set up a private chain accessible by nodes and Neo-GUI will be used to release smart contracts. Detailed information about the clients can be found in [Neo Node Introduction](../../node/introduction.md). ## System environment -NEO-GUI runs in the following environments: +Neo-GUI runs in the following environments: Windows 7 SP1 / Windows 8 / Windows 10 [.NET Framework 4.7.1](https://www.microsoft.com/net/download/framework) must be installed for system versions prior to Windows 10. -NEO-CLI runs in the following environments: +Neo-CLI runs in the following environments: - Linux (ubuntu 16.04 and above) - Windows 10 > [!NOTE] > -> Windows 10 is a recommended choice since NEO-GUI and NEO-CLI will be running at the same time. +> Windows 10 is a recommended choice since Neo-GUI and Neo-CLI will be running at the same time. > -> This tutorial only describes the occurrences on Windows 10. Readers using other systems may refer to relevant chapters in [NEO Documentation](../../index.md) since environment and dependencies may differ in different systems. +> This tutorial only describes the occurrences on Windows 10. Readers using other systems may refer to relevant chapters in [Neo Documentation](../../index.md) since environment and dependencies may differ in different systems. ### Download clients -- NEO-GUI +- Neo-GUI Download the latest Release version at [GitHub](https://github.com/neo-project/neo-gui/releases) and run neo-gui.exe. -- NEO-CLI +- Neo-CLI Take Windows 10 for example: - Users are not required to install a client. You may get the latest Release version from [GitHub](https://github.com/neo-project/neo-cli/releases) by downloading the source code from [GitHub](https://github.com/neo-project/neo-cli.git) or using the following command: - - ``` - $ git clone https://github.com/neo-project/neo-cli.git - ``` + Download the latest [Neo-CLI](https://github.com/neo-project/neo-cli/releases) package according to your operating system on Github and unzip it. ## What's next? diff --git a/docs/zh-cn/network/private-chain/solo.md b/docs/zh-cn/network/private-chain/solo.md index ce48f985fb..873d93b5ec 100644 --- a/docs/zh-cn/network/private-chain/solo.md +++ b/docs/zh-cn/network/private-chain/solo.md @@ -123,13 +123,13 @@ Neo-CLI 2.10.2 支持单节点模式下正常生成区块,只需一个节点 在 NEO 网络的创世块中存放着 1 亿份 NEO,当私链搭建起来后,GAS 也将伴着新区块的生成而生成。你可以使用 NEO-GUI 从多方签名合约中提取出这部分 NEO 和 GAS 以便内部开发测试使用。 -### 安装并配置 NEO-GUI +### 安装并配置 Neo-GUI 1. 从 Github 上下载 [NEO-GUI](https://github.com/neo-project/neo-gui/releases) 并解压。 2. 复制上一步编辑好的 protocol.json 文件,替换 neo-gui 中原有的文件 -3. 配置 config.json 文件,设置端口与 NEO-CLI 的端口不冲突。如果端口冲突,NEO-GUI 将无法与 NEO-CLI 同时运行。 +3. 配置 config.json 文件,设置端口与 Neo-CLI 的端口不冲突。如果端口冲突,Neo-GUI 将无法与 Neo-CLI 同时运行。 ```json { diff --git a/docs/zh-cn/sc/deploy/deploy.md b/docs/zh-cn/sc/deploy/deploy.md index 1088d8e386..e5fc9b7983 100644 --- a/docs/zh-cn/sc/deploy/deploy.md +++ b/docs/zh-cn/sc/deploy/deploy.md @@ -47,8 +47,10 @@ 1. 创建好钱包后,在 NEO-GUI 中点击鼠标右键,选择 `创建合约地址` -> `自定义`。 2. 在 `导入自定义合约` 对话框中设置以下选项: + a. `形参列表`:参考 [智能合约参数和返回值](Parameter.md) b. `脚本代码`:填写上一步复制的合约脚本代码。 c. `私钥`:可选参数,当合约执行过程中需要签名时,设置用于签名的私钥。 + 3. 点击 `确定`。 diff --git a/docs/zh-cn/sc/devenv/getting-started-csharp-mac.md b/docs/zh-cn/sc/devenv/getting-started-csharp-mac.md index 46f58ca357..70fde942f2 100644 --- a/docs/zh-cn/sc/devenv/getting-started-csharp-mac.md +++ b/docs/zh-cn/sc/devenv/getting-started-csharp-mac.md @@ -15,6 +15,7 @@ ![](../assets/mac3.png) > [!Note] +> > 基本安装全程大约需要几十分钟,如果勾选了 Android / iOS / macOS 平台,其安装时间可能会需要数小时,而且由于网络情况,可能会失败 N 次,所以不建议勾选平台组件。 ## 新建项目 @@ -24,6 +25,7 @@ ![](../assets/mac4.png) > [!Note] +> > 新建项目时 .NET Core 版本请选择 2.0,因为如果选择 1.x 后,接下来添加 “Neo.SmartContract.Framework” 时会失败。 然后右击 `Dependencies`,单击 `Add Packages...`,搜索 “neo” ,选择 “Neo.SmartContract.Framework”,点击 `Add Package`。 @@ -56,6 +58,7 @@ public class Class1: SmartContract 在 GitHub 上下载 [neo-compiler](https://github.com/neo-project/neo-compiler) 项目,用 Visual Studio for Mac 打开该解决方案,编译其中的 neon 项目 > [!Note] + > > 首次编译 neon 需要还原 NuGet 程序包,根据网络速度 该过程可能需要几十分钟至几小时不等,并且中途可能失败十余次,请耐心尝试。 > > 本次测试过程中我使用 Visual Studio for Mac 还原项目,又用 Visual Studio Code 还原项目,又用 dotnet 命令行还原项目,总之失败 N 次后,终于还原成功了。历时几个小时。 diff --git a/docs/zh-cn/sc/devenv/getting-started-csharp-ubuntu.md b/docs/zh-cn/sc/devenv/getting-started-csharp-ubuntu.md index 418cb8f6d4..39bf90e689 100644 --- a/docs/zh-cn/sc/devenv/getting-started-csharp-ubuntu.md +++ b/docs/zh-cn/sc/devenv/getting-started-csharp-ubuntu.md @@ -4,7 +4,7 @@ 1. 创建 library 项目,编写代码,引入智能合约库。 2. 编译 neo-compiler/neon 生成编译器。 -   3. 执行命令运行 neon 生成.avm 文件。 + 3. 执行命令运行 neon 生成.avm 文件。 ## 新建合约项目 diff --git a/docs/zh-cn/sc/fees.md b/docs/zh-cn/sc/fees.md index 81b5aee986..91070c189f 100644 --- a/docs/zh-cn/sc/fees.md +++ b/docs/zh-cn/sc/fees.md @@ -4,7 +4,7 @@ NEO 智能合约在部署和执行的时候都要缴纳一定的系统费和网 ## 智能合约费用 -当开发者将一个智能合约部署到 NEO 区块链上时,需要向 NEO 系统支付 500 GAS 的系统费用。每执行一条智能合约的指令时也需要向 NEO 系统支付一定的执行费用。 +当开发者将一个智能合约部署到 NEO 区块链上时,需要向 NEO 系统支付 100~1000 GAS 的系统费用。每执行一条智能合约的指令时也需要向 NEO 系统支付一定的执行费用。 每个智能合约在每次执行过程中有10 GAS 的免费额度,无论是开发者部署还是用户调用,因此,若智能合约的单次执行费用低于10 GAS ,则不需要支付手续费;如果超过10 GAS,则减免10 GAS 的手续费。 diff --git a/docs/zh-cn/sc/gettingstarted/deploy.md b/docs/zh-cn/sc/gettingstarted/deploy.md index d8d76caa49..a9569ec223 100644 --- a/docs/zh-cn/sc/gettingstarted/deploy.md +++ b/docs/zh-cn/sc/gettingstarted/deploy.md @@ -4,7 +4,7 @@ ## 部署合约 -生成合约文件后,我们可以使用 NEO-GUI 进行部署。 +生成合约文件后,我们可以使用 Neo-GUI 进行部署。 1. 打开钱包文件 0.json,点击 `高级` -> `部署合约`。 @@ -50,9 +50,9 @@ ## 查看合约资产 -在 NEO-GUI 中点击 `高级`-> `选项`,添加刚部署的资产的脚本散列,即可在资产页面看到你的 NEP-5 资产。 +在 Neo-GUI 中点击 `高级`-> `选项`,添加刚部署的资产的脚本散列,即可在资产页面看到你的 NEP-5 资产。 ![3_check_nep5](assets/3_check_nep5.png) -至此,祝贺你已经成功地在NEO 私链上发布了智能合约。 +至此,祝贺你已经成功地在Neo 私链上发布了智能合约。 diff --git a/docs/zh-cn/sc/gettingstarted/develop.md b/docs/zh-cn/sc/gettingstarted/develop.md index 8ac65e3c25..a5a297bf5a 100644 --- a/docs/zh-cn/sc/gettingstarted/develop.md +++ b/docs/zh-cn/sc/gettingstarted/develop.md @@ -1,6 +1,6 @@ # 开发示例合约 -我们已经搭建私链并启动节点连接私链,下文将以使用 windows 10 和 C# 为例,带领开发者配置环境、编写、编译以及在私链上部署和调用 NEO 智能合约。 +我们已经搭建私链并启动节点连接私链,下文将以使用 windows 10 和 C# 为例,带领开发者配置环境、编写、编译以及在私链上部署和调用 Neo 智能合约。 在本节我们将完成以下任务: @@ -66,9 +66,9 @@ ![3_1545037391347](assets/3_1545037391347.png) -## 创建 NEO 合约项目 +## 创建 Neo 合约项目 -完成以上步骤后,即可在 Visual Studio 2017 中创建 NEO 智能合约项目(.NET Framework 版本任意): +完成以上步骤后,即可在 Visual Studio 2017 中创建 Neo 智能合约项目(.NET Framework 版本任意): 1. 点击 `文件` -> `新建` -> `项目`。 2. 在列表中选择 `NeoContract` 并进行必要设置后,点击 `确定`。 @@ -83,11 +83,11 @@ ## 编辑 NEP-5 代码 -很多开发者比较关心的是如何在 NEO 公链上发布自己的合约资产,现在我们就在私链上一步步实现。 +很多开发者比较关心的是如何在 Neo 公链上发布自己的合约资产,现在我们就在私链上一步步实现。 1. 从 [Github](https://github.com/neo-project/examples)上下载 NEP5 示例。 -2. 在 Visual Studio 2017 中创建一个 NEO 智能合约项目,这里命名为 NEP5。 +2. 在 Visual Studio 2017 中创建一个 Neo 智能合约项目,这里命名为 NEP5。 3. 打开示例文件 NEP5.cs @@ -250,7 +250,7 @@ namespace NEP5 ![](assets/compile.png) -编译成功后你会在该项目的 `bin/Debug` 目录下看到生成的 `NEP5.avm` 文件,该文件即是生成的 NEO 智能合约文件。 +编译成功后你会在该项目的 `bin/Debug` 目录下看到生成的 `NEP5.avm` 文件,该文件即是生成的 Neo 智能合约文件。 ![](assets/contractfile.png) diff --git a/docs/zh-cn/sc/gettingstarted/enviroment.md b/docs/zh-cn/sc/gettingstarted/enviroment.md index 180454b6b0..1e6a01a0b9 100644 --- a/docs/zh-cn/sc/gettingstarted/enviroment.md +++ b/docs/zh-cn/sc/gettingstarted/enviroment.md @@ -2,9 +2,9 @@ ## 搭建私链 -NEO 官方提供了供用户开发、调试和测试的测试网(Test Net),但在本地搭建你自己的私链将获得更多的灵活性以及取之不尽的测试币。你可以选择以下一种方式搭建私有链: +Neo 官方提供了供用户开发、调试和测试的测试网(Test Net),但在本地搭建你自己的私链将获得更多的灵活性以及取之不尽的测试币。你可以选择以下一种方式搭建私有链: -- [使用单节点搭建](../../network/private-chain/solo.md) (适用于 NEO-CLI 2.10.2及之后版本) +- [使用单节点搭建](../../network/private-chain/solo.md) (适用于 Neo-CLI 2.10.2及之后版本) - [在一台 Windows 主机上搭建](../../network/private-chain/private-chain2.md) - [使用虚拟机搭建](../../network/private-chain/private-chain.md) @@ -14,7 +14,7 @@ NEO 官方提供了供用户开发、调试和测试的测试网(Test Net) 现在我们创建一个新的钱包文件 0.json,放在节点根目录下供发布智能合约时使用。 -1. 在 NEO-GUI 中创建一个新的钱包文件 0.json,复制默认地址备用。 +1. 在 Neo-GUI 中创建一个新的钱包文件 0.json,复制默认地址备用。 2. 打开前面提取了 NEO 和 GAS 的钱包,将钱包中全部的资产都转入钱包 0.json 中,等待交易确认。 3. 打开钱包文件 0.json,可以看到其中的资产。 diff --git a/docs/zh-cn/sc/gettingstarted/introduction.md b/docs/zh-cn/sc/gettingstarted/introduction.md index 470d64dc92..dac301de83 100644 --- a/docs/zh-cn/sc/gettingstarted/introduction.md +++ b/docs/zh-cn/sc/gettingstarted/introduction.md @@ -4,17 +4,17 @@ 智能合约是一套以数字形式定义的承诺,包括合约参与方可以在上面执行这些承诺的协议。区块链技术给我们带来了一个去中心化的,不可篡改的,高可靠性的系统,在这种环境下,智能合约才大有用武之地。智能合约是区块链最重要的特性之一,也是区块链能够被称为颠覆性技术的主要原因。 -## NEO 智能合约有哪些特点? +## Neo 智能合约有哪些特点? -NEO 智能合约 2.0 包括以下特性:确定性、高性能、拓展性。其合约类型包括:验证合约、函数合约和应用合约。 +Neo 智能合约 2.0 包括以下特性:确定性、高性能、拓展性。其合约类型包括:验证合约和应用合约。 -从性能角度来说,NEO 采用了轻量级的 NeoVM(NEO Virtual Machine)作为其智能合约的执行环境,其启动速度非常快,占用资源也很小,适合像智能合约这样短小的程序。通过 JIT(即时编译器)技术对热点智能合约进行静态编译和缓存可以显著提升。NEO 虚拟机的指令集中内建提供了一系列的密码学指令,以优化智能合约中用到密码学算法时的执行效率。此外,数据操作指令直接对数组及复杂数据结构提供支持。这些都会提升 NEO 智能合约 2.0的运行性能。 +从性能角度来说,Neo 采用了轻量级的 NeoVM(Neo Virtual Machine)作为其智能合约的执行环境,其启动速度非常快,占用资源也很小,适合像智能合约这样短小的程序。通过 JIT(即时编译器)技术对热点智能合约进行静态编译和缓存可以显著提升。Neo 虚拟机的指令集中内建提供了一系列的密码学指令,以优化智能合约中用到密码学算法时的执行效率。此外,数据操作指令直接对数组及复杂数据结构提供支持。这些都会提升 Neo 智能合约 2.0的运行性能。 -NEO 智能合约 2.0实现可拓展性的方法是通过高并发和动态分区的形式,结合其低耦合的设计完成的。低耦合合约程序在一个虚拟机(NEO 虚拟机)中执行,并通过交互服务层与外部通信。因此,对智能合约功能的绝大部分升级,都可以通过增加交互服务层的 API 来实现。 +Neo 智能合约 2.0实现可拓展性的方法是通过高并发和动态分区的形式,结合其低耦合的设计完成的。低耦合合约程序在一个虚拟机(Neo 虚拟机)中执行,并通过交互服务层与外部通信。因此,对智能合约功能的绝大部分升级,都可以通过增加交互服务层的 API 来实现。 ## 用什么语言编写智能合约? -从语言角度看 NEO 智能合约 2.0与以太坊的区别更为直观:与以太坊原创的 Solidity 语言不同,NEO 智能合约开发者可以直接使用几乎任何他们擅长的高级语言来进行 NEO 智能合约的开发工作。NEO 提供了这些语言的编译器和插件,用于将高级语言编译成 NEO 虚拟机所支持的指令集。由于编译器会针对 MSIL(微软中间语言)来进行编译,所以理论上任何.Net 中的语言或者可被转译成 MSIL 的语言都可以直接支持。 +从语言角度看 Neo 智能合约 2.0与以太坊的区别更为直观:与以太坊原创的 Solidity 语言不同,Neo 智能合约开发者可以直接使用几乎任何他们擅长的高级语言来进行 Neo 智能合约的开发工作。Neo 提供了这些语言的编译器和插件,用于将高级语言编译成 Neo 虚拟机所支持的指令集。由于编译器会针对 MSIL(微软中间语言)来进行编译,所以理论上任何.Net 中的语言或者可被转译成 MSIL 的语言都可以直接支持。 当前已经支持的语言有: @@ -28,13 +28,13 @@ NEO 智能合约 2.0实现可拓展性的方法是通过高并发和动态分区 - C、C++ -多种高级语言的支持,使得 90% 以上的开发者无需学习新的语言即可参与到 NEO 智能合约的开发中来,甚至可将现有业务系统中的代码直接移植到区块链上。这将大大增加未来区块链的全面普及。 +多种高级语言的支持,使得 90% 以上的开发者无需学习新的语言即可参与到 Neo 智能合约的开发中来,甚至可将现有业务系统中的代码直接移植到区块链上。这将大大增加未来区块链的全面普及。 -最后从调试角度看,通常智能合约的开发过程是非常困难的,重要的原因之一是此前的智能合约缺乏良好的调试和测试方法。NEO 在 NeoVM 层面提供了程序调试功能的支持,使得开发 NEO 智能合约 2.0变得更方便快捷。 +最后从调试角度看,通常智能合约的开发过程是非常困难的,重要的原因之一是此前的智能合约缺乏良好的调试和测试方法。Neo 在 NeoVM 层面提供了程序调试功能的支持,使得开发 Neo 智能合约 2.0变得更方便快捷。 ## 智能合约的触发 -NEO 的智能合约有两种触发方式: +Neo 的智能合约有两种触发方式: - 合约用户的鉴权:智能合约作为一个合约账户,当用户使用该合约账户里的一笔资产时,会触发该智能合约。 - 手动发送交易调用智能合约:用户发送一笔交易(Invocation Transaction )来触发一段智能合约的执行。 @@ -45,17 +45,19 @@ NEO 的智能合约有两种触发方式: ## NeoVM 虚拟机 -NeoVM 是执行 NEO 智能合约代码的虚拟机。这里所讲述的虚拟机概念比较狭义,并非是借助于操作系统对物理机器的一种模拟,这里的虚拟机与 vmware 或者 Hyper-V 不同,是针对具体语言所实现的虚拟机。 +NeoVM 是执行 Neo 智能合约代码的虚拟机。这里所讲述的虚拟机概念比较狭义,并非是借助于操作系统对物理机器的一种模拟,这里的虚拟机与 vmware 或者 Hyper-V 不同,是针对具体语言所实现的虚拟机。 -例如在 java 的 JVM 或者 .Net 的 CLR 中,java 或者 .Net 源码会被编译成相关字节码,然后在对应虚拟机上运行, JVM 或 CLR 会对这些字节码进行取指令,译码,执行,结果回写等操作,这些步骤和真实物理机器上的概念都很相似。相对应的二进制指令仍然是在物理机器上运行,物理机器从内存中取指令,通过总线传输到 CPU,然后译码、执行、结果存储。 +例如在 java 的 JVM 或者 .Net 的 CLR 中,java 或者 .Net 源码会被编译成相关字节码,然后在对应虚拟机上运行, JVM 或 CLR 会对这些字节码进行取指令,译码,执行,结果回写等操作,这些步骤和真实物理机器上的概念都很相似。相对应的二进制指令仍然是在物理机器上运行,物理机器从内存中取指令,通过总线传输到 CPU,然后译码、执行、结果存储。更多信息,请参阅 [NeoVM 指令集](../../reference/neo_vm.md)。 ## 收费模式 -NEO 智能合约在部署或者执行的时候都要缴纳一定的手续费,分为部署费用和执行费用。 +Neo 智能合约在部署或者执行的时候都要缴纳一定的手续费,分为部署费用和执行费用。 部署费用是指开发者将一个智能合约部署到区块链上需要向区块链系统支付一定的费用,根据合约所需功能,系统将收取100~ 1000 GAS 的费用,并作为系统收益。 -执行费用是指每执行一条智能合约的指令都会向 NEO 系统支付一定的执行费用。具体收费标准请参阅 [智能合约费用](../fees.md)。 +执行费用是指每执行一条智能合约的指令都会向 Neo 系统支付一定的执行费用。 + +具体收费标准请参阅 [智能合约费用](../fees.md)。 ## 一些简单的智能合约(C#) @@ -70,7 +72,7 @@ public static bool Main() 该合约的返回值永远为 true,表示任何人都可以花费这个合约地址里的资产(可以理解为撒钱)。 -NEO 钱包客户端有删除资产功能,当你删除了一个资产,这个资产实际上发送到了一个指定地址中,这个地址就是上述智能合约所生成的合约地址,任何人都可以花费这个地址里的资产,当然这个地址里的资产都是别人不想要的资产。 +Neo 钱包客户端有删除资产功能,当你删除了一个资产,这个资产实际上发送到了一个指定地址中,这个地址就是上述智能合约所生成的合约地址,任何人都可以花费这个地址里的资产,当然这个地址里的资产都是别人不想要的资产。 ```c# public static bool Main() diff --git a/docs/zh-cn/sc/gettingstarted/prerequisites.md b/docs/zh-cn/sc/gettingstarted/prerequisites.md index 0e721676ad..08b251d088 100644 --- a/docs/zh-cn/sc/gettingstarted/prerequisites.md +++ b/docs/zh-cn/sc/gettingstarted/prerequisites.md @@ -1,45 +1,40 @@ # 准备工作 -本文将以在 NEO 区块链上发布一个 NEP-5 资产为例,一步步带领开发者完成开发环境的搭建和配置,编写智能合约以及在私链上部署和调用合约。 +本文将以在 Neo 区块链上发布一个 NEP-5 资产为例,一步步带领开发者完成开发环境的搭建和配置,编写智能合约以及在私链上部署和调用合约。 -NEO 有两个全节点客户端:NEO-GUI 和 NEO-CLI。本教程将使用 NEO-CLI 搭建私链供节点连接,使用 NEO-GUI 发布智能合约,关于客户端的详细信息,可参考 [NEO 节点介绍](../../node/introduction.md)。 +Neo 有两个全节点客户端:Neo-GUI 和 Neo-CLI。本教程将使用 Neo-CLI 搭建私链供节点连接,使用 Neo-GUI 发布智能合约,关于客户端的详细信息,可参考 [Neo节点介绍](../../node/introduction.md)。 ## 系统环境 -NEO-GUI 支持以下环境: +Neo-GUI 支持以下环境: Windows 7 SP1 / Windows 8 / Windows 10 Windows 10 之前版本的系统需要安装 [.NET Framework 4.7.1](https://www.microsoft.com/net/download/framework) -NEO-CLI 支持以下环境: +Neo-CLI 支持以下环境: - Linux (ubuntu 16.04 及以上) - Windows 10 > [!NOTE] > -> 由于同时涉及到 NEO-GUI 和 NEO-CLI ,建议直接使用 Windows 10 的系统。 +> 由于同时涉及到 Neo-GUI 和 Neo-CLI ,建议直接使用 Windows 10 的系统。 > > 本教程中的描述均发生于 Windows 10 系统上,由于部分环境和依赖项的配置在不同系统上都有差异,如读者使用其他系统,请参考 [开发环境](../devenv/getting-started-csharp-mac.md) 中对应章节。 ## 下载客户端 -- NEO-GUI +- Neo-GUI 进入 [GitHub](https://github.com/neo-project/neo-gui/releases) 下载最新的Release版本,直接运行 neo-gui.exe 即可。 -- NEO-CLI +- Neo-CLI 以 Windows 10为例: - 客户端无需安装,进入[GitHub](https://github.com/neo-project/neo-cli/releases)下载最新的Release版本。 + 在 GitHub 上下载系统对应的 [Neo-CLI](https://github.com/neo-project/neo-cli/releases) 程序包并解压。 - 从 [GitHub](https://github.com/neo-project/neo-cli.git) 下载源代码或通过以下命令下载: - - ``` - $ git clone https://github.com/neo-project/neo-cli.git - ``` ## 继续阅读 diff --git a/docs/zh-cn/sc/sample/verify.md b/docs/zh-cn/sc/sample/verify.md index eeb64dd551..d057c32304 100644 --- a/docs/zh-cn/sc/sample/verify.md +++ b/docs/zh-cn/sc/sample/verify.md @@ -57,8 +57,11 @@ namespace Neo.SmartContract 2. 在 `导入自定义合约` 对话框中设置以下选项: + a. 形参列表:参考 [智能合约参数和返回值](../deploy/Parameter.md),由于我们的合约中有一个 signature 参数,所以此处要填写 00 。 + b. 脚本代码:填写上一步复制的合约脚本代码。 + c. 私钥:可选参数,当合约执行过程中需要签名时,设置用于签名的私钥。 ![创建合约地址](assets/verify_7.png) @@ -71,6 +74,7 @@ namespace Neo.SmartContract 下面就可以对刚创建的智能合约鉴权账户进行测试,测试方法是先向合约地址转入一笔资产,再将其转出,验证合约是否执行成功。 > [!Note] +> > 为了更简单验证测试结果,钱包中的标准账户里最好不要有资产,或者转账金额要大于标准账户资产,以确定资产是从合约账户转出。 ### 转入资产到合约地址