Polygon API FAQ

The Polygon API follows a JSON-RPC standard. This doc contains the methods that Alchemy supports for Polygon development (smart contracts & decentralized applications) on mainnet and Mumbai testnet.

What is Polygon?

Polygon is a sidechain, one type of Ethereum scaling solution, that runs parallel to the Ethereum Mainnet. Polygon improves transaction speeds and cost compared to the mainnet, making it an excellent solution for Ethereum developers. Originally known as the Matic network, Jaynti Kanani, Sandeep Nailwal, and Anurag Arjun founded Polygon in late 2017.

How can I get started using the Polygon API?

It's simple! If you're using JavaScript and Node.js, simply install the Alchemy SDK, create an Alchemy object, and you'll be ready to start making Polygon node requests (for instance, getting the latest block) in a couple of lines of code.

After setting up a node project using npm init -y, install the SDK by running the following command in your shell:

npm install alchemy-sdk
yarn add alchemy-sdk

After installing the package, you can then import and use the SDK:

import { Network, Alchemy } from 'alchemy-sdk';

// Optional Config object, but defaults to demo api-key and eth-mainnet.
const settings = {
  apiKey: 'demo', // Replace with your Alchemy API Key.
  network: Network.MATIC_MAINNET, // Replace with your network.
const alchemy = new Alchemy(settings);

// Access standard Ethers.js JSON-RPC node request

Is Polygon EVM compatible?

Yes! Polygon is fully EVM-compatible with all Solidity smart contracts and Ethereum libraries. The Ethereum Virtual Machine is the distributed state machine that allows developers to make smart contracts on Ethereum. Because Polygon is an sidechain scaling solution, operating in conjunction with the Ethereum blockchain, it is fully compatible with EVM and benefits from its functionality.

What API does Polygon use?

Polygon uses the JSON-RPC API standard as its API. The Polygon JSON-RPC API serves as the backbone for the Polygon network and powers any blockchain interaction.

In aggregate, this API suite allows users to read block/transaction data, query chain information, execute smart contracts, store data on-chain, etc. Developers and consumers alike interact with Polygon’s base JSON-RPC APIs to communicate with its decentralized network of nodes.

What is a Polygon API key?

When accessing the Polygon network via a node provider like Alchemy, Polygon developers use an API key to send and receive transactions from the network.

While many Polygon development tools like MetaMask have a set of default Polygon RPC endpoints, they are often throttled during periods of high usage leading to slower response times and a higher likelihood of request failures.

For the best development experience, we recommend that you sign up for a free API key! With a dedicated API key, developers can:

  • access higher request throughput and increased concurrent requests
  • query enhanced APIs, gaining access to free archive data, logs, and API abstractions
  • leverage individualized usage metrics

Which libraries support Polygon?

Three libraries support Polygon: Alchemy-web3, Web3.js, and Ethers. Of these three, Alchemy is an improvement over Web3 and Ethers libraries, providing enhanced API calls, upgraded WebSockets, and many other benefits.

What programming languages work with Polygon?

Many programming languages work with Polygon including Go, Javascript, Solidity, Typescript, and Shell. Javascript and Solidity are some of the best languages to use, Solidity for smart contracts and Javascript for off-chain requests.

How do I add Polygon to MetaMask Mainnet?

To connect Polygon to MetaMask, create a Polygon app in Alchemy. To get a dedicated Polygon RPC endpoint, add a new network to MetaMask, and enter the following details:

What testnet should I use for Polygon?

You should use the Mumbai testnet for testing Polygon applications. Mumbai is the testnet of Polygon, and Polygon developers can use a Mumbai faucet to get test MATIC tokens.

If you sign in with your Alchemy account, you’ll get 5x more test MATIC tokens. On Mumbai, developers can get one token in a twenty-four-hour period, and use that on the testnet to make sure their Polygon applications are working properly before putting them on the mainnet.

How do I build an app on Polygon?

Simply sign up for Alchemy, click the “Apps” tab, “Create App”, and then you can start building your new app for either the Polygon mainnet or the Mumbai test network!

What wallets can be used on Polygon?

Developers can use many wallets on Polygon. Some of the most popular wallets include Metamask, Ledger Nano X, and SafePal S1. We give details on many of these wallets in our Web3 wallet overview.

What does Polygon use for gas?

Polygon uses MATIC tokens for gas, as MATIC is Polygon’s native token. To check the current price of Polygon Gas, use the Polygon Gas Tracker.

How do you bridge Polygon to Ethereum?

For bridging, use the Polygon PoS Bridge. When you connect your Metamask wallet, you will be able to send and receive tokens between Polygon and Ethereum.

Alchemy’s overview on cross-chain bridges can further help you understand how bridging works and how these bridges allow chains to interact with each other.

How do you withdraw ETH from Polygon?

To withdraw ETH from Polygon, go to a Polygon Bridge, click “Withdraw”, enter your desired amount, and then click “Transfer”.

What projects are on Polygon?

Some of the most popular dApps on Polygon include KyberSwap, QuickSwap, ZED RUN, and EasyFi. Currently, there are over 19,000 unique dApps running on the Polygon network.

What methods does Alchemy support for the Polygon API?

Getting Blocks

Retrieves information from a particular block in the blockchain.

Reading Transactions

Retrieves information on the state data for addresses regardless of whether it is a user or a smart contract.

Writing Transactions

Allows developers to both send POLYGON from one address to another, write data on-chain, and interact with smart contracts.

Account Information

Returns information regarding an address's stored on-chain data.

Event Logs

Returns logs which are records that denote/provide context on specific events within a smart contract, like a token transfer or a change of ownership for example.

Chain Information

Returns information on the Polygon network and internal settings.

Getting Uncles

Returns information on uncle blocks which are network rejected blocks and replaced by a canonical block instead.

Gas Estimation


Returns Polygon network configuration information.

Real-time Events

Introduces WebSocket-based requests/responses which leverage a network connection allowing developers to listen for changes continuously without the need for HTTP polling.

My question isn't here, where can I get help?

Don't worry, we got you. Check out our feel free to post in discord with any questions you have!