Re: [Bitcoin-development] [BIP] Normalized Transaction IDs

2015-05-15 Thread s7r
Hello,

How will this exactly be safe against:
a) the malleability of the parent tx (2nd level malleability)
b) replays

If you strip just the scriptSig of the input(s), the txid(s) can still
be mutated (with higher probability before it gets confirmed).

If you strip both the scriptSig of the parent and the txid, nothing can
any longer be mutated but this is not safe against replays. This could
work if we were using only one scriptPubKey per tx. But this is not
enforced, and I don't think it's the proper way to do it.

Something similar can be achieved if you would use a combination of
flags from here:

https://github.com/scmorse/bitcoin-misc/blob/master/sighash_proposal.md

But this has some issues too.

I've read your draft but didn't understand how exactly will this prevent
normal malleability as we know it, second level malleability and replays
as well as how will we do the transition into mapping the txes in the
blockchain to normalized txids. Looking forward to read more on this
topic. Thanks for the brainstorming ;)


On 5/13/2015 3:48 PM, Christian Decker wrote:
 Hi All,
 
 I'd like to propose a BIP to normalize transaction IDs in order to
 address transaction malleability and facilitate higher level protocols.
 
 The normalized transaction ID is an alias used in parallel to the
 current (legacy) transaction IDs to address outputs in transactions. It
 is calculated by removing (zeroing) the scriptSig before computing the
 hash, which ensures that only data whose integrity is also guaranteed by
 the signatures influences the hash. Thus if anything causes the
 normalized ID to change it automatically invalidates the signature. When
 validating a client supporting this BIP would use both the normalized tx
 ID as well as the legacy tx ID when validating transactions.
 
 The detailed writeup can be found
 here: https://github.com/cdecker/bips/blob/normalized-txid/bip-00nn.mediawiki.
 
 @gmaxwell: I'd like to request a BIP number, unless there is something
 really wrong with the proposal.
 
 In addition to being a simple alternative that solves transaction
 malleability it also hugely simplifies higher level protocols. We can
 now use template transactions upon which sequences of transactions can
 be built before signing them.
 
 I hesitated quite a while to propose it since it does require a hardfork
 (old clients would not find the prevTx identified by the normalized
 transaction ID and deem the spending transaction invalid), but it seems
 that hardforks are no longer the dreaded boogeyman nobody talks about.
 I left out the details of how the hardfork is to be done, as it does not
 really matter and we may have a good mechanism to apply a bunch of
 hardforks concurrently in the future.
 
 I'm sure it'll take time to implement and upgrade, but I think it would
 be a nice addition to the functionality and would solve a long standing
 problem :-)
 
 Please let me know what you think, the proposal is definitely not set in
 stone at this point and I'm sure we can improve it further.
 
 Regards,
 Christian
 
 
 --
 One dashboard for servers and applications across Physical-Virtual-Cloud 
 Widest out-of-the-box monitoring support with 50+ applications
 Performance metrics, stats and reports that give you Actionable Insights
 Deep dive visibility with transaction tracing using APM Insight.
 http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
 
 
 
 ___
 Bitcoin-development mailing list
 Bitcoin-development@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/bitcoin-development
 

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] [BIP] Normalized Transaction IDs

2015-05-15 Thread Tier Nolan
On Fri, May 15, 2015 at 10:54 AM, s7r s...@sky-ip.org wrote:

 Hello,

 How will this exactly be safe against:
 a) the malleability of the parent tx (2nd level malleability)


The signature signs everything except the signature itself.  The normalized
txid doesn't include that signature, so mutations of the signature don't
cause the normalized txid to change.

If the refund transaction refers to the parent using the normalised txid,
then it doesn't matter if the parent has a mutated signature.  The
normalized transaction ignores the mutation.

If the parent is mutated, then the refund doesn't even have to be modified,
it still refers to it.

If you want a multi-level refund transaction, then all refund transactions
must use the normalized txids to refer to their parents.  The root
transaction is submitted to the blockchain and locked down.


 b) replays


If there are 2 transactions which are mutations of each other, then only
one can be added to the block chain, since the other is a double spend.

The normalized txid refers to all of them, rather than a specific
transaction.


 If you strip just the scriptSig of the input(s), the txid(s) can still
 be mutated (with higher probability before it gets confirmed).


Mutation is only a problem if it occurs after signing.  The signature signs
everything except the signature itself.


 If you strip both the scriptSig of the parent and the txid, nothing can
 any longer be mutated but this is not safe against replays.


Correct, but normalized txids are safe against replays, so are better.

I think the new signature opcode fixes things too.  The question is hard
fork but clean solution vs a soft fork but a little more hassle.
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] Proposed alternatives to the 20MB step function

2015-05-15 Thread Rusty Russell
Tier Nolan tier.no...@gmail.com writes:
 On Sat, May 9, 2015 at 4:36 AM, Gregory Maxwell gmaxw...@gmail.com wrote:

 An example would
 be tx_size = MAX( real_size  1,  real_size + 4*utxo_created_size -
 3*utxo_consumed_size).


 This could be implemented as a soft fork too.

 * 1MB hard size limit
 * 900kB soft limit

I like this too.

Some tweaks:

1) Nomenclature: call tx_size tx_cost and real_size tx_bytes?

2) If we have a reasonable hard *byte* limit, I don't think that we need
   the MAX().  In fact, it's probably OK to go negative.

3) ... or maybe not, if any consumed UTXO was generated before the soft
   fork (reducing Tier's perverse incentive).

4) How do we measure UTXO size?  There are some constant-ish things in
   there (eg. txid as key, height, outnum, amount).  Maybe just add 32
   to scriptlen?

5) Add a CHECKSIG cost.  Naively, since we allow 20,000 CHECKSIGs and
   1MB blocks, that implies a cost of 50 bytes per CHECKSIG (but counted
   correctly, unlike now).   

This last one implies that the initial cost limit would be 2M, but in
practice probably somewhere in the middle.

  tx_cost = 50*num-CHECKSIG
+ tx_bytes
+ 4*utxo_created_size
- 3*utxo_consumed_size

 A 250 byte transaction with 2 inputs and 2 outputs would have an adjusted
 size of 252 bytes.

Now cost == 352.

Cheers,
Rusty.

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] Block Size Increase Requirements

2015-05-15 Thread Stephen
Comments in line:

 On May 8, 2015, at 11:08 PM, Peter Todd p...@petertodd.org wrote:
 
 Makes it trivial to find miners and DoS attack them - a huge risk to the
 network as a whole, as well as the miners.
 
 Right now pools already get DoSed all the time through their work
 submission systems; getting DoS attacked via their nodes as well would
 be a disaster.

It seems that using a -miner flag to follow rules about smaller blocks would 
only reveal miner nodes if one sent the node a solved block that that was valid 
in every way except the block size. While not impossible, I wouldn't call this 
trivial, as it still requires wasting an entire block's worth of energy. 

 When in miner mode, the client would reject 4MB blocks and wouldn't build
 on them.  The reference client might even track the miner and the non-miner
 chain tip.
 
 Miners would refuse to build on 5MB blocks, but merchants and general users
 would accept them.
 
 That'd be an excellent way to double-spend merchants, significantly
 increasing the chance that the double-spend would succeed as you only
 have to get sufficient hashing power to get the lucky blocks; you don't
 need enough hashing power to *also* ensure those blocks don't become the
 longest chain, removing the need to sybil attack your target.
 

I think this could be mitigated by counting confirmations differently. We 
should think of confirmations as only coming from blocks following the miners' 
more strict rule set. So if a merchant were to see payment for the first time 
in a block that met their own size restrictions but not the miners', then they 
would simply count it as unconfirmed. 

If they get deep enough in the chain, though, the client should probably count 
them as being confirmed anyway, even if they don't meet the client nodes' 
expectation of the miners' block size limit. This happening probably just means 
that the client has not updated their software (or -minermaxblocksize 
configuration, depending on how it is implemented) in a long time. 

I actually like Tier's suggestion quite a bit. I think we could have the 
default client limit set to some higher number, and have miners agree out of 
band on the latest block size limit. Or maybe even build in a way to vote into 
the blockchain. 

Best, 
Stephen
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] [BIP] Normalized Transaction IDs

2015-05-15 Thread Stephen
We should make sure to consider how BIP34 affects normalized transaction ids, 
since the height of the block is included in the scriptSig ensuring that the 
txid will be different. We wouldn't want to enable replay attacks in the form 
of spending coinbase outputs in the same way they were spent from a previous 
block. 

So maybe normalized txids should strip the scriptSigs of all transactions 
except for coinbase transactions? This seems to make sense, since coinbase 
transactions are inherently not malleable anyway. 

Also, s7r linked to my 'Build your own nHashType' proposal (although V2 is 
here: 
https://github.com/scmorse/bitcoin-misc/blob/master/sighash_proposal_v2.md). I 
just wanted to add that I think even with normalized ids, it could still be 
useful to be able to apply these flags to choose which parts of the transaction 
become signed. I've also seen vague references to some kind of a merklized 
abstract syntax tree, but am not fully sure how that would work. Maybe someone 
on here could explain it? 

Best,
Stephen



 On May 15, 2015, at 5:54 AM, s7r s...@sky-ip.org wrote:
 
 Hello,
 
 How will this exactly be safe against:
 a) the malleability of the parent tx (2nd level malleability)
 b) replays
 
 If you strip just the scriptSig of the input(s), the txid(s) can still
 be mutated (with higher probability before it gets confirmed).
 
 If you strip both the scriptSig of the parent and the txid, nothing can
 any longer be mutated but this is not safe against replays. This could
 work if we were using only one scriptPubKey per tx. But this is not
 enforced, and I don't think it's the proper way to do it.
 
 Something similar can be achieved if you would use a combination of
 flags from here:
 
 https://github.com/scmorse/bitcoin-misc/blob/master/sighash_proposal.md
 
 But this has some issues too.
 
 I've read your draft but didn't understand how exactly will this prevent
 normal malleability as we know it, second level malleability and replays
 as well as how will we do the transition into mapping the txes in the
 blockchain to normalized txids. Looking forward to read more on this
 topic. Thanks for the brainstorming ;)
 
 
 On 5/13/2015 3:48 PM, Christian Decker wrote:
 Hi All,
 
 I'd like to propose a BIP to normalize transaction IDs in order to
 address transaction malleability and facilitate higher level protocols.
 
 The normalized transaction ID is an alias used in parallel to the
 current (legacy) transaction IDs to address outputs in transactions. It
 is calculated by removing (zeroing) the scriptSig before computing the
 hash, which ensures that only data whose integrity is also guaranteed by
 the signatures influences the hash. Thus if anything causes the
 normalized ID to change it automatically invalidates the signature. When
 validating a client supporting this BIP would use both the normalized tx
 ID as well as the legacy tx ID when validating transactions.
 
 The detailed writeup can be found
 here: 
 https://github.com/cdecker/bips/blob/normalized-txid/bip-00nn.mediawiki.
 
 @gmaxwell: I'd like to request a BIP number, unless there is something
 really wrong with the proposal.
 
 In addition to being a simple alternative that solves transaction
 malleability it also hugely simplifies higher level protocols. We can
 now use template transactions upon which sequences of transactions can
 be built before signing them.
 
 I hesitated quite a while to propose it since it does require a hardfork
 (old clients would not find the prevTx identified by the normalized
 transaction ID and deem the spending transaction invalid), but it seems
 that hardforks are no longer the dreaded boogeyman nobody talks about.
 I left out the details of how the hardfork is to be done, as it does not
 really matter and we may have a good mechanism to apply a bunch of
 hardforks concurrently in the future.
 
 I'm sure it'll take time to implement and upgrade, but I think it would
 be a nice addition to the functionality and would solve a long standing
 problem :-)
 
 Please let me know what you think, the proposal is definitely not set in
 stone at this point and I'm sure we can improve it further.
 
 Regards,
 Christian
 
 
 --
 One dashboard for servers and applications across Physical-Virtual-Cloud 
 Widest out-of-the-box monitoring support with 50+ applications
 Performance metrics, stats and reports that give you Actionable Insights
 Deep dive visibility with transaction tracing using APM Insight.
 http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
 
 
 
 ___
 Bitcoin-development mailing list
 Bitcoin-development@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/bitcoin-development
 
 --
 One dashboard for servers and applications across Physical-Virtual-Cloud 
 Widest out-of-the-box 

Re: [Bitcoin-development] [BIP] Normalized Transaction IDs

2015-05-15 Thread Luke Dashjr
On Friday, May 15, 2015 9:54:55 AM s7r wrote:
 If you strip both the scriptSig of the parent and the txid, nothing can
 any longer be mutated but this is not safe against replays. This could
 work if we were using only one scriptPubKey per tx. But this is not
 enforced, ...

Assuming you mean one output per scriptPubKey (and not limiting tx to one 
output), the alternative is essentially undefined, and creates real problems 
for Bitcoin today. It's not something we should go out of the way to support 
or encourage. Therefore, regardless of whatever other options are available, I 
would like to see a scriptPubKey-only sighash type for strong safety within 
all malleability situations (including CoinJoin and other sender-respends) 
that more advanced wallet software could take advantage of in the future 
(while strictly enforcing no-reuse on its own wallet to avoid known replays).

Luke

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development