I've created a Python script that creates a wallet and monitors all SPL transactions of this wallet.

Using an example to illustrate the problem:

The generated public key belongs to account A with owner "System Program" (1111...).

SPL tokens sent to account A ended up in account B. Account B has owner "Account A". Actually not a problem, because funds are shown in account A.

This went on for a while, until suddenly SPL tokens did not end up in account B, but in account C. Account C has owner "Account B".

Account A (Owner: System Program)   <-- generated with Python script
|- Account B (Owner: Account A)     <-- SPL tokens sent to account A (or B) end up here
|-- Account C (Owner: Account B)    <-- ?

I've several questions now:

  1. Why did this happen?
  2. How can I access the funds that are now in account C?
  3. Is there a way to prevent this from happening (i.e. creation of account C)?
  • You say "spl tokens": Are the tokens in B and C of the same token mint?
    – Ahri
    Commented Jan 10 at 1:32
  • 1
    Also suggest reading through this, will answer 1. and likely 2. and 3. of your question too: solana.stackexchange.com/questions/139/…
    – Ahri
    Commented Jan 10 at 1:34
  • @GuiomarRaissa, yes, they are the same token mint/SPL token.
    – theb
    Commented Jan 10 at 8:33
  • Could it be that an SPL token sent to account A ends up in account B (ATA of account A), but if someone would send it to account B, it would end up in account C (ATA of account B), and this would go on, i.e. SPL token sent to account C would end up in account D (ATA of account C), SPL token sent to account D...?
    – theb
    Commented Jan 10 at 9:27
  • Yes, this is what happened. I've added it as an answer.
    – Ahri
    Commented Jan 10 at 9:43

1 Answer 1


Since you mentioned it's the same mint for both ATAs, you're dealing with a nested ATA. This question gives some more info on these and how to recover funds from them. To avoid this happening in the future, make sure that the account you're sending to is not already a token account itself. More info on how to perform this check here.

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.