Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send tokens to multiple accountsin bulk #6524

Closed
bigbulb opened this issue Mar 30, 2024 · 1 comment
Closed

How to send tokens to multiple accountsin bulk #6524

bigbulb opened this issue Mar 30, 2024 · 1 comment
Labels
question Further information is requested

Comments

@bigbulb
Copy link

bigbulb commented Mar 30, 2024

Hello,
I am following the tutorial to send a token to a specific recipient (https://spl.solana.com/token#example-transferring-tokens-to-an-explicit-recipient-token-account).
Below is the code that works where I can send the transactions 1 by one, but it would take forever for large amounts of wallets.

const walletsTo = [wallet1, 'wallet2, 'wallet3'...]


  walletsTo.forEach(async function (addressTo) {

    const toWallet = new PublicKey(addressTo);

    const toTokenAccount = await getOrCreateAssociatedTokenAccount(
      connection,
      fromWallet,
      new PublicKey(mintToken),
      toWallet
    );

    let signature = await transfer(
      connection,
      fromWallet,
      fromTokenAccount.address,
      toTokenAccount.address,
      fromWallet.publicKey,
      1
    );

    console.log("Signature tx: ", signature);
  });

Is there a way to do the same but send the token to dozens or hundreds of recipients by batching the transactions?

@joncinque joncinque added the question Further information is requested label Mar 30, 2024
Copy link
Contributor

Hi @bigbulb,

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of Solana itself.

Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with Solana itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask


This automated message is a result of having added the ‘question’ tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants