简体   繁体   中英

paying solana transaction fee from multisig account

i have a solana smart contract with 3 signatories on solana. people deposit sol into a 'project' account. all 3 signatories have to sign using their wallets (phantom) if any sol is to be transferred out or for a number of other operations. My understanding is that the signing transaction cost will be charged to each signatory who signs? Is it possible to take this transaction cost from the 'project' account and not from each signatory?

I guess the question comes down to if a signer and fee payer can be different accounts in solana? similar question - Make a Solana program pay for the transaction

You can do so very easily leveraging Snowflake's Solana Multisig at https://safe.snowflake.so

When you create a Safe, you can select 3 signatories, and specific the number of signers required for any transaction. This will create a Safe address where you are able to store funds. Any transaction, that has been approved by the necessary signers, will use the funds within the project to pay the fee. Let me know if you have any feedback!

You can specify the feePayer by hand for any transaction, so it could be some other account. Here's a JS example:

      const from = Keypair.generate();
      const to = Keypair.generate().publicKey;
      const feePayer = Keypair.generate();
      const transaction = new Transaction({
        feePayer: feePayer.publicKey,
      }).add(
        SystemProgram.transfer({
          fromPubkey: from.publicKey,
          toPubkey: to,
          lamports: 10,
        }),
      );
      const signature = await connection.sendTransaction(transaction, [feePayer, from]);

Note that feePayer must be an account that can produce a signature, and not a program-derived address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM