2

I am currently experimenting with Geth on ios. I've imported Geth using cocoapods and trying to run the (light) node.

Config:

Geth version: 1.6.5 (but I have tried 1.6.1, 1.6.2, 1.6.3, 1.6.4 and 1.6.6-unstable)

OS & Version: OSX Sierra 10.12.5 / Xcode 8.3.2 (8E2002)

Language: Swift 3

Simply adding "import Geth" to my ViewController file crashes the LLBD RPC server on the simulator (or the app on a device). On the simulator it messes up the debugging tools of Xcode (break points, etc).

On the simulator the node seem to start but does not establish a connection with peers and does not synch.

The relevant code is as follows:

    let bootstrap = GethNewEnodes(2)
    do {
        try bootstrap?.set(0,enode: GethNewEnode("enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303", &error))
        try bootstrap?.set(1, enode: GethNewEnode("enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"
, &error))
    } catch let ee {
        print(ee.localizedDescription)
        }

    // configuration of the nodes
    let config = GethNewNodeConfig()
    config?.setEthereumGenesis(GethTestnetGenesis())
    config?.setEthereumNetworkID(3)
    config?.setBootstrapNodes(bootstrap)
    config?.setEthereumEnabled(true)
    config?.setMaxPeers(25)
    config?.setWhisperEnabled(false)

    // create new node
    node = GethNewNode(nodeDir.path, config, &error)

        do {
            try node?.start()
        } catch let err {
            print("error: \(err.localizedDescription)")
        }

The node logs are:

WARN [06-14|11:33:30] Failed to start Ledger hub, disabling: unsupported platform 
INFO [06-14|11:33:30] Starting peer-to-peer node               instance=iGeth/v1.6.6-unstable/darwin-amd64/go1.8.3
INFO [06-14|11:33:30] Allocated cache and file handles         database=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/Documents/ethereum/iGeth/lightchaindata cache=16 handles=16
INFO [06-14|11:33:30] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Metropolis: 9223372036854775807 Engine: ethash}"
INFO [06-14|11:33:30] Disk storage enabled for ethash caches   dir=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/Documents/ethereum/iGeth/ethash count=3
INFO [06-14|11:33:30] Disk storage enabled for ethash DAGs     dir=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/.ethash                         count=2
INFO [06-14|11:33:30] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576
INFO [06-14|11:33:30] Starting P2P networking 
WARN [06-14|11:33:30] Light client mode is an experimental feature 
INFO [06-14|11:33:30] RLPx listener up                         self="enode://d390f94b00eb9326089e903799607d4445472e0bb96fca4488c66a5dfeaa8b195b0681a3d867ad33c067303b29ee4296dee95e499dfe5a286dff1152328a2801@[::]:49771?discport=0"

Am I doing something wrong (in particular with the configuration of the node)?

Any help would be greatly appreciated.

  • i'm currently experiencing the same issue, did you have any news about this ? I'm using a private blockchain but, as you, i can't use LLBD RPC server and i can't start Ledger hub. The node is created but unreachable by my BKC nodes even with admin.addPeer() method. And not syncing too. My code is quite the same as yours. Did you check your emulator connection to network (ip, ports) ? – nperez Aug 8 '17 at 9:52
1

I fixed my issue by adding the --lightserv 90 flag when booting my private nodes (cause i'm using a private blockchain).

You should use the GethSetVerbosity(9) method to add so trace and debug in your xcode console. If you see a "useless peer" error it's because your server protocol doesn't match the node protocol. In my case I add only "les" protocol in my iOS node and only "eth" protocol in my private nodes.

However I don't know if you can specify a protocol on Rinkeby nodes.

I hope it will help you, good luck !

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.