With 100% segwit transactions, what would be the max number of transaction confirmation possible on a block?
And, how many utxo can be updated by a block full of segwit transactions?
With 100% segwit transactions, what would be the max number of transaction confirmation possible on a block?
And, how many utxo can be updated by a block full of segwit transactions?
Very interesting question, let's see what the smallest transaction we can build is. For it to be minimal it has to be a single input and a single output. The non-segwit part would look something like this:
0x00
)0x0014{20-byte keyhash}
)This sums up to a total of 82 bytes for the non-witness part. So with a total non-witness blocksize of 1 million bytes we get a maximum of 12195 transactions. Assuming that all spent outputs were P2WPKH the witness part for each transaction consists of two pushes: one for the signature and one for the pubkey. These are around 72 bytes and 33 bytes long, and each need a length prefix of 1 byte. Additionally there is 1 byte witness version. So the total witness size is 108 bytes. With 3 MB of space in the witness block left, this brings us to about 27777 witnesses per block. So the limiting factor is the space in the non-witness part of the block, so that's the final number that we should consider.
Notice that I used the non-segwit serialization for the non-segwit part since that is what non-upgraded nodes will enfore. Notice also that this is an extreme example, since most transactions are not single-input-single-output. A corresponding non-segwit transaction would have a size of 192 bytes, which, together with the 1MB size limit brings us to 5208 transactions per block, compared to 12195 max segwit transaction per block.
The second part of your question regarding maximum UTXO in a block is rather easy. We'd like to amortize the overhead from the transaction structure, and maximize inputs + outputs. Since inputs are larger than outputs we will simple use a single input and compute the maximum number of outputs that fits in a block which is 32256. Since the outputs are non-segwit data, it also changes minimally from before the segwit activation (only the signature from the one input is moved to the segwit part). Therefore the maximum UTXO churn is 1 UTXO gets removed, 32256 get added. For comparison, without segwit the maximum number added was 32252. Notice that there may be other limits that I haven't considered, but this definitely are the upper limits, and these limits are unlikely to have changed during the activation of segwit.
SIGHASH_ALL
, which is the most common use. Since we have just a single input and a single output, this also matches SIGHASH_SINGLE
.