Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

shh jsonrpc methods not accessible to parity_subscribe #9675

Closed
jam10o-new opened this issue Sep 30, 2018 · 4 comments
Closed

shh jsonrpc methods not accessible to parity_subscribe #9675

jam10o-new opened this issue Sep 30, 2018 · 4 comments
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API. P5-sometimesoon 🌲 Issue is worth doing soon.
Milestone

Comments

@jam10o-new
Copy link
Contributor

  • Parity Ethereum version: 2.1.1
  • Operating system: Linux
  • Installation: one-line installer
  • Fully synchronized: n/a
  • Network: dev
  • Restarted: yes

When trying to use parity_subscribe to subscribe to whisper/shh related methods, we receive a "Method not found" error.

~> wscat -c localhost:8546
connected (press CTRL+C to quit)
> {"method":"parity_subscribe","params":["shh_getFilterMessages",["0xe986ce6c7c33bbadf01b872c27a4c019457763cdee915ac16baf66b6b2b001af"]],"id":1,"jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":"0x32921aece9b80f9a","id":1}
< {"jsonrpc":"2.0","method":"parity_subscription","params":{"error":{"code":-32601,"message":"Method not found"},"subscription":"0x32921aece9b80f9a"}}
>

The method gives the expected response when called manually.

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

This seems to have been an issue in the past in #6161

@jam10o-new jam10o-new added F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API. labels Sep 30, 2018
@jam10o-new jam10o-new added this to the 2.2 milestone Sep 30, 2018
@jam10o-new jam10o-new added the P5-sometimesoon 🌲 Issue is worth doing soon. label Sep 30, 2018
@Tbaut
Copy link
Contributor

Tbaut commented Oct 1, 2018

It looks like it's not supported, did you try out with shh_subscribe?

@jam10o-new
Copy link
Contributor Author

I see what you mean, that does appear to work... I'll make sure I know how this works before updating docs today (missing examples).

issue still stands that parity_subscribe should have access to shh rpc methods, right?

@jam10o-new
Copy link
Contributor Author

Not an issue; I just didn't expose the api's in my config 😅

@emizzle
Copy link

emizzle commented Dec 2, 2019

@joshua-mir - I'm having the same issue but am running Parity with all WS APIs enabled:

parity --chain=dev --network-id=17 --base-path=.embark/development/datadir --password=.embark/development/datadir/devPassword --port=30303 --jsonrpc-port=8545 --jsonrpc-interface=local --jsonrpc-cors=*,http://localhost:8000,http://localhost:8080,http://embark --jsonrpc-hosts=all --ws-port=8546 --ws-interface=local --ws-origins=all --ws-hosts=all --no-discovery --max-peers=0 --whisper --jsonrpc-apis=web3,eth,pubsub,net,parity,private,parity_pubsub,traces,rpc,shh,shh_pubsub --ws-apis=web3,eth,pubsub,net,parity,private,parity_pubsub,traces,rpc,shh,shh_pubsub,personal --unlock=0x00a329c0648769a73afac7f9381e08fb43dbea72 --gas-floor-target=8000000

Additionally, the APIs for websockets are enabled in my config:

[websockets]
# Allows connecting from Origin 'parity://*,chrome-extension://*,moz-extension://*,,'.
origins = ["parity://*", "chrome-extension://*", "moz-extension://*", ""]
# Allow connections only using specified addresses.
hosts = ["*"]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "private", "traces", "rpc", "shh", "shh_pubsub", "personal", "parity_accounts"]

Which APIs did you enable to get this to work? And did you end up using shh_subscribe or parity_subscribe with getFilterMessages?

Two attempts tried -- one using shh_subscribe and the other using parity_subscribe:

shh_subscribe

wscat -c ws://localhost:8546
Connected (press CTRL+C to quit)
> {"method":"shh_subscribe","params":[{"topics":["0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"]}],"id":1,"jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":"840a497d56ba9e3a424be071724e7a7d0da8dedac08e53b4c627f8fc85afc802","id":1}
> {"jsonrpc":"2.0","id":2,"method":"shh_post","params":[{"topics":["0xb10e2d527612073b26eecdfd717e6a320
cf44b4afac2b0732d9fcbe2b7fa0cf6"],"payload":"0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6","priority":40,"ttl":400}]}
< {"jsonrpc":"2.0","result":true,"id":2}

No messages returned

parity_subscribe

wscat -c ws://localhost:8546                                                   Connected (press CTRL+C to quit)
> {"jsonrpc":"2.0","id":1,"method":"shh_newMessageFilter","params":[{"topics":["0xb10e2d527612073b26eec
dfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"]}]}
< {"jsonrpc":"2.0","result":"0xe8bf9900df085f8320cda9bee33fe408df9bb26510963dbd1af2830ddf1e9e9b","id":1}
> {"jsonrpc":"2.0","id":1,"method":"shh_getFilterMessages","params":["0xe8bf9900df085f8320cda9bee33fe40
8df9bb26510963dbd1af2830ddf1e9e9b"]}
< {"jsonrpc":"2.0","result":[],"id":1}
> {"method":"parity_subscribe","params":["shh_getFilterMessages",["0xe8bf9900df085f8320cda9bee33fe408df
9bb26510963dbd1af2830ddf1e9e9b"]],"id":1,"jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":"0x785114be19e13abc","id":1}
< {"jsonrpc":"2.0","method":"parity_subscription","params":{"error":{"code":-32601,"message":"Method not found"},"subscription":"0x785114be19e13abc"}}

Method not found

Version

version Parity-Ethereum/v2.5.10-stable-9f94473eaf-20191112/x86_64-macos/rustc1.39.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. M6-rpcapi 📣 RPC API. P5-sometimesoon 🌲 Issue is worth doing soon.
Projects
None yet
Development

No branches or pull requests

3 participants