Party Penguins — The Airdrop

One of the biggest yet ?

Party Penguins
4 min readAug 14, 2021
Party Penguins

We did something we’re scared will give our mums a heart-attack if we ever told them how much we spent in transaction fees 🙂

Last week, we airdropped almost 3000 penguins to the Party Penguins community at a cost of 10.7 ETH ($30,000+) in gas fees alone. The gas was pretty crazy at the time because of the London hard-fork, but we felt it needed to be done because it was in the best interest of the community. You can read more about that announcement here.

These Party Penguins were worth 43 ETH at the time of airdrop (at an effective 0.015 ETH price with the BOGO offer we ran); and these free Party Penguins are worth AT LEAST 1350 ETH (or ~$4.5m) at floor price at the time of writing this blog post. Some Party Penguins have rarer traits and are worth a lot more, but let’s just account for the floor price for the sake of simplicity, shall we?

We thought of penning down some of the technical details on how we managed to do this, because in all the time we’ve spent being part of so many brilliant NFT communities so far, we haven’t seen gas that’s been paid for airdrops at this scale before. Here goes:

airdrop costs

So, at the time of snapshot, 3031 were penguins minted, out of which 157 were in the team wallets(due to an early floor buyback by us). That meant, airdropping 2874 penguins to 655 different holders. Here’s the sheet with all the details

We had estimated spending around 12 ETH for all the airdrops, assuming the gas price of 30~35 Gwei. The initial 5–6 airdrops were done directly through Remix IDE, manually, at times when the average gas was around 22–24 Gwei.

But, manual execution was not feasible to complete the rest of the airdrops. So, I wrote a script which automatically airdrops when the gas prices are low.

First, a bit about our smart contract. There were 2 things I chose to do in our mint function, which turned out to be good decisions w.r.t airdrops.

PartyPenguins smart contract — mint function

First, the mint function accepts a _to address, so we could essentially mint the penguins directly to a wallet, instead of minting and transferring it(which would use slightly more gas).

Second, owner of the contract can mint penguins for a price of 0 ETH. So, the only amount we had to keep in our owner wallet was the gas that would be used in minting. Even though we minted and airdropped 43 ETH(at time of airdrop) worth of penguins, we didn’t have to keep that amount in our wallet.

Setup code

We start by some setup code to be used by all the scripts ahead

setup_code

We initialise the contract and owner addresses, our infura key and private key path. Be very careful while handling private keys to locally sign transactions, do not code them directly in any scripts. We used a shortened ABI of the contract, only using the mint function which would be used for the airdrop.

Simple airdrop transaction in js

Following is a simple airdrop script which does the same manual transaction done in remix, only programmatically and hands free.

airdrop.js

The function airdrops count penguins to to_address at a given gas_price. We used Infura to broadcast a locally signed transaction over the network.

Automated low cost Airdrop

Lastly, we need a controller function to perform the airdrops when gas is low. It would check the current gas prices and decide whether to do the airdrop or wait. If the gas price is within a given limit, it will try and execute the airdrop and record the result, else, it just sleeps for sometime and tries again.

airdrop_all.js

The main controller function takes 3 parameters

  • max_gas_gwei, the maximum gas price that will be used for an airdrop
  • multiplier, used to prioritize our transaction over the current average gas price. Use higher values to speed up transactions.
  • sleep_seconds, the no. of seconds the script will sleep before checking gas prices again.

The complete code snippet for automated airdrop can be found in our github repository. Do not blindly copy paste the code snippets, these were modified for demonstration purposes, and are not production level code you can use.

Join the penguin party !!
Website: https://partypenguins.club/
Twitter: https://twitter.com/PartyPenguinNFT
Discord: https://discord.gg/PartyPenguins
OpenSea: https://opensea.io/collection/party-penguins

Follow the team !!
Dev: https://twitter.com/pengwin_potter
Designer: https://twitter.com/rozi_525

--

--

Party Penguins
Party Penguins

Written by Party Penguins

9,999 unique penguins ready to party in the coolest NFT project.

No responses yet