Skip to main content
Airdrop/batch send smart contracts are a great way to consolidate knowledge after learning a new programming language. The aim is simple: Instead of sending to multiple recipients in multiple transactions that use a lot of gas, you can send everything with one function and pay gas once. It’s all about saving fees in one clean transaction.

Building an Airdrop Package

First, you’ll need to create the project if you don’t have one already. You know the drill; execute this command and open your project in your IDE of choice.
[Terminal]
Now, declare the module like this:
[sui.move]
These are the imports you’ll need. The Coin module for working with coins and the event module for emitting events.
[sui.move]
Now, define your event struct like this:
[sui.move]
You can optionally define custom error codes. In this case, we need to make sure the lengths or the vectors match:
[sui.move]
Here’s the main function signature. It takes a coin, a list of recipient addresses, and the amounts each one should receive.
[sui.move]
Now, we can compare the lengths of the recipient vectors and amounts to ensure that every recipient has an allocation.
[sui.move]
The final piece in the puzzle is to use a loop to transfer tokens to all the recipients with the public_transfer function.
[sui.move]
In the loop, you split the coin into the amount allocated for the specific recipient before sending it. Every transfer emits an event. Best part? It’s all one transaction. One gas fee. Now build the project for some house keeping. Everything should work fine.
[sui.move]
Once it builds successfully, you can publish to the Sui network with this command.
[sui.move]
Once you’ve published you can call the function via Sui CLI like this to airdrop to multiple recipients:
[Terminal]
Replace the arguments with actual values and you’re good to go. Your recipients should recieve the coins you specify.

Conclusion

You’ve learned to execute an airdrop without spending so much on gas. Sui’s object-centric model and parallel execution engine make this kind of flow not just possible, but natural. With a single transaction, you can send tokens to dozens (or hundreds) of recipients; there is no need for multiple calls or gas fees.