This case study details creating a script for transferring NFTs on Polygon, using an ERC721-compatible contract. It selects random tokens and sends them to predefined addresses, considering gas prices and a configurable threshold.
Client & product
The client sought a solution to automate the distribution of NFT tokens from an existing smart contract on the Polygon blockchain. The goal was to efficiently and randomly transfer tokens to a predefined list of receiver addresses while ensuring that gas prices remain within a specified threshold. DevCom intended to provide this solution as an open-source project.
The main challenge was to create an automated process that could randomly select NFT tokens from a collection and distribute them to receiver addresses, all while considering gas prices and adhering to a configurable gas price threshold. This required seamless interaction with the Polygon blockchain, continuous monitoring of gas prices, and efficient error handling in case of transaction failures or high gas prices.
The proposed solution involved building a NodeJS script that utilized the Ethers.js module to interact with the Polygon blockchain. The script iteratively performed token transfers, ensuring that gas prices remained below a specified threshold. The core features of the solution included:
Iterating over a
predefined list of
gas prices against
Logging all transaction
The delivered solution provided an automated and efficient method for distributing NFT tokens on the Polygon blockchain. Key outcomes of the project included:
- ➤ A functional script capable of selecting tokens and transferring them to predefined receivers.
- ➤ Gas price monitoring and transaction validation to prevent costly transfers.
- ➤ A detailed log of transaction attempts allows for further analysis and troubleshooting.
The solution was built using the following technologies:
NodeJS platform for
Ethers.js module for
interacting with the
Additional modules for