Use this script to quickly and simply perform token airdrop from existing ERC20 Token contract on Ethereum
node
npm/yarn install
- You need to have the private key and public address of that wallet
- Send tokens you want to do airdrop to that wallet, and necessary ethers for gas usage.
- prepare the airdrop address list
- copy it into
airdrop_address.txt
- get the token contract address
- get the token contract abi from the token contract source code (you can get it on Etherscan using the contract address you get before)
- copy it into
token_contract_abi.txt
If you have setted holder address, holder key, token contract address in script, simply use this
node airdrop.js
Or you can use it in this way
node airdrop.js [Holder address] [Holder key] [Token Contract address]
A example is like this
node airdrop.js 0xC160C39E3c6De4B4E4193cAF7e0769a3E6002482 0x45dec472e5e726ecb7d81cfb08054ea7af6709d0e4be7d44e985960bfbdeedfd 0xB5bcf22CB47c9CacC504903F2c109041e91D7797
Notice that I did not provide a runnable script here, you need to replace [Holder address] [Holder key] [Token Contract address] with your own to run it.
-
When use one holder address to do airdrop, better not use this address to do other transactions at the same time because of ehthereum nonce design
-
An alternative way and more stable way is to deploy smart contract for airdrop, using this way can also avoid potential nonce issue. This will be contributed further.
-
Some important parameters can be changed in script manually. They are
AIR_DROP_GAS_PRICE
,NODE
,DECIMALS
,air_drop_amount
andAIR_DROP_GAS_LIMIT
.AIR_DROP_GAS_PRICE
by current network stausair_drop_amount
is the number of tokens you want to do airdrop for one addressDECIMALS
is the decimals of that token, often is 1e18AIR_DROP_GAS_LIMIT
is the gas limit of one airdrop transaction. Precisely gas limit can be setted according to the estimation from theestimateGas()
function oftransfer()
function.NODE
is setted to determin running airdrop on which network (public main net, public test net and local etc.)
More detailed description can be found in script comments.