0

I have used truffle to a migrate some contracts to a local instance of geth that points at Rinkeby. The problem is that I'm behind a firewall, with little hope of getting port 8545 open, so now I can't get my dApp to use those contracts :(

However, do I have to use a local instance of geth to access contracts deployed to Rinkeby, via a dApp?

In other words, within my dApp, instead of:

window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

Can I do something like:

window.web3 = new Web3(new Web3.providers.HttpProvider("http:/api.rinkeby.io:8545"));

...or some such like?

  • unfortunately, I won't be able to teswt this until Monday, but will new Web3.providers.HttpProvider('https://rinkeby.infura.io/') work? – glowkeeper Oct 20 '17 at 13:33
1

I don't know how to tell you how to do this in your exact code, but this page shows the various networks Infura provides: https://infura.io/docs/. The Rinkeby network is listed. That might work.

| improve this answer | |
1

The simple solution here was to use MetaMask and set it to point at rinkeby. Then the code just uses the current provider:

window.web3 = new Web3(web3.currentProvider)

| improve this answer | |

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.