DEV Community

Mike Ng for AWS Community Builders

Posted on

How to send large batch transaction to EVM-based blockchain network using AWS serverless service

This article is just a start, there will be more updates coming up like extracting the gas fee wallet to a separate wallet either using the private key in Secrets Manager or the KMS key and also setting up multiple workers for the minting process in the ERC721 smart contract. Which enables a higher volume of transactions executions performance.

This article illustrates sending a large batch of transactions from a single EOA on any EVM-based Blockchain network.

The entire solution used Lambda, Step Function, and SQS. At first, this solution will keep it simple as possible and continue to update.

To get started on this solution, please make sure you have development experience with any EVM-based blockchain network and ether.js.

As we all know, when sending transactions on any EVM-based blockchain will have a nonce. The nonce is the number of transactions sent from a given address which acts as a one-time code that prevents replay attacks or double-spending.

This means when sending batch transactions in an EVM-based blockchain, you have to wait until the recently sent transaction has been mined in the latest block, then you can get the latest nonce and send the next transaction.

If the application is sending the transaction in a synchronous manner, the overall performance and execution experience will be very poor. This means the entire transaction-sending process must be refactored and extracted to become an asynchronous process.

Image description

This solution has used a FIFO queue to ensure the transaction has been sent in an absolute order for processing. The example ERC-721 has been written to demonstrate large batch or minting process execution in Lambda function.

For the detail configuration and setting you can see directly in the CDK Github repository.

Top comments (0)