DIY Airdrop on Elrond using Elven Tools and erdpy.

James
6 min readJun 20, 2022

Even though the NFTs I sell have no utility, people still collect them for various reasons. Now that my 500 piece NFT collection on Elrond has minted over 60 pieces through Frame It, I wanted to find a way to send a thank you straight to the wallet of all the collectors.

How I airdropped $EGLD to collectors.

TLDR: I used Elven Tools to generate a list of addresses that were holding the NFTs from the AI Knights collection. I then used a Bash script and erdpy from the Elrond developer docs to send a transaction with a small amount of EGLD and a note to every one of those addresses.

Wanting to airdrop: I have released NFTs on multiple blockchains. The AI-Knight series is the largest so far, and I have always looked for ways to let my collectors know I appreciate them. Up until now, I was not able to find an easy-to-use tool that would allow me to find every collector who held one of my pieces, and then send them an amount of cryptocurrency along with an attached note as a “thank you”.

Even the way I found to do it on Elrond wasn’t what I would consider “easy” for your typical 1 of 1 NFT artist. It takes some basic knowledge of programming on Linux, but nothing that should scare anyone away. With a little time and sweat equity, I’m confident anyone can do it.

Elven Tools

Finding my collectors: The first thing I had to do was find out who actually collected the pieces from AI Knights. Thankfully, Elven Tools has this utility built in. It has a couple options for the output, but I went with the most basic options possible and figured I could manually pull out the individual addresses if necessary.

I won’t go into the setup or configuration of Elven Tools here. Like I said before, if you have some basic Linux skills, you should be able to muscle through it. Also, Julian (the Elven Tools creator) is very helpful if you have questions and his contact info is on his About page.

Here’s a sample of how the script works:

elven-tools collection-nft-owners 
✔ Provide the collection ticker
… EAPES-8f3c1f
✔ Do you want to exclude smart contract addresses?
› Yes
✔ Do you want to filter by metadata JSON file name? Provide names without the extension separated by a comma (example: 123,555,9999) [you can ommit that, just confirm empty]

There are 10000 tokens in that collection.
Done, 1042 addresses saved. Without smart contract addresses.

Once I had the tools installed, I ran the script and received a JSON file with every address of the collectors (I left out any pieces held in a smart contract) along with the quantity and specific NFTs they held in their wallets. This is exactly what I needed. Thanks Elven Tools!

erdpy developer tools on Elrond

Dropping $EGLD with a note: A lot of NFT projects will drop a coin specific to their project that has some utility for their holders. I focus on creating art and learning blockchain tech, so I don’t have enough time to create/manage a community. But, there’s nothing that prevents me from sending some of my profits, or possibly future NFTs, to my early collectors who have believed in me from the beginning.

There is obviously no guarantee this will happen to all of my collectors (I’m sorry!). But I’m learning the tech, and airdrops are something I have wanted to do for a while. Elrond was just the first chain that had the tools available that I could understand and use with my limited knowledge. It just so happens the AI Knight collectors were lucky enough to benefit this time around.

Now that I had all of the collector addresses, and the number of AI Knights in each address, I came up with a very tiny narrative to send along with the airdropped $EGLD. The note would say “Your AI Knights assisted with the liberation of a small neighboring territory. Each knight you sponsored received a portion of the rewards. Thank you for supporting my artwork!”

Sending bulk transactions

Lucky for me, I found a script directly in the Elrond dev docs that had the code to do this! I struggled a little bit with this script because some of the changes I was trying to make essentially broke it (my fault). After quite a few breaks, leaving the code and coming back, I got it working on the developer network. It sends a small amount of $EGLD with the narrative I wrote so the collector knows why $EGLD just appeared in their wallet.

A side benefit to doing this airdrop was it allowed me to give my early collectors a small discount on their purchased pieces while not changing the mint price of pieces or the floor price of pieces that may be listed on the secondary market.

Here’s the entire code for the airdrop. Medium code blocks don’t seem to format this very well, but at least it gives you an idea of what’s involved. (These are all fabricated wallet addresses):

# You must edit the values of MYWALLET and PEM_FILE 
# and then modify the TRANSACTIONS list.
MYWALLET="erd1sg4u62lzvgkeu4grnlwn7h2s92rqf8a64z48pl9c7us37ajv9u8qj9w8xg"
PEM_FILE="./walletKey.pem"
declare -a TRANSACTIONS=( "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 2" "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 4" "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 8" ) # DO NOT MODIFY ANYTHING FROM HERE ON PROXY="https://gateway.elrond.com"
DENOMINATION="000000000000000000"
# We recall the nonce of the wallet
NONCE=$(erdpy account get --nonce --address="$MYWALLET" --proxy="$PROXY")
function send-bulk-tx {
for transaction in "${TRANSACTIONS[@]}"; do
set -- $transaction
erdpy --verbose tx new --send --outfile="bon-mission-tx-$NONCE.json" --pem=$PEM_FILE --nonce=$NONCE --receiver=$1 --value="$2$DENOMINATION" --gas-limit=50000 --proxy=$PROXY
echo "Transaction sent with nonce $NONCE and backed up to bon-mission-tx-$NONCE.json."
(( NONCE++ )) done }

Once I had the script all set up and correctly working on the developer network, it was time for me to change the values and run it on the main Elrond network (mainnet). Even though I wasn’t going to be sending thousands of dollars, I was still very nervous about running the script with the possibility of actual monetary repercussions. My first test transaction on mainnet failed which meant I lost the transaction (gas) fee. Granted, the fee was less than $0.03 USD, but it was still money wasted due to my mistake.

After quadruple checking the code, I ran the script and watched nervously as each transaction distributed the $EGLD to the collectors. After the final transaction completed, I was able to breathe a sigh of relief. There were no failed transactions and all of the funds were distributed correctly! I couldn’t have been happier with the final result. All of my collectors received a small amount of $EGLD and a thank you note for being part of my creative journey.

Thank you: I can’t thank my collectors and readers enough for their support. My main goal is to pass the knowledge I gain from these experiences on to others while creating at the same time. Sometimes, that is really hard and other times, it’s fairly easy. Either way, I hope you learn something. Thank you again!

Good luck, have fun, and never stop learning!

James

--

--