-
Notifications
You must be signed in to change notification settings - Fork 3
Add Support for AirdropOp
for Bulk Distribution of Tokens
#15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test run dropping 100 tokens into 50 virtual timelock accounts.
|
This instruction is compute limited, not transaction size limited. One potential area for improvement would be to not use Initial tests for 65 transfers shows that this could be done. I suspect if we get more smart about PDA calculations, use no-std, etc... we could probably land closer to 75. This isn't a huge improvement at a cost of higher complexity but it is an option.
|
When adding multiple of these instructions into a single transaction, the transaction limit is hit at a nice round 200 airdrops :) Transfering 100 tokens to 200 accounts in one transaction:
|
Problem
Distributing tokens to numerous accounts is inefficient with the current
TransferOp
, which limits to approximately8
transfers per Solana transaction. Each transfer requires a separate signature, consuming 64 bytes of transaction message space, thereby increasing costs and reducing throughput.Proposal
Introduce
AirdropOp
, a new opcode that allows a single source timelock account to distribute identical token amounts to multiple destination timelock accounts within a single transaction. This enhancement enables up to 255 recipients per airdrop, significantly improving efficiency and scalability.Changes
AirdropOp
struct andprocess_airdrop
function to handle bulk token distribution.compact_airdrop_message
andcreate_airdrop_message
functions for message construction.Usage
Use
AirdropOp
to efficiently distribute tokens from one source timelock to multiple destinations in a single transaction, reducing the number of required signatures and lowering transaction costs.Compute Cost
An airdrop to
50
accounts consumes around190,000
Compute Units (CU). Users should keep it under 55 to ensure the transaction doesn't fail. Larger airdrops are feasible though at increased costs by requesting more CU at the transaction level.