No Longer Injecting web3.js
Click here to learn more about related breaking changes to MetaMask. These changes were originally planned to take place in 2020.
In early 2021, MetaMask will no longer inject the
web3.js API. You can still bring your own web3.js or similar library and use it with MetaMask. We will simply stop injecting a particular version of web3.js for you.
We’ve primarily included web3.js as a convenience alongside MetaMask’s core Ethereum provider API, which wraps the JSON-RPC API and is documented here.
Removing web3.js is part of an effort to simplify MetaMask’s API and provide the safest, most stable experience possible.
Why are we doing this? What does this mean for you?
MetaMask currently injects
firstname.lastname@example.org, which is no longer receiving fixes or updates. The
0.20.x version also lacks some safety validations that have caused trouble for our users.
While upgrading web3.js to
1.0.x is an option, the upgrade would require breaking changes.
email@example.com is already a scheduled breaking change, so rather than subject our users to a series of breaking changes, we are finally putting version choice firmly in the hands of developers so we can minimize the number of breaking changes in the future.
You can still bring your own convenience library and use it with the MetaMask inpage provider, whether ethers.js, web3.js, or something else.
Removing our injected version of web3.js will help us continue to provide a safe, performant experience for developers while managing our maintenance costs. In early 2021, dapps will have to bring their own convenience library if they want to use one.