Run a Local RPC Node

Run a full instance of the blockchain on your machine
You have the option of running a full node of the Energy Web Chain main network or Volta test network locally. Running a local node does requires a degree of technical capability. It helps to understand the benefits of doing so, and the alternatives to running a full local node.
There are a number of benefits to running your own node, which are described below.

What does it mean to run a node?

A 'client' is software that implements a blockchain's protocols and allows you to connect directly with the blockchain - that is to read data from the blockchain or initiate transactions on the blockchain, such as transferring tokens. Anyone can create client software, as long as it implements that blockchain's official protocols. Ethereum's protocols are specified in their yellow paper, and there are a number of Ethereum clients to choose from.
A node is any machine that is actively running client software and is connected to the blockchain. Blockchain is often called a “peer-to-peer” network, because its network is made up of many peers running nodes simultaneously that are connected to each other.
Depending on if you are running a full node, a light node, or an archive node (see the differences between these nodes here), your client will sync with the current state of blockchain and then continue to execute every transaction that is added to the blockchain. Essentially it is having a live copy or version of the blockchain running locally on your machine.
Depending on the blockchain you are you connecting to, this can take up large amounts of space and take a long time to retrieve and sync the history of the chain on your machine. For example, synching with the Energy Web chain will require much less resources than syncing with the Ethereum mainnet, as it is a much larger and longer-running blockchain.

What do I need to run a node?

To run a node, you need to install the client software. The Energy Web mainnet and Volta testnet both use the OpenEthereum client (formally known as Parity), because it supports the Authority Roundtable (AuRa), which is a consensus algorithm specifically for Proof-of-Authority (PoA) blockchains. You can read more about the PoA consensus algorithm and why we implemented it for the Energy Web Chain here.
Only approved validators can create or 'seal' new blocks on the Energy Web Chain. If you run a full local node, you will be able to validate transactions, but not create new blocks.

Benefits to Running a Local Node

  1. 1.
    The more nodes there are, the more secure the system is as a whole. Blockchains are decentralized technology, so by design the system performs better if there are multiple instances of it rather than just one. The more nodes there are, the less points of failure or opportunities for malicious action.
  2. 2.
    Your transactions are more direct and more secure. Software that provides intermediary connections to the blockchain like Infura or MetaMask are, like any other web-based software, susceptible to downtime or error. By connecting to the blockchain yourself, you are removing your dependency on external providers for secure and direct connection. You also do not expose your public keys to the browser.
  3. 3.
    You can self-verify transactions. You have part or all of the blockchain running on your node, so you can query the chain for transactions directly (and as often as you want) rather than relying on a user interface like a block explorer. Your queries can be more specific and efficient, giving you only the information that you need, for example, ‘how many transactions did addresses X, Y and Z send during this time period on each day for the last 30 days?’
  4. 4.
    You are not subject to rate limits. Infura (and therefore MetaMask, as it implements Infura to connect to the blockchain) does have rate limits for JSON RPC requests. If your development requires a lot of requests to the blockchain, running a local node may be more efficient.

Alternatives to Running a Local Node

Running a local node is not necessary to use applications that run on the blockchain or transfer tokens.
To use applications deployed on the Energy Web Chain, or to transfer tokens, you can connect to the blockchain through MetaMask using a remote RPC. You can see guidance for doing that on the Volta Test Network and the Energy Web Main Network here.

Run a local node using the command line

  1. 2.
    Download and save the chain config to your local machine. The chain config for Volta Test Network is here. The chain config for Energy Web Main Network is here.
  2. 3.
    Run the following command in your terminal. Provide the path to the chain config that you want to use. The following command references the Volta chain config.
parity --chain /path/to/chainconfig/volta.json
Your local node should start:
2021-09-21 09:54:03 Starting Parity-Ethereum/v2.7.2-stable-d961010f63-20200205/x86_64-apple-darwin/rustc1.41.0
2021-09-21 09:54:03 Keys path /Users/whitneypurdum/Library/Application Support/io.parity.ethereum/keys/Volta
2021-09-21 09:54:03 DB path /Users/whitneypurdum/Library/Application Support/io.parity.ethereum/chains/Volta/db/d94a0a739a3e416a
2021-09-21 09:54:03 State DB configuration: fast
2021-09-21 09:54:03 Operating mode: active
2021-09-21 09:54:03 Not preparing block; cannot sign.
2021-09-21 09:54:03 Configured for Volta using AuthorityRound engine
2021-09-21 09:54:04 NAT mapped to external address
2021-09-21 09:54:04 Public node URL: enode://a29dd8b0d114e099a7b1ef8045fbbeac632539001ac9d4350b024f9a3f189ee9a[email protected]
2021-09-21 09:54:05 Not preparing block; cannot sign.
2021-09-21 09:54:18 Snapshot initializing (7/2085 chunks restored, 0%) #0 4/25 peers 920 bytes chain 216 KiB db 0 bytes queue 5 KiB sync RPC: 0 conn, 0 req/s, 0 µs
2021-09-21 09:54:23 Snapshot initializing (21/2085 chunks restored, 1%) #0 5/25 peers 920 bytes chain 216 KiB db 0 bytes queue 5 KiB sync RPC: 0 conn, 0 req/s, 0 µs

Connect your local node to MetaMask

Connect your MetaMask to the Volta Test Network or Energy Web Chain via remote RPC. You can read how to do this here.
Get the URL of your MetaMask account. You can do this by clicking the settings dropdown and selecting "Expand View."
When the view is expanded, copy the URL in the browser
Run the following command in your terminal
parity --chain path/to/chainconfig/volta.json --jsonrpc-cors METAMASK URL

Run a local node using Docker

This section describes minimal setup to run an RPC node locally or on the server using Docker container run with docker-compose. This is solely for development purposes, it's not a production grade recommendation.
See OpenEthereum documentation for Docker:
OpenEthereum Documentation - Docker


Hardware Requirements

You need to meet OpenEthereum hardware requirements and have enough disk space to store database snapshots (which will grow in time).
OpenEthereum - EthHub
  • Multi-core CPU
  • 4GB RAM
  • SSD drive and at least 150GB free space
  • A decent DSL connection is required

Set up

  1. 1.
    Verify that prerequisites are installed:
docker --version
docker-compose --version
curl --version
2. Create working directory
mkdir openethereum
cd openethereum
mkdir -p chain-data/chains
3. Create docker-compose.yaml file
cat > docker-compose.yaml << 'EOF'
version: '3.8'
image: openethereum/openethereum:v3.3.0-rc.11
restart: always
- 8545:8545
- 8546:8546
- 30303:30303
- 30303:30303/udp
--jsonrpc-interface all --chain /config/chainspec.json
# Uncomment this if connecting local node to MetaMask
# --jsonrpc-cors chrome-extension://URL-OF-METAMASK
- ./chain-data:/home/openethereum/.local/share/io.parity.ethereum/
- ./chainspec-volta.json:/config/chainspec.json:ro
# chainspec file should be changed if using EWC
# - ./chainspec-ewc.json:/config/chainspec.json:ro
Full specification for configuration options can be found here:
OpenEthereum Documentation - Configuring OpenEthereum
4. Download the chainspec file. Note that there are different chainspec files for the Volta Testnet and the Energy Web production chain:
GitHub - energywebfoundation/ewf-chainspec: EWF official chainspec repository
Volta Testnet chainspec:
curl -L -o chainspec-volta.json
Energy Web Chain (production) chainspec:
curl -L -o chainspec-ewc.json
5. Download database snapshot - this takes some time and requires resources due to the size of the .tar file, but it will speed up synchronization process.
*Note that this step is optional. If you do not download the database snapshot, move to Step 7.
Volta (depending on your internet connection ~1 hour download time for us):
curl -L -C - -o ./chain-data/chains/volta.tar
Energy Web Chain (production) (30 minutes download time for us):
curl -L -C - -o ./chain-data/chains/energywebchain.tar
6. Unpack database snapshot.
*Note that this step is optional. If you did not complete Step 5, skip this step and move to Step 7.
sudo tar -xvf ./chain-data/chains/volta.tar -C ./chain-data/chains
Energy Web Chain (production):
curl -L -C - -o ./chain-data/chains/energywebchain.tar
7. Set permissions:
sudo chmod -R 777 chain-data
8. Start container:
docker-compose up -d
9. Examine logs:
docker-compose logs --tail 20 openethereum
The log output should be similar to the following (sometimes the logging output does not appear immediately, wait some time):
openethereum_1 | 2021-11-03 15:26:22 UTC Starting OpenEthereum/v3.3.0-rc.11-stable/x86_64-linux-musl/rustc1.47.0
openethereum_1 | 2021-11-03 15:26:22 UTC Keys path /home/openethereum/.local/share/io.parity.ethereum/keys/Volta
openethereum_1 | 2021-11-03 15:26:22 UTC DB path /home/openethereum/.local/share/io.parity.ethereum/chains/Volta/db/d94a0a739a3e416a
openethereum_1 | 2021-11-03 15:26:22 UTC State DB configuration: fast
openethereum_1 | 2021-11-03 15:26:22 UTC Operating mode: active
openethereum_1 | 2021-11-03 15:26:22 UTC Not preparing block; cannot sign.
openethereum_1 | 2021-11-03 15:26:27 UTC Configured for Volta using AuthorityRound engine
openethereum_1 | 2021-11-03 15:26:32 UTC Error reading node table file: Error("EOF while parsing a value", line: 136, column: 13)
openethereum_1 | 2021-11-03 15:26:32 UTC Listening for new connections on
openethereum_1 | 2021-11-03 15:26:35 UTC Not preparing block; cannot sign.
openethereum_1 | 2021-11-03 15:26:37 UTC Public node URL: enode://fd35fd56944ed2150d019ab7f9c42e48c7dce5409af0c57b3f295fd083c04492c[email protected]172.
10. After some, you will sync with the network. Until a full sync, you will see be in a "syncing" state:
12021-11-03 15:33:42 UTC Syncing #14332274 0x2b0d...23c2 0.00 blk/s 0.0 tx/s 0.0 Mgas/s 0+ 0 Qed LI:#14332276 1/25 peers 72 KiB chain 0 bytes queue RPC: 0 conn, 0 req/s, 87 µs
11. Check the database synchronization status in the command line using OpenEthereum's 'eth-syncing' module:
OpenEthereum Documentation - The `eth` Module
curl --data '{"method":"eth_syncing","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
The output will show current synchronization status:
It will take some time to fully sync with the current state of the blockchain. When the synchronization is finished status will be:

Additional Resources