4

Is it possible for a decentralized application to get details about the offered JSON-RPC APIs from the local ethereum node?

I want to check the following specs in the following order using web3.js:

  1. Is the RPC port open and listening at :8545?
  2. Is the RPC set to allow CORS requests from my domain (example.com)?
  3. Which RPC APIs are availabe by the client (db,eth,net,web3)?

Is the 2nd step even possible if CORS is disabled for my remote domain? Will a disabled CORS RPC port be discoverable? If so, how?

4

1 and 2 can be checked with web3.isConnected()

  1. You can only use web3 with web3.js

You can't check these if you don't have cors for your domain because you can't access the rpc without it

  • but can 1 and 2 be checked independently? – Afr Feb 2 '16 at 0:58
  • AFAIK makes no sense to check 2 via web3.js, if the response was false, you would not be able to ask. – Viktor Trón Feb 2 '16 at 1:21
  • 1
    FYI as of yesterday, there is this npmjs.com/package/web3_extended which brings you admin and debug through js. Use with extreme caution. – Viktor Trón Feb 2 '16 at 1:25
  • as of yesterday @tjade273 published npmjs.com/package/web3_ipc which is a fork that adds IPC support – Viktor Trón Feb 17 '16 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.