4

I tried to connect to an ethereum node by using remix. It means that I am using http and not https. However, I receive same error message:

Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC).

Is there any other solution for this problem ? I searched in internet and found only one answer : use of http, that in my case I receive same error message.

  • are you trying to connect to a local node? – Achala Dissanayake Mar 26 '18 at 19:26
  • @Achala Dissanayake No, how can do this? thanks – Questioner Mar 26 '18 at 20:57
  • @ Achala Dissanayake i receive same message yet. this is not because of geth (go ethereum) ? since i have not installed it yet – Questioner Mar 27 '18 at 20:21
  • you need to have a node running locally, either using geth or any other way. Not having a local node gives you the error. try installing geth running a local node with -rpc flag, this will solve your error – Achala Dissanayake Mar 27 '18 at 20:33
  • Did you get it solved? – Refiner Apr 29 '18 at 17:18
2

Remix provide you with three environments to run your smart contract code. As well explained in the docs,

  1. JavaScript VM: All the transactions will be executed in a sandbox blockchain in the browser. This means nothing will be persisted and a page reload will restart a new blockchain from scratch, the old one will not be saved.

  2. Injected Provider: Remix will connect to an injected web3 provider. Mist and Metamask are example of providers that inject web3, thus can be used with this option.

  3. Web3 Provider: Remix will connect to a remote node. You will need to provide the URL address to the selected provider: geth, parity or any Ethereum client.

As a beginner it will be better to use JavaScriptVM as it's convenient because each execution runs in your browser and no external tool, node is needed . Reloading the page will restart Remix with an empty state.

If you want the code run in a actual node, either you should run your own node and open a rpc endpoint (in geth using --rpc flag) and provide the url for the endpoint after selecting Web3 Provider option as environment in run tab

or

use injected web3. E.g. have metamask extension installed in your browser and create an account and select a network (Ethereum main net or any other testnet.)

  • Thank you for your useful answer. Just you please tell me how can I use JavaScriptVM to connect to a local node ? thanks a lot – Questioner Mar 26 '18 at 21:35
  • JSVM is run in your browser and uses a sandbox blockchain, it can't be used to connect to a local node. If you want to connect to a local node, set environment to web3 provider and provide the rpc endpoint url of your local node ( when running a local node with geth by default it is http://localhost:8545). is it clear? – Achala Dissanayake Mar 26 '18 at 21:39
  • @ Achala Dissanayake exactly this is what I am trying to do. However, as I explained above, I receive that error message, even when I use http instead of https. I though may it is because of npm and node.js but after installation I receive same message – Questioner Mar 26 '18 at 21:45
  • have you opened a rpc end point? are you using geth? – Achala Dissanayake Mar 26 '18 at 21:46
  • @ Achala Dissanayake no i amusing only remix.ethereum.org. how can i open an rpc ? – Questioner Mar 26 '18 at 21:50
2

Web3 Provider: Remix will connect to a remote node. You will need to provide the URL address to the selected provider: geth, parity or any Ethereum client

To provide a URL you need to have a node running somewhere. To use http://localhost:8545, you need to have a local node running and port 8545 opened to it via JSON RPC.

As explained in the other answer's comments by @AchalaDissanayake you can simply do it with Geth, and there are many other as well.

  • Would you please say that how to Would you please say that how to "have a local node running" and how to be sure that "port 8545 opened to it via JSON RPC" ? – Questioner Apr 1 '18 at 10:10
  • I just went thru the other answer and its comments. Looks like everything is there. Hope you got it well explained :) – Refiner Apr 14 '18 at 19:47

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.