Example accepted getwork function input and output?

6

1

I'm looking for example getwork input and output of a successful block hash to verify a getwork client I've implemented.

I'd also accept suggestions on better ways to verify this. I've looked at TestNet but this seems to be a slow process.

Glen T

Posted 2012-12-15T21:41:30.587

Reputation: 163

The best thing I've come up with at the moment is looking at the block explorer and trying to manually recreate the block header in the format of getwork data and compare it to the resulting hash.Glen T 2012-12-16T20:23:47.397

You can try running some miner and wireshark the traffic between your machine and a pool / testnet server client.ThePiachu 2012-12-17T12:41:09.647

Thanks for the suggestion but my problem is I'm unable to capture a successful block hash.Glen T 2012-12-18T05:37:06.573

You can always try setting up mining on testnet and try to capture a block there.ThePiachu 2012-12-18T05:58:25.207

Have tried but wasn't able to generate a block yet sadly.Glen T 2012-12-19T15:38:50.980

Answers

3

On testnet I get the following dump:

Miner -> bitcoind

POST / HTTP/1.1
Authorization: Basic Y2RlY2tlcjphYmMxMjM=
Host: localhost:18332
Accept: */*
Accept-Encoding: deflate, gzip
Content-type: application/json
X-Mining-Extensions: longpoll midstate rollntime submitold
X-Mining-Hashrate: 583000000
Content-Length: 45
User-Agent: cgminer 2.8.1

{"method": "getwork", "params": [], "id":0}

Response

HTTP/1.1 200 OK
Date: Fri, 01 Feb 2013 20:40:06 +0000
Connection: keep-alive
Content-Length: 592
Content-Type: application/json
Server: bitcoin-json-rpc/v0.7.2.0-g32a928e-beta

{"result":{"midstate":"d330cdcb6296c8befe66dc38ca10589aa54cb364bf2f174aea7c9329263841f9","data":"00000002b15704f4ecae05d077e54f6ec36da7f20189ef73b77603225ae56d2b00000000bcf59695a4e35a2f7535e1a86b306a3b08c212bf0b833764018fe39f01919381510c28111c0e8a3700000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"00000000000000000000000000000000000000000000000000378a0e00000000"},"error":null,"id":0}

Reporting successful blockwith diff 18:

POST / HTTP/1.1
Authorization: Basic Y2RlY2tlcjphYmMxMjM=
Host: localhost:18332
Accept: */*
Accept-Encoding: deflate, gzip
Content-type: application/json
X-Mining-Extensions: longpoll midstate rollntime submitold
X-Mining-Hashrate: 661000000
Content-Length: 305
User-Agent: cgminer 2.8.1

{"method": "getwork", "params": [ "00000002b15704f4ecae05d077e54f6ec36da7f20189ef73b77603225ae56d2b00000000b052cbbdeed2489ccb13a526b77fadceef4caf7d3bb82a9eb0b69ebb90f9f5a7510c27fd1c0e8a37fa531338000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000" ], "id":1}

I hope I didn't mix the requests.

cdecker

Posted 2012-12-15T21:41:30.587

Reputation: 7 878