Choose a "stable" RPC node in your Steem App by using the Load Balancer Node

in #steem3 days ago

As you may know, I’ve set up two Steem Load Balancer RPC nodes:

  1. https://api.steemyy.com (London)
  2. https://steem.justyy.com (New York)

The project is open source, so you can easily deploy your own instance if needed:
https://github.com/doctorlai/steem-load-balancer

Using the Load Balancer in Your Steem App

Instead of hardcoding a single RPC node, you can select the most stable one dynamically through the Load Balancer.

For example, you can query the Load Balancer with a simple GET request, then parse the __server__ field:

curl -s "https://steem.justyy.com/" | jq .server
"https://api.justyy.com"

image.png

This response gives you the fastest responding RPC node at that moment.

Example: Dynamic RPC Node Selection with Fallback

node = fetch_from_load_balancer("https://api.steemyy.com")
while your_app_is_running:
    try:
        # use the node in your API calls
        pass
    except:
        # if the node fails, refresh it from the load balancer
        node = fetch_from_load_balancer("https://api.steemyy.com")

With this setup, your app will:

  • Always start with a healthy RPC node
  • Automatically switch to a new one if the current node fails

This approach provides better stability and resilience compared to relying on a single hardcoded RPC endpoint.

Steem to the Moon🚀!