Tools for running airdrop and token distribution campaigns on the Solana blockchain.

Overview

samoyed logo

Overview

This repository contains some of the scripts we have used for running our airdrop campaigns and other distributions.

Initially, all of these were made purely for internal use and there were little to none UI considerations. However, as we decided to release these publicly, we have made some improvements on that front. We also created accompanying README documents that will hopefully allow you to use these in your own projects without issues.

Before using our scripts, we strongly recommend that you get to grips with the mechanics of using the tools on Solana's testnet/devnet before doing any live mainnet transactions. Any mistakes you make there are completely harmless and will serve as a learning experience.

Built with

Everything was written and tested on a Linux-based 64-bit system running Ubuntu 20.04 and Python 3.8.5. These tools should also work on other Linux distros and MacOS systems, but they will definitely not run on Windows. If you are on a Windows machine, we recommend looking into WSL and WSL2.

All tools currently available are built with python3 and no external modules or packages, but they are dependant on having local installations of Solana CLI tools available on the PATH.

Below are links on the installation steps for solana-cli and spl-token-cli tools:

If you haven't used these tools before, we would recommend following along with the documentation, as it explains some basic usage scenarios that will familiarize you with them.

Available tools

Tools Description
address-fetcher Fetching addresses of token holders and accounts
flat-distributor Distribute a fixed amount of tokens
proportional-distributor Distribute a proportional amount of tokens

The accompanying README for each tool is located in its directory. Refer to them for usage examples.

Issues

Feel free to report any issues you encounter while using these tools, or ideas you may have for improvement. We will try to help out with any problems when we can, but understand that these tools were made for private use and there might be usage scenarios that we never thought of or got around to testing.

License

Distributed under the MIT License

Links

Contact me on Discord: praskOo#0892

Comments
  • fix flat-distributor.py

    fix flat-distributor.py

    Fix options

    context

    If my understanding is correct, this options leaves flexibilities to add arguments like --fund-recipient and --allow-unfunded-recipient for spl-token command.

    issue

    Without this modification, the to_str() will fail because the self.options is always None It is not a critical bug, but maybe worth to fix it.

    Fix csv header of unconfirmed log:

    lu.write('recipient,amount,error') -> lu.write('recipient,amount,error\n')

    opened by leafwind 3
  • Flat-distributor: cancelling airdrop

    Flat-distributor: cancelling airdrop

    Hi, it seems that I'm not able to perform the airdrop with flat-distributor, I've double checked everything and the env is correct, mint address, solana address etc.

    The error I'm getting is:

    Running the airdrop in non-interactive mode. The airdrop will run without additional confirmations.
    --------------------------------------------------
    Enter Y to proceed
    > y
    Log file handlers closed.
    Cancelling the airdrop.
    

    this happens instantly and quits. Nothing in the logs

    opened by k666-bit 2
  • Merge funding-options feature

    Merge funding-options feature

    Allow users to use --fund-recipient and --allow-unfunded-recipient flags in the transfer sub-command of distributor tools. Both flags behave in the same manner as they do in the spl-token transfer command.

    • --fund-recipient - if an address doesn't own an associated token account, the sender will create one (and fund it, this costs a bit of SOL!)
    • --allow-unfunded-recipient - complete the transaction, even if the recipient has 0 SOL on their balance.

    check-before and check-after sub-commands have been adjusted to better account for this use-case.

    enhancement 
    opened by praskoson 1
  • fix proportional-distributor.py

    fix proportional-distributor.py

    FYI, all the fixes are the same as #1

    Fix options

    context

    If my understanding is correct, this options leaves flexibilities to add arguments like --fund-recipient and --allow-unfunded-recipient for spl-token command.

    issue

    Without this modification, the to_str() will fail because the self.options is always None It is not a critical bug, but maybe worth to fix it.

    Fix csv header of unconfirmed log:

    lu.write('recipient,amount,error') -> lu.write('recipient,amount,error\n')

    opened by leafwind 1
  • Improved duplicate removal code.

    Improved duplicate removal code.

    Duplication removal is now done immediately after fetching the raw address data.

    This still only affects owner type addresses. A different solution is needed to better handle multiple token addresses that belong to the same account.

    Resolves #5

    bug 
    opened by praskoson 0
  • Hotfix handle 429 timeout

    Hotfix handle 429 timeout

    Implement a --retry-on-429 option for distributors when using transfer sub-command.

    This was previously the default behaviour, but we learned that if spl-token transfer returns a HTTP Too Many Requests error (429), this is not a guarantee of a failed transaction. This is a bug in how spl-token handles those errors and according to Solana developer support, a fix is on the way.

    A transaction happening despite this error is rare, but it can happen. The safe way to treat this error is to consider the transaction as unconfirmed, until the error is fixed in spl-token. The --retry-on-429 option will use the old behaviour, where the tool retried the transaction if it encountered this error.

    bug 
    opened by praskoson 0
  • Issue when handling HTTP Too Many Requests (429) error

    Issue when handling HTTP Too Many Requests (429) error

    When a HTTP 429 error is received while transferring tokens, the distributor attempts to retry the transfer. In rare cases, the transaction is completed regardless of the error. A possible explanation is that the error happens while polling the transaction status, according to Solana developer support.

    ATM there is no clear solution other than to handle a 429 error as an unconfirmed transaction, even though this happens very rarely.

    opened by praskoson 0
  • Estimated drop

    Estimated drop

    Print the number of addresses that are being dropped to (flat-distributor and proportional-distributor) and print the estimated total tokens to be dropped (flat-distributor˙).

    enhancement 
    opened by praskoson 0
  • Address fetcher sorting issue

    Address fetcher sorting issue

    address-fetcher is supposed to sort the address - balance pairs by the current balance amount in the address-list-balance.txt file.

    When using owner type addresses, the tool sums up the balances of all pairs that have the same owner address (this happens when an owner account owns multiple token accounts, likely because of trading on some dex). Those address - balance pairs are sometimes not sorted properly.

    E.g. when fetching Samoyed owner addresses:

    3o35HGWTqvkTUX77CZN4VrFg1xAzZrTqs2oEGxRSvjNm,6472.0
    AVYXwvrJLCdqJ1dEKieTnpQHvndT2ef5wwhPTULqfFBd,10431.0
    2bn5FRNy3SD2udDxkW6oQY1ghSY3buxForh6BKsagyis,6459.0
    

    AVYX... account owns 2 SAMO token accounts.

    A simple solution would be to sort the list again after summing up the duplicate balances, but this might impact performance.

    bug 
    opened by praskoson 0
  • App doesn't exit when missing parameters

    App doesn't exit when missing parameters

    When either distribution tool (proportional-distributor or flat-distributor) is started without any parameters and without a config file, it will still prompt for the RPC API URL, token address and token decimals before exiting.

    ./flat-distributor.py
    
    Select an endpoint
    1. https://api.mainnet-beta.solana.com
    2. https://api.testnet.solana.com
    3. https://api.devnet.solana.com
    Select an option:
    > 1
    
    Enter the token mint address:
    > aaaa
    
    Enter the number of token decimals:
    > 8
    No mode selected, use -h
    
    bug 
    opened by praskoson 0
  • Can't start the address-fetcher.py

    Can't start the address-fetcher.py

    I use macOs 11.6 (Big Sur) When running the python script I got this error

    % ./address-fetcher.py 
    Traceback (most recent call last):
      File "./address-fetcher.py", line 4, in <module>
        import requests
    ModuleNotFoundError: No module named 'requests'
    

    Do I need to deploy some depencies to be able to run the script?

    opened by cdric 1
Releases(v0.2.1)
  • v0.2.1(Jun 15, 2021)

    Includes address-fetcher, flat-distributor and proportional-distributor. This is not a build, just a package with all the tools and readmes.

    Changelog

    • Bugfixes
      • address-fetcher will correctly eliminate duplicates and sort owner type addresses according to their total balance (#5)
      • Added a --retry-on-429 option (this was previously the default behaviour) to distributors when using transfer sub-command (#13)

    Check the PR #14 for more information on the --retry-on-429 option. Using it will keep the old behaviour of transfer, but in rare cases it can result in a duplicate transaction. When Solana rolls out their fix, this will not be an issue anymore.

    UPDATE Solana released spl-token version 2.0.12 which handles 429 Too Many Request errors with exponential backoff, meaning that the --retry-on-429 option is obsoleted. You can update spl-token with solana-install update and you shouldn't see those errors any more.

    Source code(tar.gz)
    Source code(zip)
    distribution-tools-v0.2.1.zip(23.89 KB)
  • v0.2.0(Jun 12, 2021)

    Includes address-fetcher, flat-distributor and proportional-distributor. This is not a build, just a package with all the tools and readmes.

    Changelog

    • Features
      • Short option (-t) for specifying address type (available in all tools, #11)
      • Show the estimated total drop amount when running distributors (#7)
      • Allow usage of --fund-recipient and --allow-unfunded-recipient options with distributors (#8)
    • Bugfixes
      • Fixed CSV headers in log files for unconfirmed transfers (thanks @leafwind, #3)
      • Exit immediately when there is no config or console params in distributors (#4)
    Source code(tar.gz)
    Source code(zip)
    distribution-tools-v0.2.0.zip(23.52 KB)
  • v0.1.0(Jun 4, 2021)

Owner
Hello there
null
A discord bot to crop an NFT image living on the Solana blockchain.

NFT Discord Cropper This discord bot crops an NFT in your set measures by getting it through the .cache file which has been used to make a candy machi

Rude Golems 7 Mar 21, 2022
Token drop template on Tezos blockchain, based on Merkle Tree Distribution mechanism.

?? Token Drop Template This is a template to perform token drops efficiently on Tezos blockchain. The drop is handled using Merkle Tree Distribution m

Anshu Jalan 5 Oct 11, 2022
Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) consensus algorithm.

Ceres Combine-Harvester Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) c

null 38 Nov 14, 2022
Ethereum ETL lets you convert blockchain data into convenient formats like CSVs and relational databases.

Python scripts for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions.

Blockchain ETL 2.3k Jan 1, 2023
seno-blockchain is just a fork of Chia, designed to be efficient, decentralized, and secure

seno-blockchain https://seno.uno Seno is just a fork of Chia, designed to be efficient, decentralized, and secure. Here are some of the features and b

Denis Erygin 27 Jul 2, 2022
A little side-project API for me to learn about Blockchain and Tokens

BlockChain API I built this little side project to learn more about Blockchain and Tokens. It might be maintained and implemented to other projects bu

Loïk Mallat 1 Nov 16, 2021
This is simple Blockchain ,miner and wallet to send crypto using python

pythonBlockchain-SImple This is simple Blockchain ,miner and wallet to send crypto using python It is simple Blocchain so it can only dobasic work usi

null 3 Nov 22, 2022
J. Brandon Walker 1 May 13, 2022
Learn Blockchains by Building One, A simple Blockchain in Python using Flask as a micro web framework.

Blockchain ✨ Learn Blockchains by Building One Yourself Installation Make sure Python 3.6+ is installed. Install Flask Web Framework. Clone this repos

Vaibhaw 46 Jan 5, 2023
blockchain address database

Blockchain Address Ownership Database The database is in data/addresses.db This is a SQLite database of addresses from several blockchains. It's obtai

null 37 Nov 26, 2022
A repository for Algogenous Smart Contracts created on the Algorand Blockchain.

Smart Contacts Alogrand Smart Contracts using Choice Coin. Read Docs for how to implement Algogenous Smart Contracts for your own applications. Smart

Choice Coin 3 Dec 20, 2022
A repository for Algogenous Smart Contracts created on the Algorand Blockchain.

Smart Contacts This Repository is dedicated to code for Alogrand Smart Contracts using Choice Coin. Read Docs for how to implement Algogenous Smart Co

Choice Coin 3 Dec 20, 2022
High Performance Blockchain Deserializer

bitcoin_explorer is an efficient library for reading bitcoin-core binary blockchain file as a database (utilising multi-threading).

Congyu 2 Dec 28, 2021
Python implementation of a blockchain.

The goal of this project is to explain and to make clearer how is a blockchain structured at the very core. It's not built with the intention to replicate an advanced blockchain like Bitcoin or Ethereum

Rahul raikwar 5 Jan 28, 2022
An BlockChain Based solution for storing the medical records

Blockchain-based Medical Records ?? Abstract Blockchain has the ability to keep an incorruptible, decentralized, and transparent log of all patient da

Yuvraj Singh Deora 3 Jan 14, 2022
A workshop to build an NFT smart contract on the polygon blockchain

Polygon NFT Workshop This is an interactive workshop that guides you through the steps to deploy an NFT smart contract on the Polygon blockchain. By t

Banjo Obayomi 56 Oct 14, 2022
Blockchain Python Implementation

Blockchain Python Implementation

0918nobita 2 Nov 21, 2021
Accounting Cycle Program with Blockchain Component

In the first iteration of my accounting cycle program, I talked about adding in a blockchain component that allows the user to verify the inegrity of

J. Brandon Walker 1 Nov 29, 2021
Best blockchain in the world

alphachain Best blockchain in the world!!! Can be used to implement Layer 2 cryptocurrency protocol just click alphachain.py and it will execute autom

Niño Sison 0 Feb 18, 2022