Infura Integrates with Polygon to Advance Web 3.0

Infura Transactions (ITX) have come to Polygon! Leveraging the Polygon network to support ITX provides applications with a seamless scaling experience. Specifically, ITX allows end users to send transactions without necessarily holding Ether (ETH). ITX ensures that your transactions are safely submitted and not dropped, while abstracting away the complexities with gas management for developers. This results in more transaction safety for infrastructure development and better user flow with less micromanagement.

Infura serves as the backbone for much of Ethereum’s blockchain development, supporting major DeFi outfits like Uniswap and MakerDAO, the world’s most popular decentralized wallet MetaMask, as well as NFT projects including Sorare and Async Art. Some 350,000 developers are using Infura to build applications for Web 3.0.

ITX is automatically enabled for your projects. You can choose to disable it in your Project Settings.

There are three high-level steps you need to take when integrating ITX in your project:

  • On-chain deposit. You generate a private key and deposit some ETH with Infura’s on-chain deposit contract. This action credits your ITX gas tank with the corresponding amount of ETH (after 10 block confirmations). You will use your private key any time you authorize spending from your ITX gas tank.
  • Send a relay request. You send a transaction relay request to your usual Infura endpoint using the ‘relay_sendTransaction’ RPC call. ITX will first check if you have sufficient balance, then lock a portion of your funds and relay the transaction on your behalf to the Ethereum network. 
  • Transaction mined. In an effort to minimize confirmation time and gas paid, ITX will gradually increase the amount of gas you put in and republish the transaction according to a preset schedule. When the transaction does go through, your final transaction fee will be your network fee + ITX fee. You can check your wallet’s new balance of Ethereum tokens by using the ‘relay_getBalance’ RPC call.

Specifically, how do we navigate these three steps? Follow the instructions here:

  1. Set up the ITX provider. All ITX-specific JSON-RPC methods can be accessed via the ‘ethers.js’ built-in ‘InfuraProvider' class, using your dedicated Infura URL.
  1. Create a signer account. You will use the private key for authenticating your ITX transaction requests, and its corresponding public address for identifying your ITX gas tank for your Polygon decentralised applications (DApps).
  1. Check balance. Your signing account needs to have gas tank balance registered with ITX. You can do this by calling the ‘relay_getBalance’ method.
  1. Make a deposit. And finally, we get to the good part: making a deposit into the ITX gas tank. Note that the contract you’re depositing to (itx.eth) is the same address across all Ethereum networks, and your deposit will be registered after 10 block confirmations.
  1. Send a Relay Request. The format of an ITX request is as follows:

A slight note on what’s happening under the hood, ITX generates a unique transaction hash for every relay request made by a smart contract. This consists of the ‘keccak256’ hash of the address, the bytes in the data field, a uint value of gas and the chain id. The relay transaction hash is then signed by using the standard Ethereum message signing process.

You only need to pass in the ‘relayTransactionHash’ into the ‘signRequest’ function.

  1. Example. The code below sends a transaction that calls the ‘echo’ method in a sample contract that is already deployed. ‘relay_sendTransaction’ requires two parameters:
    1. The relay request object (under const tx = {...} )
    2. Your signature

Note: The Ethereum transaction hash is changed every time the fee is bumped according to the schedule and the previous hash is no longer reliable for tracking its status. Because the ITX is completely responsible for sending and broadcasting your transaction, you get back a ‘relayTransactionHash’ instead of an Ethereum transaction hash.

  1. ​​Check your transaction status. There’s a new RPC call ‘relay_getTransactionStatus’ that returns the list of Ethereum Transaction hashes which have been broadcast for the supplied relay ‘TransactionHash’. You can then check client-side whether any of the transaction hashes were mined.

And that’s it! You’ve successfully sent a relay request via the ITX service. From there you can use optimistic rollups, ZK rollups and everything in between. We can’t wait to see how you use the ITX for seamless UX in your Polygon PoS builds!

Keep up with the latest news on Polygon Developers twitter channel, take a deep dive into the available resources or say hi on Discord. Then go build something!

Be a part of our social ecosystem!

Website | Twitter | Ecosystem TwitterDeveloper Twitter | Enterprise Twitter | Studios Twitter | Telegram | Reddit | DiscordInstagram | Facebook | LinkedIn

More from the Polygon Blog
Announcing Polygon Pod, a Podcast From the Epicenter of Web3

What’s the future of DeFi? How can blockchain projects shake the reputation for being bad for the environment? What in the world are zero knowledge proofs? How can Web3 attract and accommodate the next billion users? When Flippening? You want to know the answers and so do we. That’s why Polygon is launching Polygon Pod […]

Read More
Introducing Polygon Nightfall Mainnet: Decentralized Private Transactions for Enterprise

We’re in the early innings when it comes to enterprise needs for blockchains. Whether it’s supply chain management or marketplaces, the potential for secure business transactions on a public ledger has enormous implications. That’s why we’re pleased to announce Polygon Nightfall, a blockchain solution that leverages cutting edge Optimistic-Zero Knowledge technology to give businesses an […]

Read More
Polygon Is Going Carbon Negative in 2022 With a $20 Million Pledge

Today marks the start of a new, sustainable era for the Polygon ecosystem -- the core team has committed to eliminating all of the network’s carbon debt going back to inception and making the chain climate positive into the future. Polygon’s Green Manifesto announced today is part of a broader vision for sustainable development that […]

Read More
Introducing Polygon ID, Zero-Knowledge Identity for Web3

At Polygon, we believe that putting people firmly in control of their digital identities is at the core of Web3’s promise to empower users over networks. We have been working behind the scenes to fulfill this promise and today are proud to introduce Polygon ID, the self-sovereign, decentralized and private identity for the next iteration […]

Read More
Calling All Web3 Developers: #WAGMIonPolygon

This is Dalip, head of Developer Relations at Polygon. These past few weeks have been tough on everyone in Web3. But when the going gets tough, the tough get building. That’s why today we are announcing #WAGMIonPolygon, a new series for developers available on our YouTube channel. The program will focus on educational content, expert […]

Read More
PolygonInsights - WEEK19

Hola readers! Roland-Garros, an eTennis competition series by BNP Paribas, will launch its first NFT collection on Polygon, Chainsmokers shared their album royalties via NFT drops on our network, and the Polygon PoS bridge maintains its position in the Top 5 most used dApps on Ethereum. Let’s dive in.  Key takeaways:  There was an increase […]

Read More
MSP Recovery and Tokenology Choose Polygon to Tokenize Medical Claims

MSP Recovery, a $32.6 billion publicly-traded U.S. company leading the healthcare reimbursement recovery industry, has partnered with Tokenology to launch a healthcare claims tokenization platform that will help eliminate fraud and benefit patients, care providers and insurers alike.  LifeChain will run on Polygon, leveraging the carbon-neutral network’s low transaction fees, high throughput and a suite […]

Read More
crossmenuchevron-down-circle