Managing parallel smart contract calls in NestJS
Author: Jonasz WiÄ…cek
Problem context
Blockchain calls take a lot of time to execute. It may be few seconds for local blockchain calls, up to one minute or so on real blockchain. One of the solutions to this problem might be parallelization of requests to reduce waiting for response time.
In Ethereum every transaction has a nonce which is the number of transactions sent from a given (wallet) address. When you try to make multiple blockchain calls without manually setting the nonce it might result in:
- duplicated nonce - blockchain will revert such transaction
- misordered transactions - blockchain calls will be executed in different order which may result in incorrect results.