Reprinted from Liandeng Community Satoshi Nakamoto

In the Solana ecosystem, batch transfers are a common operation, especially when airdropping tokens or sending tokens to multiple addresses. This tutorial will show you how to perform batch transfers on the Solana network, including an introduction to the account model, the cost of batch transfers, and more.

Solana Account Model

There are three types of accounts in Solana:

  • Data account, used to store data

  • Program account, used to store executable programs

  • Native accounts refer to native programs on Solana, such as "System", "Stake", and "Vote".

Data accounts are divided into two categories:

  • All system accounts

  • Program Derived Account (PDA)

The wallet address we usually use belongs to all system accounts in the data account. We can sign with our own private key, and the system verifies whether the signature is correct. If the signature is correct, we can access the account, such as transferring money and calling contracts.

The relationship between accounts in Solana tokens

In the Ethereum series, issuing a token is to directly deploy a smart contract, and the address corresponding to the contract is the token address. But Solana is different.

The following figure shows the three accounts corresponding to the Solana token:

in:

token program: It is a program account and an executable program officially deployed by the SPL token.

Mint account: It is a token account created by the user through the token program, that is, the token minting address. This account stores the basic information of the token, such as the token supply, the address of minting and freezing permissions, and the decimal precision of the token.

Token account: refers to the user's token account. Each token holder has a specific token account, which records the balance and related information of the specific token of the holder. For example, Alice owns both USDT and Slerf tokens. She will have two token accounts, one of which records the balance of USDT and the other records the balance of Slerf. The account is created by associating the user address and the token account.

In fact, when we send tokens to a certain address, the program first calculates the token account of the token under the user address, and the balance data changes are recorded in the token account.

Solana Account Rental

In the Solana economic model, establishing a token account requires paying a certain rent to the chain. Users can also close a token account under their own address to recover the rent. When recovering, it is necessary to pay attention to the token assets being 0, otherwise the assets will be lost.

When a Solana address is receiving a token, there must be a token account created under the address to store token information, balances, etc. If the recipient does not have one, the sender can create a token account for the recipient.

The rental storage fee on Solana is 0.00000348 SOL per byte. The wallet data size is 586 bytes, and the rental fee is about 0.002 SOL.

Cost of bulk transfers

By understanding the account model above, we can know how much a token transfer transaction will cost and where these costs will be spent.

If we transfer Slerf tokens to 10 addresses, and if those 10 addresses never accept the token, then our cost is 0.02 sol, plus the on-chain fee for the transfer.

If these 10 addresses have already accepted Slerf before, the transfer cost is just a negligible on-chain fee.


How to transfer funds in batches

If you are familiar with programming, you can use the SDK provided by Solana officially. You can visit the Solana official documentation for detailed instructions and sample codes.

The following is a detailed introduction on how to use tools without programming to perform batch transfers. SlerfTools is the cheapest, fastest, and most convenient Solana one-click toolbox on the entire network. It supports coin issuance, creation of openbook market IDs, creation of Raydium liquidity, removal of liquidity, batch transactions, etc.

1. First, open the batch transfer page of SlerfTools:

2. After linking the wallet, fill in the token address and payment address list. The payment address list can also be completed by uploading a file.

3. Click Next to display the following confirmation interface

4. After clicking Send Transaction, the transfer is successful:

5. After the transfer is successful, two successful transaction hashes will appear. You can click to view them in the block browser.

It should be noted that in order to save on-chain fees and speed up on-chain speed, SlerfTools aggregates each batch of transfers into one transaction.
In order to speed up data transmission between nodes, Solana limits each transaction to 1232 bytes, and its size is limited to one MTU transmission unit of ipv6. Therefore, the number of transfers in each batch needs to be limited.

Through multiple tests, we have concluded that the optimal number of transfers per transaction is: for new addresses (i.e. addresses that have not received this token before), each batch transfer includes a maximum of 9 receiving addresses; for old addresses (i.e. addresses that have received this token before), each batch transfer can include a maximum of 19 receiving addresses. Transfer attempts exceeding these recommended numbers may result in failure.

The reason why the former is less is as mentioned in the article above. When an address that has never received this token receives a token transfer, it needs to create a token account, which takes up part of the transaction size.