简体   繁体   English

从多重签名账户支付 solana 交易费用

[英]paying solana transaction fee from multisig account

i have a solana smart contract with 3 signatories on solana.我在 solana 上有 3 个签署者的 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.如果要转出任何 sol 或进行许多其他操作,所有 3 个签名者都必须使用他们的钱包(幻像)签名。 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?我想问题归结为签名者和付费者是否可以是 solana 中的不同帐户? similar question - Make a Solana program pay for the transaction类似问题 - 让 Solana 程序为交易付费

You can do so very easily leveraging Snowflake's Solana Multisig at https://safe.snowflake.so您可以在https://safe.snowflake.so上利用 Snowflake 的 Solana Multisig 非常轻松地做到这一点

When you create a Safe, you can select 3 signatories, and specific the number of signers required for any transaction.创建保险箱时,您可以选择 3 个签名者,并指定任何交易所需的签名者数量。 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.您可以为任何交易手动指定feePayer ,因此它可以是其他帐户。 Here's a JS example:这是一个 JS 示例:

      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.请注意, feePayer必须是可以生成签名的帐户,而不是程序派生地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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