Skip to content

Connecting to private network

Stan Reshetnyk edited this page Jan 24, 2017 · 8 revisions

Supposing we need to connect Harmony to network named jungle.

Add network specific genesis file

You must have genesis file let's call it: jungle.json The file will contain all the information about the concrete blockchain genesis block, check the example of genesis file for the live Ethereum network : frontier.json

Add network specific config file

Create config file jungle.conf with content:

# Peer discovery is supposed to be disabled
peer.discovery.enabled = false

# List of nodes the peer should connect to
peer.active = [
    {
       ip = hostname1.com
       port = 30303
       nodeId = e437a4836b77ad9d777...234542e21b95aa8c3489
    },  
    {
        ip = hostname2.com
        port = 30303
        nodeId = 4567a4836b77ad9d9ff...0d8542e21b95aa8c5e6c
    }
]

# Network id
peer.networkId = 777

# Network genesis file
# No need to change it because we will use -DgenesisFile
genesis = jungle.json

# Consensus algorithm 
blockchain.config.name = null
blockchain.config.class = "org.ethereum.config.blockchain.FrontierConfig"

Be sure to change options highlighted with bold to your network specific values

If the private network is running with the Frontier consensus algorithm use the config as written above.
For Homestead network use the class org.ethereum.config.blockchain.HomesteadConfig If some algorithm constants or algorithms are different then the custom class (analogous to org.ethereum.config.blockchain.FrontierConfig) should be created.

Running

  1. Get sources via:

git clone [email protected]:ether-camp/ethereum-harmony.git

cd ethereum-harmony

  1. Launch Harmony with
gradlew bootRun -Dethereumj.conf.file=PATH_TO/jungle.conf -DgenesisFile=PATH_TO/jungle.json

By default, Harmony will keep database at user home location at ~/ethereumj/database. To change that location you need to run with:

-Ddatabase.dir=PATH_TO_DATABASE

Default ports are:

  • 30303 for peer. Use -Dpeer.listen.port=33333 to change
  • 8080 for web interface and JSON RPC. Use -Dserver.port=8888 to change

References

Full ethereumj config file sample with description: https://github.com/ethereum/ethereumj/blob/develop/ethereumj-core/src/main/resources/ethereumj.conf