The `shh` Module - Wiki Parity Ethereum Documentation

Note: Run parity with the --whisper flag to enable this API.

JSON-RPC methods

JSON-RPC API Reference

shh_info

Returns info about the whisper node.

Parameters

None

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":{"memory":0,"messages":0,"targetMemory":10485760},"id":1}

shh_newKeyPair

Generate a new key pair for asymmetric encryption

Parameters

None

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0x498cc0323523a6b778bc43edbdbd4402772dfa4aaddc268ed1653e1c85f285d5","id":1}

shh_addPrivateKey

Import a private key to use for asymmetric decryption.

Parameters

  1. Data - 32 bytes - The private key to import

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0x2265fc77fdb16fe54260a66437267c3cf5b6929d91f7994f48191e9ad9584c50","id":1}

shh_newSymKey

Generate a key for symmetric encryption

Parameters

None

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0x38cbc721b0a10a85134af2b2c1546850b5ef626e3ca4df37d991c527e22de61f","id":1}

shh_getPublicKey

Get the public key associated with an asymmetric identity.

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0x0b14b6056be85728b3a32918c7e067fc5f382c9d32f8893e5d161177404855c183b0fb5026c2fec382f9635f5366759075aef7474330d16613aedc43c83ad2f9","id":1}

shh_getPrivateKey

Get the private key associated with an asymmetric identity.

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0x04aa79b13d4e9f765972e9f8207de424ddbee123a6955e21b930ae067ef22e4d","id":1}

shh_getSymKey

Get the key associated with a symmetric identity.

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":"0xe4288c636477f3f7685a3112e7e3e717b78a4310366596b45161553e41f3cd56","id":1}

shh_deleteKey

Delete the key or key pair denoted by the given identity.

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":true,"id":1}

shh_post

Post a message to the whisper network.

Parameters

Returns

Example

Request

curl --data '{"method":"shh_post","params":[{
   "from":"0x193f71c502feb0c181ed0b97352fdcebcb621c733cd80637b2154a2a2b867a12",
   "topics":["0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"],
   "payload":"0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6",
   "priority":40,
   "ttl":400
 }],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{"jsonrpc":"2.0","result":true,"id":1}

shh_newMessageFilter

Create a new polled filter for messages.

Parameters

  1. Object
    • decryptWith: Data - 32 bytes - Identity of key used for description. null if listening for broadcasts.
    • from: Data - 64 bytes - if present, only accept messages signed by this key.
    • topics: [Data] - Only accept messages matching these topics. Should be non-empty.

Returns

Example

Request

curl --data '{"method":"shh_newMessageFilter","params":[{"decryptWith":"0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6", "from":"0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6",
"topics":["0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"]}],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Response

{"jsonrpc":"2.0","result":"0xea7120c5408c72cfd7e0e1d2ff62df8e208d9a1f85d2ed54a4a3e1ad6daeb6f9","id":1}

shh_getFilterMessages

Poll for changes on a filter.

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":[],"id":1}

shh_deleteMessageFilter

Delete a message filter by identifier

Parameters

Returns

Example

Request

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

Response

{"jsonrpc":"2.0","result":true,"id":1}

shh_subscribe

Open a subscription to a filter. Works in general the same as eth_subscribe and parity_subscribe in pubsub. Subscription calls are only supported on the websocket transport. (‘ws://localhost:8545’)

Parameters

See shh_newMessageFilter

Returns

subscription id

Example

TODO

shh_unsubscribe

Close a subscribed filter

Parameters

Returns

Example

TODO