Merge pull request #40 from status-im/develop

Updated docs
This commit is contained in:
Bruno Škvorc 2019-08-27 16:21:25 +02:00 committed by GitHub
commit e512baa220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 47 deletions

View File

@ -5,29 +5,19 @@ title: Getting Started with Nimbus
This document will explain how to install, test, and run Nimbus on your local machine. To learn about what Nimbus is, see the [intro post](https://our.status.im/nimbus-for-newbies/).
## Installing prerequisites
If you are on Windows, instead of using the commands below you can also use our [pre-configured Vagrant box](https://github.com/status-im/nim-vagrant) if you prefer to run things in a Linux environment.
We use Makefiles to quickly and easily build our binaries. Before you begin, please make sure you have [RocksDB installed](https://github.com/status-im/nimbus#rocksdb). On Windows, you can skip this step and instead rely on the "WINDOWS ONLY" part of the process below:
```bash
git clone https://github.com/status-im/nimbus
cd nimbus
make update # Downloads and builds submodules, dependencies, and even Nim itself
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
./env.sh bash # Optional, but useful. Sets the current shell's environment to use the version of Nim language the `make update deps` command just built
```
### Building and Running Nimbus
To run Nimbus in Ethereum 1.0 mode:
```bash
git clone https://github.com/status-im/nimbus
cd nimbus
make update
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
make nimbus
./build/nimbus
```
@ -38,13 +28,23 @@ Nimbus will now run and attempt to synchronize with the Ethereum 1.0 blockchain.
The beacon chain simulation runs several beacon nodes on the local machine, attaches several local validators to each, and builds a beacon chain between them. This is a precursor to our [testnet](https://our.status.im/the-nimbus-mvp-testnet-is-here/).
Prerequisites: Golang 1.12+, because we need it to build the Go libp2p daemon for node communication. You also need `git-lfs` installed to run tests - on Windows that's a command documented below, on other operating systems it can be installed using your system's package manager (e.g. `sudo apt-get install git-lfs`).
Enter the Ethereum 2.0 realm of Nimbus:
```bash
cd vendor/nim-beacon-chain
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
make
make test
```
There, use this submodule's Make commands. To run the simulation:
To run the simulation:
```bash
make eth2_network_simulation

View File

@ -7,23 +7,28 @@ title: Creating your own Nimbus testnet
All beacon nodes joining your custom testnet MUST be compiled with the same beacon chain constants - i.e. if a node is compiled with 8 slots per epoch, one with 16 slots per epoch will not be compatible with it. With that in mind, let's do this step of building the basic beacon node binary from within `vendor/nim-beacon-chain`, and let's also build the tool that can generate validator keys.
If you haven't cloned Nimbus already, do it now:
> Note that you need Go 1.12+ installed to build the libp2p Go daemon!
If you haven't cloned the beacon chain implementation already, do it now:
```bash
git clone https://github.com/status-im/nimbus
cd nimbus
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
make update
cd vendor/nim-beacon-chain
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
```
Then let's build the binaries of the tools we'll need.
```bash
export NIMFLAGS="-d:release -d:SECONDS_PER_SLOT=30 -d:SHARD_COUNT=8 -d:SLOTS_PER_EPOCH=8" \
export NIMFLAGS="-d:release -d:SECONDS_PER_SLOT=6 -d:SHARD_COUNT=64 -d:SLOTS_PER_EPOCH=64" \
&& make beacon_node validator_keygen
```
This will place the `beacon_node` binary and the `validator_keygen` tool in `build` in the current folder, i.e. `vendor/nim-beacon-chain`.
This will place the `beacon_node` binary and the `validator_keygen` tool in `build/` in the current folder.
Let's generate the folders where the node will store its data and then add the validator keys in there. I picked 500 keys.
@ -57,16 +62,50 @@ createTestnet \
Running the above command will result in two new files being created. In my case `$HOME/testnets/custom-network/genesis.json` and `$HOME/testnets/custom-network/custom-network.json`.
We are now ready to connect and to share these files with those who would connect to us. Please note that in order to allow others to connect to you, you need to open the port you chose manually on your router and firewall for as long as Nimbus doesn't yet have UPnP implemented. If you're hosting your bootnode on something like DigitalOcean or AWS, there are firewall controls there that are quite intuitive. For your own local computer, please consult your router's manual on how to do that.
The `genesis.json` file is the starting state, "block 0" of your testnet beacon chain. It contains the listed validators, initial shufflings, and everything the system needs in order to have the clients connecting to the network build on the same foundation. The `custom-network.json` file is the "metadata" file of your new network - it has identified your node, the one this file was generated with - as the bootstrap node and included its enode address under `bootstrapNodes`, along with the other required data and the root of the genesis. You can host these two files on a server somewhere or in a [Github Gist](https://gist.github.com) anyone grabbing them will be able to join your network if they execute the command:
Because these files that were generated are made for others joining you, we need to make a copy of the `custom-network` file so that we can launch our node, the bootstrap node.
```bash
./build/beacon_node --network=$HOME/testnets/custom-network/custom-network.json --stateSnapshot=$HOME/testnets/custom-network/genesis.json --tcpPort=34001 --udpPort=34001
cp $HOME/testnets/custom-network/custom-network.json $HOME/testnets/custom-network/custom-network_boot.json
```
However, they MUST first build their beacon node with the same parameters you did in the beginning of this setup.
Then open this new file and delete the `bootstrapNodes` object, all of it. If you don't, the node you run will try to connect to a bootstrap node that is effectively its-not-yet-running-self. Without the `bootstrapNodes` part, the node just _runs_ so others can connect _to_ it.
Congrats, you have a custom Nimbus testnet up and running!
We are now ready to connect and to share these files with those who would connect to us.
The `genesis.json` file is the starting state, "block 0" of your testnet beacon chain. It contains the listed validators, initial shufflings, and everything the system needs in order to have the clients connecting to the network build on the same foundation.
The `custom-network.json` file is the "metadata" file of your new network - it has identified your node, the one this file was generated with - as the bootstrap node and included its enode address under `bootstrapNodes`, along with the other required data and the root of the genesis.
Let's run the original node now.
```bash
./build/beacon_node --network=$HOME/testnets/custom-network/custom-network_boot.json --stateSnapshot=$HOME/testnets/custom-network/genesis.json --tcpPort=34000 --udpPort=34000
```
You can host `custom-network.json` and `genesis.json` on a server somewhere or in a [Github Gist](https://gist.github.com) so anyone grabbing them will be able to join your network if they execute the command:
```bash
./build/beacon_node --network=$HOME/testnets/custom-network/custom-network.json --stateSnapshot=$HOME/testnets/custom-network/genesis2.json --tcpPort=34001 --udpPort=34001
```
Let's run another node on the same machine where the bootstrap node is running. This requires that we create a new data dir, otherwise it'll clash with the current node. Execute the following chain of commands:
```bash
export DATA_DIR=$HOME/testnets/custom-testnet/node-1 && mkdir -p $DATA_DIR/data && mkdir -p $DATA_DIR/validators && ./build/beacon_node \
--network=$HOME/testnets/custom-network/custom-network_boot.json \
--stateSnapshot=$HOME/testnets/custom-network/genesis.json \
--tcpPort=34000 \
--udpPort=34000 \
--dataDir:$DATA_DIR/data \
--nodename:node1
```
However, they MUST first build their beacon node with the same parameters you did in the beginning of this setup:
```bash
export NIMFLAGS="-d:release -d:SECONDS_PER_SLOT=6 -d:SHARD_COUNT=64 -d:SLOTS_PER_EPOCH=64" && make beacon_node
```
Congrats, you have a custom Nimbus testnet up and running! Host those startup files somewhere, distribute some validator keys, and others can join your testnet!
[![Screenshot-from-2019-03-29-21-25-15](https://our.status.im/content/images/2019/03/Screenshot-from-2019-03-29-21-25-15.png)](https://our.status.im/content/images/2019/03/Screenshot-from-2019-03-29-21-25-15.png)

View File

@ -27,7 +27,8 @@ To run Nimbus in Ethereum 1.0 mode:
```bash
make nimbus
make test
./build/nimbus
```
Nimbus will now run and attempt to synchronize with the Ethereum 1.0 blockchain. It can currently reach block 1.5 million.
Nimbus will now run and attempt to synchronize with the Ethereum 1.0 blockchain. It can currently reach block 1.5 million.

View File

@ -13,15 +13,14 @@ Here is the full process if you're starting from scratch, without even Nim insta
```bash
# Ensure you have rocksdb installed before running this!
git clone https://github.com/status-im/nimbus
cd nimbus
make update deps # this might take a few minutes
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
make update # this might take a few minutes
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
cd vendor/nim-beacon-chain # All Ethereum 2.0 functionality is in here
make testnet0
./build/testnet0_node # this launches the testnet0-specific node you just built
```
@ -29,8 +28,8 @@ make testnet0
Here is the full process if you've already run testnet0 before but might be stuck with old source code or old, incompatible cache.
```bash
cd nimbus
make update deps # update dependencies
cd nim-beacon-chain
make update # update dependencies
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
@ -38,7 +37,7 @@ make fetch-dlls # WINDOWS ONLY
cd vendor/nim-beacon-chain
make clean-testnet0 testnet0 # clean cache and rebuild binary
./scripts/testnet0.sh # this launches the testnet0-specific node you just built
./build/testnet0_node # this launches the testnet0-specific node you just built
```
Congratulations, you should now be joining us - your node will start syncing with the current state of our beacon chain. Once you're in sync, you should also start proposing your own blocks and providing attestations - exciting! You are now among [Ethereum 2.0 Nimbus pioneers](https://gitcoin.co/kudos/1160/nimbus_pilot)!

View File

@ -7,17 +7,19 @@ Testnet1 is a cutting edge highly breakable in-flux testnet we use to test new f
## Joining Nimbus Testnet 1
_Note: Works only on non-Windows right now. If on Windows, consider using our [Vagrant box](https://github.com/status-im/nim-vagrant)._
Before following the instructions below, please make sure you have Go installed. Follow [official instructions](https://golang.org/doc/install) and make sure it's above version 1.12. This is required because we build the Libp2p Go daemon.
Before following the instructions below, please make sure you have Go installed. Follow [official instructions](https://golang.org/doc/install) and make sure it's above version 1.12. This is required because we build the Libp2p Go daemon. You also need `git-lfs` installed - on Windows that's a command documented below, on other operating systems it can be installed using your system's package manager (e.g. `sudo apt-get install git-lfs`).
```bash
git clone https://github.com/status-im/nimbus
cd nimbus
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
git fetch
git checkout devel
make update deps
cd vendor/nim-beacon-chain
make update
# >>> WINDOWS ONLY <<<
make fetch-dlls # WINDOWS ONLY
# >>> WINDOWS ONLY <<<
make clean-testnet1 testnet1
./scripts/testnet1.sh
```