How does MetaMask connect to a blockchain network?
Does this article need to be translated?
The Internet was originally created as a tool to share information: to pull information out of one database, transfer it remotely, and make it appear on a computer somewhere else. But, in order to do that, you need to have some sort of program to represent that data in the same way, no matter what computer you're on (and, ideally, make it a pleasant experience): and thus, browsers were born.
Public blockchains like Ethereum are the next evolution of Internet databases, and MetaMask is the next evolution of the browser. Your legacy browser doesn't have the ability to connect to this new kind of network, so MetaMask builds on top of them, pulling and pushing data to and from these public blockchain networks, with all of the interactivity we've come to expect from a Web experience built in.
Choose your own network connection
Just like pointing your browser to a URL, MetaMask needs to be pointed to what blockchain engineers call an RPC endpoint. The data transfer standard for legacy Internet traffic is HTTP; in web3, most public blockchains use a standard called JSON-RPC. This requesting and submitting of data is done through a set of commands that programmers call an API. If someone says 'the blockchain API' or 'the blockchain endpoint', they're referring to the same thing: the place where you can send a request to the blockchain.
JSON-RPC APIs
If you want to know more about how JSON-RPC APIs work with public blockchains, take a look at MetaMask's Developer Docs, and ethereum.org's documentation.
How do you find an API endpoint?
Well, you have to have a node of the blockchain available. Each node is constantly syncing the state of the blockchain, the history of transactions on the network. It's keeping the decentralized database up to date, and you can request—from that database—information it holds. What if you don't have the ability to run a blockchain node?
That's where Infura comes in. Infura provides an instantly available, always on, scalable blockchain API which gives you data access as if you were running your own node, and so much more. Infura offers access to these nodes through API endpoints, through which wallets and applications can send JSON-RPC requests. You could think of Infura, in this way, as a gateway to blockchain data.