Introduction
A Provider interacts with the blockchain network, allowing applications to send transactions, query data, and listen to events. Providers bridge the application and blockchain, ensuring smooth communication.
The zksync-ethers library supports providers from
the ethers.js library and adds extra functionality.
Two providers are available:
Provider: Functions likeethers.providers.JsonRpcProviderwith added ZKsync-specific methods.Web3Provider: Extends the ZKsync EraProviderclass for better compatibility with Web3 wallets.
Web3Provider for browser integrations.Provider
The Provider class in the zksync-ethers library extends the ethers.providers.JsonRpcProvider with additional
ZKsync-specific methods. This lets users access advanced ZKsync features using the familiar ethers.js interface.
Web3Provider
The Web3Provider class extends the ZKsync Era Provider class for better compatibility with Web3 wallets, making it
ideal for browser-based integrations. This provider ensures seamless interaction with wallet extensions like MetaMask,
allowing users to manage accounts and sign transactions directly from the browser.