27.6.2023

Starknet: Gateway API vs JSON-RPC endpoints

Let us show you how to connect to the Starknet network via Gateway / Feeder Gateway API and JSON-RPC endpoints on full nodes.

Hello frens👋

Today we will introduce two ways to connect to the Starknet network, namely through the:

  • Gateway / Feeder Gateway API
  • JSON-RPC endpoints on full nodes

Note: We want to emphasize at the very beginning that we strongly encourage you to use the JSON-RPC endpoints, since the Feeder Gateway API will be deprecated in the near future!

If you want to jump straight into coding, you can take a look at how you can connect to Starknet (using both methods) with JavaScript in our Starknet.js guides!

Feeder Gateway API

The old way to communicate with Starknet was via classic HTTP calls, using the Feeder Gateway and Gateway API endpoints.

Basically, through the Gateway, your DAPP communicates directly with the Starknet Sequencer. Don’t know what the Sequencer is? Take a look at our article on exploring Starknet sequencers and nodes.

Note: Deprecation warning! This part of the article should just be used for information purposes! You should not build your DAPP to rely on the Feeder Gateway!

But why two names? To clarify, Feeder Gateway is used for HTTP GET requests and the Gateway is for POST requests! The endpoints are not documented, and you must take a look at the repo in order to get a better feel about them. This article can also provide more information!

JSON-RPC API

StarkNet will become decentralized at some point and DAPP-s will communicate ONLY via the JSON-RPC protocol to the network… Similar to how it is on Ethereum!

Here we have a specification for it (yay!)

Luckily all major RPC providers (such as Alchemy, Infura and others) support Starknet, so you can easily connect to them in your DAPP… Or if you prefer, you can even spin up your own node!

Conclusion

We hope this article has clarified the difference between the two connection methods to Starknet! And once again, please use the JSON-RPC in your DAPP!

Follow our blog and Twitter to keep yourself up to date with the latest Starknet guides!

See you soon again🙂

*This article is also available on SpaceShard Medium.

Downlaod all images