Skip to content

Instantly share code, notes, and snippets.

@bas-vk
Created June 9, 2017 09:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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