Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Light client fails to connect private network #3789

Closed
sumanxp opened this issue Mar 17, 2017 · 20 comments
Closed

Android Light client fails to connect private network #3789

sumanxp opened this issue Mar 17, 2017 · 20 comments
Assignees

Comments

@sumanxp
Copy link

sumanxp commented Mar 17, 2017

System information

Geth version: geth 1.5.8
OS & Version: Android
Commit hash : (if develop)

Expected behaviour

Android light client should connect private network

Actual behaviour

Not able to connect private network

Steps to reproduce the behaviour

STEP 1: Set-up one private network and run one node as light server passing "--lightserv 25 --lightpeers 3" in geth as ETHEREUM OPTIONS
genesis I tried with
a)

{
    "nonce": "0x0000000000000042",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0x400",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "alloc": {
    }
}

b)

{
    "config": {
        "chainId": 7,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 10,
        "eip158Block": 10,
        "eip160Block": 10
    }
}
geth --datadir lightserver init genesis.json
geth --datadir lightserver --networkid 999 --port 31113 --identity lightnode --lightserv 25 --lightpeers 10 --verbosity 6 --rpc --rpcapi "eth,web3,net,admin" --rpcport 8545 --rpcaddr "0.0.0.0" --rpccorsdomain "*" --nodiscover console

STEP2: Configure the Android App to connect private network

        NodeConfig config = new NodeConfig();
        Enodes nodes = new Enodes(1);
        nodes.set(0, Geth.newEnode("<enode of the lightserver>"));
        config.setBootstrapNodes(nodes);
        config.setEthereumGenesis("<same genesis used in private network>");
        ChainConfig chainConfig = new ChainConfig();
        chainConfig.setEIP155Block(10);
        chainConfig.setEIP158Block(10);
        chainConfig.setChainID(PRIVATE_NETWORK_ID);//999
        config.setEthereumChainConfig(chainConfig);
        config.setEthereumNetworkID(PRIVATE_NETWORK_ID);//999
        config.setMaxPeers(25);

Backtrace

[backtrace]
@fjl
Copy link
Contributor

fjl commented Mar 18, 2017

@zsfelfoldi Please look into this when you have time. It should be reproducible without a phone.

@sumanxp
Copy link
Author

sumanxp commented Mar 29, 2017

@zsfelfoldi Did you get any chance to look into it?

@berlinerwander
Copy link

Hello @zsfelfoldi @fjl are you that busy that you cannot reply to us? I am researching the same thing and i found the same bug! How long is the default timeout, why is it so low

@berlinerwander
Copy link

@karalabe will your latest geth 1.6 resolve this issue?

@berlinerwander
Copy link

@sumanxp please try **upgrading to geth 1.6 and the config checklist is followed below #3510

-disabling topic discovery (--nodiscover) on both sides (light client and main node)
-add the main node manually with admin.addPeer('enode://...') on the light client side.
-both sides had the same genesis block.

@sekharkumarroy
Copy link

@berlinerwander Issue is between Andriod light client with a light server. CLI version works well even in earlier releases(e.g 1.5.9). Are you experimenting with Android light client ?

@berlinerwander
Copy link

@sekharkumarroy Yes experimenting. I just wanted to check there are no breaks when geth goes to 1.6 anyway

In #3510 you said '...facing challenges when connecting from an android device to a private light server using the android package (geth.aar). I'm doing experiment in an internet facing AWS server and all the required ports open. .'

What is the result of your experiment?

Does the problem lie within the design constraints https://blog.ethereum.org/2017/01/07/introduction-light-client-dapp-developers/

@gmerlino
Copy link

gmerlino commented Jun 1, 2017

Hello, we are trying to have a working Android light client node connecting to a private chain, but the problem is we cannot find a way to "add a peer" (no addPeer method available), in order to add the light server from the client (Android) side.

We are looking for that, as it seems this is the only way to do it (also when we try it out on test containers): the bootnodes switch seems to be useless (ignored).

@treste91
Copy link

Same problem here! I can connect to 'ropsten' but not to private network lightserver!
Any help would be appreciated..

@nmanchov
Copy link

Any update on this one? Has anyone found a solution for this issue? I can see only ping messages in the log and it never trigers a sync.

@jellelicht
Copy link

We are also having the same issue, any idea how to debug this issue?

@kelsos
Copy link

kelsos commented Jul 25, 2017

@gmerlino You can supply a static-nodes.json on the android client this will work the same way as the addPeer method.

If you your data directory in android is something like "$filesDir/.ethereum" then the static-nodes.json must be under the $filesDir/.ethereum/GethDroid/static-nodes.json in order to get picked. I had some issues syncing with the Android with Ropsten and after adding the static-nodes.json with the peers it started syncing properly.

I didn't actually test with a private network but I don't see why it should not work

@DHOscar
Copy link

DHOscar commented Aug 13, 2017

@kelsos I am working on the iOS framework right now. Does your suggestion also work on iOS side?
As so far I could not find any methods related to static-nodes.json.

@kelsos
Copy link

kelsos commented Aug 16, 2017

@DHOscar I am not sure how the iOS counterpart works to be honest. There should not be any methods related. Since the mobile frameworks don't support the addPeer method, adding the static-nodes.json can be used as an alternative approach to supply the list of peers. You should check where the internal structure of the files and find where the GethDroid equivalent folder is in iOS.

@DHOscar
Copy link

DHOscar commented Aug 17, 2017

@kelsos Thx for the reply. Yes indeed as you said. I already checked file structure and there is a folder call iGeth which should be similar like GethDroid. The full path is $filesDir/ethereum/iGeth

@cat-cat
Copy link

cat-cat commented Jan 5, 2018

Was the problem solved? iOS and Android both cannot sync with the private blockchain. Checked with geth mobile 1.7.3

@cat-cat
Copy link

cat-cat commented Jan 9, 2018

still doesn't sync with geth mobile libraries 1.8.0

@stale
Copy link

stale bot commented Jan 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@ligi
Copy link
Member

ligi commented Feb 28, 2019

OK will look into the issue.
I synced public chains with android with no problem.
Never used it with private chains and have to start quoting Bruce Schneier:

Private blockchains are completely uninteresting.

https://www.schneier.com/blog/archives/2019/02/blockchain_and_.html

That said - it should still work. Looking in the initial issue I see chainID 7 in the genesis and chainID 999 in the command line parameters.
If others face the same problem - the following things help:

  • full private chain configuration/setup including full genesis file
  • log output with high verbosity

@ligi
Copy link
Member

ligi commented Apr 2, 2019

closing for now - please reopen when you have a problem like this and then please submit your config and log

@ligi ligi closed this as completed Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests