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.
The Polygon API lets you connect to a Polygon node that is part of the Polygon network. You can interact with onchain data and send different types of transactions to the network using the endpoints provided by the API. The API follows a JSON-RPC standard -- a stateless, lightweight, remote procedure call (RPC) protocol encoded in JSON.
Explained in the Polygon API Quickstart Guide.
Yes! Polygon is fully EVM-compatible with all Solidity smart contracts and Ethereum libraries. The Ethereum Virtual Machine is the distributed state machine that lets you create smart contracts on Ethereum. Because Polygon is a sidechain scaling solution operating in conjunction with the Ethereum blockchain, it is fully compatible with EVM and benefits from its functionality.
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.
This API suite lets you read block/transaction data, query chain information, execute smart contracts, store data onchain, and more. You interact with Polygon’s base JSON-RPC APIs to communicate with its decentralized network of nodes.
When accessing the Polygon network via a node provider like Alchemy, you 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 you sign up for a free API key. With a dedicated API key, you 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
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 offchain requests.
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:
- Network Name: Polygon mainnet
- New RPC URL: https://polygon-mainnet.g.alchemy.com/v2/YOUR-API-KEY
- Chain ID: 137
- Currency Symbol: MATIC
- Block Explorer URL: https://polygonscan.com/
You should use the Mumbai testnet for testing Polygon applications. Mumbai is the testnet of Polygon, and you 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, you can get one token in a twenty-four-hour period and use it on the testnet to make sure your Polygon applications work properly before deploying to mainnet.
Sign up for Alchemy, click the “Apps” tab, then “Create App”, and start building your new app for either the Polygon mainnet or the Mumbai test network.
You can use many wallets on Polygon. Some of the most popular include Metamask, Ledger Nano X, and SafePal S1. We cover many of these wallets in our Web3 wallet overview.
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.
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.
To withdraw ETH from Polygon, go to a Polygon Bridge, click “Withdraw”, enter your desired amount, and then click “Transfer”.
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.
You can find the list of all the methods Alchemy supports for the Polygon API on the Polygon API Endpoints page.
If you have any questions or feedback, contact us at [email protected] or open a ticket in the Alchemy Dashboard.