There doesn't seem to be much documentation for the mobile Ethereum libraries yet, at least that I could find.

I know they are still in development, but is there any way to set the Genesis file within the mobile libraries yet? More specifically in the Android library?

(additionally if there is any useful documentation of the mobile libraries a link would be greatly appreciated, as I cant find any!)


After a bit of digging I found this in the source code under /mobile/geth.go

When creating the NodeConfig for your Geth.newNode, you can specify any of the configurations for the client you need. When generating the Go to Java binding, gomobile by default turn structs into classes and generates generic setters and getters. Thus, NodeConfig's EthereumGenesis can be set using NodeConfig.setEthereumGenesis(String str)

Specifically, the struct for NodeConfig is layed out like this in Go:

// NodeConfig represents the collection of configuration values to fine tune the Geth
// node embedded into a mobile process. The available values are a subset of the
// entire API provided by go-ethereum to reduce the maintenance surface and dev
// complexity.
type NodeConfig struct {

// Bootstrap nodes used to establish connectivity with the rest of the network.
    BootstrapNodes *Enodes

// MaxPeers is the maximum number of peers that can be connected. If this is
// set to zero, then only the configured static and trusted peers can connect.
    MaxPeers int

// EthereumEnabled specifies whether the node should run the Ethereum protocol.
    EthereumEnabled bool

// EthereumNetworkID is the network identifier used by the Ethereum protocol to
// decide if remote peers should be accepted or not.
    EthereumNetworkID int

// EthereumChainConfig is the default parameters of the blockchain to use. If no
// configuration is specified, it defaults to the main network.
    EthereumChainConfig *ChainConfig

// EthereumGenesis is the genesis JSON to use to seed the blockchain with. An
// empty genesis state is equivalent to using the mainnet's state.
    EthereumGenesis string

// EthereumDatabaseCache is the system memory in MB to allocate for database caching.
// A minimum of 16MB is always reserved.
    EthereumDatabaseCache int

// EthereumNetStats is a netstats connection string to use to report various
// chain, transaction and node stats to a monitoring server.
// It has the form "nodename:secret@host:port"
    EthereumNetStats string

// WhisperEnabled specifies whether the node should run the Whisper protocol.
    WhisperEnabled bool
| improve this answer | |

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.