Web3 APIs & Dev Tools: Leap’s Fallback Falooda

Tutorials/Guides
Kagemni Karimu
Oct 4, 2023

In recent years we’ve seen huge increase in the number of active developers across all blockchain ecosystems. With this exciting boom came a wave of new tools and technologies that aim to simplify the web3 development process, and help builders ship better products.

This is the first edition of a new series we’re releasing where we’ll showcase and analyze dev tools that we find interesting, in order to help you understand whether they are the right tools for your next project. We hope you enjoy it!

Application: Fallback Falooda by Leap

As developers who work with Cosmos and NEAR blockchains can attest, relying on public infrastructure can be a hit-or-miss affair. Fallback Falooda offers a clever way to integrate a resilient fallback system for blockchain nodes. It acts as a buffer between a program and a potentially unreliable blockchain node, creating redundancy through fallbacks.

Fallback Falooda was created by Leap - one of the fastest shipping teams in Cosmos, who’s building awesome products like Leap Wallet, MetaMask Snaps, Leap Browser and more! 🐸


// Create an instance of Falooda with the provided URLs for a hypothetical blockchain named 'evmos'.
const falooda = new Fallback.Falooda({
  intervalInSecs: 5, // Set the monitoring interval to every 5 seconds (or any other preferred value).
  urls: {
    cosmos: {
      evmos: {
        rpcNodes: [
          'https://tm.evmos.lava.build',
          'https://tendermint.bd.evmos.org:26657'
        ],
        lcdNodes: []  // Assuming LCD nodes are not provided for this setup.
      }
    }
  }
});

// Starting the monitoring process.
falooda.start();

// Later, when you need a healthy RPC node URL for 'evmos'.
const healthyEvmosRpcUrl = falooda.getFastestCosmosRpc('evmos');
console.log(`Healthy Evmos RPC URL: ${healthyEvmosRpcUrl}`);

Main Features:

  • Platform Agnostic: The library caters to both front-end and back-end developers with Node.js, ES6, and React Native.
  • TypeScript Support: Bundled TypeScript definitions provide static type checking !
  • Dynamic Health Monitoring: Fallback Falooda doesn’t just switch between nodes. It periodically checks the health of each node, ensuring the user always connects to a functioning one.
  • Decentralization: By distributing requests across random nodes, not only is the load balanced, but the decentralized ethos of blockchain is upheld. This prevents an over-reliance on centralized nodes.
  • Customization: Developers have the option to specify the blockchains, node URLs, and health check intervals, giving them full control over the monitoring process.

Considerations

🟢 Fallback Falooda is a relatively lightweight implementation for handling both RPC and LCD nodes ensuring comprehensive coverage of the Cosmos ecosystem (w/ support for NEAR). It’s a neat and elegant solution that can be used with pre-existing Public-RPC URLs and requires no extra configurations.

🔴 Falooda seems to depend on external libraries (like typedi for dependency injection). Also, while sequential pinging (as implemented) prevents overloading with too many simultaneous requests, it could be slower in accumulating results, especially if there are numerous nodes to monitor.

Why we LAV Fallback Falooda

❤️ It is an open-source project after our own heart with great simplicity. In fact, you can even use it with Lava Gateway, Lava’s Incentivized Public RPC, and any of our offerings with URLs if you want to run speed tests and benchmarks.

What we’d like to see!

While Fallback Falooda offers many features for basic usage, Lava offers Quality of Service checks and Data Reliability assurances that are not easily duplicated with lighter weight offerings like Fallback Falooda. Because of this, Fallback Falooda, as a robust yet lightweight offering, is an awesome candidate for integration with the Lava network:

  1. We’d love to see a no-URL-mode where Fallback Falooda takes requests directly and routes them to Lava Network!
  2. We’d love to see URLs from Lava’s Gateway or ipRPC built into the list of default URLs which are sourced at initialization.

Outro

With its easy integration, dynamic monitoring, and emphasis on decentralization, Fallback Falooda is a great tool for Cosmos and NEAR developers looking to do benchmarks on Public RPC or add a simple fallback layer of nodes for your project. As always, public infrastructure, particularly in the blockchain space, can be unpredictable. Lava aims to offer the most reliable RPC by optimally routing requests through a globally distributed network. Get started with our Gateway now! Or forgo URLs altogether with our SDK!