0

The method to aggregate functions belonging to contracts is given in this library: https://pypi.org/project/web3-multicall/

But my question is, how can I aggregate a basic web3 function (that is not a part of any contract) too using Multicall?

In my case, I want to get multiple transaction receipts/timestamps (using the web3.eth.get_transaction_receipt() or web3.eth.getBlock().timestamp function) via a single API call.

Would it be possible for them or any other basic non-contract functions such as web.eth.eth_balance() to be used with the Multicall feature?

1 Answer 1

1

I will give you an example. Imagine you want to get balances of 100 addresses.

There are two general options:

  1. Your Backend/Frontend calls blockchain a 100 times.

  2. You write a SmartContract function that receives an array of 100 addresses and in turn returns an array of 100 corresponding balances.

The second option is the way to go.

1
  • Thank you for the answer. Do you know any public SmartContract which returns the timestamp of a block (similar to web3.eth.getBlock().timestamp), that I can directly use? Aug 4 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.