Web3 APIs & Dev Tools: Fluence's fRPC-Substrate

Tutorials/Guides
Kagemni Karimu
Oct 23, 2023

As time progresses in the crypto-world, developers across various ecosystems are in need of cutting-edge tools and technologies. Accordingly, this series gives a front-seat view to some of the great projects which are helping developers in need of Web3 Tools & APIs!

If this is your first time joining us, we hope you enjoy our journey ;). If you haven’t already checked out the first in this series, take a look at it here!

Application: fRPC-Substrate by Fluence Labs

Lava knows for a fact that almost everyone is in need of EVM-based blockchain data access. Enter fRPC-Substrate, a way to quickly decentralize EVM RPC without altering frontend code. Beyond being sophisticated and efficient, fRPC-Substrate offers developers a potent combination of modularity, performance tracking, and broad compatibility. With fRPC-Substrate, Developers choose sorting algorithms for endpoints and host a gateway which intelligently employs the algorithms to provide RPC.

fRPC-Substrate was created by Fluence Labs - the team which provides premier web3 decentralized serverless compute using Aqua, a novel open-source language for distributed systems.


// Quickstart as so:::
// git clone https://github.com/fluencelabs/fRPC-Substrate.git
// cd fRPC-Substrate && npm i
// npm -g i @fluencelabs/cli@unstable
// nano configs/quickstart_config.json

{
  "providers": [
    "https://evmos.lava.build/",
    "https://evmos-evm.publicnode.com/",
    "https://g.w.lavanet.xyz:443/gateway/evmos/json-rpc-http/80a45d4d0adc53edff1ae44762c9fa2e"
  ],
  "mode": "round-robin",
  "relay": "/dns4/stage.fluence.dev/tcp/19002/wss/p2p/12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU",
  "serviceId": "e9e32b0b-3b19-4bdd-b1da-f5ff9cc0357f",
  "port": 3000,
  "counterServiceId": null,
  "counterPeerId": null,
  "quorumServiceId": null,
  "quorumPeerId": null,
  "quorumNumber": null
}

// npm -C gateway run run configs/quickstart_config.json
// Gateway is now available on 127.0.0.1:3000 !

Main Features:

  • Adjustable fRPC Algorithms: Select between algorithms like Random Load Balancing, Round Robin, and Quorum for handling RPC endpoints.
  • Modularity: The generic set of supported RPC features is modular. fRPC-Substrate offers default modules (curl_adapter and eth_rpc ) and allows easy addition of custom modules, as needed.
  • Fluence CLI Integration:  Using a CLI simplifies module management (addition, creation, removal) and service deployment. Fluence CLI simplifies the development flow for those using Fluence by letting you scaffold and tear down project tools.
  • Deployment Ease: For Fluence developers, this tool features a streamlined deployment process using commands like fluence deal deploy, easily integrating with major players like Metamask and IPFS.
  • Aqua Integration: fRPC-Substrate is fully integrated with existing Fluence offerings; It bridges HTTP and libp2p, allowing dynamic Aqua script generation and integration.
  • Configuration Flexibility:  Doing simple configurations, a developer can define and adjust how decentralized nodes participate through fluence.yaml, adapting based on peer willingness.

Considerations

🟢 fRPC-Substrate is supremely modular;  with the creation of modules, fRPC Substrate can capture and store RPC endpoint performance data in IPFS, Ceramic, Sia, or another web3 storage provider. Really, this example is just one of many possibilities… There is comprehensive documentation which makes it much easier for developers to jump in and start building innovative use cases.

🔴 fRPC-Substrate is jam packed with highly customizable and configurable features. For Developers less familiar with Fluence, Aqua, or fRPC - there is a substantial (and we do mean substantial) learning curve. Additionally, the variety of features which are available by default could lead to additional overhead for simpler implementations. The final major consideration is the fact that running the Substrate requires self-hosting a Gateway, which though substantially easier than running a bunch of nodes, is probably less than ideal for most developers.

Why we LAV fRPC-Substrate

❤️ Did we say features, features, features? Almost all of the features of fRPC-Substrate can be changed by editting configuration files such as fluence.yaml, service.yaml, and module.yaml. Plus the project is fully open-source and written primarily in Rust! (Performance ++)

What we’d like to see!

fRPC-Substrate is a slam dunk for developers familiar with Fluence’s ecosystem and developing on an EVM-based chain. However, the project’s git repository currently suggests that fRPC is looking for multi-chain support (hint! hint! hint!). As Lava provides multi-chain support by default, it’d be great to see LavaSDK as a route/means to integrate non-EVM chain support - since Lava handles many of the implemented features (pairing algorithms) automatically! Plus support for Cosmos chains!

Outro

In the ever-evolving landscape of Web3 development, tools like fRPC-Substrate emerge as beacons, guiding developers to decentralized heaven. The emphasis on modularity, decentralization, and performance sets it apart, offering a promising path for those keen on pushing the boundaries of what's possible in the decentralized world. Dive in, explore, and learn more about Lava’s innovative RPC offerings by trying out our Gateway or SDK!