8

I'm writing a chat app on top of Whisper; the app is supposed to manage the lifecycle of the Ethereum node.

One way to build to is to use wnode in the background & communicate with it using stdout/stdin programmatically. However, I prefer to use the web3.shh API so I need an Ethereum/Whisper client that provides the RPC interface beside Whisper stuff.

geth seems to fit. However, it seems to, by default, start blockchain stuff & other stuff while I only need it for Whisper. So:

1- How to start geth such that it provides absolutely zero blockchain stuff & only whisper stuff (+rpc)?

2- How to get it to be a bootstrap node for whisper & retrieve its enode url?

3- How to configure it to use other bootstrap nodes? Is the --bootnodes flag used for whisper?

Basically, I want to be able to do what's in the example here but using geth, with no unnecessary overhead:

> wnode -standalone -forwarder -ip=127.0.0.1:30379
my public key: 0x040ef7acd60781c336c52056b3782f7eae45be2063e591ac6b78472dc27ba770010bde445ffd2f3623ad656f3859e00d11ef518df4916c4d4e258c60b15f34c682 enode://15454fc65bbf0031155f4eee83fa732f1454c314e9f78ade9cba4d4a098d29edbf5431764ee65b200169025c3f900cacc3348a000dda7a8a0d9643d0b7618712@127.0.0.1:30379
Bootstrap Whisper node started

... Then, in another tab:

> wnode -test -boot=enode://15454fc65bbf0031155f4eee83fa732f1454c314e9f78ade9cba4d4a098d29edbf5431764ee65b200169025c3f900cacc3348a000dda7a8a0d9643d0b7618712@127.0.0.1:30379
............................
Whisper node started
Connected to peer.
............................

Update

I haven't tried the accepted answer myself but I confirmed from the author that he/she tried it and the solution seems to be meeting all the requirements.

  • You can start geth --light and add --nodiscover tag, in this case you will have minimal client useful for ssh transporting. – Baracuda May 9 at 19:23
1

Running Status's go server (in a docker image) will do what you want: no blockchain syncing, plus an exposed HTTP API interface that meets the JSONRPC standard.

Following these instructions worked for me: https://status.im/technical/run_status_node.html

Namely

docker run --rm \
    -p 8545:8545 \
    -v $(pwd)/http-enabled.json:/config/config.json \
    statusteam/status-go:0.16.0 \
    -register \
    -log DEBUG \
    -c /config/config.json

Then test it with calls like

curl -X POST "http://localhost:8545" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"shh_newKeyPair","params":[],"id":1}' 

Archive (Geth only)

My old answer, for completeness. You can run geth with only the whisper shh module enabled and syncmode=light. This doesn't exactly do what you wanted (it still syncs the blockchain) but is more lightweight / faster than running a full node, and more secure than giving access to the other API modules that you don't need or want to expose.

You can start with flags like this

geth --rinkeby --syncmode=light --rpcaddr=0.0.0.0 --shh --rpcapi=shh --rpc --rpcport 8547

There's no technical difference between mainnet and rinkeby messages, since whisper messages are ephemeral and not secured on-chain, but mainnet whisper messages won't get exchanged with rinkeby peers and vice versa.

  • 1
    Thank you. Unfortunately, I haven't used geth for so long that I don't remember the question and that setting up to try out your suggestions would be costly. I also won't be able to mark as accepted in case it was not. If you have tried it and are sure it's correct, please tell me to mark it as accepted to guide future visitors. – Hossam El-Deen Sep 29 at 10:11
  • 1
    Thanks for a response, I see you originally posted over a year ago (yikes). I found that the status-go server meets all of your requirements and just tried it out a few minutes ago. The few RPC methods I tried work fine. – Paul Pham Sep 30 at 0:13

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.