[Ethereum] how to connect ethereumj with private node

configurationethereumjprivate-blockchain

I want to create a private blockchain network using EthereumJ and connect it to a project implementing EthereumJ. I tried modifying ethereumj.conf file but thats not working. How to do it?

Best Answer

Here is some sample code to connect ethereumj to a testnet from github - ethereumj-core/.../samples/TestNetSample.java:

    private final String config =
            // network has no discovery, peers are connected directly
            "peer.discovery.enabled = false \n" +
            // set port to 0 to disable accident inbound connections
            "peer.listen.port = 0 \n" +
            "peer.networkId = 161 \n" +
            // a number of public peers for this network (not all of then may be functioning)
            "peer.active = [" +
            "    { url = 'enode://9bcff30ea776ebd28a9424d0ac7aa500d372f918445788f45a807d83186bd52c4c0afaf504d77e2077e5a99f1f264f75f8738646c1ac3673ccc652b65565c3bb@peer-1.ether.camp:30303' }," +
            "    { url = 'enode://c2b35ed63f5d79c7f160d05c54dd60b3ba32d455dbb10a5fe6fde44854073db02f9a538423a63a480126c74c7f650d77066ae446258e3d00388401d419b99f88@peer-2.ether.camp:30303' }," +
            "    { url = 'enode://8246787f8d57662b850b354f0b526251eafee1f077fc709460dc8788fa640a597e49ffc727580f3ebbbc5eacb34436a66ea40415fab9d73563481666090a6cf0@peer-3.ether.camp:30303' }" +
            "] \n" +
            "sync.enabled = true \n" +
            // special genesis for this test network
            "genesis = frontier-test.json \n" +
            "database.dir = testnetSampleDb \n" +
            "cache.flush.memory = 0";

Search this site for the parameters to set up a private network and adjust the config parameters in the example above.

Related Topic