You want to reward thousands (or millions) of users. Sending assets to each address proactively looks simple-until you see the bill. Network fees add up fast when the sender pays for every transfer.
An airdrop flips the model. Instead of the distributor paying all fees, each eligible user claims their allocation and covers the network fees themselves.The straightforward approach is to keep a precomputed mapping of recipient → allocation in the contract. When a user sends a claim message, the contract releases the preassigned drop for that user.
Keep a precomputed mapping of recipient → allocation in the contract. When a user sends a claim message, the contract releases the preassigned amount. This works until the list becomes too large, starting at roughly 3,000 entries, problems begin to surface with the external limit (see more in limits).
The airdrop contract stores a root hash of a dictionary (see hashmap) containing all allocations. Users present a Merkle proof to verify their allocation against this root.On-chain state:
Root hash (256 bits)
How to prepare:
Prepare a list of eligible recipients and their allocations, and construct a dictionary.
The airdrop contract stores a backend public key. The backend signs authorization messages for eligible users. Users present the signature to claim.On-chain state:
Backend public key (256 bits)
How to prepare:
Deploy airdrop contract with backend public key.
Backend validates eligibility criteria on demand (database, external API, business logic).
Backend signs authorization messages for eligible users.
For signature implementation details and security considerations, see signing messages.