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.
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.
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.