What Do Infrastructure Providers Do? We Connect the World to Web3
December 14, 2022
7 min read
Ankr makes Web3 work behind the scenes by connecting devs & decentralized apps to blockchains via RPC/API services.
In Web3, it can be a real challenge to keep up with technology that is literally updating every day. With as many facets and projects as there are with dApps, DeFi, DAOs, Layer-1s, Layer-2s, bridges, NFT marketplaces, and so much more, it’s hard to keep track of what makes it all work.
So what about the infrastructure that makes it all work behind the scenes? Just like the internet, there is a huge need for infrastructure to make the decentralized applications of Web3 possible. For you to even be able to read this article online, there are many levels of things happening in the Web1/Web2 background. If you searched Google for “what is an RPC” and wound up here, your screen is only populated with this information because your browser was able to establish a connection to your Internet Service Provider, the Domain Name Server, various data centers, and internet hosting services, all within a fraction of a second.
All of these processes are happening in Web3 as well – but there are extra layers on top of this that enable the blockchain elements that are key to the technology. In order for decentralized applications to function, they need to connect to the information held on various blockchains. For dApps, wallets, and other Web3 apps to know the contents of your wallet address, verify asset ownership, or execute critical tasks like crypto transactions, they need to connect to blockchains to pull this data. Let this article be your guide to how this all works in the background.
Ankr: Connecting Developers, Apps, Wallets, and the World to Web3
What Is A Blockchain Connection or RPC (Remote Procedure Call)?
RPCs could be classified as a type of API (application programming interface) that allow developers and their apps to both read data from blockchains and run code that can be executed on servers (nodes) remotely. And when developers build dApps that are connected to RPCs, the app will be able to connect users’ requests for information from blockchains and initiate tasks like crypto transactions. For instance, when users access a dApp or DEX to make transactions, their requests go through an RPC to connect them with the nodes that hold the data from blockchains so they can send new transactions to the mempool where they wait to be sent to validator nodes so they can be added to the chain. RPCs can likewise pull any data that a dApp might need from any epoch in a blockchain, including block numbers, accounts, balances, gas, mining data, and all other immutable info stored as a part of the blockchain.
Get started using Ankr’s RPCs for 20+ blockchains.
How Does An RPC Service Provide Blockchain Connections?
Today, Ankr Network handles over 8 billion “RPC calls” to blockchains daily. These calls are simply requests coming from different Web3 developers and decentralized applications needing access to blockchain data or wanting to initiate a transaction. Specific types of these requests are referred to as “methods” such as eth_getBalance (find the balance of a wallet address) or eth_estimateGas (provides an estimate of how much gas is needed for the transaction to complete).
As you can imagine, these types of requests would be very useful as a part of the basic functionality of a wallet such as MetaMask or Trust Wallet. As a user of the wallet, you will obviously be wanting to know your balance on different chains and how much you’ll need to pay in gas to send some ETH to a friend for example. RPCs are the magic messengers between applications and blockchains that make these actions possible.
How Do Web3 Applications Use Ankr’s Blockchain Connections?
Ankr connects RPC request calls automatically to the best nodes available that are running on our dozens of supported blockchains and testnets.
Here’s a breakdown of the process:
- A developer or application makes a query to the desired blockchain like eth_getBalance by using one of our “endpoints.” The endpoint is simply a Uniform Resource Locator (URL) that provides the location that the data should be retrieved from.
In this image, the endpoint is https://rpc.ankr.com/eth and it is being used to request the balance from the wallet address 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 (vitalik.eth).
The request (or query) is then sent to the closest instance of Ankr’s intelligent load balancer. The load balancer is responsible for routing request traffic to the best available nodes on chains like Ethereum, ensuring that none of them are over or under worked.
Once the request reaches one of the full or archive nodes running on the specified blockchain, the desired data will be pulled and delivered back to the dev or application that asked for it. The new data can then be used to inform an application’s front end, so you can see things like how much ETH you have stored on the Ethereum blockchain on your wallet’s interface.
Keep in mind that Ankr alone serves approximately 92,000 of these requests every second.
The graphic below shows a simplified illustration of this process. Ankr’s users connect to nodes via endpoints available on the Ankr Network RPC platform to reach nodes around the world that deliver the information that they need to operate.
What Are RPCs Used For In Web3?
Creating decentralized applications
One of the main use cases for RPCs is building dApps that have the capability to interact with one or more blockchains. Decentralized applications are based on smart contracts that enable features like automatic or “permissionless” executions of tasks like crypto trades on a user interface accessible to everyone. The RPC layer built into a dApp’s code allows it to communicate with as many different blockchains as it needs to satisfy its core function, which could be gaming, finance, social, or anything else.
Connecting to blockchain data without access to your own nodes
Developers only have a few options if they need access to on-chain data. They can either set up all their own nodes themselves and take on all the equipment maintenance and server problem-solving, or they can use a provider like Ankr for RPC services. The latter is most often the easiest, fastest, and most affordable solution to gain instant access to blockchains.
Simplifying the building process
RPC services are extremely useful when building Web3 applications as they can greatly simplify the job of developers. For instance, if you wanted users to be able to view their Web3 wallet’s crypto balance within your new DeFi protocol instead of building a new wallet from scratch – you would just need to access an API that can ask to communicate with the wallet to find what the user holds. At the same time, the software that forms the crypto wallet can contain API-enabling code that allows interoperability with many other DeFi protocols. To further simplify and streamline building, Ankr’s Advanced APIs are an extension of our RPC services that cache and pre-package info from the most popular request methods to make the data accessible at near-instant speeds.
Creating WebSockets to view real-time transactions data
WebSockets are APIs that allow for a constant exchange of information between a client and a server. Since they keep the communication channel open and flowing, there is no need to establish a connection every time a message is sent. These are extremely useful for high-throughput applications such as GameFi or Internet of Things (IoT) capabilities that need to send and receive huge amounts of data.
Run calls to access a massive amount of information
Developers can run calls to execute tasks like encrypting wallets, producing a human-readable JSON object, finding current block size, creating multi-signature addresses, and much more. These are critical pieces of information that builders need to create their own blockchain platforms and services. With access to multi-tiered (scalable), readily available, and reliable RPCs, developers will be able to build faster and make more efficient applications.
Ankr Offers More Blockchain Connections and Faster Global Speeds Than Any Provider
Since 2017, Ankr has been helping blockchain developers create dApps by providing the highest quality RPC/API connections to different chains. Exceptional dApps need high-performance infrastructure – that’s why Ankr is becoming the go-to provider for devs that require a higher bar for service.
Ankr is overtaking the most well-known Web3 infrastructure providers by offering high performance in every metric that matters to blockchain devs when connecting their dApps to blockchains:
- Supported blockchains
- User experience (UX)
- And decentralization