Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Follow up neo-project#826

* update
  • Loading branch information
Celia18305 committed Jun 5, 2019
1 parent 304e989 commit fcf1171
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 3 deletions.
2 changes: 1 addition & 1 deletion en-us/network/private-chain/private-chain2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Build a private chain in an easy way
# Build a private chain with one computer

In previous document we described the standard way to build a private chain using four computers or virtual machines. In this document we will introduce an easier way to build a private chain on a windows system computer.

Expand Down
164 changes: 164 additions & 0 deletions en-us/network/private-chain/private-chain3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Build a private chain with one node

NEO-CLI 2.10.2 supports generating blocks without consensus nodes, which means you can set up a private chain with one node.

You can directly download the project [NEO-Private-Net](https://github.com/chenzhitong/NEO-Private-Net) to run a private chain quickly. Note that this project assumes you use Windows 10 and has [.NetFramework 4.7.1](https://www.microsoft.com/net/download/dotnet-framework-runtime) installed.

You can also build a private chain with one node by yourself, which will be elaborated in the following sections.

## Installing NEO node

Refer to [Installation of NEO-CLI](../../node/cli/setup.md) to install NEO-CLI 2.10.2.

## Installing plug-in (Optional)

Install the plug-in [SimplePolicy](https://github.com/neo-project/neo-plugins/releases/) which is used to output the log of generated blocks . Place the unzipped plugin under the Plugins folder of NEO-CLI.

You can also install other plugins with reference to the following list:

```
─Plugins
│ ApplicationLogs.dll
│ RpcSecurity.dll
│ RpcWallet.dll
│ SimplePolicy.dll
├─ApplicationLogs
│ config.json
├─RpcSecurity
│ config.json
├─RpcWallet
│ config.json
└─SimplePolicy
config.json
```

## Creating a wallet file

From NEO-CLI or NEO-GUI create a wallet a.json and place it in the node folder.

## Modifying config.json

Make the following configurations in config.json of the node:

- Specify the ports so that each port is not duplicated and is not occupied by other applications.
- In "UnlockWallet" specify the wallet path and wallet password.
- Set `StartConsensus` and `IsActive` as true.

You can refer to the following example:

```json
{
"ApplicationConfiguration": {
"Paths": {
"Chain": "Chain_{0}",
"Index": "Index_{0}"
},
"P2P": {
"Port": 10003,
"WsPort": 10004
},
"RPC": {
"BindAddress": "127.0.0.1",
"Port": 10002,
"SslCert": "",
"SslCertPassword": ""
},
"UnlockWallet": {
"Path": "a.json",
"Password": "1",
"StartConsensus": true,
"IsActive": true
},
"PluginURL": "https://github.com/neo-project/neo-plugins/releases/download/v{1}/{0}.zip"
}
}
```

## Modifying protocol.json

Configure the following parameters in NEO-CLI protocol.json. If you configure other nodes later ensure the configuration in each file is consistent.

- Magic: The private chain ID, which can be any integer in the range of [0 - 4294967295].
- StandbyValidators :The public key of the alternate consensus node. Enter the public key of the wallet a.json (It is single node mode when there is only one public key included in StandbyValidators).
- SeedList: The IP address and port number of the seed node. Specify the IP address as `localhost` and the ports as the P2P port configured in config.json.

You can refer to the following example:

```json
{
"ProtocolConfiguration": {
"Magic": 1840412,
"AddressVersion": 23,
"SecondsPerBlock": 5,
"LowPriorityThreshold": 0.001,
"StandbyValidators": [
"03d08d6f766b54e35745bc99d643c939ec6f3d37004f2a59006be0e53610f0be25"
],
"SeedList": [
"127.0.0.1:10003"
],
"SystemFee": {
"EnrollmentTransaction": 1000,
"IssueTransaction": 500,
"PublishTransaction": 500,
"RegisterTransaction": 10000
}
}
}
```

## Starting the private chain

Run the command line and enter the NEO-CLI directory. Then enter `neo-cli.exe` to start the private chain. The private chain is set up successfully when it goes as shown below:

![img](https://github.com/chenzhitong/NEO-Private-Net/raw/master/img/privatechain_demo.png)

The private chain is terminated if you close the window.

## Withdrawing NEO and GAS

In the genesis block of the NEO network, 100 million NEOs are generated. Additionally, GAS is generated with the generation of new blocks. When the private chain is set up, you can withdraw those NEO and GAS from a multi-party address with NEO-GUI, to facilitate your blockchain development and testing.

### Installing and configuring NEO-GUI

1. Download [NEO-GUI](https://github.com/neo-project/neo-gui/releases) from Github and extract the file.

2. Replace the protocol.json in the NEO-GUI folder with the one configured before.

3. Configure the file config.json to make sure the NEO-GUI port is not conflict with the one of NEO-CLI; otherwise, NEO-GUI cannot work as NEO-CLI is running.

```json
{
"ApplicationConfiguration": {
"Paths": {
"Chain": "Chain_{0}",
"Index": "Index_{0}",
"CertCache": "Certs"
},
"P2P": {
"Port": 60001,
"WsPort": 60002
},
"Urls": {
"AddressUrl": "https://neoscan.io/address/{0}",
"AssetUrl": "https://neoscan.io/api/main_net/v1/get_asset/{0}",
"TransactionUrl": "https://neoscan.io/transaction/{0}"
}
}
}
```

Start NEO-GUI and open a.json, if you see the connection number in the lower left corner is not 0 and the client has been downloading the blocks, the client has been successfully connected to the private chain.

### Transferring NEO/GAS

1. In NEO-GUI, right-click on the blank area of account page, click `Create Contract Address` -> `Multi-Signature`.
2. Enter the public key and set the minimum number of signatures to 1. Click `Confirm`.
3. Click `Wallet` -> `Rebuild wallet index`.

Now you should see the contract address has 100 million NEO shares. Since this multi-signature address only requires one signature, operations of transferring assets from the contract address is as same as transferring assets from a standard address.

6 changes: 4 additions & 2 deletions en-us/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,12 @@
- name: Private Chain
href: network/private-chain/private-chain.md
items:
- name: Build a private chain
- name: Build a private chain with virtual machines
href: network/private-chain/private-chain.md
- name: Build a private chain in an easy way
- name: Build a private chain with one computer
href: network/private-chain/private-chain2.md
- name: Build a private chain with one node
href: network/private-chain/private-chain3.md
- name: Local Blockchain
href: network/local-chain.md
- name: Synchronizing the blockchain faster
Expand Down

0 comments on commit fcf1171

Please sign in to comment.