Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: m0mchil on October 01, 2010, 11:58:03 AM



Title: [PATCH] JSON-RPC getwork
Post by: m0mchil on October 01, 2010, 11:58:03 AM
This is a patch against SVN 159 that allows external RPC clients to ask for unsolved block data and eventually submit back a solution.

It opens the way for external bitcoin miners. If non-local RPC is used it also enables multiple-miners-to-client arrangement.

EDIT:

theymos is expressing some concerns regarding extraNonce here (http://bitcointalk.org/index.php?topic=1332.msg14966#msg14966)

There are actually many components of a block that change its hash. Let's assume the block contains only the initial (award) transaction. The hash will change if either:

     - transactions merkle hash - if you change txOUT publicKey, txIN difficulty or extraNonce
     - block time - 4 bytes that are updated every n seconds in the original client
     - block's nonce

Bitcoin is giving by default each mining thread it's unique extraNonce (to ensure different hash space). However if there are new transactions after at least 60 seconds merkle hash will change. This patch rebuilds merkle hash at each request for work because of the new extraNonce it assigns. If there are new transactions it should rebuild merkle hash anyway so I don't think this is much of a problem. Also, the external miner may change it's block time if needed - it will get back and processed/verified accordingly.

I made some tests with difficulty of 1 and generation rate was equal to the expected values.


Title: Re: [PATCH] JSON-RPC getwork
Post by: m0mchil on October 06, 2010, 04:21:39 PM
This patch is maintained now at http://github.com/m0mchil/bitcoin-getwork (http://github.com/m0mchil/bitcoin-getwork)


Title: Re: [PATCH] JSON-RPC getwork
Post by: Cdecker on October 06, 2010, 05:04:33 PM
Is there a plan for this to be merged into the main tree at some point?