Can I connect to ANY contract on the Ethereum mainnet using Quicknode? Or does Quicknode only support a subset of actual solidity contract endpoints using a rest API?
1 Answer
Quicknode provides, besides many other services, a REST API to interact with supported blockchain networks via JSON-RPC clients. This means that Quicknode can be used as a JSON-RPC Provider. For supported chains refer to their documentation, here.
In order for a software application to interact with the Ethereum blockchain - either by reading blockchain data or sending transactions to the network - it must connect to an Ethereum node. Every Ethereum client implements a JSON-RPC specification...
In order to interact with a smart contract, e.g. call a function for reading state, an client needs to send an eth_call
method JSON-RPC request.
So now back to your question.
Can I connect to ANY contract on the Ethereum mainnet using Quicknode?
If you mean by "connecting to a contract", to interact with a contract: YES, you can interact with any contract via Quicknode calling their respective API endpoint.
-
Thanks @norym. So if I wish to make a swap on Balancer, I can use Quicknode and just provide an appropriate JSON request payload for the contract function I want to call? Commented May 11, 2023 at 21:48
-
I do not know about Balancer and I think if Balancer provides swaps for tokens, it will likely provide a dApp on which you can connect with your wallet in order to interact with the contract/swap your tokens. But, yes you will be able to interact with Balancer's contracts as I explained.– norymCommented May 11, 2023 at 22:03
-
Btw just for clarity, when you say Quicknode provides a REST API for interacting with supported blockchain networks via JSON-RPC, does this mean I make an API request (say HTTP) and then they in turn create a request for the JSON-RPC? I never need to create a JSON-RPC request myself? Commented May 13, 2023 at 20:39
-
Correct, you do not need to care about the JSON-RPC request handling.– norymCommented May 14, 2023 at 8:13
-
Awesome. And if I use a library like
web3js
then I am in fact directly constructing the JSON-RPC calls again? Commented May 14, 2023 at 14:24