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.
Challenge
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.
Solution
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
receiver addresses.Randomly selecting
tokens available
for transfer.Checking real-time
gas prices against
a configurable
threshold.Logging all transaction
attempts, successes,
and failures.
Results
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.