You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And has this error: instruction spent from the balance of an account it does not own
I assume the reason, in this case, is that: the system_program checks who request the transfer and finds out the PDA, which is illegal because the PDA is not the owner of "itself", PDA cannot modify PDA's balance.
Instead, I run directly the SOL transfer in the program and it works. My theory is that the program is the owner of PDA so it can modify the SOL balance of PDA directly.
If my assumption is right, the snippet will be irrelevant when we want to transfer SOL from PDA. My suggestion is, to demonstrate the PDA signing, we can:
Show snippet for transferring token from PDA's token account
Just mention the case creating a PDA account which already has a snippet mentioned before in the previous section.
The text was updated successfully, but these errors were encountered:
Link: https://solanacookbook.com/references/accounts.html#how-to-sign-with-a-pda
I tested this snippet
And has this error:
instruction spent from the balance of an account it does not own
I assume the reason, in this case, is that: the system_program checks who request the transfer and finds out the PDA, which is illegal because the PDA is not the owner of "itself", PDA cannot modify PDA's balance.
Instead, I run directly the SOL transfer in the program and it works. My theory is that the program is the owner of PDA so it can modify the SOL balance of PDA directly.
If my assumption is right, the snippet will be irrelevant when we want to transfer SOL from PDA. My suggestion is, to demonstrate the PDA signing, we can:
The text was updated successfully, but these errors were encountered: