Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: NetTecture on June 23, 2011, 05:44:01 PM



Title: Documentation needed for a pool (wire level protocol)?
Post by: NetTecture on June 23, 2011, 05:44:01 PM
Can anyone pont me to some relevant documentation for the protocols needed for a pool / miner proxy?

I.e. whom to talk to (i assume a bitcoin server), what protocols / ports etc. to use.

Just trying to get a decent start here. Any lightweight sample code pointer also welcome... just I dont really talk PHP ;)

Regards

;) NetTecture


Title: Re: Documentation needed for a pool (wire level protocol)?
Post by: d3m0n1q_733rz on June 23, 2011, 06:05:47 PM
As long as you don't talk SQL, you'll survive.


Title: Re: Documentation needed for a pool (wire level protocol)?
Post by: fpgaminer on June 23, 2011, 06:26:09 PM
Mining software must communicate with a pool/proxy/bitcoind for two reasons; to get work and to submit work.

The most common protocol (supported by every mining software I've seen) for that is JSON-RPC: http://en.wikipedia.org/wiki/JSON-RPC (http://en.wikipedia.org/wiki/JSON-RPC).

This is the request a miner makes to the server to get new work:
Code:
{"params": [], "method": "getwork", "id": "json"}

An example response by the server:
Code:
{"id":"json","error":null,"result":{"midstate":"b07ab2ccf48b89a0217384c1299d8b7e7cc9bb7ac16dd1366d9955669cb253aa","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000","data":"0000000146f6a6158418099f9c3a68ffec435166cfdb9eef51479153000001ee000000004d3a3c9c00dc8b69df7c0e9b4f3fa4ea587cddd2392d186e9dca1b5ea1669ea74e03844d1a13218500000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000"}}

An example of the request made by a miner to submit results:
Code:
{"params": ["000000019a086f0290f4b6d34a6e1b8a4b9974d585819abcd8e8f3d400000b5d00000000aaf9271bb6c2892dd5f96a71da1ed4be9b234f74a8de246acd91851a6639e1904e0384731a132185d1684680000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"], "method": "getwork", "id": "json"}

And the server's response (if the result was correct):
Code:
{"id":"json","error":null,"result":true}


Title: Re: Documentation needed for a pool (wire level protocol)?
Post by: NetTecture on June 23, 2011, 07:25:17 PM
Mining software must communicate with a pool/proxy/bitcoind for two reasons; to get work and to submit work.

The most common protocol (supported by every mining software I've seen) for that is JSON-RPC: http://en.wikipedia.org/wiki/JSON-RPC (http://en.wikipedia.org/wiki/JSON-RPC).

This is the request a miner makes to the server to get new work:
Code:
{"params": [], "method": "getwork", "id": "json"}

An example response by the server:
Code:
{"id":"json","error":null,"result":{"midstate":"b07ab2ccf48b89a0217384c1299d8b7e7cc9bb7ac16dd1366d9955669cb253aa","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000","data":"0000000146f6a6158418099f9c3a68ffec435166cfdb9eef51479153000001ee000000004d3a3c9c00dc8b69df7c0e9b4f3fa4ea587cddd2392d186e9dca1b5ea1669ea74e03844d1a13218500000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000"}}

An example of the request made by a miner to submit results:
Code:
{"params": ["000000019a086f0290f4b6d34a6e1b8a4b9974d585819abcd8e8f3d400000b5d00000000aaf9271bb6c2892dd5f96a71da1ed4be9b234f74a8de246acd91851a6639e1904e0384731a132185d1684680000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"], "method": "getwork", "id": "json"}

is there a full documentation for this communication? I am especially inerested actually in:
* All commands and return codes
* How to handle authentication etc.

Or do I ahve t oget some code from a miner and try to reverse engineer this part?

And the server's response (if the result was correct):
Code:
{"id":"json","error":null,"result":true}


Title: Re: Documentation needed for a pool (wire level protocol)?
Post by: wyze on June 23, 2011, 07:29:53 PM
Maybe these will help you?

https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list


Title: Re: Documentation needed for a pool (wire level protocol)?
Post by: NetTecture on June 23, 2011, 08:09:31 PM
Maybe these will help you?

https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Yes, that is a decent start ;) Thanks. Will give it a try.