Airdropping Assets and Coins with CodeChain-Helicopter

Seung Woo Kim
CodeChain
Published in
3 min readOct 2, 2018

If you are or have been involved in blockchain development, then you must be aware that one of the most important methods for token distribution is airdropping. While providing blockchain services, there may be times when one must host various events to distribute money or items to users. That is precisely why we developed CodeChain Helicopter, and in today’s post, let’s discuss what exactly CodeChain Helicopter is.

What is CodeChain Helicopter?

CodeChain Helicopter is an airdrop tool that distributes assets and coins for free. The helicopter that is responsible for distributing the assets will have a platform and asset account with CCC and various assets stored inside. We are currently running the Helicopter on our testnets, Husky and Saluki. For the sake of simplicity, only Husky Helicopter’s settings will be discussed in this article. Every 24 seconds(arbitrary value chosen for testing purposes), the Helicopter will randomly choose a target platform account to which CCC will be transferred to. Currently, the airdrop distributes 0.001 CCC per cycle. Assets are also dropped in a similar manner. However, since assets cannot be distributed in fractions, the amount of assets dropped is randomly chosen between the values of 0 to 10. Furthermore, assets are not given to random users, but dropped in a certain location, where anyone can find and claim them. Finally, the condition for transparency is met by the utilization of CodeChain Explorer. Users can easily peruse which airdrop went to which user on the blockchain.

How are CCCs distributed?

Winners are chosen through a process of simple probability. Based on each user’s current balance, the Helicopter will assign each individual a proportional winning probability. For instance, if a user called Sparrow has 2 CCC and Barbossa has 1 CCC, then the winning probability of Sparrow and Barbossa would be 66% and 33% respectively. Users can make their own platform account on CodeChain by following this guide. CCC for test usage can be obtained from the faucet site.

How are assets distributed?

The Helicopter distributes assets by randomly dropping assets that anyone can claim. To be more specific, the Helicopter will drop assets at an asset address that users can freely approach. The items dropped will have their lockscripts changed into pushb(1). Thus, anyone who first discovers an airdrop can take assets within and claim it as their own by locking those assets with their own lockscript. However, keep in mind that these airdropped assets are distributed in a first-come, first-served basis.

How to run your own Helicopter

First, go and clone this Github repository. Then copy the config directory and make a new file named production.json in the build directory.

Set the proper settings by updating the production.json file. A properly set up .json file would look something like this:

If you look closely, CCC and assets are separated into their own categories. The payer section specifies the one responsible for the CCC distribution. The oil section specifies where the assets are originating from. Also, the drop_interval is set to 12, which means that after CCC drops, it waits for 12 seconds to drop random assets. Then it would wait another 12 seconds to drop the CCC, and it would repeat this pattern. This explains why both CCC and assets are airdropped every 24 seconds.

Finally, set the environment variable $NODE_CONFIG_DIR to the directory containing your configuration files with the command:

Conclusion

We’ve discussed what the Helicopter is used for, and how exactly to configure a Helicopter to one’s liking. Currently, the Helicopter randomly distributes CCC to random platform addresses. However, asset drops happen randomly, and any user can claim it freely. CodeChain’s testnets are actively running at the time of writing this article. If you are interested in random item distribution, don’t miss out on this chance and go make your own account now to test all of Helicopter’s features.

--

--