I need to create a program where only 1 wallet signs and pays all transactions.


pub struct SignupUser<'info> {
    #[account(init, payer = authority, space = 8 + 40 + 120  + 32)]
    pub user_account: Account<'info, UserState>,
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,

In this case, I want my wallet to pay for all the users that will be registered.

How can I do that?

1 Answer 1


Without exposing your secret key, your best options is for the program to have a pool of funds (under the program's authority, typically owned by a PDA), and this pool transfers the user some funds to compensate for the account creation fee.

In your case, user will still be the payer/authority, they will pay the account init fee, then you can transfer them funds from some pool like:

    fn transfer_context(&self) -> CpiContext<'_, '_, '_, 'info, Transfer<'info>> {
            Transfer {
                from: self.some_pool.to_account_info(),
                to: self.user_account.to_account_info(),
                authority: self.authority_pda.clone(),

  • But I want my wallet to pay all the transactions, instead of the user Commented Jul 6, 2023 at 22:59
  • Then you would have to expose your secret key, since only the keypair that signs the tx can pay the tx fee and account init fees. A PDA can sign for a transfer, which lets you refund that fee without exposing your key. If you refund the user's fee in the same tx, they won't notice the difference.
    – Whiteseal
    Commented Jul 7, 2023 at 18:32
  • If you absolutely must pay for the transaction fees, and you don't want to expose the private key, you can setup a service, like a web API, which takes a user instruction, and then your secret key sets itself as the fee payer, signs it, and sends it to the chain itself
    – Jon C
    Commented Jul 10, 2023 at 10:07

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.