LearnBitcoin

Bitcoin Dev Archive 2011

Protocol changes

3 messages, 11 Aug 2011. Started by Mike Hearn.

Mike Hearn (2), Andy Parkins

Permalink Original thread on gnusha.org

Mike Hearn permalink original

This thread is getting off-topic so I changed the subject.

Quoted text (2 lines)
> The benefit I'm aiming at is to imagine a thin client that has done a fast
> startup and only downloaded the headers.

OK. A better way is tx filtering, as discussed here:

   http://bitcointalk.org/?topic=7972.0

The reason is you want to only get the transactions+merkle branches relevant to you, otherwise cost is still O(system activity) not O(your activity) as blocks get bigger, even if you don't download every block.

Quoted text (2 lines)
> The sequence number (and perhaps I've misunderstood) allows me to replace a
> transaction I've already submitted

Yes, but it's more complex than that.

Some contract protocols require one party in a set to be able to re-issue transactions without interacting with the other parties. The reason is that each input can come from a different person. If the sequence number was a property of the transaction, updating it would either require all participants to re-sign the transaction, or for the signatures to not cover the sequence number at all.

With seqnums on the inputs, I can create a newer version of the transaction by just resigning my input with a higher sequence number. This is defined by IsNewerThan(). Note that my options here are limited - I can't create an arbitrarily different version of the transaction without invalidating all the other input signatures. If I own all the inputs, no problem. If some are owned by others, what I can change is defined by the SIGHASH flags. To replace this tx in the memory pool requires others to re-sign their input with a higher sequence number than mine - so we establish a kind of chain. Nobody can rewind the transaction to an earlier point, but anyone can update it within the parameters established by the SIGHASH flags on the others signatures.

These features all combine together to allow for particular types of contracts that take place on the negotiating table of the networks memory pool. For instance, if you are taking part and then decide you don't wish to continue, you can set the output that's in the same position as your input to reassign all the money you put in back to you, sign the input with SIGHASH_SINGLE and broadcast with nSequence set to UINT_MAX. Now the transaction is still valid but is a no-op from your perspective. Note that once you've done this, you've bowed out of the negotiation completely because you can't replace the transaction anymore.

You can't change anything about the inputs beyond scripts this way. The transaction still has to connect to the same outputs as before, and thus import the same amount of value.

Andy Parkins in reply to Mike Hearn permalink original

On Thursday 11 August 2011 17:17:23 Mike Hearn wrote:

Quoted text (1 line)
> This thread is getting off-topic so I changed the subject.

Fair enough.

Quoted text (11 lines)
> > The benefit I'm aiming at is to imagine a thin client that has done a
> > fast startup and only downloaded the headers.
>
> OK. A better way is tx filtering, as discussed here:
>
>    http://bitcointalk.org/?topic=7972.0
>
> The reason is you want to only get the transactions+merkle branches
> relevant to you, otherwise cost is still O(system activity) not O(your
> activity) as blocks get bigger, even if you don't download every
> block.

Well okay; it seems to me that that is considerably bigger task, and I'm not sure how likely that is to appear. But that sounds workable, since my feature request is simply this filtering system with the filter set to "ALL"; so I can hardly complain about that.

Quoted text (4 lines)
> > The sequence number (and perhaps I've misunderstood) allows me to
> > replace a transaction I've already submitted
>
> Yes, but it's more complex than that.

... good stuff removed for brevity ...

Quoted text (4 lines)
> sequence number than mine - so we establish a kind of chain. Nobody
> can rewind the transaction to an earlier point, but anyone can update
> it within the parameters established by the SIGHASH flags on the
> others signatures.

I can't say I see what the point of all that added complexity is, contracts are usually more than just financial, and the ability to pick a slightly different set of source inputs doesn't seem like a hugely useful feature; but I'm willing to accept someone thinks it is a good idea and leave it at that. I withdraw my "move sequence number" feature request.

Quoted text (3 lines)
> You can't change anything about the inputs beyond scripts this way.
> The transaction still has to connect to the same outputs as before,
> and thus import the same amount of value.

What then allows the contract out of the memory pool into a chain? The locktime? No, no, forget it... I don't want to open a new can of worms.

Andy

Mike Hearn in reply to Andy Parkins permalink original
Quoted text (2 lines)
> I can't say I see what the point of all that added complexity is, contracts
> are usually more than just financial

The term "contract" is sort of misleading, but there isn't a better word for it. Satoshi called them contracts so that's what I call them too.

http://en.bitcoin.it/wiki/Contracts

The point is to allow for lower trust in certain types of transactions. For instance, consider Kickstarter. They allow people to club together to fund the creation of new things, typically indie movies and games. The problem is you need this trusted middleman to collect peoples pledges and aggregate them. That adds fees, etc. With contracts it can be done entirely with software, all the artist/game programmer would need is to run some software on their website.

Quoted text (2 lines)
> What then allows the contract out of the memory pool into a chain?  The
> locktime?  No, no, forget it... I don't want to open a new can of worms.

;)

Lock time or if every sequence number is UINT_MAX.