Bitcoin Forum
February 07, 2023, 05:19:23 PM *
News: Latest Bitcoin Core release: 24.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: 100$ за разбор исходников на c++  (Read 9478 times)
vadim_msk (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
June 16, 2011, 07:28:10 AM
 #1

http://forum.bitcoin.org/index.php?topic=16037.0
Нужны запросы в формате голых http заголовков.
http://www.mediafire.com/?ve608cl5mk1ka3 - вроде самые понятные исходники на c++.
1675790363
Hero Member
*
Offline Offline

Posts: 1675790363

View Profile Personal Message (Offline)

Ignore
1675790363
Reply with quote  #2

1675790363
Report to moderator
The network tries to produce one block per 10 minutes. It does this by automatically adjusting how difficult it is to produce blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1675790363
Hero Member
*
Offline Offline

Posts: 1675790363

View Profile Personal Message (Offline)

Ignore
1675790363
Reply with quote  #2

1675790363
Report to moderator
1675790363
Hero Member
*
Offline Offline

Posts: 1675790363

View Profile Personal Message (Offline)

Ignore
1675790363
Reply with quote  #2

1675790363
Report to moderator
1675790363
Hero Member
*
Offline Offline

Posts: 1675790363

View Profile Personal Message (Offline)

Ignore
1675790363
Reply with quote  #2

1675790363
Report to moderator
Bablos
Newbie
*
Offline Offline

Activity: 23
Merit: 8


View Profile
June 16, 2011, 10:22:02 AM
Last edit: June 16, 2011, 02:57:42 PM by Bablos
Merited by xandry (7), klarki (1)
 #2

Вадим, чего ты хотел-то а?  Huh
(дал ссылку на какую-то рекламу файлобменика, нужны запросы от кого кому?)

Если тебя интересует как обменивается майнер с пулом или с bitcoin клиентом, то берешь бинарник манейра для CPU от Jgarzik, - он понятнее всего написан и с меньшими проблемами собирается на большинстве ОС. У него есть опция "-P" для печати протокола обмена, с ней идешь, например, тренироваться на namecoin пул bitparking.com (не требует какой-либо регистрации, только имей адрес, куда потом можно попросить сбросить заработанное):

Code:
./minerd  --userpass N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh:anything --url http://bitparking.com:9098 -r -1 -a 4way -P
[2011-06-16 13:27:29] JSON protocol request:
{"method": "getwork", "params": [], "id":0}


* About to connect() to proxy 192.168.31.28 port 8080 (#0)
*   Trying 192.168.31.28... * TCP_NODELAY set
* connected
* Connected to 192.168.31.28 (192.168.31.28) port 8080 (#0)
* Server auth using Basic with user 'N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh'
> POST http://bitparking.com:9098 HTTP/1.1
Authorization: Basic TjZvZTJOM1pzcnZUcXdSYUFvc0Q3OWM0RUQ4ZzF4amdlaDphbnl0aGluZw==
Host: bitparking.com:9098
Pragma: no-cache
Accept: */*
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
Content-type: application/json
Content-Length: 45
User-Agent: cpuminer 1.0

[2011-06-16 13:27:30] 1 miner threads started, using SHA256 '4way' algorithm.
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: nginx/0.7.65
[2011-06-16 13:27:34] HTTP hdr(Server): nginx/0.7.65
< Date: Thu, 16 Jun 2011 09:27:34 GMT
[2011-06-16 13:27:34] HTTP hdr(Date): Thu, 16 Jun 2011 09:27:34 GMT
< Content-Type: application/json
[2011-06-16 13:27:34] HTTP hdr(Content-Type): application/json
< Content-Length: 591
[2011-06-16 13:27:34] HTTP hdr(Content-Length): 591
< Content-script-type: text/javascript
[2011-06-16 13:27:34] HTTP hdr(Content-script-type): text/javascript
< X-Long-Polling: http://namecoin.bitparking.com:28081/longpoll
[2011-06-16 13:27:34] HTTP hdr(X-Long-Polling): http://namecoin.bitparking.com:28081/longpoll
< X-Cache: MISS from proxy.farfar.away.ru
[2011-06-16 13:27:34] HTTP hdr(X-Cache): MISS from proxy.farfar.away.ru
< X-Cache-Lookup: MISS from proxy.farfar.away.ru:8080
[2011-06-16 13:27:34] HTTP hdr(X-Cache-Lookup): MISS from proxy.farfar.away.ru:8080
* HTTP/1.0 proxy connection set to keep alive!
< Proxy-Connection: keep-alive
[2011-06-16 13:27:34] HTTP hdr(Proxy-Connection): keep-alive
<
* Connection #0 to host 192.168.31.28 left intact
[2011-06-16 13:27:34] Long-polling activated for http://namecoin.bitparking.com:28081/longpoll
[2011-06-16 13:27:34] JSON protocol request:
{"method": "getwork", "params": [], "id":0}


* About to connect() to proxy 192.168.31.28 port 8080 (#0)
*   Trying 192.168.31.28... * TCP_NODELAY set
[2011-06-16 13:27:34] JSON protocol response:
{
   "error": null,
   "result": {
      "target": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000",
      "midstate": "23a5462da570289c8f96df3f77857d334fad33d1ff26f86f98ea6b8c528179ea",
      "hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
      "data": "0000000136d875b9447e6dae07cb0025c4984c4103fc42af02151c9e0001600c0000000081bdf1bdbc97284973c58f871d199ce705cae3a79640715e08ba9bf1b47594b14df9cc841b04592f00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
   },
   "id": 1
}
* connected
* Connected to 192.168.31.28 (192.168.31.28) port 8080 (#0)
* Server auth using Basic with user 'N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh'
> POST http://namecoin.bitparking.com:28081/longpoll HTTP/1.1
Authorization: Basic TjZvZTJOM1pzcnZUcXdSYUFvc0Q3OWM0RUQ4ZzF4amdlaDphbnl0aGluZw==
Host: namecoin.bitparking.com:28081
Pragma: no-cache
Accept: */*
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
Content-type: application/json
Content-Length: 45
User-Agent: cpuminer 1.0

[2011-06-16 13:28:13] thread 0: 16777216 hashes, 435.47 khash/sec
[2011-06-16 13:28:13] JSON protocol request:
{"method": "getwork", "params": [], "id":0}


* Re-using existing connection! (#0) with host 192.168.31.28
* Connected to 192.168.31.28 (192.168.31.28) port 8080 (#0)
* Server auth using Basic with user 'N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh'
> POST http://bitparking.com:9098 HTTP/1.1
Authorization: Basic TjZvZTJOM1pzcnZUcXdSYUFvc0Q3OWM0RUQ4ZzF4amdlaDphbnl0aGluZw==
Host: bitparking.com:9098
Pragma: no-cache
Accept: */*
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
Content-type: application/json
Content-Length: 45
User-Agent: cpuminer 1.0

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: nginx/0.7.65
< Date: Thu, 16 Jun 2011 09:28:13 GMT
< Content-Type: application/json
< Content-Length: 591
< Content-script-type: text/javascript
< X-Long-Polling: http://namecoin.bitparking.com:28081/longpoll
< X-Cache: MISS from proxy.farfar.away.ru
< X-Cache-Lookup: MISS from proxy.farfar.away.ru:8080
* HTTP/1.0 proxy connection set to keep alive!
< Proxy-Connection: keep-alive
<
* Connection #0 to host 192.168.31.28 left intact
[2011-06-16 13:28:13] JSON protocol response:
{
   "error": null,
   "result": {
      "target": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000",
      "midstate": "daa42e3211f0362efc063e2b4baa1f8aeb61ccaca83cdab3a69130af584fa838",
      "hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
      "data": "0000000141f2067c93e6c4bb2e38d94d7cfb0ef3a344fe355361d1a700020ec0000000003a153e52f061869453c9ad322b9d12548bf5f876e444aaee6713c66d84a90c5e4df9ccab1b04592f00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
   },
   "id": 1
}

.... ... .. .

В конце-концов одна и попыток найти nonce, для одного из выданных заданий будет удачной, и тогда в очередной запросе будет выдан этот результат (на который будет дано подтверждение принято ли решение или нет, а затем будут продолжаться запросы заданий с пустым параметром; в этом ответе появилось поле nonce равное "dd7c5f00" вместо нулевых байт в задании которое было перед этим; кстати 6257856=0x5F7CC0, а разница из-за выбрананого алгоритма 4way обрабатывающего сразу 4 хеша):
Code:
[2011-06-16 18:00:27] JSON protocol response:
{
   "error": null,
   "result": {
      "target": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000",
      "midstate": "405ff1b847ab172b846e226aec2e7bcbcd186616b6b69392be7443523abbecfc",
      "hash1": "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
      "data": "000000014f57c6fe236b27b438906653a1d0a56904ef3d006cc47b5d0001ac2300000000ca96c254c7551a84008df04f93fdf31bdfae8fbdd70593d8e4958a5e99af6e204dfa0c791b04592f00000000000000800000000000000
000000000000000000000000000000000000000000000000000000000000000000080020000"
   },
   "id": 1
}
[2011-06-16 18:00:41] thread 0: 6257856 hashes, 429.52 khash/sec
[2011-06-16 18:00:41] JSON protocol request:
{"method": "getwork", "params": [ "000000014f57c6fe236b27b438906653a1d0a56904ef3d006cc47b5d0001ac2300000000ca96c254c7551a84008df04f93fdf31bdfae8fbdd70593d8e4958a5e99af6e204dfa0c791b04592fdd7c5f000
00000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000" ], "id":1}


* Re-using existing connection! (#0) with host 192.168.31.28
* Connected to 192.168.31.28 (192.168.31.28) port 8080 (#0)
* Server auth using Basic with user 'N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh'
> POST http://bitparking.com:9098 HTTP/1.1
Authorization: Basic TjZvZTJOM1pzcnZUcXdSYUFvc0Q3OWM0RUQ4ZzF4amdlaDphbnl0aGluZw==
Host: bitparking.com:9098
Pragma: no-cache
Accept: */*
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
Content-type: application/json
Content-Length: 305
User-Agent: cpuminer 1.0

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: nginx/0.7.65
< Date: Thu, 16 Jun 2011 14:00:54 GMT
< Content-Type: application/json
< Content-Length: 35
< Content-script-type: text/javascript
< X-Cache: MISS from proxy.farfar.away.ru
< X-Cache-Lookup: MISS from proxy.farfar.away.ru:8080
* HTTP/1.0 proxy connection set to keep alive!
< Proxy-Connection: keep-alive
<
* Connection #0 to host 192.168.31.28 left intact
[2011-06-16 18:00:54] JSON protocol response:
{
   "error": null,
   "result": true,
   "id": 1
}
[2011-06-16 18:00:54] PROOF OF WORK RESULT: true (yay!!!)
[2011-06-16 18:00:54] JSON protocol request:
{"method": "getwork", "params": [], "id":0}

...

Можно точно также поизучать протокол обмена без longpoll, - ставишь дополнительную опцию "--no-longpoll", либо работаешь со своим локальным bitcoin/namecoin клиентом (но на нем вряд ли дождешься нахождения блока, т.к. в отличие от работы через пул сложность будет не единичная, а реальная).

P.S. У меня майнер слегка подхаченный, работает через прокси сервер, так что твой лог должен быть ещё проще...

P.P.S Насчет "Authorization: Basic" пишем javascript:atob("TjZvZTJOM1pzcnZUcXdSYUFvc0Q3OWM0RUQ4ZzF4amdlaDphbnl0aGluZw==") в командной строке firefox и тот выдаст "N6oe2N3ZsrvTqwRaAosD79c4ED8g1xjgeh:anything"..
vadim_msk (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
June 16, 2011, 11:26:37 AM
Last edit: June 16, 2011, 03:20:41 PM by vadim_msk
 #3

Спасибо. Буду экспериментировать, думаю это то, что нужно Smiley
А ссылку я давал на исходники майнера RPC Miners http://forum.bitcoin.org/index.php?topic=2444.0
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!