I’ve installed parity on a AWS EC2 instance following these instructions and started parity with the --jsonrpc-apis 'web3,eth,net,parity' flag. I've also tried many other flags, such as --rpccorsdomain '*'

However I’m struggling to connect to it using web3.js.

Also I’ve, temporarily, opened all inbound traffic from my IP

4 Answers 4


Have a look at the JSONRPC docs:

--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 web3, eth, net, personal,
                             parity, parity_set, traces, rpc, parity_accounts.
                             (default: web3,eth,net,parity,traces,rpc).
--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).

So, enabling the required APIs as you did is only one piece of the puzzle you are trying to solve :)

Assuming you are fine with default port and default APIs, let's have a look at the following features you probably want:

  • --jsonrpc-interface all enables the HTTP JSON-RPC API on all network interfaces, not only the local loop-back. You could also specify --jsonrpc-interface which your public IP to only serve RPC to the public network interface.

Give this a try, it should work already, assuming you have opened the RPC port against the AWS firewall. Additional fine-tuning can be achieved via

  • --jsonrpc-hosts all to allow all host header values sent by the browser.
  • --jsonrpc-cors '*' to allow all CORS requests from any domain.

Note, you probably want to disable sensible APIs such as personal,parity_accounts,parity_set and also disable other features such as --no-ui, --no-dapps, --no-secretstore, --no-code, or --no-storage to harden your client.


+1 @Vlal. Along with --jsonrpc-hosts all --jsonrpc-interface all I had to add --jsonrpc-cors null instead of --rpccorsdomain "*"


the short version (if you're on a trusted network and assuming you don't have any local firewalls running):

--jsonrpc-hosts all --jsonrpc-interface all

then you connect via (and change the IP obviously): web3 = new Web3(new Web3.providers.HttpProvider("http://xxx.xxx.xxx.xxx:8545"));


You have to use

jsonrpc-cors all


jsonrpc-hosts all

either directly in the command (--jsonrpc-cors all --jsonrpc-hosts all) or in the .toml config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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