0

how can I overcome this?

I am building a webapp that uses solana-web3js and whilst testing on devnet, I am creating 2 wallets.

airdropped 1 sol to wallet1

and want to transfer 0.1 sol to wallet2

but am getting the following error;

Transaction results in an account (1) without insufficient funds for rent

1 Answer 1

1
  1. I'd 1st recommend checking that your airdrop is actually occurring. Log the wallet you're air dropping to https://explorer.solana.com/address/$%7BWALLET_ADDRESS%7D?cluster=devnet(or transaction id of the airdrop). Just make sure that there's not an issue w/ your airdrop function. Failure could occur for a number of reasons (e.g., you've hit your rate limit on airdrops, invalid parameters, connected to wrong cluster
  2. More likely the issue is that your airdrop has not been settled before you are trying to initiate your 2nd transaction. Make sure you are confirming the airdrop transaction is finalized before proceeding to your next step. Ex:
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash()
const signature = await connection.requestAirdrop(destination, LAMPORTS_PER_SOL)
const confirmation = await connection.confirmTransaction(
                { blockhash, lastValidBlockHeight, signature },
                'finalized'
            )
// run your next steps
  1. If you are building a dApp you could build these in two-steps to avoid any race issues like this. Create an airdrop button for your devnet use case, and a separate button for running your process.
3
  • Thanks. Yes I have tried both. This is not the solution but thank you
    – Metasal
    Commented Mar 30, 2023 at 15:52
  • Is your airdrop transaction showing up in Solana Explorer? Can you share your code?
    – AMilz
    Commented Mar 30, 2023 at 21:27
  • Found the issue. I was doubling the Keypair.generate()
    – Metasal
    Commented Mar 31, 2023 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.