0

I am trying to understand how MetaMask works in browser.

Metamask, as a browser extension, is used to send transactions for ethereum blockchain. After reading some articles, I think one of important things Metamask does is to inject a Web3 instance into the browser's global variable window so that DApp's script could find a provider to make JSON_RPC call.

In web3 instance, there is a currentProvider already defined by MetaMask. I am wondering where this currentProvider pointing to.

I develop and test my own dApp based on a my local private chain so I have an IP and port to create a HttpProvider to allow Dapp to connect to. But I don't know what is the IP and Port used by MetaMask to create a provider.

My questions:
1. Is there a server or cluster set up by MetaMask itself in order to receive transactions from MetaMask browser extension?
2. If no, what mechanism for MetaMask to get active node?
3. Can you provide source code for this part? There are too many projects under metamask so that I cannot find it.

1

Metamask uses Infura as you can see here:

https://github.com/MetaMask/metamask-extension/blob/5f3f8c85fcc5bd378ef1a886434a3e98546fee7f/app/scripts/controllers/network/enums.js

EDIT: It seems they have made some changes and now they are using this package: https://github.com/kumavis/eth-json-rpc-infura

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.