shuijian-xu / bitcoin

0 stars 0 forks source link

Performance of signature hashing algorithm #180

Open shuijian-xu opened 4 years ago

shuijian-xu commented 4 years ago

The signature hashing algorithm is inefficient and wasteful.

The quadratic hashing problem states that time required to calculate the signature hashes increases quadratically with the number of inputs in a transaction.

Specifically, not only will the number of hash256 operations for calculating z increase on a per-input basis, but in addition, the length of the transaction will increase, slowing down each hash256 operation because the entire signature hash will need to be calculated anew for each input.

Segwit fixes this with a different way of calculating the signature hash, which is specified in BIP0143.