3

I want to start a private node of go-ethereum on android-studio. I have tried this to start a private node but I am getting the error geth not running:

https://github.com/karalabe/geth-sandbox/tree/master/android_sync/DroidGeth

2

Are you using the newest Geth version (1.6.0) for Android? If not you can add it to your build.gradle with: compile 'org.ethereum:geth:1.6.0'

Because this example application (DroidGeth) is probably not up to date. At the moment there are not a lot of up to date tutorials so I think it will be much easier for you to use the newest Geth version, because then you can use the new API.

With the newest version you should be able to set up a private net with the Geth Node and NodeConfig class. Your code would look similar to this one:

    NodeConfig nodeConfig = new NodeConfig();
    nodeConfig.setEthereumNetworkID(3); //Your Private Network-ID
    nodeConfig.setWhisperEnabled(true); // Your Node Settings
    nodeConfig.setEthereumEnabled(true);
    String genesis = Geth.testnetGenesis(); // Your Genesis File
    nodeConfig.setEthereumGenesis(genesis);
    Node node = Geth.newNode(getFilesDir() + "/.ropsten1", nodeConfig ); //Your Datadirectory
    node.start(); // Check Android Logs if node starts correctly
| improve this answer | |
  • Is there any additional dependencies that i need to add on android studio to start a new node. – error_terror Apr 2 '17 at 13:31
  • To start a node it's enough to add the geth library to your build.gradle and then import it in the class file. – Tom Apr 3 '17 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.