<oembed><type>rich</type><version>1.0</version><author_name>npub1r3san9v5njl6798hvauyu9ntm6r9c7u8s0t65wls58gpfdcvqp5sa48d0u</author_name><author_url>https://nostr.ae/npub1r3san9v5njl6798hvauyu9ntm6r9c7u8s0t65wls58gpfdcvqp5sa48d0u</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2015-11-04&#xA;📝 Original message:At the first Scaling Bitcoin workshop in Montreal I presented on the topic&#xA;of &#34;bad blocks&#34; that take an excessive amount of time to validate. You can&#xA;read a transcript of this talk here:&#xA;&#xA;http://diyhpl.us/wiki/transcripts/scalingbitcoin/alternatives-to-block-size-as-aggregate-resource-limits/&#xA;&#xA;The core message was that the assumption made by the design parameters of&#xA;the system, namely that validation costs scale linearly with transaction or&#xA;block size, is wrong. In particular, in certain kinds of transactions there&#xA;are validation costs which scale quadraticly with size. For example, the&#xA;construction of SIGHASH_ALL results in each input signing a different&#xA;message digest, meaning that the entire transaction (minus the scriptSigs)&#xA;is rehashed for each input. As another example, the number of signature&#xA;operation performed during block validation is unlimited if the validations&#xA;are contained within the scriptPubKey (this scales linearly but with a very&#xA;large constant factor). The severity of these issues increase as the&#xA;aggregate limits in place on maximum transaction and block size increase.&#xA;&#xA;There have been various solutions suggested, and I would like to start a&#xA;public discussion to see if consensus can be reached over a viable approach.&#xA;&#xA;Gavin, for example, has written code that tracks the number of bytes hashed&#xA;and enforces a separate limit for a block over this aggregate value. Other&#xA;costs could be constrained in a similar whack-a-mole way. I have two&#xA;concerns with this approach:&#xA;&#xA;1. There would still exist a gap between the average-case validation cost&#xA;of a full block and the worst case validation cost of a block that was&#xA;specifically constructed to hit every limit.&#xA;&#xA;2. Transaction selection and by extension fee determination would become&#xA;much more complicated multi-dimensional optimization problems. Since fee&#xA;management in particular is code replicated in a lot of infrastructure, I&#xA;would be very concerned over making optimal behavior greatly more difficult.&#xA;&#xA;My own suggestion, which I submit for consideration, is to use a linear&#xA;function of the various costs involved (signatures verified, bytes hashed,&#xA;inputs consumed, script opcodes executed, etc.). The various algorithms&#xA;used for transaction selection and fee determination can then be reused,&#xA;using the output of this new linear function as the &#34;size&#34; of the&#xA;transaction.&#xA;&#xA;Separately, many others including Greg Maxwell have advocated for a&#xA;&#34;net-UTXO&#34; metric instead of, or in combination with a validation-cost&#xA;metric. In the pure form the block size limit would be replaced with a&#xA;maximum UTXO set increase, thereby applying a cost in extra fee required to&#xA;create unspent outputs. This has the distinct advantage of making dust&#xA;outputs considerably more expensive than regular spend outputs.&#xA;&#xA;For myself, I remain open to the possibility of adding a UTXO set size&#xA;corrective factor to a chiefly validation-cost metric. It would be nice to&#xA;reward users for cleaning up scattered small output, reward miners for&#xA;including dust-be-gone outputs, and make spam attacks more costly. But&#xA;doing so requires setting aside some unused validation resources in order&#xA;to reward miners who clean up the UTXO, which means it widens the gap&#xA;between average and worst case block validation times. Also, worry over the&#xA;size of the UTXO database is only a concern for how Bitcoin Core is&#xA;currently structured -- with e.g. UTXO or STXO commitments it could be the&#xA;case that in the future full nodes do not store the UTXO and instead carry&#xA;proofs of their inputs as prunable witness data. If we choose a net-UTXO&#xA;metric however, we will be stuck with it for some time.&#xA;&#xA;I will be submitting a talk proposal for Scaling Bitcoin on this topic, but&#xA;I would like to get some feedback from the developer community first.&#xA;Anyone have any thoughts to add?&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20151104/036ee438/attachment.html&gt;</html></oembed>