0

There's a similar question here. I've read it but still got some questions.

I know the transaction fee is simply lamports_per_signature * number_of_signatures (plus a little miner tip). However, what is number_of_signatures exactly?

Inside the transaction data, we should specify an array of accounts, denoting which accounts are to be used in this transaction. I'm wondering what number_of_signatures is in each of the following cases:

  1. There are 2 accounts in the array and both are signers. However, these 2 accounts are in fact the same account. i.e., I'm passing duplicated accounts.
  2. There are 2 accounts in the array, and the first is signer, the second is not. These 2 accounts are actually the same too.
  3. There are 3 different accounts in the array. The first is signer, the second is not and it's a PDA. The third is a program account. Inside one of the instructions, the program performs a CPI to the third account, and the second account (PDA) becomes a signer.
2
  • See Trent's response here from prior thread: solana.stackexchange.com/a/2201/10959 Commented Mar 13 at 15:50
  • @RexSt.John Thanks! But the response author only describes how lamports_per_signature is dynamically changed. Seems it does nothing with my question
    – Yan
    Commented Mar 14 at 1:33

1 Answer 1

1

number_of_signatures is the number of unique signatures in the transaction that must be verified by the runtime. An account can only sign a transaction once. Given that, here are the answers:

  1. The two accounts are deduplicated when the transaction's "message" is compiled, so only one signature is produced
  2. Same thing here, only one signature is produced
  3. PDAs do not produce signatures, which is why you'll sometimes see that a PDA's "signature" is designated in quotes. This means you'll only have one signature.

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.