<oembed><type>rich</type><version>1.0</version><author_name>npub1g6vxlp4e0nyhs2dqxxcryztyf5f5hyuaq93nw4r87zcnv0sdsa0qqsl5wd</author_name><author_url>https://nostr.ae/npub1g6vxlp4e0nyhs2dqxxcryztyf5f5hyuaq93nw4r87zcnv0sdsa0qqsl5wd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2017-05-24&#xA;📝 Original message:On Tue, May 23, 2017 at 3:22 PM, Paul Sztorc &lt;truthcoin at gmail.com&gt; wrote:&#xA;&#xA;&gt;&#xA;&gt; If you haven&#39;t seen http://www.truthcoin.info/blog/drivechain/ , that is&#xA;&gt; probably the most human-readable description.&#xA;&gt;&#xA;&#xA;I guess I was looking for the detail you get in the code, but without&#xA;having to read the code.&#xA;&#xA;My quick reading gives that the sidechain codes (critical hashes) are added&#xA;when a coinbase is processed.&#xA;&#xA;Any coinbase output that has the form &#34;OP_RETURN &lt;32 byte push&gt;&#34; counts as&#xA;a potential critical hash.&#xA;&#xA;When the block is processed, the key value pair (hash, block_height) is&#xA;added to a hash map.&#xA;&#xA;The OP_BRIBE opcode checks that the given hash is in the hash map and&#xA;replaces the top element on the stack with the pass/fail result.&#xA;&#xA;It doesn&#39;t even check that the height matches the current block, though&#xA;there is a comment that that is a TODO.&#xA;&#xA;I agree with ZmnSCPxj, when updating a nop, you can&#39;t change the stack.  It&#xA;has to fail the script or do nothing.&#xA;&#xA;OP_BRIBE_VERIFY would cause the script to fail if the hash wasn&#39;t in the&#xA;coinbase, or cause a script failure otherwise.&#xA;&#xA;Another concern is that you could have multiple bribes for the same chain&#xA;in a single coinbase.  That isn&#39;t fair and arguably what the sidechain&#xA;miner is paying for is to get his hash exclusively into the block.&#xA;&#xA;I would suggest that the output is&#xA;&#xA;OP_RETURN &lt;sidechain_id&gt; &lt;critical hash&gt;&#xA;&#xA;Then add the rule that only the first hash with a particular sidechain id&#xA;actually counts.&#xA;&#xA;This forces the miner to only accept the bribe from 1 miner for each&#xA;sidechain for each block.  If he tries to accept 2, then only the first one&#xA;counts.&#xA;&#xA;OP_BRIBE_VERIFY could then operate as follows&#xA;&#xA;&lt;block height&gt; &lt;sidechain_id&gt; &lt;critical hash&gt; OP_BRIBE_VERIFY&#xA;&#xA;This causes the script to fail if&#xA;  &lt;block height&gt; does not match the block height, or&#xA;  &lt;critical hash&gt; is not the hash for the sidechain with &lt;sidechain_id&gt;, or&#xA;  there is no hash for that sidechain in the block&#39;s coinbase&#xA;&#xA;If you want reduce the number of drops, you could serialize the info into a&#xA;single push.&#xA;&#xA;This has the advantage that a sidechain miner only has to pay if his block&#xA;is accepted in the next bitcoin block.  Since he is the only miner for that&#xA;sidechain that gets into the main bitcoin block, he is pretty much&#xA;guaranteed to form the longest chain.&#xA;&#xA;Without that rule, sidechain miners could end up having to pay even though&#xA;it doesn&#39;t make their chain the longest.&#xA;&#xA;How are these transactions propagated over the network?  For relaying, you&#xA;could have the rule that the opcode passes as long as &lt;block height&gt; is&#xA;near the current block height.  Maybe require that they are in the future.&#xA;They should be removed from the memory pool once the block height has&#xA;arrived, so losing miners can re-spend those outputs.&#xA;&#xA;This opcode can be validated without needing to look at other blocks, which&#xA;is good for validating historical blocks.&#xA;&#xA;I am still looking at the deposit/withdrawal code.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20170524/ac8f7126/attachment.html&gt;</html></oembed>