ethers.js
is a popular, lightweight JavaScript library designed for interacting with the Ethereum Blockchain and its ecosystem. It provides a comprehensive tool suite for connecting Ethereum nodes via JSON-RPC, managing wallets, and deploying and interacting with smart contracts.
ethers.js
has introduced the ChainstackProvider
, a new addition to its Community Providers.
ChainstackProvider
integrates directly withethers.js
, enabling developers to connect seamlessly to multiple blockchain networks supported by Chainstack via JSON-RPC endpoints. The ChainstackProvider
enhances the development of decentralized applications by offering robust and scalable connections to blockchain networks such as Ethereum Mainnet, Arbitrum, BNB Smart Chain Mainnet, and Polygon.
ChainstackProvider
supports connections to:
ChainstackProvider
extends JsonRpcProvider
and implements the CommunityResourcable
interface. It allows users to connect to Chainstack’s JSON-RPC endpoints.
This provider is particularly useful for developers needing reliable network access to test and prototype blockchain applications.
network
: Optional. The network identifier.apiKey
: Optional. The authorization key from your deployed Chainstack node.ChainstackProvider
you must first install ethers.js
:
ChainstackProvider
instance and call the eth_chainId
method:
ChainstackProvider
.
Follow these steps to sign up on Chainstack, deploy a node, and find your endpoint credentials:
ChainstackProvider
.https://ethereum-mainnet.core.chainstack.com/AUTH_KEYNow you can add the
AUTH_KEY
to the ChainstackProvider
instance: