I am wondering how many times ECDSA digital signature are used across transactions in one block.
Let's take for example Block #735,273. It contains 405 transactions. My understanding is that each transaction should have the same number of signatures as the inputs. If there is one input in a transaction then just one signature, if two then two. Are there any additional situations that digital signatures are used?
I saw some post saying that digital signature takes up 20-40% of the block size, and I am wondering where these signatures are?
2 Answers
You are right, transactions can have multiple inputs, but you are missing that inputs can also have multiple signatures! You may have heard of multisig addresses: they can require a quorum of multiple keys to sign off on spending a UTXO.
For example transaction 466fff41…1a1e82a5 from Block #735,273 has 122 inputs and each of those inputs spends a 2-of-2 P2SH output. The transaction has 244 signatures. So, you not only have to count the transaction inputs in a block, but also count additional signatures due to multisig.
Generally, signatures are fairly sizeable: serialized ECDSA signatures usually have a length of 71-72 bytes. Even when the signatures are discounted against the block weight due to being part of the witness data, the signatures have to be written to disk in full.
E.g. a 2-input-2-output P2WPKH transaction counts as 208.5 vB towards the block weight limit, but will have 372 bytes on disk. 144 bytes of that would be signatures. So, for that transaction, signatures would be about 38.7% of its data.
For the 2-of-2 transaction 466fff41…1a1e82a5 from above, about 17,570 bytes out of the data footprint of 31,516 bytes were signatures which amounts to about 55.7% of the whole transaction data.
Unfortunately, I do not have statistics on how many signatures appear in blocks in average.
In the Bitcoin blockchain, each transaction typically includes one or more digital signatures, depending on the number of inputs in the transaction. Digital signatures are used to prove that the person sending the transaction (the "signer") is the owner of the funds being spent, and to prevent the transaction from being altered once it has been signed.
In the example you gave, Block #735,273 contains 405 transactions. If each of these transactions has at least one input, then it will also have at least one digital signature. If some of the transactions have multiple inputs, then they will have multiple digital signatures. So, the total number of digital signatures in the block will depend on the specific transactions included in the block and the number of inputs in each transaction.
As for the size of the digital signatures, it is true that they can take up a significant portion of the block size. Digital signatures are typically encoded using a format called DER (Distinguished Encoding Rules), which can be quite large. In general, the larger the block size, the more digital signatures it will contain and the more space they will take up.
To answer your specific questions:
The number of digital signatures in a block will depend on the specific transactions included in the block and the number of inputs in each transaction. Digital signatures are typically encoded using DER, which can take up a significant portion of the block size. I hope this helps! Let me know if you have any other questions.