Skip to content

Instantly share code, notes, and snippets.

@bas-vk
Created June 9, 2017 09:21
Show Gist options
  • Save bas-vk/645953908eb7b50ec64708a4989cb374 to your computer and use it in GitHub Desktop.
Save bas-vk/645953908eb7b50ec64708a4989cb374 to your computer and use it in GitHub Desktop.
Whisper chat demo

Compile geth from https://github.com/bas-vk/go-ethereum/tree/whisper-api

Setup private network: genesis file: https://gist.github.com/bas-vk/bbd75fcbcdd73b64cbb864f78fe49988

geth --datadir /tmp/whisper init

Get chat.js from https://gist.github.com/bas-vk/0961a9c945b3761eee7bfc4f70db75a9

Start node:

geth --datadir /tmp/whisper --shh --preload </path/to/downloaded/chat.js> console 2>/dev/null

Add peer: admin.addPeer("enode://3b48b9200bd964fee986358edf721de0c322339b36a73016e9af4de9e3b5d6da090807596b9dfb52ee35056005211c51f3744d728edf06c4c6567a309d29c967@[85.146.5.133]:30303")

Set username (optional):

chat.setUsername("abcd")

Join chat box:

chat.join("geth")

Say something:

chat.say("my message")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment