Join 100,427 users already on read.cash

[HOWTO] Airdrop BCH or tokens to shareholders in SmartBCH

2 172
Avatar for norphine
Written by   32
1 year ago

Lately I've been busy developing smartindex.cash, a project that I invite you to know. I need a tool that allows me to airdrop BCH or a given token to $SIDX token holders, proportionally to the amount of tokens they have.

The initial purpose to this was to make a "dead man switch": if something happens to me, a trusted 3rd party will receive the private keys of the managed portfolio, and using this tool can simply convert all the assets in the portfolio to BCH and distribute it to token holders. Another advantage is that know token holders can vote: if they want a reward to be distributed this way instead of buying back and burning $SIDX, now it will be possible.

There are several tools in SmartBCH for making an airdrop, but as far as I know, no one to distribute rewards in a proportional way. So I developed a small Python program to take generate a list with token holders address and their corresponding reward and then pass it to https://airdrop.squidswap.cash/.

Upgraded: added support for 1BCH (2nd Dec).

Upgraded: added detection of liquidity pools in all the farms currently available on SmartBCH (27th Nov).

Upgraded: added detection of liquidity pools in Benswap farms (25th Nov). Other farms coming soon.

Upgraded: automatic detection of liquidity pools (19th Nov)

Upgraded: now added support for liquidity tools and detection for smart contract which ask for allowance

The first thing is to download the latest release.

You need to have installed Python3 to run this little app, the shell script is made for Linux but you can simply run the Python files manually if you use Windows.

So let's get started with this example: you are the AxieBCH admin and want to airdrop 1 BCH to any address holding, at least, 10 AxieBCH tokens. This is want you need to change:

Changes on sbch_eventscanner.py

Open the sbch_eventscanner.py file and change these 2 parameters:

  • Line 432: put the address of your token smart contract. In this case, AxieBCH smart contract address.

  • Line 453: put the block number where the contract was deployed. As you can see, by default is 714671, where AxieBCH was deployed.

Changes on get_airdrop_list.py

Now open get_airdrop_list.py and make the following changes:

  • Line 6: target_token_address is the smart contract address of your contract, AxieBCH in this case.

  • Line 7: in ignored addresses, you can put addresses you don't want to airdrop. For example, if you're the admin of a project, you can add your own address, so you don't airdrop yourself. The syntax is: ignored_addresses = ["address1", "address2", "address3"].

  • Line 10: amount to share. In this case, is 1 because is 1 BCH. If you're want to airdrop 100 SIDX tokens, change it to 100. It doesn't matters the kind of token it is.

  • Line 11: airdrop threshold: only addresses holding 10 AxieBCH tokens or more are qualified to get an airdrop, so it's set to 10.

  • Line 12: LP_CA_list is the list that contains the addresses for LP contracts. You don't have to do nothing here as the program will find it automatically. But if some liquidity pool is missing, you can add it manually. This can happens if one new exchange comes to SmartBCH and the tools hasn't been updated yet. How to get them? Simply, go to TokenTransferScanner and insert the address of your token smart contract. This tool will give you a list of LPs contract addresses.

We are ready to go

Now in a terminal, go to the folder where the app is and type:

chmod +x  get_airdrop_list.sh
./ get_airdrop_list.sh

This will take a while the first time, as it has to scan the blockchain to get all transfer events for our token. Once it finishes, you'll get a confirmation:

Done, airdrop list available in airdrop_list.txt

So we now have a file called aidrop_list.txt in the app folder. This list contains a list of every address and the amount of BCH/token it has to get, separate by a space:

address1 airdrop_balance_1
address2 airdrop_balance_2
address3 airdrop_balance_3
...

Now open aidrop_list.txt and copy the content. Paste this content to https://airdrop.squidswap.cash/. You'll see ETH instead of BCH, but don't worry, it will work.

One thing to keep in mind: fees! Fees on SmartBCH are low, but airdropping to a lot of addresses can get somewhat expensive. One solution is to withdraw fees from the amount to share. If you want to share 1 BCH but Metamask tell you that fees are 0.01 BCH, change the "amount to share" parameter to 0.99.

Disclaimer

This tool is offered with no guarantee. Please, test it with low amounts! It can fail while detecting some smart contract addresses, or people who has their LPs locked in farms. Feedback to solve this issues is appreciated!

Time to build!

7
$ 13.61
$ 10.04 from @Borracho_mejor
$ 3.00 from Anonymous user(s)
A
$ 0.46 from @TheRandomRewarder
+ 1
Avatar for norphine
Written by   32
1 year ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments

Great airdrop tool, it has many uses even for a non-dev. Also, thank you for the regular updates to both the tool and this write-up, I reference it often!

$ 0.00
1 year ago

Thank you! I try to do my best, the next feature should be adding support for farms.

$ 0.00
1 year ago