0

I am developing a ReactJs blockchain application on ethereum network. How can I use MetaMask Wallet instead of local ganache account.

import web3 from 'Web3';
const web3 = new Web3("localurl"); 
3

Check out this guide. To summarize: first check whether web3 already exists. If it does, initialize a Web3 object with web3.currentProvider. Otherwise, use your node's URL

  • In react environment, what web3.currentProvider will refer to as web3 is still not instantiated. – Arpit Sharma Apr 23 '18 at 19:07
  • If MetaMask is installed and working, web3 will be instantiated. If MetaMask is not installed, web3 will be undefined and you have to instantiate it yourself – Henk Apr 24 '18 at 6:49

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.