Created
March 17, 2019 15:41
-
-
Save ankitbrahmbhatt1997/ea7b647a178897290db0dcc556bc159c to your computer and use it in GitHub Desktop.
ethereum stack exchange question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof window !== "undefined" && typeof window.web3 !== "undefined") { | |
// In the browser and metamask is running | |
web3 = new Web3(window.web3.currentProvider); | |
} else { | |
// We are on the server *OR* the user is not running metamask | |
const provider = new Web3.providers.HttpProvider( | |
"https://rinkeby.infura.io/v3/bb20540179824ccb94cf748904d43090" | |
); | |
web3 = new Web3(provider); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment