0

I have an Ethereum app written using react + web3 and my contract code written using solidity. Can I test the app using real addresses [I used Rinkbey network] and my wallet Metamask?

1 Answer 1

0

Yes, this is possible. You need to connect to your web3 app to your metamask wallet using metamask API. First, set the web3 provider to metamask's using

const web3 = new Web3(window.ethereum);

Then connect you account to the site using:

window.ethereum
.request({ method: "eth_requestAccounts"})
.then( () => {
  // after logic
})
.catch( (err) => {
  // handle user rejection
});

Now you can use your metamask accounts to interact with your smart contracts.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.