LearnBitcoin

Bitcoin Dev Archive 2014

BIP - Selector Script

9 messages, 25 to 26 Apr 2014. Started by Tier Nolan.

Tier Nolan (4), Luke Dashjr (2), Peter Todd, Greg Maxwell, Mark Friedenbach

Permalink Original thread on gnusha.org

Tier Nolan permalink original

This is a BIP to allow the spender to choose one of multiple standard scripts to use for spending the output.

https://github.com/TierNolan/bips/blob/bip4x/bip-0045.mediawiki

This is required as part of the atomic cross chain transfer protocol. It is required so that outputs can be retrieved, if the process ends before being committed.

https://bitcointalk.org/index.php?topic=193281.msg2224949#msg2224949

The script allows multiple standard scripts to be included in the scriptPubKey.

When redeeming the script the spender indicates which of the standard scripts to use.

Only one standard script is actually executed, so the only cost is the extra storage required.

A more ambitious change would be a soft fork like P2SH, except the spender is allowed to select from multiple hashes. Effectively, it would be "Multi-P2SH".

This gets much of the benefits of MAST, but it requires a formal soft fork to implement.

If there is agreement, I can code up the reference implementation as a PR. The multi-P2SH might actually be easier.

Luke Dashjr in reply to Tier Nolan permalink original
I believe you meant to link here instead?
    https://github.com/TierNolan/bips/blob/bip4x/bip-0046.mediawiki

This looks reasonable from a brief skim over, but does not define any use cases (it mentions "necessary for atomic cross chain transfers", but does not explain how it is useful for that - perhaps that belongs in another BIP you haven't written yet, though). IMO, it should also require P2SH.

Luke

On Friday, April 25, 2014 6:49:35 PM Tier Nolan wrote:

Quoted text (29 lines)
> This is a BIP to allow the spender to choose one of multiple standard
> scripts to use for spending the output.
>
> https://github.com/TierNolan/bips/blob/bip4x/bip-0045.mediawiki
>
> This is required as part of the atomic cross chain transfer protocol.  It
> is required so that outputs can be retrieved, if the process ends before
> being committed.
>
> https://bitcointalk.org/index.php?topic=193281.msg2224949#msg2224949
>
> The script allows multiple standard scripts to be included in the
> scriptPubKey.
>
> When redeeming the script the spender indicates which of the standard
> scripts to use.
>
> Only one standard script is actually executed, so the only cost is the
> extra storage required.
>
> A more ambitious change would be a soft fork like P2SH, except the spender
> is allowed to select from multiple hashes.  Effectively, it would be
> "Multi-P2SH".
>
> This gets much of the benefits of MAST, but it requires a formal soft fork
> to implement.
>
> If there is agreement, I can code up the reference implementation as a PR.
> The multi-P2SH might actually be easier.
Peter Todd in reply to Luke Dashjr permalink original

On Fri, Apr 25, 2014 at 07:17:48PM +0000, Luke-Jr wrote:

Quoted text (7 lines)
> I believe you meant to link here instead?
>     https://github.com/TierNolan/bips/blob/bip4x/bip-0046.mediawiki
>
> This looks reasonable from a brief skim over, but does not define any use
> cases (it mentions "necessary for atomic cross chain transfers", but does not
> explain how it is useful for that - perhaps that belongs in another BIP you
> haven't written yet, though). IMO, it should also require P2SH.

Keep in mind that P2SH redeemScripts are limited to just 520 bytes; there's going to be many cases where more complex transactions just can't be encoded in P2SH at all.

Tier Nolan in reply to Luke Dashjr permalink original

On Fri, Apr 25, 2014 at 8:17 PM, Luke-Jr <luke@dashjr•org> wrote:

Quoted text (9 lines)
> I believe you meant to link here instead?
>     https://github.com/TierNolan/bips/blob/bip4x/bip-0046.mediawiki
>
> Yeah, sorry.

> This looks reasonable from a brief skim over, but does not define any use
> cases (it mentions "necessary for atomic cross chain transfers", but does
> not
> explain how it is useful for that - perhaps that belongs in another BIP you
> haven't written yet, though).

One use case should be enough. The atomic cross chain proposal has been discussed for a while. It feels like bitcoin works on an "ask permission first" basis.

It always stalls at the fact that non-standard transactions are hard to get confirmed on other coins. It is hard to find pools on other coins which have weaker isStandard() checks. The timeouts have to be set so that they are long enough to guarantee that transactions are accepted before they expire.

A testnet to testnet transfer is the best that would be possible at the moment.

I don't think the cross chain system needs a BIP (except to justify this one).

If cross chain transfer become popular, then it would be useful to ensure that clients are interoperable, but first things first. If the transactions aren't accepted in any chains, then everything stalls.

Secure transfers require that the malleability issue is fixed, but that is a separate issue. I am assuming that will be fixed at some point in the future, since micro-payment channels also requires that it is fixed.

Quoted text (2 lines)
> IMO, it should also require P2SH.
>

It could be restricted to only P2SH, I don't think there would be a loss in doing that.

Personally, I would make it so that P2SH is mandatory after a certain time. It makes distributed verification of the block chain easier. Everything needed to verify a script is present in the transaction (except that the output actually exists).

A soft fork that expands P2SH functionality would be even better, but I would rather not let the best be the enemy of the good.

Quoted text (51 lines)
>
>
> Luke
>
>
> On Friday, April 25, 2014 6:49:35 PM Tier Nolan wrote:
> > This is a BIP to allow the spender to choose one of multiple standard
> > scripts to use for spending the output.
> >
> > https://github.com/TierNolan/bips/blob/bip4x/bip-0045.mediawiki
> >
> > This is required as part of the atomic cross chain transfer protocol.  It
> > is required so that outputs can be retrieved, if the process ends before
> > being committed.
> >
> > https://bitcointalk.org/index.php?topic=193281.msg2224949#msg2224949
> >
> > The script allows multiple standard scripts to be included in the
> > scriptPubKey.
> >
> > When redeeming the script the spender indicates which of the standard
> > scripts to use.
> >
> > Only one standard script is actually executed, so the only cost is the
> > extra storage required.
> >
> > A more ambitious change would be a soft fork like P2SH, except the
> spender
> > is allowed to select from multiple hashes.  Effectively, it would be
> > "Multi-P2SH".
> >
> > This gets much of the benefits of MAST, but it requires a formal soft
> fork
> > to implement.
> >
> > If there is agreement, I can code up the reference implementation as a
> PR.
> > The multi-P2SH might actually be easier.
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
Tier Nolan in reply to Peter Todd permalink original

On Fri, Apr 25, 2014 at 8:58 PM, Peter Todd <pete@petertodd•org> wrote:

Quoted text (4 lines)
> Keep in mind that P2SH redeemScripts are limited to just 520 bytes;
> there's going to be many cases where more complex transactions just
> can't be encoded in P2SH at all.
>

True. Having said that, this is just a change to isStandard(), rather than a protocol change.

These transactions can already be mined into blocks.

Quoted text (17 lines)
> --
> 'peter'[:-1]@petertodd.org
> 00000000000000006407c80d5d4506a4253b4b426e0c7702963f8bf91e7971aa
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
Greg Maxwell in reply to Tier Nolan permalink original

On Fri, Apr 25, 2014 at 1:02 PM, Tier Nolan <tier.nolan@gmail•com> wrote:

Quoted text (9 lines)
>> This looks reasonable from a brief skim over, but does not define any use
>> cases (it mentions "necessary for atomic cross chain transfers", but does
>> not
>> explain how it is useful for that - perhaps that belongs in another BIP
>> you
>> haven't written yet, though).
> One use case should be enough.  The atomic cross chain proposal has been
> discussed for a while.  It feels like bitcoin works on an "ask permission
> first" basis.

You're reading that response the wrong way. It isn't in any way opposed to the specification, it's pointing out that the specification is _unclear_ about the applications, it mentions one but doesn't explain it and it wouldn't be apparent to all readers. Thats all.

It could be clarified by saying something like "allows spending to be controlled by the publication of information, for example in another transaction so that they can only be completed atomically [citation to a revision of the contracts page]".

Luke Dashjr in reply to Tier Nolan permalink original

On Friday, April 25, 2014 8:02:41 PM Tier Nolan wrote:

Quoted text (6 lines)
> I don't think the cross chain system needs a BIP (except to justify this
> one).
>
> If cross chain transfer become popular, then it would be useful to ensure
> that clients are interoperable, but first things first.  If the
> transactions aren't accepted in any chains, then everything stalls.

I think you may be misunderstanding what BIPs are. They do not force nodes to take on any given relay/mining policy (thus, BIPs should never talk about IsStandard at all). They define standard for interoperability between software. So, if you want nodes to relay these transactions, you need to convince them, not merely write a BIP for the transaction format. Defining a BIP for cross-chain trading would be one way to do that.

Quoted text (3 lines)
> Secure transfers require that the malleability issue is fixed, but that is
> a separate issue.  I am assuming that will be fixed at some point in the
> future, since micro-payment channels also requires that it is fixed.

The malleability "issue" has been known for years. I wouldn't expect any special effort made to fix it...

Quoted text (2 lines)
> A soft fork that expands P2SH functionality would be even better, but I
> would rather not let the best be the enemy of the good.

There is some ongoing discussion of a softfork to basically redo the Script language entirely, but it will take quite a bit of time and development before we'll see it in the wild.

Luke

P.S. Did the BIP editor assign these numbers? If not, best to keep them numberless until assigned, to avoid confusion when people Google the real BIP 44 and 45...

Tier Nolan in reply to Luke Dashjr permalink original

On Fri, Apr 25, 2014 at 9:26 PM, Luke-Jr <luke@dashjr•org> wrote:

Quoted text (3 lines)
> They define standard for interoperability between
> software. So, if you want nodes to relay these transactions, you need to
> convince them, not merely write a BIP for the transaction format.

I agree with you in theory, each miner could decide their inclusion rules for themselves.

In practice, if the reference client is updated, then most miners will accept those transactions. In addition, it would eventually propagate to alt-coins (or at least the supported ones).

I could simply submit the changes as a pull request for the reference client, but I was hoping that by doing it this way, it would increase the odds of it being accepted.

Quoted text (2 lines)
> Defining a BIP for cross-chain trading would be one way to do that.
>

I don't think it quite requires the same coordination in the short term. I could write up the sequence as an info BIP.

The malleability "issue" has been known for years.

Quoted text (2 lines)
> I wouldn't expect any special effort made to fix it...
>

It is possible to tweak the protocol so that it still works. However, it means that 3rd parties are required (that could go in the BIP too).

Quoted text (5 lines)
> There is some ongoing discussion of a softfork to basically redo the Script
> language entirely, but it will take quite a bit of time and development
> before
> we'll see it in the wild.
>

Implementing multi-P2SH gets a lot of the benefits of MAST, in terms of efficiency.

Quoted text (8 lines)
>
> Luke
>
> P.S. Did the BIP editor assign these numbers? If not, best to keep them
> numberless until assigned, to avoid confusion when people Google the real
> BIP
> 44 and 45...
>

Not yet, but that is just my personal repo. I did email gmaxwell, but he said that they can't be assigned until some discussion has happened.

I take your point that the name appears in the link though, so could cause issues with searching.

Quoted text (12 lines)
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
Mark Friedenbach in reply to Tier Nolan permalink original

I think you're misunderstanding the point. The way you get IsStandard changed is that you make an application-oriented BIP detailing the use of some new standard transaction type (say, generalized hash-locked transactions for atomic swaps). We then discuss that proposal for its technical merits and reach consensus about the best way to do, for example, cross-chain atomic swaps. It is then implemented.

So please, focus on some BIP(s) detailing applications of hash-locked transactions, and we will engage more constructively -- I promise that I will as cross-chain atomic swaps scratch my itch as well.

On 04/25/2014 01:48 PM, Tier Nolan wrote:

Quoted text (90 lines)
> On Fri, Apr 25, 2014 at 9:26 PM, Luke-Jr <luke@dashjr•org
> <mailto:luke@dashjr.org>> wrote:
>
>     They define standard for interoperability between
>     software. So, if you want nodes to relay these transactions, you need to
>     convince them, not merely write a BIP for the transaction format.
>
>
> I agree with you in theory, each miner could decide their inclusion
> rules for themselves.
>
> In practice, if the reference client is updated, then most miners will
> accept those transactions.  In addition, it would eventually propagate
> to alt-coins (or at least the supported ones).
>
> I could simply submit the changes as a pull request for the reference
> client, but I was hoping that by doing it this way, it would increase
> the odds of it being accepted.
>
>
>     Defining a BIP for cross-chain trading would be one way to do that.
>
>
> I don't think it quite requires the same coordination in the short
> term.  I could write up the sequence as an info BIP.
>
>     The malleability "issue" has been known for years.
>     I wouldn't expect any special effort made to fix it...
>
>
> It is possible to tweak the protocol so that it still works.  However,
> it means that 3rd parties are required (that could go in the BIP too).
>
>
>     There is some ongoing discussion of a softfork to basically redo the
>     Script
>     language entirely, but it will take quite a bit of time and
>     development before
>     we'll see it in the wild.
>
>
> Implementing multi-P2SH gets a lot of the benefits of MAST, in terms of
> efficiency.
>
>
>
>     Luke
>
>     P.S. Did the BIP editor assign these numbers? If not, best to keep them
>     numberless until assigned, to avoid confusion when people Google the
>     real BIP
>     44 and 45...
>
>
> Not yet, but that is just my personal repo.  I did email gmaxwell, but
> he said that they can't be assigned until some discussion has happened.
>
> I take your point that the name appears in the link though, so could
> cause issues with searching.
>
>
>     ------------------------------------------------------------------------------
>     Start Your Social Network Today - Download eXo Platform
>     Build your Enterprise Intranet with eXo Platform Software
>     Java Based Open Source Intranet - Social, Extensible, Cloud Ready
>     Get Started Now And Turn Your Intranet Into A Collaboration Platform
>     http://p.sf.net/sfu/ExoPlatform
>     _______________________________________________
>     Bitcoin-development mailing list
>     Bitcoin-development@lists•sourceforge•net
>     <mailto:Bitcoin-development@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
>
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
>
>
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>