Systango Resolves Multithreading Issue With Web3 Calling In The Multicall.py

Last Updated on: April 27, 2023

Systango Resolves Multithreading Issue With Web3 Calling In The Multicall.py

For those of you who are not aware of what exactly is a multi call feature? 

Multi call is a  feature used while reading information from the blockchain to save the system from recurring node provider calls. In layman’s language, a multi call will aggregate multiple networks calls into one – thereby reducing the latency.

Problem Statement

The multi call is an aggregated call that is executed on the blockchain, saving network latency for those calls and avoiding clocking repeated calls.

Python implementation of multi call (Github reference) uses an ‘async-eth’ module to get data from the blockchain asynchronously.

Here, the problem with Python multi call was that it could not run in threads on docker containers, because the context manager was already occupied with async threads.

Solution

We have made changes to the module so that the async-eth execution can be enabled/disabled based on the environment variables. If disabled the module will be able to execute in threads on docker containers.

To run multicall with threading in a docker container, all we need to do is set the environment variable “ASYNC_W3” in the following manner

export ASYNC_W3 = 0

By default this variable is set to 1 which means ASYNC_W3 is on, else is off.

Check it on Systian’s Github Profile

Mayank Khare

January 6, 2023

Leave a Reply

Your email address will not be published. Required fields are marked *