summaryrefslogtreecommitdiff
path: root/c8/31ec7703a01fac66ef01f82489d0abfcbf2850
blob: b7ba56c309b214bb3db12ddaf0e538e292519074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <operator@bitminter.com>) id 1S4FYR-0000SD-Ay
	for bitcoin-development@lists.sourceforge.net;
	Sun, 04 Mar 2012 17:49:07 +0000
X-ACL-Warn: 
Received: from thalia-smout.broadpark.no ([80.202.8.21])
	by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76)
	id 1S4FYQ-0006Hp-2R for bitcoin-development@lists.sourceforge.net;
	Sun, 04 Mar 2012 17:49:07 +0000
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from terra-smin.broadpark.no ([80.202.8.13])
	by thalia-smout.broadpark.no
	(Sun Java(tm) System Messaging Server 7u3-15.01 64bit (built Feb 12
	2010)) with ESMTP id <0M0D00ES6G5NK610@thalia-smout.broadpark.no> for
	bitcoin-development@lists.sourceforge.net; Sun,
	04 Mar 2012 18:48:59 +0100 (CET)
Received: from xr4.com ([80.203.26.133]) by terra-smin.broadpark.no
	(Sun Java(tm) System Messaging Server 7u3-15.01 64bit (built Feb 12
	2010)) with ESMTP id <0M0D00A47G5NLP21@terra-smin.broadpark.no> for
	bitcoin-development@lists.sourceforge.net; Sun,
	04 Mar 2012 18:48:59 +0100 (CET)
Received: from [192.168.1.4] (grimreaper.xr4.com [192.168.1.4])
	by xr4.com (Postfix) with ESMTP id 803F026392; Sun,
	04 Mar 2012 18:48:59 +0100 (CET)
Message-id: <4F53AB0C.5010008@bitminter.com>
Date: Sun, 04 Mar 2012 18:49:00 +0100
From: Geir Harald Hansen <operator@bitminter.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216
	Thunderbird/10.0.2
To: Luke-Jr <luke@dashjr.org>
References: <201202281706.22650.luke@dashjr.org>
	<4F52AE86.2060102@bitminter.com> <201203032004.31048.luke@dashjr.org>
In-reply-to: <201203032004.31048.luke@dashjr.org>
X-Spam-Score: 0.0 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
X-Headers-End: 1S4FYQ-0006Hp-2R
Cc: bitcoin-development@lists.sourceforge.net
Subject: Re: [Bitcoin-development] getmemorypool BIP process
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Sun, 04 Mar 2012 17:49:07 -0000

On 04.03.2012 02:04, Luke-Jr wrote:
> On Saturday, March 03, 2012 6:51:34 PM Geir Harald Hansen wrote:
>> Long polling as currently implemented in pools has a race condition.
>> Does the miner reconnect first or does another block change happen
>> first? "Double" block changes are common with merged mining and I'm
>> doing all sorts of tricks in my pool backend to reduce this problem.
> 
> How would you suggest addressing this? I presume if a share solves blocks on 
> multiple chains, you just longpoll once when that's successful?

If the client doesn't tell you which block change it saw last, you can't
avoid this problem completely.

>> How about another entry "longpollid" in long poll responses. The last
>> seen longpollid should be included by the client in future long poll
>> requests. This enables the server to see if the client has missed any
>> block changes. The ID could perhaps be submitted in an HTTP header
>> (X-LongPollID?) if we wish to keep the JSON-RPC params empty, or params
>> could hold an object with a key "longpollid". Could be a string or
>> number, like "workid".
> 
> Hmm, the problem is that adding any parameters to getmemorypool itself breaks 
> compatibility with bitcoind 0.5, and using HTTP headers makes it HTTP-specific 
> again. Any ideas?

I think long polling and reconnecting to LP is an HTTP-specific problem
anyway? So it may be best to go with an HTTP header. See below for an
idea for a capabilities reporting system, though, which would allow
putting this data into JSON.

>> Another useful value in the getmemorypool response would be "height", so
>> the miner can include the correct height in the coinbase. I would like
>> that in bitcoind as well. One JSON-RPC call instead of two, and no race
>> condition between getmemorypool and getblocknumber.
> 
> Good catch. Should this be required (since it might be necessary for future 
> Bitcoin blocks), or just "should" for compatibility?

I think "should" makes sense.

>> It should be explained how target vs. fulltarget works.
> 
> What is unclear about this?

Reading through it again it is mostly clear except for one thing, how to
submit "share/merkle" style. It doesn't say exactly how to submit this data.

It says merkle tree, but a merkle branch should suffice. Also, I believe
the coinbase must always be the first transaction of a block? So we
won't need the transaction's index in the merkle tree (it's always index
zero). This would then be just an array of sha256 hashes making up the
merkle branch for the coinbase.

I'd prefer if block header, coinbase tx and merkle branch were submitted
in 3 pieces. When merged mining and submitting a block generating proof
to the aux backend you put an auxiliary proof of work between the block
header and transactions. So the header and transactions are not
necessarily adjacent. Also, there's no merkle branch in a regular
bitcoin block.

>> Perhaps some things should be optional for a client to implement?
> 
> Doing this safely needs some way for clients to communicate capabilities to 
> the server, which has the problem of passing parameters to getmemorypool.

Let's add an optional "servercapabilities" key on the server side, the
value being a space-delimited list of what's supported by the server. If
that list contains "clientcapabilities" then the client may, instead of
sending an empty request, send an object where one of the keys is
"clientcapabilities", and the value is a space-delimited list of extensions.

Those names are a bit long, maybe "caps" is better.

Ok, this is not entirely clean. For the first request the client won't
know what the server supports. For subsequent requests I guess always
assume the last caps the server reported.

>> I think "noncerange" is of limited use and there's a good chance of getting
>> the endianness wrong.
> 
> There is no mining hardware to date that exhausts even half the nonce space, 
> so I'd really prefer to see this as a required feature on the miner side. On 
> the other hand, it's merely an extension for getwork, so I can see the problem 
> so long as we're using getwork proxies.

Yes, you can end up getting half a nonce range from an upstream server,
and not being able to make use of it because your downstream clients
don't support it.

A single GPU can make full use of the noncerange if you allow the
timestamp to slip a few seconds into the past. I believe most miners do
that today.

Also worth including are the "hostlist" and "switchto" getwork
extensions. I think those can fit right into the JSON response, to keep
with being transport-agnostic, but otherwise look like they do for getwork.

Regards,
Geir H. Hansen