From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 27914904 for ; Wed, 24 May 2017 08:50:25 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 143CE1A0 for ; Wed, 24 May 2017 08:50:23 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id l18so232969961oig.2 for ; Wed, 24 May 2017 01:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=dnCNKeIYURkXIlnp+pmeA3zYcxj78gggeH+gy7R2LEc=; b=P+MewZ8d96dsJ0i0e2CzYu8DBsBdcNYh5EhCCaEcp+ZZmdt2LryovbPOjOhVqMM7WW x54nkHi8Nr5cCn7gSyO7drETJOswT2SQ2UBAGEKPIjHOzpSsoCqiOe/0vS1MRUq2Ut6D EVscPZ2RuWq6y0Tg6iSnATyTrKd8mNo63tckFhxCsLN0JiawROAP7jaws/TfY+WeZqND 2EwYJyxOSY04k0lvDNm5RI6shqb5zacfS+H51akY3tuVevrTSAJk9Oq+kmTPUbB0BSwY Wiah5jen84cZEhOBZQJQ5v1tcuCUay9+3Cw6SrDbVUJI0KqXmE8pN9qZAsVVkBNUnL3L xaBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=dnCNKeIYURkXIlnp+pmeA3zYcxj78gggeH+gy7R2LEc=; b=NSrWIlCwQNa1Wgq6qfuykmPDA45A5WqHJ6Z0kQAdFDG3dx+7X2yhgfl30ua2C5PeAy Ld4ggdh/Cr8+cVizeCC7pQdYFqNkd/yLTU5kPGNXPWmZ+37+rKu2TSh+MSzWyK4jy8x3 a63AZD7Y8N8N4vR1kZCs4h19H7EwDd1Y7CDEKZPNZRhm+0xNBUhxTIHS4h/Nn5+e9eje R1j+tuu7jlAxV4OTVNq92YF2K5UBIRzpF+zTNxZAG5+aoeo2iLPHVPv4CUHcCFfO00Qh ejCRolYiUSOLLFYCv0MMnUs2n8VHhSEt3GauyIR2WV4UGLG3rg3UqEN0mlUacUFstT16 7ScQ== X-Gm-Message-State: AODbwcARBRijL6clISfOMFWInNSX/3tM8RfBIljaH9PVuvBHYLsamCl3 G6C5bBX6bmlBlRLKIIRUCYj95frh/o/f X-Received: by 10.157.46.234 with SMTP id w97mr3602709ota.78.1495615823259; Wed, 24 May 2017 01:50:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.100.89 with HTTP; Wed, 24 May 2017 01:50:22 -0700 (PDT) In-Reply-To: <141a0cd1-9d4f-c137-a349-17248f9cafd4@gmail.com> References: <24f2b447-a237-45eb-ef9f-1a62533fad5c@gmail.com> <141a0cd1-9d4f-c137-a349-17248f9cafd4@gmail.com> From: Tier Nolan Date: Wed, 24 May 2017 09:50:22 +0100 Message-ID: Cc: Bitcoin Dev Content-Type: multipart/alternative; boundary="001a114639d0ddafe605504131a3" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MISSING_HEADERS, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: Re: [bitcoin-dev] Drivechain -- Request for Discussion X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 May 2017 08:50:25 -0000 --001a114639d0ddafe605504131a3 Content-Type: text/plain; charset="UTF-8" On Tue, May 23, 2017 at 3:22 PM, Paul Sztorc wrote: > > If you haven't seen http://www.truthcoin.info/blog/drivechain/ , that is > probably the most human-readable description. > I guess I was looking for the detail you get in the code, but without having to read the code. My quick reading gives that the sidechain codes (critical hashes) are added when a coinbase is processed. Any coinbase output that has the form "OP_RETURN <32 byte push>" counts as a potential critical hash. When the block is processed, the key value pair (hash, block_height) is added to a hash map. The OP_BRIBE opcode checks that the given hash is in the hash map and replaces the top element on the stack with the pass/fail result. It doesn't even check that the height matches the current block, though there is a comment that that is a TODO. I agree with ZmnSCPxj, when updating a nop, you can't change the stack. It has to fail the script or do nothing. OP_BRIBE_VERIFY would cause the script to fail if the hash wasn't in the coinbase, or cause a script failure otherwise. Another concern is that you could have multiple bribes for the same chain in a single coinbase. That isn't fair and arguably what the sidechain miner is paying for is to get his hash exclusively into the block. I would suggest that the output is OP_RETURN Then add the rule that only the first hash with a particular sidechain id actually counts. This forces the miner to only accept the bribe from 1 miner for each sidechain for each block. If he tries to accept 2, then only the first one counts. OP_BRIBE_VERIFY could then operate as follows OP_BRIBE_VERIFY This causes the script to fail if does not match the block height, or is not the hash for the sidechain with , or there is no hash for that sidechain in the block's coinbase If you want reduce the number of drops, you could serialize the info into a single push. This has the advantage that a sidechain miner only has to pay if his block is accepted in the next bitcoin block. Since he is the only miner for that sidechain that gets into the main bitcoin block, he is pretty much guaranteed to form the longest chain. Without that rule, sidechain miners could end up having to pay even though it doesn't make their chain the longest. How are these transactions propagated over the network? For relaying, you could have the rule that the opcode passes as long as is near the current block height. Maybe require that they are in the future. They should be removed from the memory pool once the block height has arrived, so losing miners can re-spend those outputs. This opcode can be validated without needing to look at other blocks, which is good for validating historical blocks. I am still looking at the deposit/withdrawal code. --001a114639d0ddafe605504131a3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On T= ue, May 23, 2017 at 3:22 PM, Paul Sztorc <truthcoin@gmail.com> wrote:

If you haven't seen http://www.truthcoin.info/b= log/drivechain/ , that is
probably the most human-readable description.

I guess I was looking for the detail you get in the code, but withou= t having to read the code.

My quick reading gives that the sid= echain codes (critical hashes) are added when a coinbase is processed.
<= br>
Any coinbase output that has the form &= quot;OP_RETURN <32 byte push>" counts as a potential critical ha= sh.

When the block is processed, th= e key value pair (hash, block_height) is added to a hash map.

=
The OP_BRIBE opcode checks that the given hash i= s in the hash map and replaces the top element on the stack with the pass/f= ail result.

It doesn't even che= ck that the height matches the current block, though there is a comment tha= t that is a TODO.

I agree with ZmnSCPxj, when updating a nop, you can't = change the stack.=C2=A0 It has to fail the script or do nothing.

OP_BRIBE_VERIFY would cause the script to fai= l if the hash wasn't in the coinbase, or cause a script failure otherwi= se.

Another concern is that you cou= ld have multiple bribes for the same chain in a single coinbase.=C2=A0 That= isn't fair and arguably what the sidechain miner is paying for is to g= et his hash exclusively into the block.

I would suggest that the output is

OP_RETURN <sidechain_id> <critical hash>

Then add the rule that only the first hash with a pa= rticular sidechain id actually counts.

This forces the miner to only accept the bribe from 1 miner for each si= dechain for each block.=C2=A0 If he tries to accept 2, then only the first = one counts.

OP_BRIBE_VERIFY could t= hen operate as follows

<block he= ight> <sidechain_id> <critical hash> OP_BRIBE_VERIFY

=
This causes the script to fail if
=C2=A0 <block height> does not match the = block height, or
=C2=A0 <critical ha= sh> is not the hash for the sidechain with <sidechain_id>, or
<= /div>
=C2=A0 there is no hash for that sidechain = in the block's coinbase

If you = want reduce the number of drops, you could serialize the info into a single= push.=C2=A0

This has the advantag= e that a sidechain miner only has to pay if his block is accepted in the ne= xt bitcoin block.=C2=A0 Since he is the only miner for that sidechain that = gets into the main bitcoin block, he is pretty much guaranteed to form the = longest chain.

Without that rule, s= idechain miners could end up having to pay even though it doesn't make = their chain the longest.

How are these transactions propagated over the netwo= rk?=C2=A0 For relaying, you could have the rule that the opcode passes as l= ong as <block height> is near the current block height.=C2=A0 Maybe r= equire that they are in the future.=C2=A0 They should be removed from the m= emory pool once the block height has arrived, so losing miners can re-spend= those outputs.

This opcode can be valida= ted without needing to look at other blocks, which is good for validating h= istorical blocks.

I am still looking at the deposit/withdrawal code.
--001a114639d0ddafe605504131a3--