Features
Cached RPC
By design, multichain leverages caching for RPC queries, ensuring that repeated requests for the same query within a designated period yield instantly available cached results. This feature is especially beneficial in scenarios where identical RPC queries are required across various components while maintaining speed.
To achieve this, we implemented an abstraction layer, LocalRPCSubscriber
, dedicated to tracking all references of RPC queries. This layer acts as the backbone of the caching mechanism, ensuring that responses are rapid and managed in a completely transparent manner, requiring no explicit actions from the user.
Automatic multicall
Natively, automatic multicall
intelligently batches individual call requests into a multichain request, streamlining the process in a way that remains entirely invisible to the user.
This optimization occurs without the need for explicit instructions to initiate a multichain call. This feature enhances performance by aggregating multiple requests into a single call, reducing latency and network load, thereby providing a smoother and more responsive experience for users.
RPC rotation
To guarantee optimal RPC availability across various blockchain networks, multichain meticulously manages a curated list of RPCs for each chain.
In the event that a selected RPC demonstrates sluggish performance or fails to respond, multichain automatically reroutes the current query to an alternative RPC in the list. This process continues iteratively until a successful response is secured.
This approach ensures uninterrupted access to blockchain data and optimizes query execution by dynamically selecting the most efficient RPC endpoint, thereby maintaining high levels of performance and reliability for end-users.
Retry query
You can automatically force an RPC query to retry itself every X seconds in case of an error.
const balance = local.call(
usdcContract,
erc20ABI,
proxy.new("balanceOf"),
proxy.new([
proxy.new(new Address("0xa889C78f474a98ce667Db5206f35A9a14e3e027a")),
]),
proxy.new({ retry: 1 })
);
Refresh query
You can set a validity period for a given query. If the validity period expires, the request will be replayed to update its value. For instance, this can be used to refresh the balance of a user every X seconds.