Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5201AC19 for ; Tue, 5 Jun 2018 18:45:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.bluematt.me (mail.bluematt.me [192.241.179.72]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AD71D70E for ; Tue, 5 Jun 2018 18:44:59 +0000 (UTC) Received: from [172.17.0.2] (gw.vpn.bluematt.me [144.217.106.88]) by mail.bluematt.me (Postfix) with ESMTPSA id 52D5513AA22 for ; Tue, 5 Jun 2018 18:44:58 +0000 (UTC) To: Bitcoin Dev From: Matt Corallo Openpgp: preference=signencrypt Autocrypt: addr=matt@bluematt.me; prefer-encrypt=mutual; keydata= xsFNBFPBqxoBEADnCJofKjaMG2qC0RkJAFgKNjyulG0YwrMpIMQJbD3ymYd8gty97RCvb+3E r5Lg1W6EwRXSDx88xmZSM+T2hSu5s9pUkpHWY+Ulcc8Iu4aMHiWvw7c6N4KPttMVjvinj9mk 2aWiU1nr/nba7ZXFo4kjd9YPY5GBVEC1KvAY84AYg0lJvnzddq0CEjwOtaxFKRMIkRHeUhMK aBdQdKU4CjzsIt6qdmFoqgGdPWQ4w8NhGALxdeSX8LF5zwSeun/FZ6KIQqSo+3yBFrEQHMzM iIm3Xn8MZla/UwmaBDB+IfjSoKp5hM+l6NvCuOc9BmczK2+ZGEJNnvsooCpYoN3GK8G1dkWP FNUKTEG4QB0KsE6v877HfpG8mbhyNxKeZ36JdeoFjuTAwp4mP/c80focJjh8UNZsNCmunkI6 erjxPtqRkVkU6BcLfFtGTrzM3+I8m2YJdw2ZvCzsEPU62X9QsCWrhHZsxhwS8/wtzGJpPTTO gx2sJQQW2E6E3m6wgKXWWj9oMo61wWwdeiDtJUnzT0DoB9CJLA1zT4V6lTrATPH8AMJ+73qh 0nAEEXSL1kPwDLGlkZtylyqRi1UcAGg9r7bW/KLTEcIueS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liFIc8Eu2fgbbjjB6VsLQ352A7y2agtK3vaKjK013/hqoSYuG FU4Q3+Y6hJaiSB6P9syNcjJtsSiS8t9VmF7ZUAR3q958Q8XyGNXHtHfqxVj55mWSt9+eH0Wl h7ODk4L2GaXF1xWdBEyt6xypapmm2Z9/qcuX7X3eZcC4hMHgwHsfZh+LvIzeup3E8wYkr6gZ uWCHuEtIxpFG8chItvKHjHI= Message-ID: <92215b88-75a4-6be7-dec6-89c567a74a9a@mattcorallo.com> Date: Tue, 5 Jun 2018 14:44:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [bitcoin-dev] [BIP Proposal] BetterHash Mining Protocol Replacements 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: Tue, 05 Jun 2018 18:45:00 -0000 Been working on this one for a while, so its already been through a few rounds of feeback (thanks to all those who already have provided feedback)! At a high level, this meets a few goals: 1) Replace getblocktemplate with something that is both more performant (no JSON encoding, no full transactions sent over the wire to update a job, hence we can keep the same CTransactionRef in Bitcoin Core making lots of validation things way faster), more robust for consensus changes (no need to add protocol changes to add commitments ala SegWit in the future), and moves more block-switching logic inside of the work provider (allowing Bitcoin Core to better optimize work switching as it knows more than an outside pool server, specifically we can play more games with how we do mempool eviction, empty block mining, and not mining fresh transactions more easily by moving to a more "push" model from the normal "pull" getblocktemplate implementation). 2) Replace Stratum with something more secure (sign messages when applicable, without adding too much overhead to the pool), simpler to implement (not JSON-wrapped-hex, no 32-byte-swapped-per-4-byte-byteorder insanity), and better-defined (a clearly written spec, encompassing the various things shoved backwards into stratum like suggested difficulty in the password field and device identification by setting user to "user.device") with VENDOR_MESSAGEs provided for extensibility instead of conflicting specifications from various different vendors. 3) Provide the ability for a pool to accept work which the users of the pool selected the transactions for, providing strong decentralization pressure by removing the network-level centralization attacks pools can do (or be compromised and used to perform) while still allowing them full control of payout management and variance reduction. While (1) and (2) stand on their own, making it all one set of protocols to provide (3) provides at least the opportunity for drastically better decentralization in Bitcoin mining in the future. The latest version of the full BIP draft can be found at https://github.com/TheBlueMatt/bips/blob/betterhash/bip-XXXX.mediawiki and implementations of the work-generation part at https://github.com/TheBlueMatt/bitcoin/commits/2018-02-miningserver and pool/proxy parts at https://github.com/TheBlueMatt/mining-proxy (though note that both implementations are currently on a slightly out-of-date version of the protocol, I hope to get them brought up to date in the coming day or two and make them much more full-featured. The whole stack has managed to mine numerous testnet blocks on several different types of hardware). Matt