I'm trying to implement my own version of a SmartContract-driven Discover protocol and in order to get it fully working, I want to remove the admin.addPeer() command from the console.

I know there's a way to add my own custom commands as said in here but I haven't been able to find a way to remove a command.

Even though I am confident programming in Go, I'm not so experienced in JS.

  • One way to do it, is to completely turn off the admin interface (i.e. you have to specify exactly which kind of interface you would like your client is supporting). I don't know whether it is possible to turn off single commands inside an interface :/ Maybe to do this, you have to re-compile geth from scratch – Briomkez Sep 13 '18 at 18:03
  • @Briomkez That would be just perfect but I don't know how to disable a module in the console. I'm actually re-compiling gets all the time. – Javier Sagredo Sep 13 '18 at 18:32

I came up with only two solutions:

  1. Disable entirely the admin api
  2. Disable only the selected api entry (admin.addPeer). To do so, you have to modify the source code of geth to eliminate the admin.addPeer from the admin api and recompile geth from scratch.
  3. Remove entirely the admin interface from the source code (?)

I think that the most viable way is to use possibility 1. Essentially, when you are using the console you have three possibilities to communicate with a running node:

IPC - Interprocess-comunication

In this case (at least version 1.8.10-stable-eae63c51) you cannot disable the admin interface (although https://github.com/ethereum/go-ethereum/wiki/Management-APIs the --ipcapi is reported).

RPC - Remote Procedure-Call

In this case, you can specify exactly which interface your node will support.

geth --ipcdisable --rpc --rpcapi "eth,web3"

and then you can connect with another terminal with the command:

geth attach http://localhost:8545

WS - Websocket

geth --ipcdisable --ws --wsapi "eth,web3"

and then you can connect from another terminal with the following command

geth attach ws://
| improve this answer | |
  • Eventhough this virtually has the desired behavior, I'd prefer that no-one is able to use the admin module. With this option that you are considering, someone could put his node down and restart it with the admin api enabled. A more precise solution shall be to remove entirely from the code but I'm not quite sure where is it declared and used. – Javier Sagredo Sep 14 '18 at 7:27
  • With ipc you can send commands only if you are executing in the same machine (so only you can access to the api) with rpc and ws you can disable the admin interface and also restrict the ip from which you accept commands (with the option rpccorsdomain)... – Briomkez Sep 14 '18 at 12:14

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.