1

I have a blockchain based on Ethereum, I will call it my testnet for now and I have a few nodes running and mining. All seems well so far, I am currently starting geth with several parameters

If I use this examples with different values,

geth --identity "MyNodeName" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "C:\chains\TestChain1" --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1999 init /path/to/CustomGenesis.json

I want the users of my geth to not have to type all these parameters in at the command line & I would also like to package my version of geth with my version of Mist. Infact I would rather not have the --nodiscover parameter there and let it find the other peers without the manual admin.addPeer("") being used.

Is there any example of this being done, if not can anyone point me to where I would embed these parameter values in the code so I can update the codebase and build a release.

  • I did everything you want for my private net, but it requires you to modify the sources. I think in about a month you will understand how Ethereum works and will be able to move parameters as you wish. I can do it for you for a fee, my contact is in my profile , if interested. – Nulik Nov 29 '17 at 20:14
  • 1
    Thanks for your offer, I came here looking for answers not to be pitched for money. I am comfortable coding myself. – Lismore Nov 29 '17 at 22:36
2

I think the a better way to do this would be to package Geth with a wrapper/script, and have the script call Geth with the appropriate commands and flags. That way you can abstract away all the fiddly details from your users, while still allowing you in future to easily change the values in the script if you need to.

For the sake of experimentation (and because code == fun), if you did want to make your version of Geth a black box, and don't mind rebuiling and redistributing whenever you need to change any of your flags, there are a few ideas below.


Noting that there's a difference between Boot Nodes, Static Nodes, and Trusted Nodes, one thing you probably want to do is remove the hard-coded boot nodes from the Geth code. You can then either replace them with static addresses of nodes in your network, and build them in, or supply a static-nodes.json file with your version of Geth.

The hard-coded boot nodes you will want to remove/replace are in bootnodes.go. Once this is done you could probably then remove --nodiscover, though from previous discussions it appears that this won't protect against nodes outside your network from trying to connect into it. (That is, if your nodes have in the past joined any of the public networks, the public nodes will keep a record of your enode/IP address. See How to avoid collisions between Ethereum-like networks? for a potential solution to this. Not that this is a real problem - your private nodes will reject the incoming connections.)

If you want to hard-code the values of any of the flags, the easiest place to change the code is probably in flags.go, where the flags are parsed into the Go code.

  • Thanks Richard, that was the kind of answer I was looking. – Lismore Nov 30 '17 at 12:28

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.