Bitcoin Forum
November 21, 2017, 02:30:26 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: « 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 »
  Print  
Author Topic: [ANN] Stratum mining protocol - ASIC ready  (Read 143518 times)
-ck
Moderator
Legendary
*
Offline Offline

Activity: 2338


Ruu \o/


View Profile WWW
February 21, 2013, 01:47:49 AM
 #501

Thanks. However what if it's the first command after the socket is opened?

Why there should be any exception for first message?

If the miner knows any recent session id, it should send mining.resume(id) firstly. If miner don't have any session id, it should send mining.subscribe(). When the pool doesn't understand mining.resume message, it should respond with standard error, not by closing the connection.

Is there really any pool which closes the connection on unknown message?
I was mistaken. I checked with Eleuthria and he said his pool simply doesn't respond to messages it doesn't recognise. This is a problem for me since I would have to wait for a response to time out and that would not be graceful or efficient. Perhaps for important auth messages I should let cgminer time out relatively quickly like 5 seconds since it really shouldn't take the pool longer than that to respond.

Primary developer/maintainer for cgminer and ckpool/ckproxy.
ZERO FEE Pooled mining at ckpool.org 1% Fee Solo mining at solo.ckpool.org
-ck
1511274626
Hero Member
*
Offline Offline

Posts: 1511274626

View Profile Personal Message (Offline)

Ignore
1511274626
Reply with quote  #2

1511274626
Report to moderator
1511274626
Hero Member
*
Offline Offline

Posts: 1511274626

View Profile Personal Message (Offline)

Ignore
1511274626
Reply with quote  #2

1511274626
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511274626
Hero Member
*
Offline Offline

Posts: 1511274626

View Profile Personal Message (Offline)

Ignore
1511274626
Reply with quote  #2

1511274626
Report to moderator
slush
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
February 21, 2013, 01:54:13 AM
 #502

It will be better to ask Eleuthria to add standard error messages for unknown methods. It's actually pretty easy and it will make the life easier.

Auth messages are a bit sensitive, because pool may need database lookup. Especially during the server restart authorization messages may take longer time than usual, because of connection storms.

DrHaribo
Legendary
*
Offline Offline

Activity: 2240


Bitminter.com Operator


View Profile WWW
February 21, 2013, 06:43:02 AM
 #503

Is it possible to use the existing unique subscription ID as the session ID with mining.resume instead?

Sounds good to me, mine is just hardcoded to "1" at the moment. I'll make it unique when it is actually used for something. Wink

Pool should not close the connection on unknown message.

Can this go in the docs?

As well as mining.resume and mining.identify or whatever the "which client version are you" message is called.

▶▶▶ Bitminter.com - Your trusted mining pool since 2011.
-ck
Moderator
Legendary
*
Offline Offline

Activity: 2338


Ruu \o/


View Profile WWW
February 21, 2013, 07:25:35 AM
 #504

Is it possible to use the existing unique subscription ID as the session ID with mining.resume instead?

Sounds good to me, mine is just hardcoded to "1" at the moment. I'll make it unique when it is actually used for something. Wink
We had a chat about this on IRC and agreed this would be the most seamless conversion without breaking existing clients. If the client gets a different id or enonce1 they assume it didn't resume.

Primary developer/maintainer for cgminer and ckpool/ckproxy.
ZERO FEE Pooled mining at ckpool.org 1% Fee Solo mining at solo.ckpool.org
-ck
techwtf
Full Member
***
Offline Offline

Activity: 138


View Profile
February 22, 2013, 04:31:41 PM
 #505

Any chance to have the functionality like "X-Switch-To" in getwork protocol extension?
this may allow pool operators do some maintenance work & ask the miners to migrate to a fallback server.

I'm not sure if similar idea is asked before.
eleuthria
Legendary
*
Offline Offline

Activity: 1750



View Profile
February 22, 2013, 04:33:18 PM
 #506

Any chance to have the functionality like "X-Switch-To" in getwork protocol extension?
this may allow pool operators do some maintenance work & ask the miners to migrate to a fallback server.

I'm not sure if similar idea is asked before.

This was actually suggested by me on the very first reply to the thread.  I'm not sure if we'll see it standardized though.

RIP BTC Guild, April 2011 - June 2015
slush
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
February 22, 2013, 04:34:45 PM
 #507

There's mining.reconnect(). It should work in proxy, poclbm and cgminer too.

techwtf
Full Member
***
Offline Offline

Activity: 138


View Profile
February 22, 2013, 06:04:48 PM
 #508

There's mining.reconnect(). It should work in proxy, poclbm and cgminer too.

thank you and eleuthria Smiley I didnt come up with "reconnect" so it is ignored Smiley
DrHaribo
Legendary
*
Offline Offline

Activity: 2240


Bitminter.com Operator


View Profile WWW
February 22, 2013, 06:26:04 PM
 #509

There's mining.reconnect(). It should work in proxy, poclbm and cgminer too.

Is this an extension? Where are those documented?

▶▶▶ Bitminter.com - Your trusted mining pool since 2011.
slush
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
February 22, 2013, 06:41:57 PM
 #510

They're documented in not-yet-written BIP 40/41 O:-). I recommend to check stratum proxy as a reference implementation: https://github.com/slush0/stratum-mining-proxy/blob/master/mining_libs/client_service.py

-ck
Moderator
Legendary
*
Offline Offline

Activity: 2338


Ruu \o/


View Profile WWW
February 22, 2013, 09:21:51 PM
 #511

I've implemented the modified protocol for reconnection and it's in the current cgminer master git. Not sure if anyone's interested in testing it as you all could be too busy fapping to ASIC hashrates right about now. Either way it should work in a way that doesn't break existing pool stratum support or slush's proxy.

Primary developer/maintainer for cgminer and ckpool/ckproxy.
ZERO FEE Pooled mining at ckpool.org 1% Fee Solo mining at solo.ckpool.org
-ck
slush
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
February 23, 2013, 05:33:10 PM
 #512

Because Github no longer provides "Download section", I moved Windows binaries of Stratum Proxy here: https://mining.bitcoin.cz/media/download/mining_proxy.exe

This URL will always serve the latest Windows binary. I tried to update links on websites to this new URL, but please let me know if you'll find old link to Github download section somewhere.

kano
Legendary
*
Offline Offline

Activity: 2268


Linux since 1997 RedHat 4


View Profile
February 23, 2013, 05:52:23 PM
 #513

Because Github no longer provides "Download section", I moved Windows binaries of Stratum Proxy here: https://mining.bitcoin.cz/media/download/mining_proxy.exe

This URL will always serve the latest Windows binary. I tried to update links on websites to this new URL, but please let me know if you'll find old link to Github download section somewhere.
If you wish to see the old downloads you put in your git then just add "/downloads/" to your git address.
GutHub has disabled being able to add new downloads and will delete all download files soon.

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
slush
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
February 23, 2013, 06:03:05 PM
 #514

If you wish to see the old downloads you put in your git then just add "/downloads/" to your git address.
GutHub has disabled being able to add new downloads and will delete all download files soon.

I know that "/download" trick, I just wanted to make the announcement simple :-). But the important part is highlighted.

kano
Legendary
*
Offline Offline

Activity: 2268


Linux since 1997 RedHat 4


View Profile
February 23, 2013, 08:59:10 PM
 #515

If you wish to see the old downloads you put in your git then just add "/downloads/" to your git address.
GutHub has disabled being able to add new downloads and will delete all download files soon.

I know that "/download" trick, I just wanted to make the announcement simple :-). But the important part is highlighted.
I solved it by creating a cgminer-binaries git for me Smiley

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
-ck
Moderator
Legendary
*
Offline Offline

Activity: 2338


Ruu \o/


View Profile WWW
February 25, 2013, 02:22:24 AM
 #516

Ok for those not watching the discussion on #stratum on IRC, I believe we have a final protocol for mining resume which should not break any clients or pools.

It was decided that the parameters could include both the user agent and the session ID as the first and second parameters. If this fails cgminer/other clients should resort to sending blank set of parameters as previously.

The session Id, it was decided, would be encoded along with the notification message "mining.notify" as a member of the 3 deep array parameters returned for "result" by the pool.

See the following for an example of an initial connect followed by a reconnect.
Code:
[2013-02-25 10:30:58] SEND: {"id": 0, "method": "mining.subscribe", "params": ["cgminer/2.10.5"]}
 [2013-02-25 10:30:58] RECVD: {"result": [[["mining.notify", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108"], ["mining.set_difficulty", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e371082"]], "02000000", 4], "id": 0, "error": null}
 [2013-02-25 10:30:58] Pool 0 stratum session id: 02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108
 [2013-02-25 10:30:58] Pool 0 confirmed mining.subscribe with extranonce1 02000000 extran2size 4

 [2013-02-25 10:33:00] SEND: {"id": 2, "method": "mining.subscribe", "params": ["cgminer/2.10.5", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108"]}
 [2013-02-25 10:33:00] RECVD: {"result": [[["mining.notify", "02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e"], ["mining.set_difficulty", "02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e2"]], "02000000", 4], "id": 2, "error": null}
 [2013-02-25 10:33:00] Pool 0 stratum session id: 02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e
 [2013-02-25 10:33:00] Pool 0 confirmed mining.subscribe with extranonce1 02000000 extran2size 4
Note the session ID has changed between the initial subscription and the resume, BUT the extranonce1 has remained the same. This tells the miner it can (re)submit shares before the disconnection.

Hopefully we will not need to revise this any further.

Primary developer/maintainer for cgminer and ckpool/ckproxy.
ZERO FEE Pooled mining at ckpool.org 1% Fee Solo mining at solo.ckpool.org
-ck
eleuthria
Legendary
*
Offline Offline

Activity: 1750



View Profile
February 25, 2013, 02:45:55 AM
 #517

Ok for those not watching the discussion on #stratum on IRC, I believe we have a final protocol for mining resume which should not break any clients or pools.

It was decided that the parameters could include both the user agent and the session ID as the first and second parameters. If this fails cgminer/other clients should resort to sending blank set of parameters as previously.

The session Id, it was decided, would be encoded along with the notification message "mining.notify" as a member of the 3 deep array parameters returned for "result" by the pool.

See the following for an example of an initial connect followed by a reconnect.
Code:
[2013-02-25 10:30:58] SEND: {"id": 0, "method": "mining.subscribe", "params": ["cgminer/2.10.5"]}
 [2013-02-25 10:30:58] RECVD: {"result": [[["mining.notify", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108"], ["mining.set_difficulty", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e371082"]], "02000000", 4], "id": 0, "error": null}
 [2013-02-25 10:30:58] Pool 0 stratum session id: 02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108
 [2013-02-25 10:30:58] Pool 0 confirmed mining.subscribe with extranonce1 02000000 extran2size 4

 [2013-02-25 10:33:00] SEND: {"id": 2, "method": "mining.subscribe", "params": ["cgminer/2.10.5", "02000000b507a8fd1ea2b7d9cdec867086f6935228aba1540154f83930377ea5a2e37108"]}
 [2013-02-25 10:33:00] RECVD: {"result": [[["mining.notify", "02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e"], ["mining.set_difficulty", "02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e2"]], "02000000", 4], "id": 2, "error": null}
 [2013-02-25 10:33:00] Pool 0 stratum session id: 02000000c33cfaa37a964c2ba76c78b99dc170a1b1fe7a5fe025f72e89afba7fc6f23d0e
 [2013-02-25 10:33:00] Pool 0 confirmed mining.subscribe with extranonce1 02000000 extran2size 4
Note the session ID has changed between the initial subscription and the resume, BUT the extranonce1 has remained the same. This tells the miner it can (re)submit shares before the disconnection.

Hopefully we will not need to revise this any further.

Looks like what we discussed, and I will work on updating BTC Guild stratum servers in the future to support unique session IDs so disconnected sessions can resume without any shares completed during the disconnect period.  Also glad you decided on pushing the client software with the subscribe, it feels much better to push the data once at the initial handshake rather than have a ask/response method executed after.

RIP BTC Guild, April 2011 - June 2015
DrHaribo
Legendary
*
Offline Offline

Activity: 2240


Bitminter.com Operator


View Profile WWW
February 25, 2013, 07:14:52 AM
 #518

This looks good. Thanks for including the user-agent in there as well.

Note the session ID has changed between the initial subscription and the resume, BUT the extranonce1 has remained the same. This tells the miner it can (re)submit shares before the disconnection.

If the resume fails, how should the server respond? Give an error, or just a new extranonce1?

If the old connection is still there, I guess the server could disconnect it. That means the session ID must be hard to guess so you can't disconnect other people. You must also be very sure that you don't give out the same session ID twice, or you'll have two workers disconnecting each other all day.

It's safer to never resume a connection that still appears up to the server. But I wonder how often it will happen that a client tries to resume before the server discovers that the old connection is dead.

Letting both connections stay seems like a bad idea. They'd both be doing the same hashes in the unlikely event that they both keep hashing.

▶▶▶ Bitminter.com - Your trusted mining pool since 2011.
-ck
Moderator
Legendary
*
Offline Offline

Activity: 2338


Ruu \o/


View Profile WWW
February 25, 2013, 07:21:30 AM
 #519

This looks good. Thanks for including the user-agent in there as well.

Note the session ID has changed between the initial subscription and the resume, BUT the extranonce1 has remained the same. This tells the miner it can (re)submit shares before the disconnection.

If the resume fails, how should the server respond? Give an error, or just a new extranonce1?

If the old connection is still there, I guess the server could disconnect it. That means the session ID must be hard to guess so you can't disconnect other people. You must also be very sure that you don't give out the same session ID twice, or you'll have two workers disconnecting each other all day.

It's safer to never resume a connection that still appears up to the server. But I wonder how often it will happen that a client tries to resume before the server discovers that the old connection is dead.

Letting both connections stay seems like a bad idea. They'd both be doing the same hashes in the unlikely event that they both keep hashing.

I think submitting a new extranonce1 is all that is required. We should view the sessionid submission as a hint only and let the pool decide what to do. You will indeed need unique session IDs for this support to work. When luke-Jr tested it, he found that the old connection was not actually detached before I was requesting a new one with the sessionID. This is not surprising given how difficult it can be to tell that a raw socket is actually broken or not. I suspect that dropping the first connection there is the answer.

Primary developer/maintainer for cgminer and ckpool/ckproxy.
ZERO FEE Pooled mining at ckpool.org 1% Fee Solo mining at solo.ckpool.org
-ck
zvs
Legendary
*
Offline Offline

Activity: 1484


I have some bitcoins. Somewhere.


View Profile WWW
February 27, 2013, 06:27:05 AM
 #520

so, earlier, I posted a query about stratum causing too much cpu load and jerkiness in computers that didnt have problem with longpolling.  turning back on nagle seems to have solved that for the most part

but, i also noticed this



is minerd just really fast, is cgminer slow, or is stratum slow?  one of them was 2s late

Dacentec, best deals for US dedicated servers. They regularly restock $20-$25 Opterons with 8-16GB RAM & 2x1-2TB HDD's (ofc, usually lots of other good stuff to choose from).  I did a Serverbear benchmark of one of my $20/mo Opteron (June last year), it's here.  Have had about a half dozen different servers with Dacentec, & none have failed to sustain at least 40MB/s (burst higher). My favorite is a 12-month rent-to-own ZT Systems 2XL5520 16GB 2x2TB SATA for $40/month (got lucky with the 'off-brand', haven't seen a RTO 2xL5520 for under $50/mo since -- at least for monthly contracts).  wholesaleinternet.com has some ancient 2-core intel CPUs @ $10/mo sometimes (I got an Intel Core 2 6300 @ 1.86GHz, with a 250GB HDD with 46000 hours on it, LOL. $20 @ Dacentec is much better, if you can grab one). joesdatacenter.com (same location as Wholesale Internet) also occasionally has specials (or if you don't want to wait, it has an AMD Opteron 170 @ $16/mo).
Pages: « 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 »
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!