I have my two accounts. Is there any way to make the second account the owner of the first account using SystemProgram.assign instructions? So that I can sign transactions with the secret key of the second account.

1 Answer 1


You can use SystemProgram.assign to make the first account owned by a program. I'm not sure if it'll let you assign to an account that is not a program (eg it could check the owner is executable). It's certainly intended for assigning accounts to be owned by a program.

But more importantly, being the owner of an account doesn't let you sign transactions for it.

Let's take the token program for example. The token program is the owner of mint accounts and token accounts. If I want to have a transaction where you send me some USDC, that'll include an instruction on the token program which modifies your USDC token account. You need to sign that transaction, the token program can't sign it for you. Your USDC token account actually is not a signer of that transaction. The token program (which owns your USDC token account) will check you've signed the transaction (since you're the authority on that token account) before modifying the account.

So I think the data flow here is a bit different to what you're thinking of. The owner doesn't sign for the accounts it owns, it modifies the data in the accounts and is responsible for making sure the expected signatures are present when it does so.

Depending what your accounts are, there's also a delegate concept in eg the token program. You can sign a transaction that allows another address to spend, say 100 USDC from your token account. This doesn't require them to own your account, the delegate can be any address. So that might be an option, the second account would be a delegate on the first account, and would be able to sign transactions that modify it to some extent. But this depends on the functionality of the program that owns the first account.

Adding more detail about the token delegate:

  • You can call the approveChecked instruction: https://solana-labs.github.io/solana-program-library/token/js/functions/approveChecked.html. You would call this with the first account as the signer and the second as the delegate. You'd specify the token mint and the amount you want the second account to be able to spend.
  • Now you can call eg the transferChecked instruction, transferring from the token account owned by the first account, with only the second account as the signer.
  • So how I can allow my second address spend something from first? Is there any example? Cause idk how to do it Feb 5 at 12:45
  • What do you mean by "something"? Are you referring to SOL, or to SPL tokens, or to something else?
    – Callum M
    Feb 5 at 14:02
  • SPL tokens, if it's possible Feb 5 at 14:41
  • I've added some detail about how it works for tokens in the answer :)
    – Callum M
    Feb 5 at 15:26
  • Oh, thanks. So i should aproove approveChecked instruction from the first acc, and then i can call transferChecked instruction and sign it from the second acc? Right? And SPL-tokens from the first my acc will transfer on the second one? By the way, param's account and delegate it's the token's account's or addresses? Feb 5 at 15:46

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.