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 allows applications to connect to a Polygon node that is part of the Polygon network. Developers can interact with on-chain data and send different types of transactions to the network by utilizing the endpoints provided by the API. The API follows a JSON-RPC standard. JSON-RPC is 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 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.
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.
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
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.
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 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.
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!
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.
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 support for the Polygon API on the Polygon API Endpoints page.
Don't worry, we got you. Check out our feel free to post in discord with any questions you have!