You are participating in Ironforge Public Beta 

    Using RPC API

    Learn how to use the RPC API


    Ironforge's RPC API enables seamless interaction with the Solana blockchain through the Solana JSON RPC API. This API offers enhanced functionality, such as caching, while still maintaining Solana JSON RPC API compatibility to allow for easy integration into the existing code bases.

    Why should you care?

    RPC management is something all app developers will care about at some point, especially for quicker client responses and reliable data access. The first step is picking a good RPC provider, but that's not enough; you must also handle things like failover and caching. These tasks can distract you from working on your app's unique features. Ironforge can handle these complex parts for you, making it focusing on what makes your app unique.

    Interface

    To access Ironforge's RPC API interface, go to the corresponding tab in your dashboard. Here, you will encounter our Playground UI with all Solana JSON-RPC API methods available. Click on your desired method to open the dropdown and begin building the body of your request. Once you are satisfied with your request, click the "Execute" button to send the request and receive a response. RPC API

    Collaboration

    If you want to share this request, you can save it in your library for future use, share it directly via a link with someone, or export this request for use in your codebase through the collaboration features.

    Using the Request

    To integrate Ironforge’s RPC API into your application, you can either use the export button or copy and paste the Endpoint URL displayed at the top of the page and use that as your application RPC endpoint in your code base.

    Clicking the Export button will open a popup with options for cURL and Typescript based on code. You can copy and paste this code into your codebase. Export Example

    RPC Routing Strategy

    Ironforge allows you to set up multiple RPC endpoints (as many as you’d like). Doing so allows you to distribute your application workload across multiple endpoints, increasing the scalability and ensuring redundancy in case of endpoint failures. To add new endpoints click on the “Add a new RPC endpoint” tile at the bottom of the page and paste your desired URL.

    RPC Routing Methods

    Adding an additional endpoint means that you can take advantage of Ironforge’s smart routing functionality. Currently, Ironforge offers two routing methods: Round Robin and Parallel. Each method has its advantages and considerations. Learn more. RPC Routing Methods

    Caching

    Caching is supported for most of the requests. You can verify that on the platform by expanding the swagger card and looking for the Cache section. You can set the value of the cache there to determine the cache behaviour For example, to the cache a response for 60 seconds, use the following header:

    X-Ironforge-Cache-Control: max-age=60

    Similarly, you can also include the X-Ironforge-Cache-Control header in your requests from codebase. The value of this header will be used to determine the caching behavior.

    Pagination

    Pagination is supported for some requests such as getProgramAccounts. Limit and Offset parameters can be set by entering your desired value in the appropriate field; alternatively, you can also use query parameters in the body of your request.

    Here's an example of how to use these query parameters to retrieve the first ten accounts:

    /accounts?limit=10&offset=0

    To retrieve the next set of ten accounts, you can use the following query parameters:

    /accounts?limit=10&offset=10

    On the platform you can set these values in an input field available under Query Parameters.

    Using these query parameters, you can easily navigate through large data sets and retrieve the required data systematically and efficiently.