2

I am following the instructions from the Parity github page: https://github.com/paritytech/parity/wiki/Basic-Usage

Specifically:

$ npm install web3

$ node
> Web3 = require("web3")
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

> web3.eth.blockNumber
743397

All of this is working when I do it as the same Linux user that is running Parity. But when I try to create a new user account and access the RPC from that account, I get a different result for the Web3 and web3 commands and then I see:

  bzz: Bzz { givenProvider: null, currentProvider: null } }
> web3.eth.blockNumber
undefined

It's like it is not finding the RPC port connection. Is there a reason that the user account should matter? The RPC port is the RPC port right? Am I missing something important?

  • RPC is agnostic to the user account. Please share more details about your setup. – Waqar Lim Sep 29 '17 at 8:32
  • @5chdn Please make your comment into an answer and I will mark it correct. It answers the question I had. Regarding my setup: parity 1.7.2 binary, Debian 9, and two non-privileged users. One runs Parity and the other is trying to access the RPC via web3 as above. – stone.212 Sep 30 '17 at 2:22
2

IPC-RPC API honors unix system users rights. You can control the IPC access via tools like chmod on the IPC socket.

HTTP-RPC API is agnostic to the user account and should work for any users connecting to the HTTP endpoint locally or remotely. However, you have control over the access via Parity config:

--no-jsonrpc                   Disable the JSON-RPC API server. (default: false)
--jsonrpc-port PORT            Specify the port portion of the JSONRPC API server
                               (default: 8545).
--jsonrpc-interface IP         Specify the hostname portion of the JSONRPC API
                               server, IP should be an interface's IP address, or
                               all (all interfaces) or local (default: local).
--jsonrpc-cors URL             Specify CORS header for JSON-RPC API responses.
                               (default: None)
--jsonrpc-apis APIS            Specify the APIs available through the JSONRPC
                               interface. APIS is a comma-delimited list of API
                               name. Possible name are all, safe, web3, eth, net, personal,
                               parity, parity_set, traces, rpc, parity_accounts.
                               You can also disable a specific API by putting '-' in the front: all,-personal
                               (default: web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore).
--jsonrpc-hosts HOSTS          List of allowed Host header values. This option will
                               validate the Host header sent by the browser, it
                               is additional security against some attack
                               vectors. Special options: "all", "none",
                               (default: none).

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.