<p><br>
Hello everyone,</p>
<p>Luke&#39;s getmemorypool/BIP22 pull request has been open for a long time, and didn&#39;t receive too much discussion.</p>
<p>I think that having a stable and flexible API for negotiating block generation is important to be standardized. The fact that it allows moving block generation to specialized programs is a step in the right direction. However, it seems to me that too few people (myself included) understand all the details of BIP22 (or don&#39;t care enough) to judge their necessity. I gave up trying to follow all design decisions some time ago, and as it seems I&#39;m not alone, nobody liked merging support for it in the Satoshi client. This is a pity, and I hope the situation can be improved soon.</p>

<p>I&#39;m sorry for being this late with these comments, but I think it&#39;s essential that the standard is not more complex than necessary (making it as easy as possible to write either servers or clients for it), and perhaps even more important, that its purpose and intended use cases are clear.</p>

<p>From what I understand, the three subrequests are template, proposal and submit. The general idea is that<br>
 1) a miner requests a block template<br>
 2) builds/modifies a block based on this, and optionally uses propose to check whether the server is willing to accept it before doing work<br>
 3) submits when valid proof-of-work is found<br>
I&#39;d like to see this process described in the BIP at least, it too me way too long to extract this.</p>
<p>Regarding the block template: is there a particular reason for sending the full transactions (serialized in hex) both in templates and submissions? The server will always need to have access to the transaction database anyway, and clients will (afaics) rarely care about the actual transactions. My suggestion would be to just transfer txids - if the client is interested in the actual transactions, we have the gettransaction RPC call already. This seems to be captured by the several &quot;submit/*&quot; and &quot;share/*&quot; variations, but making it optional seems way more complex than just limiting the API to that way of working.</p>

<p>That&#39;s another thing that bothers me in the standard: too many optional features. In particular, I understand the usefulness of having some flexibility in what miner clients are allowed to modify, but I&#39;m unconvinced we need 10 individually selectable variations. In particular:<br>

* coinbase outputs: can we just add a list of required coinbase outputs (amount + scriptPubKey) to the template? If no generation+fee amount remains, nothing can be added.<br>
* coinbase input: put the required part in the template; miners can always add whatever they like. Is there any known use case where a server would not allow a client to add stuff to the coinbase?<br>
* noncerange limiting: if coinbase input variation is not limited, there is certainly no reason to limit nonceranges. This adds unnecessary complexity to clients, in my option.<br>
* time/*: put a minimum and maximum timestamp in the template (i believe those are already there anyway). Anything in between is valid.<br>
* transactions/add: what is the use case?<br>
* transactions/remove: i&#39;d just standarize on having all transactions be removable (perhaps except those marked &#39;required&#39;).<br>
* prevblock: one getmemorypool per new block shouldn&#39;t be a problem imho, so do a longpoll instead of having the client able to modify prevblock themselves.</p>
<p>One more thing that I do not like is often several ways for specifying the same behaviour. For example, txrequires specifies that the first N transactions are mandatory, a &#39;required&#39; field in the transaction list itself specifies that that transaction is mandatory, and the lack of transactions as variation means that they must not be touched at all. Pick one way that is flexible enough, and discard the others.</p>

<p>In summary, I&#39;d like to see the standard simplified. I have no problem merging code that makes getmemorypool compliant to a standard that is agreed upon, but like to understand it first.</p>
<p>In my opinion - but I&#39;m certainly open to discussion here - the standard could be simplified to:<br>
* getblocktemplate: create a new block template, and return it. The result contains:<br>
 * bits, previousblockhash, version: as to be used in block<br>
 * curtime, maxtimeoff, maxtimeoff: client chooses a timestamp between (curtime - local_time_at_receipt + local_time), decreased by mintimeoff and increased maxtimeoff<br>
 * expires, sigoplimit, sizelimit: unchanged<br>
 * subsidy: amount generated (5000000000 for now)<br>
 * coinbaseaux: what generated coinbase&#39;s scriptSig must start with<br>
 * coinbaseoutputs: list of objects, each specifying a required coinbase output. Each has fields:<br>
   * amount: sent amount<br>
   * scriptPubKey: hex serialized of the output script<br>
 * transactions: list of object, each specifying a suggested transaction (except for the coinbase) in the generated block. Each has fields:<br>
   * txid: transaction id<br>
   * depends: list of dependencies (txids of earlier objects in this same transactions list).<br>
   * fee: fee generated by this transaction, which increases the max output of the coinbase.<br>
   * required: if present, transaction may not be dropped.<br>
* submitblocktemplate: submit an object containing a hex serialized block header, hex serialized coinbase transaction, and a list of txids. Returns true or string describing the problem. Proof of work is checked last, so that error is only returned if there is no other problem with the suggested block (this allows it to replace both propose and submit).</p>

<p>Are there important use cases I&#39;m missing?</p>
<p>--<br>
Pieter<br>
</p>