| title |
|---|
The `shh` Module |
Note: Run parity with the --whisper flag to enable this API.
- shh_info
- shh_newKeyPair
- shh_addPrivateKey
- shh_newSymKey
- shh_addSymKey
- shh_getPublicKey
- shh_getPrivateKey
- shh_getSymKey
- shh_deleteKey
- shh_post
- shh_newMessageFilter
- shh_getFilterMessages
- shh_deleteMessageFilter
- shh_subscribe
- shh_unsubscribe
Returns info about the whisper node.
None
ObjectminPow:floatrequired PoW threshold for a message to be accepted into the local pool, or null if there is empty space in the pool.messages:Quantity- Number of messages in the pool.memory:Quantity- Amount of memory used by messages in the pool.targetMemory:Quantity- Target amount of memory for the pool.
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}
Generate a new key pair for asymmetric encryption
None
Data32 bytes - A unique identity to refer to this keypair by.
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}
Import a private key to use for asymmetric decryption.
Data- 32 bytes - The private key to import
Data- 32 bytes - A unique identity to refer to this keypair by.
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}
Generate a key for symmetric encryption
None
Data- 32 bytes - A unique identity to refer to this key by.
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}
Get the public key associated with an asymmetric identity.
Data- 32 bytes - The identity to fetch the public key for.
Data- 64 bytes - The public key of the asymmetric identity.
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}
Get the private key associated with an asymmetric identity.
Data- 32 bytes - The identity to fetch the private key for.
Data- 32 bytes - The private key of the asymmetric identity.
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}
Get the key associated with a symmetric identity.
Data- 32 bytes - The identity to fetch the key for.
Data- 32 bytes - The key of the symmetric identity.
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}
Delete the key or key pair denoted by the given identity.
Data- 32 bytes - The identity to remove.
bool-trueon successful removal,falseon unknown identity.
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}
Post a message to the whisper network.
-
Object
to:ObjectThe receiver of the message. Can be omitted for a broadcast message. Use one of the following two fieldspublic:Data- 64 bytes - The public key of the recipientidentity:Data- 32 bytes - The identity of the recipient key on your local node.
fromData- 32 bytes - asymmetric identity to sign the message with, or null.topics: [Data] - Array of topics for the message. Should be non-empty.payload:Data- Message datapadding:Data- Optional padding. Up to 2^24 - 1 bytes.priority:Quantity- How many milliseconds to spend doing PoW.ttl:Quantity- Time to live (in seconds) of the message before expiry
bool-trueon successful posting of the message.
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}
Create a new polled filter for messages.
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.
Data- 32 bytes - Unique identity for this filter.
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}
Poll for changes on a filter.
Data- 32 bytes - The identity to fetch changes for.
Array, where each item anObjectfrom:Data- 64 bytes - Public key that signed this message or nullrecipient:Data- 32 bytes - local identity which decrypted this message, or null if broadcast.ttl:Quantity- time to live of the message in seconds.topics: [Data] - Topics which matched the filtertimestamp:Quantity- Unix timestamp of the messagepayload:Data- The message bodypadding:Data- Optional padding which was decoded.
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}
Delete a message filter by identifier
Data- 32 bytes - The identity of the filter to delete.
bool-trueon deletion,falseon unrecognized ID.
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}
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')
subscription id
TODO
Close a subscribed filter
Data- The subscription ID of the filter
bool-trueon success,falseon unknown subscription ID
TODO