Skip to content

Commit

Permalink
0213fixes (neo-project#999)
Browse files Browse the repository at this point in the history
* fix issues

* updated

* minor updates
  • Loading branch information
Celia18305 authored Feb 14, 2020
1 parent 337a449 commit 1786a18
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 78 deletions.
6 changes: 3 additions & 3 deletions docs/en-us/sc/gettingstarted/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down Expand Up @@ -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!

16 changes: 8 additions & 8 deletions docs/en-us/sc/gettingstarted/develop.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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)

Expand Down Expand Up @@ -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`.
Expand All @@ -81,19 +81,19 @@ 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

The code contains basic information of the assets and the methods available to be invoked. You can make changes when needed.

> [!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:
>
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions docs/en-us/sc/gettingstarted/enviroment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
20 changes: 10 additions & 10 deletions docs/en-us/sc/gettingstarted/introduction.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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

Expand All @@ -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.

Expand All @@ -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 ()
Expand Down
22 changes: 9 additions & 13 deletions docs/en-us/sc/gettingstarted/prerequisites.md
Original file line number Diff line number Diff line change
@@ -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?

Expand Down
4 changes: 2 additions & 2 deletions docs/zh-cn/network/private-chain/solo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions docs/zh-cn/sc/deploy/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@

1. 创建好钱包后,在 NEO-GUI 中点击鼠标右键,选择 `创建合约地址` -> `自定义`
2.`导入自定义合约` 对话框中设置以下选项:

a. `形参列表`:参考 [智能合约参数和返回值](Parameter.md)
b. `脚本代码`:填写上一步复制的合约脚本代码。
c. `私钥`:可选参数,当合约执行过程中需要签名时,设置用于签名的私钥。

3. 点击 `确定`

Loading

0 comments on commit 1786a18

Please sign in to comment.