How To Setup An Ethereum Private Node


Back


Join over 115,115 Members
Angel Investors, Startups & Blockchain developers...
Yes, Get Access!
No Thanks!

This is a discussion on setting up your own Ethereum Private Node. A private node is very handy for testing configuration options, smart contract code and in general playing around with blockchain environment.

Ethereum is currently the most popular blockchain platform for cryptocurrency and distributed ledger logic use cases in various domains.

How To Setup An Ethereum Private Node

This is tested on the following OS, but the steps are equally valid for MacOS and Windows To Setup An Ethereum Private Node

Platform: Ubuntu 64 Bit 16.04/16.10. (4 Gig Memory, Intel 2 Ghz)

Node software: Parity 1.5.9

Although the most popular Ethereum node software is their Go client (Geth), but Parity client, developed on Rust language allows for extra configurations mode for running an Ethereum instance. You can download Parity for our platform from Parity.io

For Ubuntu OS, the download is a debian package that can be installed from the software center on a double click. On install it should be available as an environment command:

G50-70:~$parity -v

(this will print out all config parameter information.)

Parity uses the toml file to configure the process when parity starts off. There is an out of the box parameter set that runs parity Ethereum node in development mode.

G50-70:~$parity — chain dev

This will start off the Ethereum dev node on your machine with regular default parameters. It’s possible to customize the parameters using a toml (toml language) file. The default toml file on the ethcore github page is obsolete, we would need to comment out a bunch of parameters.

You can copy the file from here.

 

The basic parameters are

chain = "dev"

base_path = "/path/to/empty/directory"

db_path = "/path/to/empty/directory"

keys_path = "//path/to/secure/directory"

identity = ""

#light = false

[account]

unlock = ["<new account created>"]

password = ["/pathsafe/password.file"]

With these parameters, the blockchain will be created in the base_path during processing.

The node can be started with the customized toml. (Assuming its in the same path)

G50-70:~$parity — config dev.toml

where dev.toml is the parameter file placed in the same directory.

The analysis of individual parameters with defaults is listed here: parity toml

You can also use the config generator tool to generate this file. Parity instance can also be customized with of command line parameters with identical names as toml parameters.

Chain Specs:

Running a local instance is a choice we have made, we could alternately connect to mainnet (default) or testnet (public testing environment). These choices and a couple of other parameters from the chain specifications.

An important choice to make as a chain spec is what is the confirmation mode. Parity offers multiple modes using the “engine” spec to configure a Proof Of Work or Proof Of Authority chain. We will go into the engine parameter in later sections. For now, important chain specs are named. params, genesis, accounts.

The name is any phrase that you want to give to your chain, params hold some max values, genesis has some genesis phase offsets. The accounts hold the specific account config that the chain starts off with. You will create an account in the following section. In the account parameter, you can add the starting ether balance you want to give to your account with account specific configuration.

A tool to generate chain specs can be found here. The file used for this demo can be

viewed from here.

Create account:

Before starting the chain, we need to create an account that forms our coinbase. In case we start to mine on production, this account will receive the ether rewards.

G50-70:~$parity account new — chain chain_spec.json — keys-path dev_chain/signer

The chain_spec.json is the chain spec file and dev_chain/signer is the path to your private keys, refer to these in the toml file. You will be prompted for a password, once you type it, you will receive a newly created account.

Once the account is created add it to the chain_spec file in the accounts element. add this :

"faa6848230f35ea54e38b089699d9532f004865b": { "balance":

"1606938044258990275541962092341162602522202993782792835301376" })

replace “faa…” with your account minus the 0x.

You need to also replace the following parameters in your toml file:

unlock = ["faa6848230f35ea54e38b089699d9532f004865b"]

password = ["safe/password.file"]

(replace “faa with your account and create a file password.file in a directory “safe” with the

account password.)

Once you have the account properly configured, you can run the instance:

parity — config dev.toml — chain chain_spec.json ui

You should see the following output:

2017-04- 20 22:57:39 main INFO parity::run Starting Parity/v1.5.3-beta- 82e33fa-20170220/x86_64- linux-

gnu/rustc1.15.1

2017-04- 20 22:57:39 main INFO parity::run State DB configuration: fast

2017-04- 20 22:57:39 main INFO parity::run Operating mode: active

2017-04- 20 22:57:39 main INFO ethcore::service Configured for DevelopmentChain using InstantSeal

engine

2017-04- 20 22:57:40 hyper-client INFO miner Updated conversion rate to Ξ1 = US$48.05 (2477578000

wei/gas)

2017-04- 20 22:57:40 IO Worker #3 INFO ethcore_network::host NAT mapped to external address

172.30.0.82:43801

2017-04- 20 22:57:40 IO Worker #3 INFO network Public node URL:

enode://f4af9bd554ac11acc2341e7b3fc013590cf9a0545b41e7d440d7beefebd7551d8cdb685d32f7eeae02a

95465bb97a438563fc32f90a64f5a95bf6fe974b4c661@172.30.0.82:43801+639762017-04- 20 23:01:08 IO

Worker #1 INFO import Syncing #0 48d7…8e3e 0 blk/s 0 tx/s 0 Mgas/s 0+ 0 Qed #0

0/ 0/25 peers 7 KiB db 7 KiB chain 0 bytes queue 448 bytes sync

2017-04- 20 23:01:13 IO Worker #2 INFO import Syncing #0 48d7…8e3e 0 blk/s 0 tx/s 0 Mgas/s

0+ 0 Qed #0 0/ 0/25 peers 7 KiB db 7 KiB chain 0 bytes queue 448 bytes sync

Now your chain has started. This chain is configured to use InstancSeal engine so you don’t create extra blocks when there are no transactions.

You can load the wallet here

This wallet UI should automatically launch if your default browser is configured): http://127.0.0.1:8180/#/accounts/

You can confirm the JSON RPC here http://localhost:8545/

(This will show you something like HTTP is not allowed error – but that is expected)

The next steps are to create smart contract on this instance and test it using an web3.js html test harness.

Join over 115,115 Members
Angel Investors, Startups & Blockchain developers...
Yes, Get Access!
No Thanks!