1

I am trying to connect geth to a private blockchain running parity nodes and I don't know how. Some of my research leads me to this page: how to connect "Kovan" or "Rinkeby" from geth

They mention the "--chain" option. But I don't see that option here: https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options

Can anyone tell me what --chain is? Can anyone tell me if that is the same as the genesis file?

Thank you.

Alan Buxton
  • 660
  • 4
  • 12
stone.212
  • 1,994
  • 1
  • 19
  • 38
  • Kovan and Rinkeby are public test network, not private ones. Concentrate opinions and suggestions to your real question (https://ethereum.stackexchange.com/questions/16866/geth-not-connecting-to-private-network) and close this one. – Giuseppe Bertone Aug 30 '17 at 11:09
  • I know that they are public test networks. That does not change anything. And thank you for the suggestion but I think it is always better to break questions down into little pieces. Especially since my main question has not been answered, perhaps because it has too many pieces in it. – stone.212 Sep 01 '17 at 05:54

2 Answers2

1

There is no --chain option for geth. You can build geth and start it at private blockchain, as follows:

  1. Install go

  2. Clone go-ethereum project by git clone https://github.com/ethereum/go-ethereum.git

  3. Rebuild all commands by make all. For example geth
  4. Test whether everything is ok. ./build/bin/geth --datadir=./dev/data0 --networkid 2 console. At first you should create directory ./dev/data0 to save chain data. If Ok, now you have entered geth console on private blockchain.

If you want to use genesis.json custom some properties, as follows:

1: create a simple genesis.json file

{
    "config": {
        "chainId": 10,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "0x400",
    "gasLimit": "2100000",
    "alloc": {
        "e2e7f3b19889d7a3ada2afaf80b6e4e2b2f8fd35": { "balance": "30000000000000000000000" }
    }
}

2: then execute geth init command:

build/bin/geth --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "./dev/data0" --port "30303" --nodiscover --rpcapi "db,eth,net,web3"
--networkid 1 init ./dev/genesis.json

Hope it helps~

BinGoBinBin
  • 2,161
  • 13
  • 17
  • Um thank you for trying but no it doesn't help. It doesn't relate to my question at all. I have already installed geth, written the custom genesis file, and init-ed it. the problem is that when I run geth with it, geth does not connect to my private blockchain that is running Parity nodes. – stone.212 Aug 30 '17 at 09:15
  • I'm so sorry for misunderstand your question. You can connect parity node using geth as follows, 1 : execute command parity --geth --config node0.toml on terminal 2 : execute command geth attach on other. If this terminal contains Welcome to the Geth JavaScript console! instance: Parity//v1.6.10-stable-1a5b176-20170721/x86_64-macos/rustc1.18.0 , it's success. image – BinGoBinBin Aug 30 '17 at 09:41
  • His real problem is this one https://ethereum.stackexchange.com/questions/16866/geth-not-connecting-to-private-network – Giuseppe Bertone Aug 30 '17 at 11:11
  • @BinGoBinBin I am not trying to connect to the ipc of a geth instance with parity. I am trying to connect a geth node to a private network. – stone.212 Sep 01 '17 at 05:55
-1

Edited answer as questioner wants to connect to parity nodes.

Maybe this is more useful for you? Is "networkID" hex or decimal?

Alan Buxton
  • 660
  • 4
  • 12
  • These links are not related to my question. I am asking how to connect a geth node to a private blockchain of Parity nodes. Not how to create a network of many geth nodes. – stone.212 Aug 30 '17 at 09:16
  • Hi @stone.212 Apologies for misunderstanding as your question did not mention Parity. Edited answer to reflect that you are looking to connect to parity nodes – Alan Buxton Aug 30 '17 at 09:23
  • @Alan_Buxton I am not trying to connect to parity noes. I am looking to connect to a private blockchain that happens to be running on parity nodes. There is a big difference. – stone.212 Sep 01 '17 at 05:55