question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JsonRpcProvider only works with localhost

See original GitHub issue

Hi, I dunno if I’m using this right or not but I’m having a lot of issues experimenting with the different providers. Example: JsonRpcProvider:

                    case "R" : break;
                        provider = new ethers.providers.JsonRpcProvider("http://164.68.121.219:8545");
                        break;
                    case "L" : 
                        // THIS WORKS AND RETURNS CORRECT BALANCE VALUES !!!
                        provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
                        break;

I tried to connetc to a local geth node and to a remote geth node. The connection with the local node works and I can read the balances of some addresses and block number and they are right, but if I try to connect to a remote machine it does not even try to connect. It is not a netowrking issue, I got this cleared. If I start a tcpdump on the address it does not even generate outgoing packets from the machine the browser is running. Could it be the browser or something concerning CORS or similar? TIA

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
BlockChainCaffecommented, Nov 29, 2019

… briliant… I’m an idiot Thanks a lot. I mean it . Both 😄

0reactions
ricmoocommented, Nov 29, 2019

LOL! Excellent. Glad that was easy to fix. My bad too for not reading the original code a bit closer. :p

Read more comments on GitHub >

github_iconTop Results From Across the Web

JsonRpcProvider - ethers
The JSON-RPC API is a popular method for interacting with Ethereum and is available in all major Ethereum node implementations (e.g. Geth and...
Read more >
What is http://localhost:8545? - json rpc
http://localhost:8545 is the RPC port of your locally running Ethereum node ... JsonRpcProvider("http://127.0.0.1:8545") And it worked.
Read more >
How to connect to custom Provider using ethers?
JsonRpcProvider (); // To connect to a custom URL: let url = "http://something-else.com:8546"; let customHttpProvider = new ethers.providers.
Read more >
How to use the ethers.providers function in ethers - Snyk
if (!provider) { try { // Allow read-only access to the blockchain if no ... JsonRpcProvider('http://localhost:8545') : new ethers.
Read more >
How to connect to Ethereum network with ethers.js - QuickNode
1. When someone thinks of developing a dApp the first tool that comes to their mind is web3.js which is ... 2. First,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found