Search code examples
blockchainethereumgo-ethereumremix

Error while connecting from Remix via rpc to local blockchain


geth --datadir  ./accnt1   --port 30306 --networkid 2018 --rpc --rpcport 8545 --rpccorsdomain=”*” --nodiscover --rpcapi “db,personal,eth,net,web3,debug”  --rpcaddr="127.0.0.1" --rpcport 8545 console

using the above command to start the console , to connect remix to private blockchain .Even Tried localhost for rpcaddr . Also used http version of remix. Still getting below error .

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


Solution

    • Make sure you have changed the environment in remix to Web3 provider
    • while starting geth if you want to connect it to remix then you need to allow remote connections to ethereum node . That can be done by adding --rpccorsdomain "URL OF THE WEBSITE "
    • the capital words in the below command means that you need to specify as required.

      geth --datadir="DIRECTORY OF THE GENESIS BLOCK" --rpc --rpcport PORTNUMBER --rpccorsdomain "URL OF THE WEBSITE"

    sample : geth --datadir="." --rpc --rpcport 8545 --rpccorsdomain="*" --rpcapi="miner,web3,debug,net,eth" console 2>>logger.log

    • rpc allows HTTP over it and not HTTPS so in the url change https to http://remix.ethereum.org/ and the ide should be connected via http not via https . Use the link provided in this line to get connected to the ide.