{"type":"rich","version":"1.0","author_name":"npub1u03cz099kt69z9awg232rjvlt34azukpzkkvy5uqv64dj9j5fqtshdnn03","author_url":"https://nostr.ae/npub1u03cz099kt69z9awg232rjvlt34azukpzkkvy5uqv64dj9j5fqtshdnn03","provider_name":"njump","provider_url":"https://nostr.ae","html":"📅 Original date posted:2017-06-27\n📝 Original message:\u003cpre\u003e\n  BIP: \u003cBIP number\u003e\n  Layer: Consensus (Soft fork)\n  Title: OP_BRIBEVERIFY\n  Author: Chris Stewart \u003cchris at suredbits.com\u003e\n  Status: Draft\n  Type: Standards Track\n  Created: 2017-06-27\n\u003c/pre\u003e\n\n\n==Abstract==\n\nThis BIP describes a new opcode, OP_BRIBEVERIFY, for the Bitcoin\nscripting system that allows for a user to bribe a miner to include a hash\nin the coinbase transaction's output.\n\n\n==Summary==\n\nBRIBEVERIFY redefines the existing NOP4 opcode. When executed, if the given\ncritical hash is included at the given vout index in the coinbase\ntransaction\nthe script evaluates to true. Otherwise, the script will fail.\n\nThis allows sidechains to be merged mined against\nbitcoin without burdening bitcoin miners with extra resource requirements.\n\n==Motivation==\n\nThe current political climate of bitcoin is extremely contentious. Many\ncommunity members\nhave different visions of what bitcoin is. This op code is meant to\nenable [http://www.truthcoin.info/blog/blind-merged-mining/ Blind Merge\nMining].\nThis enables sidechains in Bitcoin. With OP_BRIBEVERIFY, sidechains miners\ncan\nbribe bitcoin miners to to include their block hash in the bitcoin\nblockchain. If their block\nis included in the coinbase transaction's vout, it is assumed that block is\na mined block on the sidechain.\n\nThis will allow various factions of the community to realize their vision\non their own separate\nblockchain that is interoperable with the bitcoin blockchain. This allows\nthose factions to use\nbitcoin as a 'reserve currency' for their own network.\n\n\n===Commitment Structure===\n\nA new block rule is added which requires that the miner's coinbase reward\nbe at index 0 in the coinbase transaction's output vector.\n\nIt also fixes the witness commitment output to be at index 1 of the\ncoinbase transaction's output vector.\n\nThis is needed so we can reliably tell what vout corresponds to what\ndrivechain. For instance, the mimblewimble sidechain\ncould correspond to index 2 of the vector outputs on the coinbase\ntransaction.\n\nThe commitment is recorded in a \u003ccode\u003escriptPubKey\u003c/code\u003e of the coinbase\ntransaction. It must be at least 34 bytes in size\n   1-byte - OP_RETURN (0x6a)\n   1-byte - Push the following 32 bytes (0x20)\n  32-byte - block hash\n\nthe 35th byte and onward have no consensus meaning.\n\n===OP_BRIBEVERIFY op code===\n\nThis op code reads two arguments from the stack. The stack top is expected\nto be a sidechain id for which this user attempting to blind merge mine for.\nThe next element on the stack is expected to be a block hash. This op code\nlooks into the coinbase transaction's output vector at the given index\n(which is derived from the sidechain id) and checks\nto see if the hash in the block matches the hash inside of the BRIBEVERIFY\nprogram. If the hashes match, the OP_BRIBEVERIFY acts as an OP_NOP. If the\ncomparison between the two hashes fail, the script fails.\n\n===BRIBEVERIFY program===\n\nA standard BRIBEVERIFY program has the format:\n  1-byte - Push the following 32 bytes (0x20)\n 32-byte - block hash\n  1 byte - Push operation? (needed if number can't be encoded as OP_0 -\nOP_16)\n  1 byte - sidechain id\n  1 byte - OP_BRIBEVERIFY op code\n\n==Detailed Specification==\n\nRefer to the reference implementation, reproduced below, for the precise\nsemantics and detailed rationale for those semantics.\n\n\n case OP_NOP4:\n {\n    //format: block_hash sidechain_id OP_BRIBEVERIFY\n    if (!(flags \u0026 SCRIPT_VERIFY_BRIBEVERIFY)) {\n        // not enabled; treat as a NOP4\n        if (flags \u0026 SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) {\n            return set_error(serror, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS);\n        }\n        break;\n    }\n\n    if (stack.size() \u003c 2)\n        return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);\n\n    const CScriptNum scriptNumSidechainId(stacktop(-1),fRequireMinimal);\n    uint8_t nSidechainId;\n    if (!checker.CheckSidechainId(scriptNumSidechainId,nSidechainId)) {\n        return set_error(serror, SCRIPT_ERR_UNKNOWN_SIDECHAIN);\n    }\n\n    // Check block hash\n    bool fHashCritical =\nchecker.CheckCriticalHash(stacktop(-2),nSidechainId);\n    if (!fHashCritical) {\n        return set_error(serror, SCRIPT_ERR_UNSATISFIED_BRIBE);\n    }\n    break;\n }\n\n\n\nhttps://github.com/Christewart/bitcoin/blob/94b6f33f2278c42d4d8758a3c8ffe2078e4ec933/src/script/interpreter.cpp#L427\n\nhttps://github.com/drivechain-project/bitcoin/pull/13\n\n==Deployment==\n\nTODO\n\n==Credits==\n\nCredit to Paul Sztorc for the original idea of Blind Merge Mined sidechains.\n\nCredit to CryptAxe for writing the foundational layer of software for\ndrivechains so I could implement OP_BRIBEVERIFY.\n\n\n==References==\n\nBlind Merge Mined Sidechains -\nhttp://www.truthcoin.info/blog/blind-merged-mining/\n\nMailing list discussion -\nhttps://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-May/014408.html\n\n==Copyright==\n\nThis document is placed in the public domain.\n-------------- next part --------------\nAn HTML attachment was scrubbed...\nURL: \u003chttp://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20170627/bd5730bf/attachment.html\u003e"}
