<div dir="ltr">Hi Mike,<br><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Stephen,<div><br></div><div>It&#39;s an interesting idea. I&#39;m not sure that all the combinations make sense. Excluding the connected output script or value but still signing the prev tx hash appears pointless: the script cannot change anyway, and you still need to know what it is to actually calculate the inputs to it, so what is the point of this?</div></div></blockquote><div><br></div>That&#39;s a good point, maybe SIGHASH_WITHOUT_PREV_SCRIPTPUBKEY and SIGHASH_WITHOUT_PREV_VALUE should be assumed false, since you need the data anyway. That gets the total number of flags down to 17. If we eliminate SIGHASH_WITHOUT_TX_VERSION (I can&#39;t think of any good reason for this one), then we&#39;re down to a 2-byte nHashType. SIGHASH_SIGN_STACK_ELEMENT could also be removed, I&#39;m not convinced of the usefulness of that one either.<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>I also worry that quite a few of these combinations could be unexpectedly dangerous. If you don&#39;t sign the prevout hash or value and combine it with a regular pay-to-address output then you&#39;ve effectively written a blank cheque that can be used by anyone, to claim any money ever sent to that address ... no? And then any p2p </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>node or miner could do so, making the transaction pretty useless.</div><div><br></div><div>That isn&#39;t inherently a problem as long as people understand which combinations have what effects or cannot be used for various reasons. But it would need good documentation and careful thought to explore each possibility people might use.</div></div></blockquote><div><br></div><div>I don&#39;t think it&#39;s quite a blank check, but it would enable replay attacks in the form of sending the money to the same place it was sent before if an address ever receives coins again. Almost like auto-forwarding addresses. If, in addition, you signed with just that input and no outputs as well, then you&#39;re basically forfeiting your rights to any coins sent to that address.<br></div><div><br></div><div>It allows for some dangerous combinations, but we already have some dangerous nHashTypes. e.g. SIGHASH_NONE | SIGHASH_ANYONECANPAY. Good documentation and careful developers shouldn&#39;t have any issues if they use a standard set of sighash flag combinations for their standard use cases. But developers that need special combinations can now use them, so long as they are careful and think things through.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>I&#39;ll leave the soft fork business to one side for now. I think any change in CHECKSIG or new version of it would likely be ready around the same time as the hard fork we need for changing the block size limit anyway, and it&#39;s much cleaner to do it that way.</div><div><br></div><div>The most important change that we need in sighash calculation, IMO, is ensuring that you don&#39;t have to hash data over and over again without a good reason. The current sighash definition is unfortunate because it&#39;s possible to make small transactions that involve hashing huge amounts of data. It&#39;s not clear to me that your proposal fixes that: ideally there would be one exactly one sighash for one transaction no matter how many checksigs are involved in verifying it.</div><div><br></div></div></blockquote><div><br></div><div>It&#39;s hard, though, because there is different data needs to be signed for each input. Although, I suppose if you signed your input with SIGHASH_WITHOUT_PREV_SCRIPTPUBKEY, SIGHASH_WITHOUT_PREV_VALUE, and the equivalent of SIGHASH_ALL, then the hash that needs to be signed would be the same for all of your inputs. Strangely enough, I think we might have just found use cases for the flags that we had nearly dismissed. </div><div><br></div><div>Another possibility would be to put the previous scriptPubKey and previous output value at the END of the serialized transaction, so that you could make use of some sort of a signature hash midstate. But that feels a little messy. It sort of makes sense to have a base serialization for a transaction and then append it with whatever input/output specific information you have, but still, messy.</div><div><br></div><div>Is hashing transaction data once for each input really a huge bottleneck, though? Do mobile devices have an issue with this?</div><div><br></div><div>Best,</div><div>Stephen</div></div></div></div>