Research/Bitcoin Dev Archive / lightning-dev list
OP_CHECKSPVPROOFVERIFY
10 messages, Jul 29 to Aug 1, 2015. Started by Eric Lombrozo.
Eric Lombrozo (7), Rusty Russell (2), Joseph Poon
I don’t know if anyone has done any research or published anything in this regard, but one of the major issues with bitcoin I’ve been trying to solve is how to properly incentivize nodes to construct SPV proofs.
It occurs to me that with the LN, it might be practical to outsource SPV proofs from other nodes.
It is obviously ridiculously prohibitive and self-defeating to include SPV proofs in the blockchain…however, in practice this would only be necessary when the SPV client fails to pay the prover.
Thoughts?
- Eric
Hi Eric,
On Wed, Jul 29, 2015 at 02:08:39AM -0700, Eric Lombrozo wrote:
Quoted text (2 lines)
> It occurs to me that with the LN, it might be practical to outsource > SPV proofs from other nodes.
I couldn't find anything on an SPV proof opcode, what kind of opcode are you thinking of or do you have any links? I tried looking it up but couldn't find anything about it. I'm curious on whether/how it could it offer significantly better security than current SPV proofs.
I should have posted this to the whole group. Sorry, hit the wrong button. :p ---------- Forwarded message ---------- From: "Eric Lombrozo" <elombrozo at gmail.com> Date: Jul 29, 2015 3:27 PM Subject: Re: [Lightning-dev] OP_CHECKSPVPROOFVERIFY To: "Joseph Poon" <joseph at lightning.network> Cc:
Joseph,
The point isn't better security than current SPV proofs. That would require improvements to the commitment structures.
The point is to allow outsourceability of SPV proofs over LN. We would want to avoid actually using OP_CHECKSPVPROOFVERIFY in the blockchain...but it would allow crafting a contract requesting payment from the SPV client along with an enforcement mechanism in the event the client fails to pay.
- Eric On Jul 29, 2015 12:54 PM, "Joseph Poon" <joseph at lightning.network> wrote:
Quoted text (14 lines)
> Hi Eric, > > On Wed, Jul 29, 2015 at 02:08:39AM -0700, Eric Lombrozo wrote: > > It occurs to me that with the LN, it might be practical to outsource > > SPV proofs from other nodes. > > I couldn't find anything on an SPV proof opcode, what kind of opcode are > you thinking of or do you have any links? I tried looking it up but > couldn't find anything about it. I'm curious on whether/how it could it > offer significantly better security than current SPV proofs. > > -- > Joseph Poon >
The reason such outsourceability is desirable is because it leads to concrete, quantifiable incentives for running nodes to serve SPV clients making it possible to reason about the economic security model of the network. On Jul 29, 2015 3:28 PM, "Eric Lombrozo" <elombrozo at gmail.com> wrote:
Quoted text (37 lines)
> I should have posted this to the whole group. Sorry, hit the wrong button. > :p > ---------- Forwarded message ---------- > From: "Eric Lombrozo" <elombrozo at gmail.com> > Date: Jul 29, 2015 3:27 PM > Subject: Re: [Lightning-dev] OP_CHECKSPVPROOFVERIFY > To: "Joseph Poon" <joseph at lightning.network> > Cc: > > Joseph, > > The point isn't better security than current SPV proofs. That would > require improvements to the commitment structures. > > The point is to allow outsourceability of SPV proofs over LN. We would > want to avoid actually using OP_CHECKSPVPROOFVERIFY in the blockchain...but > it would allow crafting a contract requesting payment from the SPV client > along with an enforcement mechanism in the event the client fails to pay. > > - Eric > On Jul 29, 2015 12:54 PM, "Joseph Poon" <joseph at lightning.network> wrote: > >> Hi Eric, >> >> On Wed, Jul 29, 2015 at 02:08:39AM -0700, Eric Lombrozo wrote: >> > It occurs to me that with the LN, it might be practical to outsource >> > SPV proofs from other nodes. >> >> I couldn't find anything on an SPV proof opcode, what kind of opcode are >> you thinking of or do you have any links? I tried looking it up but >> couldn't find anything about it. I'm curious on whether/how it could it >> offer significantly better security than current SPV proofs. >> >> -- >> Joseph Poon >> >
Eric Lombrozo <elombrozo at gmail.com> writes:
Quoted text (3 lines)
> I don’t know if anyone has done any research or published anything in > this regard, but one of the major issues with bitcoin I’ve been trying > to solve is how to properly incentivize nodes to construct SPV proofs.
This can almost be done via P2SH, but not quite:
1) OP_CAT is disabled :( 2) The txlen limit might bite, I'd have to do the maths.
Cheers, Rusty.
I’m not entirely clear on how you intended to use OP_CAT.
I was thinking something along the lines of
<block hash> <partial merkle tree for transaction> <transaction> OP_CHECKSPVPROOFVERIFY OP_DROP
- Eric
Quoted text (14 lines)
> On Jul 29, 2015, at 6:19 PM, Rusty Russell <rusty at rustcorp.com.au> wrote: > > Eric Lombrozo <elombrozo at gmail.com> writes: >> I don’t know if anyone has done any research or published anything in >> this regard, but one of the major issues with bitcoin I’ve been trying >> to solve is how to properly incentivize nodes to construct SPV proofs. > > This can almost be done via P2SH, but not quite: > > 1) OP_CAT is disabled :( > 2) The txlen limit might bite, I'd have to do the maths. > > Cheers, > Rusty.
Let me elaborate more on the way I see this working in practice. I’ll ignore fees for now. Given that sending the proof on the blockchain is expensive, the parties need to negotiate how they split the risk. Moreover, once revoked, we want to encourage the second outputs to be claimed using the revocation secret, not the SPV proof…but we’ll ignore this detail for now.
We have two parties, Prover and Verifier. Verifier wants to pay Prover one currency unit for an SPV proof. Assume they have an open channel with each party having 10 currency units.
Here are the commitment transactions:
Verifier Commitment Transaction ========================= 10 ProverSig 1 ProverSig + VerifierRevocation || ProverSig + SPV proof || VerifierSig + timeout 9 ProverSig + VerifierRevocation || VerifierSig + timeout
Prover Commitment Transaction ========================= 9 VerifierSig 1 VerifierSig + ProverRevocation || ProverSig + SPV proof || VerifierSig + timeout 10 VerifierSig + ProverRevocation || ProverSig + timeout
A script for [ProverSig + VerifierRevocation || ProverSig + SPV proof || VerifierSig + timeout] could look like:
OP_IF OP_IF OP_HASH160 <VerifierRevocation> OP_EQUALVERIFY OP_ELSE <transaction hash> OP_CHECKSPVPROOFVERIFY OP_DROP OP_ENDIF <ProverPubKey> OP_CHECKSIG OP_ELSE <timeout> OP_CHECKLOCKTIMEVERIFY OP_DROP <VerifierPubKey> OP_CHECKSIG OP_ENDIF
To redeem this output using the SPV proof, the Prover uses:
<ProverSig> <block hash> <partial merkle tree for transaction> <0> <1>
Once the commitment transactions are created, the Prover gives the Verifier the SPV proof, then they negotiate settlement transactions and exchange revocations.
Would something like this work?
Quoted text (28 lines)
> On Jul 29, 2015, at 11:38 PM, Eric Lombrozo <elombrozo at gmail.com> wrote: > > I’m not entirely clear on how you intended to use OP_CAT. > > I was thinking something along the lines of > > <block hash> <partial merkle tree for transaction> <transaction> OP_CHECKSPVPROOFVERIFY OP_DROP > > > > - Eric > > >> On Jul 29, 2015, at 6:19 PM, Rusty Russell <rusty at rustcorp.com.au> wrote: >> >> Eric Lombrozo <elombrozo at gmail.com> writes: >>> I don’t know if anyone has done any research or published anything in >>> this regard, but one of the major issues with bitcoin I’ve been trying >>> to solve is how to properly incentivize nodes to construct SPV proofs. >> >> This can almost be done via P2SH, but not quite: >> >> 1) OP_CAT is disabled :( >> 2) The txlen limit might bite, I'd have to do the maths. >> >> Cheers, >> Rusty. >
Minor script corrections:
OP_IF OP_IF OP_HASH160 <VerifierRevocationHash> OP_EQUALVERIFY OP_ELSE <transaction> OP_CHECKSPVPROOFVERIFY OP_DROP OP_DROP OP_DROP OP_ENDIF <ProverPubKey> OP_CHECKSIG OP_ELSE <timeout> OP_CHECKLOCKTIMEVERIFY OP_DROP <VerifierPubKey> OP_CHECKSIG OP_ENDIF
Quoted text (75 lines)
> On Jul 30, 2015, at 5:18 AM, Eric Lombrozo <elombrozo at gmail.com> wrote: > > Let me elaborate more on the way I see this working in practice. I’ll ignore fees for now. Given that sending the proof on the blockchain is expensive, the parties need to negotiate how they split the risk. Moreover, once revoked, we want to encourage the second outputs to be claimed using the revocation secret, not the SPV proof…but we’ll ignore this detail for now. > > We have two parties, Prover and Verifier. Verifier wants to pay Prover one currency unit for an SPV proof. Assume they have an open channel with each party having 10 currency units. > > > Here are the commitment transactions: > > Verifier Commitment Transaction > ========================= > 10 ProverSig > 1 ProverSig + VerifierRevocation || ProverSig + SPV proof || VerifierSig + timeout > 9 ProverSig + VerifierRevocation || VerifierSig + timeout > > Prover Commitment Transaction > ========================= > 9 VerifierSig > 1 VerifierSig + ProverRevocation || ProverSig + SPV proof || VerifierSig + timeout > 10 VerifierSig + ProverRevocation || ProverSig + timeout > > > A script for [ProverSig + VerifierRevocation || ProverSig + SPV proof || VerifierSig + timeout] could look like: > > OP_IF > OP_IF > OP_HASH160 <VerifierRevocation> OP_EQUALVERIFY > OP_ELSE > <transaction hash> OP_CHECKSPVPROOFVERIFY OP_DROP > OP_ENDIF > <ProverPubKey> OP_CHECKSIG > OP_ELSE > <timeout> OP_CHECKLOCKTIMEVERIFY OP_DROP > <VerifierPubKey> OP_CHECKSIG > OP_ENDIF > > > To redeem this output using the SPV proof, the Prover uses: > > <ProverSig> <block hash> <partial merkle tree for transaction> <0> <1> > > > Once the commitment transactions are created, the Prover gives the Verifier the SPV proof, then they negotiate settlement transactions and exchange revocations. > > Would something like this work? > >> On Jul 29, 2015, at 11:38 PM, Eric Lombrozo <elombrozo at gmail.com> wrote: >> >> I’m not entirely clear on how you intended to use OP_CAT. >> >> I was thinking something along the lines of >> >> <block hash> <partial merkle tree for transaction> <transaction> OP_CHECKSPVPROOFVERIFY OP_DROP >> >> >> >> - Eric >> >> >>> On Jul 29, 2015, at 6:19 PM, Rusty Russell <rusty at rustcorp.com.au> wrote: >>> >>> Eric Lombrozo <elombrozo at gmail.com> writes: >>>> I don’t know if anyone has done any research or published anything in >>>> this regard, but one of the major issues with bitcoin I’ve been trying >>>> to solve is how to properly incentivize nodes to construct SPV proofs. >>> >>> This can almost be done via P2SH, but not quite: >>> >>> 1) OP_CAT is disabled :( >>> 2) The txlen limit might bite, I'd have to do the maths. >>> >>> Cheers, >>> Rusty. >> >
Eric Lombrozo <elombrozo at gmail.com> writes:
Quoted text (1 line)
> I’m not entirely clear on how you intended to use OP_CAT.
You can open-code a merkle tree calculation using OP_CAT and OP_HASH256. No need for a new OP (though that may be more efficient).
Anyway, I think we're getting off-topic for this list. AFAICT, this is not lightning-specific.
Cheers, Rusty.
Quoted text (7 lines)
> On Aug 1, 2015, at 4:01 AM, Rusty Russell <rusty at rustcorp.com.au> wrote: > > Eric Lombrozo <elombrozo at gmail.com> writes: >> I’m not entirely clear on how you intended to use OP_CAT. > > You can open-code a merkle tree calculation using OP_CAT and OP_HASH256. > No need for a new OP (though that may be more efficient).
Gotcha.
Quoted text (2 lines)
> Anyway, I think we're getting off-topic for this list. AFAICT, this is > not lightning-specific.
You’re right, this might not be the best place to discuss it - but I’m not sure where to discuss it since such an idea doesn’t make sense outside the context of a level 2 protocol.
Quoted text (2 lines)
> Cheers, > Rusty.