diff --git a/README.md b/README.md index 8db83ad783..cb4bd1fb0e 100644 --- a/README.md +++ b/README.md @@ -1,223 +1,46 @@ +

Ontology Layer2 Node

+

Version 1.0.0

-

Ontology

-

Version 2.0.0

+[中文](README_CN.md) | English -[![GoDoc](https://godoc.org/github.com/ontio/ontology?status.svg)](https://godoc.org/github.com/ontio/ontology) -[![Go Report Card](https://goreportcard.com/badge/github.com/ontio/ontology)](https://goreportcard.com/report/github.com/ontio/ontology) -[![Travis](https://travis-ci.com/ontio/ontology.svg?branch=master)](https://travis-ci.com/ontio/ontology) -[![Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/gDkuCAq) +The Ontology Layer2 is aimed at creating a solution to off-chain scaling. In order to cater to the needs of users that demand low transaction fee and low latency, the layer2 system can help address the scaling needs of complex applications. -English | [中文](README_CN.md) +## Node Installation -Welcome to the official Go implementation of the [Ontology](https://ont.io) blockchain! +### Pre-requisites -Ontology is a high-performance public blockchain project and distributed trust collaboration platform. It is highly customizable and suitable for all kinds of business requirements. The Ontology MainNet was launched on June 30th, 2018. +- Golang - v1.14 or higher +- Suitable Go development environment +- Linux OS -As a public blockchain project, Ontology is currently maintained by both the Ontology core tech team and community members who can all support you in development. There are many available tools for use for development - SDKs, the SmartX IDE, Ontology blockchain explorer and more. +### Fetching Layer2 Node Source Code -New features are still being rapidly developed, therefore the master branch may be unstable. Stable versions can be found in the [releases section](https://github.com/ontio/ontology/releases). - -## Features - -- Scalable lightweight universal smart contracts -- Scalable WASM contract support -- Cross-chain interactive protocol -- Multiple encryption algorithms supported -- Highly optimized transaction processing speed -- P2P link layer encryption (optional module) -- Multiple consensus algorithms supported (VBFT/DBFT/RBFT/SBFT/PoW) -- Quick block generation time (1-30 seconds) - - -## Install from Binaries -You can download a stable compiled version of the Ontology node software by either: - -- Downloading the latest Ontology binary file with `curl https://dev.ont.io/ontology_install | sh`. -- Downloading a specific version from the [release section](https://github.com/ontio/ontology/releases). - -## Build From Source - -### Prerequisites - -- [Golang](https://golang.org/doc/install) version 1.12 or later - - -### Build - -Note that the code in the `master` branch may not be stable. - -``` -$ git clone https://github.com/ontio/ontology.git -$ cd ontology -$ make all -``` - -After building the source code successfully, you should see two executable programs: - -- `ontology`: The primary Ontology node application and CLI. -- `tools/sigsvr`: The Ontology Signature Server, `sigsvr` - an RPC server for signing transactions. Detailed documentation can be found [here](https://github.com/ontio/documentation/blob/master/docs/pages/doc_en/Ontology/sigsvr_en.md). - -## Run Ontology - -The Ontology CLI can run nodes for the MainNet, TestNet and local PrivateNet. Check out the [Ontology CLI user guide](https://github.com/ontio/ontology/blob/master/docs/specifications/cli_user_guide.md) for a full list of commands. - -### MainNet Sync Node - -You can run an Ontology MainNet node built from the source code with: +Clone the Layer2 repo to the `$GOPATH/src/github.com/ontio` directory by running the following shell command: ```shell -./ontology # Linux -./ontology-darwin-amd64 # MacOS -start ontology-windows-amd64.exe # Windows +$ git clone -b layer2 https://github.com/ontio/ontology.git ``` -### TestNet Sync Node +### Compilation -You can run an Ontology TestNet node built from the source code with: +Run the `make` command to compile the library. ```shell -./ontology --networkid 2 # Linux -./ontology-darwin-amd64 --networkid 2 # MacOS - start ontology-windows-amd64.exe --networkid 2 # Windows +$ make all ``` -### Local PrivateNet - -The Ontology CLI allows you to run a local PrivateNet on your computer. Before you can run the PrivateNet you will need to create a wallet file. A wallet file named `wallet.dat` can be generated by running +Upon successful compilation, an executable program will appear in the directory. -``` shell -./ontology account add -d -``` +- `ontology`: The node program used to control the node operations using the command line. -To start the PrivateNet built from the source code with: +### Running the Layer Node -```shell -./ontology --testmode # Linux -./ontology-darwin-amd64 --testmode # MacOS -start ontology-windows-amd64.exe --testmode # Windows -``` - -Here's an example of the directory structure +Start the node by running the following command: ``` shell -$ tree -└── ontology - ├── ontology - └── wallet.dat +./ontology --layer2mode true ``` - -### Run with Docker - -You can run the Ontology node software with Docker. - -1. Setup Docker on your computer - - You will need the latest version of [Docker Desktop](https://www.docker.com/products/docker-desktop). - -2. Make a Docker image - - In the root directory of the source code, run `make docker` to make an Ontology image. - -3. Run the Ontology image - - Run the command `docker run ontio/ontology` to start Ontology - - Run the command `docker run -ti ontio/ontology` to start Ontology and allow interactive keyboard input - - If you need to keep the data generated by the image, refer to Docker's data persistence function - - You can add arguments to the Ontology command, such as with `docker run ontio/ontology --networkid 2`. - -## Examples - -### ONT transfer sample - -- from: transfer from; -- to: transfer to; -- amount: ONT amount; -```shell - ./ontology asset transfer --from=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --to=AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce --amount=10 -``` -If the asset transfer is successful, the result will display as follows: - -```shell -Transfer ONT - From:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - To:AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce - Amount:10 - TxHash:437bff5dee9a1894ad421d55b8c70a2b7f34c574de0225046531e32faa1f94ce -``` -TxHash is the transfer transaction hash, and we can query a transfer result by the TxHash. -Due to block time, the transfer transaction will not be executed before the block is generated and added. - -If you want to transfer ONG, just add --asset=ong flag. - -Note that ONT is an integer and has no decimals, whereas ONG has 9 decimals. For detailed info please read [Everything you need to know about ONG](https://medium.com/ontologynetwork/everything-you-need-to-know-about-ong-582ed216b870). - -```shell -./ontology asset transfer --from=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --to=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --amount=95.479777254 --asset=ong -``` -If transfer of the asset succeeds, the result will display as follows: - -```shell -Transfer ONG - From:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - To:AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce - Amount:95.479777254 - TxHash:e4245d83607e6644c360b6007045017b5c5d89d9f0f5a9c3b37801018f789cc3 -``` - -Please note, when you use the address of an account, you can use the index or label of the account instead. Index is the sequence number of a particular account in the wallet. The index starts from 1, and the label is the unique alias of an account in the wallet. - -```shell -./ontology asset transfer --from=1 --to=2 --amount=10 -``` - -### Query transfer status sample - -```shell -./ontology info status -``` - -For Example: - -```shell -./ontology info status 10dede8b57ce0b272b4d51ab282aaf0988a4005e980d25bd49685005cc76ba7f -``` - -Result: - -```shell -Transaction:transfer success -From:AXkDGfr9thEqWmCKpTtQYaazJRwQzH48eC -To:AYiToLDT2yZuNs3PZieXcdTpyC5VWQmfaN -Amount:10 -``` - -### Query account balance sample - -```shell -./ontology asset balance -``` - -For Example: - -```shell -./ontology asset balance ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 -``` - -or - -```shell -./ontology asset balance 1 -``` -Result: -```shell -BalanceOf:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - ONT:989979697 - ONG:28165900 -``` - -For further examples, please refer to the [CLI User Guide](https://ontio.github.io/documentation/cli_user_guide_en.html). - -## Contributions - -Contributors to Ontology are very welcome! Before beginning, please take a look at our [contributing guidelines](CONTRIBUTING.md). You can open an issue by [clicking here](https://github.com/ontio/ontology/issues/new). - -If you have any issues getting setup, open an issue or reach out in the [Ontology Discord](https://discordapp.com/invite/4TQujHj). - ## License -The Ontology source code is available under the [LGPL-3.0](LICENSE) license. +The Ontology library is licensed under the GNU Lesser General Public License v3.0, read the LICENSE file in the root directory of the project for details. diff --git a/README_CN.md b/README_CN.md index 898e854b74..65309ece27 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,272 +1,45 @@ -

Ontology

-

Version 1.8.0

- -[![GoDoc](https://godoc.org/github.com/ontio/ontology?status.svg)](https://godoc.org/github.com/ontio/ontology) -[![Go Report Card](https://goreportcard.com/badge/github.com/ontio/ontology)](https://goreportcard.com/report/github.com/ontio/ontology) -[![Travis](https://travis-ci.com/ontio/ontology.svg?branch=master)](https://travis-ci.com/ontio/ontology) -[![Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/gDkuCAq) +

Ontology Layer2 Node

+

Version 1.0.0

[English](README.md) | 中文 -欢迎来到Ontology的源码库! - -Ontology致力于创建一个组件化、可自由配置、跨链支持、高性能、横向可扩展的区块链底层基础设施。 让部署及调用去中心化应用变得更加非常简单。 - -Ontology MainNet 已经在2018年6月30日成功上线。
-但很多新的功能还处于快速的开发过程中,master分支的代码可能是不稳定的,稳定的版本可以在[releases](https://github.com/ontio/ontology/releases)中下载。 - -公开的主网和测试网都可以在下面找到,也非常欢迎及希望能有更多的开发者加入到Ontology中来。 - -* [特性](#特性) -* [构建开发环境](#构建开发环境) -* [获取ontology](#获取ontology) - * [从release获取](#从release获取) - * [从源码获取](#从源码获取) -* [运行ontology](#运行ontology) - * [主网同步节点](#主网同步节点) - * [公开测试网Polaris同步节点](#公开测试网polaris同步节点) - * [测试模式](#测试模式) - * [使用docker运行](#使用docker运行) -* [使用示例](#使用示例) - * [ONT转账调用示例](#ont转账调用示例) - * [查询转账结果示例](#查询转账结果示例) - * [查询账户余额示例](#查询账户余额示例) -* [贡献代码](#贡献代码) -* [开源社区](#开源社区) - * [网站](#网站) - * [Discord开发者社区](#discord开发者社区) -* [许可证](#许可证) - -## 特性 +Ontology Layer2致力于创建一个链下扩展方案,来满足用户低延迟、低费用的交易需求,其更好的应用扩展特性可以更好的支持大型复杂的应用。 -* 可扩展的轻量级通用智能合约 -* 可扩展的WASM合约的支持 -* 跨链交互协议(进行中) -* 多种加密算法支持 -* 高度优化的交易处理速度 -* P2P连接链路加密(可选择模块) -* 多种共识算法支持 (VBFT/DBFT/SBFT/PoW/SOLO...) -* 快速的区块生成时间 +## 安装Node -## 构建开发环境 -成功编译ontology需要以下准备: +### 前提 -* Golang版本在1.12及以上 +* Golang版本在1.14及以上 * 正确的Go语言开发环境 -* Golang所支持的操作系统 +* Linux操作系统 -## 获取ontology +### 获取Layer2 Node -### 从release获取 -- 你可以通过命令 ` curl https://dev.ont.io/ontology_install | sh ` 获取最新的ontology版本 -- 你也可以从[下载页面](https://github.com/ontio/ontology/releases)获取. +克隆Layer2仓库到 **$GOPATH/src/github.com/ontio** 目录 -### 从源码获取 - -```shell -$ git clone https://github.com/ontio/ontology.git -$ cd ontology -$ make all ``` - -成功编译后会生成两个可以执行程序 - -* `ontology`: 节点程序/以命令行方式提供的节点控制程序 -* `tools/sigsvr`: (可选)签名服务 - sigsvr是一个签名服务的server以满足一些特殊的需求。详细的文档可以在[这里](./docs/specifications/sigsvr_CN.md)参考 - -## 运行ontology - -### 主网同步节点 - -直接启动Ontology - -``` -./ontology +$ git clone -b layer2 https://github.com/ontio/ontology.git ``` -然后你可以连接上主网了。 -### 公开测试网Polaris同步节点 - -直接启动Ontology - -``` -./ontology --networkid 2 -``` -然后你可以连接上公共测试网了。 - -### 测试模式 - -在单机上创建一个目录,在目录下存放以下文件: -- 节点程序`ontology` -- 钱包文件`wallet.dat` (注:`wallet.dat`可通过`./ontology account add -d`生成) - -使用命令 `$ ./ontology --testmode` 即可启动单机版的测试网络。 - -单机配置的例子如下: -- 目录结构 - - ```shell - $ tree - └── node - ├── ontology - └── wallet.dat - ``` - -### 使用docker运行 - -请确保机器上已安装有docker环境。 - -1. 编译docker镜像 - - - 在下载好的源码根目录下,运行`make docker`命令,这将编译好ontology的docker镜像 - -2. 运行ontology镜像 - - - 使用命令`docker run ontio/ontology`运行ontology; - - - 如果需要使镜像运行时接受交互式键盘输入,则使用`docker run -ti ontio/ontology`命令启动镜像即可; - - - 如果需要保留镜像每次运行时的数据,可以参考docker的数据持久化功能(例如 valume); - - - 如果需要使用ontology参数,则在`docker run ontio/ontology`后面直接加参数即可,例如`docker run ontio/ontology --networkid 2`,具体的ontology命令 - 行参数可以参考[这里](./docs/specifications/cli_user_guide_CN.md)。 - -## 使用示例 - -### ONT转账调用示例 - - from: 转出地址; - to: 转入地址; - amount: 资产转移数量; - from参数可以不指定,如果不指定则使用默认账户。 +### 编译 +用make编译源码 ```shell - ./ontology asset transfer --from=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --to=AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce --amount=10 -``` - -执行完后会输出: - -```shell -Transfer ONT - From:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - To:AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce - Amount:10 - TxHash:437bff5dee9a1894ad421d55b8c70a2b7f34c574de0225046531e32faa1f94ce -``` -其中TxHash是转账交易的交易HASH,可以通过这个HASH查询转账交易的直接结果。 -出于区块链出块时间的限制,提交的转账请求不会马上执行,需要等待至少一个区块时间,等待记账节点打包交易。 - -如果需要转ONG,可以使用参数 -- asset = ong。注意,ONT最少单位是1,而ONG则有9位小数点。 - -```shell -./ontology asset transfer --from=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --to=ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 --amount=95.479777254 --asset=ong -``` -执行完后会输出: - -```shell -Transfer ONG - From:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - To:AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce - Amount:95.479777254 - TxHash:e4245d83607e6644c360b6007045017b5c5d89d9f0f5a9c3b37801018f789cc3 -``` - -注意,Ontology cli中,所有用到账户的地址的地方,都支持账户索引和账户标签。账户索引是账户在钱包中的序号,从1开始。标签是可以在创建账户的时候指定一个唯一的别名。如: - -```shell -./ontology asset transfer --from=1 --to=2 --amount=10 -``` - -### 查询转账结果示例 - -```shell -./ontology info status -``` - -如: - -```shell -./ontology info status e4245d83607e6644c360b6007045017b5c5d89d9f0f5a9c3b37801018f789cc3 -``` - -查询结果: -```shell -Transaction states: -{ - "TxHash": "e4245d83607e6644c360b6007045017b5c5d89d9f0f5a9c3b37801018f789cc3", - "State": 1, - "GasConsumed": 0, - "Notify": [ - { - "ContractAddress": "0200000000000000000000000000000000000000", - "States": [ - "transfer", - "ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48", - "AaCe8nVkMRABnp5YgEjYZ9E5KYCxks2uce", - 95479777254 - ] - } - ] -} -``` - -### 查询账户余额示例 - -```shell -./ontology asset balance -``` -如: - -```shell -./ontology asset balance ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 -``` -或者 - -```shell -./ontology asset balance 1 -``` -查询结果: -```shell -BalanceOf:ARVVxBPGySL56CvSSWfjRVVyZYpNZ7zp48 - ONT:989979697 - ONG:28165900 +$ make all ``` -进一步的示例可以参考[文档中心](https://ontio.github.io/documentation/) +成功编译后会生成可以执行程序 -## 贡献代码 - -请您以签过名的commit发送pull request请求,我们期待您的加入! -您也可以通过邮件的方式发送你的代码到开发者邮件列表,欢迎加入Ontology邮件列表和开发者论坛。 - -另外,在您想为本项目贡献代码时请提供详细的提交信息,格式参考如下: - - Header line: explain the commit in one line (use the imperative) - - Body of commit message is a few lines of text, explaining things - in more detail, possibly giving some background about the issue - being fixed, etc etc. - - The body of the commit message can be several paragraphs, and - please do proper word-wrap and keep columns shorter than about - 74 characters or so. That way "git log" will show things - nicely even when it's indented. - - Make sure you explain your solution and why you're doing what you're - doing, as opposed to describing what you're doing. Reviewers and your - future self can read the patch, but might not understand why a - particular solution was implemented. - - Reported-by: whoever-reported-it - Signed-off-by: Your Name - -## 开源社区 - -### 网站 +* `ontology`: 节点程序/以命令行方式提供的节点控制程序 -- https://ont.io/ +### 运行Layer Node -### Discord开发者社区 +直接启动Ontology -- https://discord.gg/4TQujHj/ + ``` + ./ontology + ``` ## 许可证