Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 26 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,8 @@ If you're interested in adding support for another language, framework, or tools

The testnet currently only supports the [go-ethereum](https://github.com/ethereum/go-ethereum) (geth) client. Support for aleth (formerly, cpp-ethereum) is a work in progress and more information may be found [here](aleth.md).

## Adding a node to the testnet

### Geth

You may install and configure geth in the following ways:

- manually, from source
- using this preconfigured Docker image

#### Manual configuration

Manually configuring geth requires installing prerequisites, downloading and compiling geth from source with [EVMC](https://github.com/ethereum/evmc) support, downloading and building [Hera](https://github.com/ewasm/hera/) (the Ewasm virtual machine connector), then launching geth with Hera set as its EVMC engine.

1. Make sure the prerequisites are installed (Go version 1.7 or later, `cmake` 3.5 or later, and a C/C++ compiler).
Expand All @@ -129,7 +120,7 @@ Manually configuring geth requires installing prerequisites, downloading and com
> sudo apt-get install build-essential make cmake golang
```

## geth + Hera
### geth + Hera

The genesis is in [ewasm-testnet-geth-config.json](ewasm-testnet-geth-config.json)

Expand Down Expand Up @@ -168,102 +159,76 @@ Aleth supports EVMC out of the box, but geth not yet.
> cmake --build .
```

1. Download the [genesis file](ewasm-testnet-geth-config.json) and use it to initialize geth:

```sh
> wget https://raw.githubusercontent.com/ewasm/testnet/ewasm-testnet-milestone1/ewasm-testnet-geth-config.json
> ./build/bin/geth --datadir /tmp/ewasm-node/4201/ init ewasm-testnet-geth-config.json
```

Note that the `/tmp/ewasm-node/4201` directory name above is arbitrary. It just needs to be unique.

1. Run geth with Hera and connect to the testnet:
1. Run geth with Hera:

Use `--vm.ewasm` flag in `geth` to plug in an EVMC VM shared library. Point it to the Hera shared library that you built a moment ago.
Additional EVMC options can be provided after a comma.
Hera options are documented [here](https://github.com/ewasm/hera).

Note also the `--etherbase`, `--networkid`, and `--bootnodes` commands, below, and copy them verbatim as these are required to connect to and sync with the Ewasm testnet.

The `--vmodule` argument sets the verbosity for the `eth` and `p2p` modules, which will provide lots of juicy debugging information on your node's connection to the other testnet peers, and on its mining, accepting, and propagating blocks. Feel free to reduce verbosity or turn this off.

Finally, if you want your node to participate in mining, add the arguments `--mine --miner.threads 1`.
Finally, if you want your node to mine, add the arguments `--mine --miner.threads 1`.

Check out the geth [CLI wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) for more information on these commands, or just run `geth --help`.

Here's the recommended configuration for connecting your node to the Ewasm testnet:
Here's the recommended configuration for running a node locally:

```sh
> ./build/bin/geth \
--vm.ewasm="/path/to/libhera.so,metering=true,fallback=true" \
--datadir /tmp/ewasm-node/4201/ \
--etherbase 031159dF845ADe415202e6DA299223cb640B9DB0 \
--rpc --rpcapi "web3,net,eth,debug" \
--rpcvhosts="*" --rpcaddr "0.0.0.0" \
--rpccorsdomain "*" \
--vmodule "miner=12,rpc=12" \
--mine --miner.threads 1 \
--nodiscover \
--networkid 66 \
--bootnodes "enode://53458e6bf0353f3378e115034cf6c6039b9faed52548da9030b37b4672de4a8fd09f869c48d16f9f10937e7398ae0dbe8b9d271408da7a0cf47f42a09e662827@23.101.78.254:30303"
--vmodule "eth=12,p2p=12" \
--nodiscover
```

*NOTE*: don't forget to specify `networkId` with the same value as the value of `chainID` in the genesis configuration, this is to avoid [Metamask error `Invalid Sender`](https://github.com/MetaMask/metamask-extension/issues/3673).

Note that if you want your node to be automatically restarted if it dies, and to survive system reboots, you'll want to use a tool such as [pm2](http://pm2.keymetrics.io/):

```sh
> npm install -g pm2
```

### geth + Wagon

## geth + Wagon
The testnet has experimental support for running a geth node with the [Wagon](http://github.com/go-interpreter/wagon) third-party VM. Instructions may be found [here](wagon.md).

### Aleth (cpp-ethereum) + Hera

**NOTE: this client currently is not supported fully and the instructions here may be wrong.**

This section describes how to run geth node with the [Wagon](http://github.com/go-interpreter/wagon) VM.
Support for aleth (formerly, cpp-ethereum) is a work in progress and more information may be found [here](aleth.md).

1. Get the code from the PR

```sh
> go get github.com/ethereum/go-ethereum
> cd $GOROOT/src/github.com/ethereum/go-ethereum
> git remote add gballet git@github.com:gballet/go-ethereum.git
> git fetch gballet add-ewasm
> git checkout add-ewasm
```
## Syncing to the testnet

In order to sync to the testnet, you'll need the proper genesis configuration.

2. Build geth
1. Follow the steps above to download and build geth+Hera.

1. Download the [genesis file](ewasm-testnet-geth-config.json) and use it to initialize geth:

```sh
> go build ./cmd/geth/...
> wget https://raw.githubusercontent.com/ewasm/testnet/ewasm-testnet-milestone1/ewasm-testnet-geth-config.json
> ./build/bin/geth --datadir /tmp/ewasm-node/4201/ init ewasm-testnet-geth-config.json
```

3. Run geth
Note that the `/tmp/ewasm-node/4201` directory name above is arbitrary. It just needs to be unique.

Note also the `--etherbase`, `--networkid`, and `--bootnodes` commands, below, and copy them verbatim as these are required to connect to and sync with the Ewasm testnet.

The Ewasm interpreter will be activated by default as long as you do not specify a `--vm.ewasm=...` on the command line option.
Don't forget to specify `networkId` with the same value as the value of `chainID` in the genesis configuration to avoid [Metamask error `Invalid Sender`](https://github.com/MetaMask/metamask-extension/issues/3673).

Run geth as above, but add the following commandline args:

```sh
> ./geth \
--datadir /tmp/ewasm-node/4201/ \
--etherbase 031159dF845ADe415202e6DA299223cb640B9DB0 \
--rpc --rpcapi "web3,net,eth,debug" \
--rpcvhosts="*" --rpcaddr "0.0.0.0" \
--rpccorsdomain "*" \
--mine --miner.threads 1 \
--nodiscover \
--etherbase a8c3eeb2915373139bcfc287d4ae9e660d734881 \
--networkid 66 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it better to split these two instructions? It seems weird that this block only contains extra options.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the geth configuration specified at line 174? Because there's a difference between running a node locally and running a node that syncs the testnet -- these additional commands are intended for testnet syncing. (Though I think --etherbase could be removed)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use of "running a node locally" without connecting to the testnet?

FYI running the node locally can be done in "test" mode which avoids 90% of the commandline options.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use of "running a node locally" without connecting to the testnet?

Local development.

FYI running the node locally can be done in "test" mode which avoids 90% of the commandline options.

Okay. Presumably we still need the --vm.ewasm flag but not the RPC-related ones?

--bootnodes "enode://53458e6bf0353f3378e115034cf6c6039b9faed52548da9030b37b4672de4a8fd09f869c48d16f9f10937e7398ae0dbe8b9d271408da7a0cf47f42a09e662827@23.101.78.254:30303"
```


### Aleth (cpp-ethereum) + Hera

**NOTE: this client currently is not supported fully and the instructions here may be wrong.**

Support for aleth (formerly, cpp-ethereum) is a work in progress and more information may be found [here](aleth.md).


### Enabling ethstats

Ethstats is a pretty UI for monitoring network state, which allows individual nodes to communicate their state to a centralized server via WebSockets. (See for instance the page for the [Ethereum mainnet](https://ethstats.net/).) Nodes must be added manually. The Ewasm team maintains an [ethstats page for the testnet](http://ewasm.ethereum.org/ethstats). If you'd like your node to be added, follow these steps:
Expand Down
29 changes: 29 additions & 0 deletions wagon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# geth + Wagon

**NOTE: this client currently is not supported fully and the instructions here may be wrong.**

[Wagon](http://github.com/go-interpreter/wagon) is a third-party WebAssembly VM written natively in Go. Support for geth + Wagon on the Ewasm testnet is experimental. This document describes how to run geth node with geth and the Wagon VM.

1. Get the code from the PR

```sh
> go get github.com/ethereum/go-ethereum
> cd $GOROOT/src/github.com/ethereum/go-ethereum
> git remote add gballet git@github.com:gballet/go-ethereum.git
> git fetch gballet add-ewasm
> git checkout add-ewasm
```

1. Build geth

```sh
> go build ./cmd/geth/...
```

1. Run geth

The Ewasm interpreter will be activated by default as long as you do not specify a `--vm.ewasm=...` on the command line option.

```sh
> TMPDIR=/tmp/ewasm-node/ ./geth --datadir $TMPDIR --etherbase 031159dF845ADe415202e6DA299223cb640B9DB0 --rpc --rpcapi "web3,net,eth,debug" --rpcvhosts="*" --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine --miner.threads 1 --nodiscover --networkid 66
```