- Steve Sokolowski

- Archived posts: 4559
- Joined: Aug 27, 2014
Stratum protocol shortcoming (Attention lozschor)
After some investigation in response to complaints about disconnections, we discovered a critical flaw in the stratum protocol for which we need to determine a solution.
Most customers use one miner per connection. However, the stratum protocol provides the ability to authorize multiple miners per connection. According to slush, who designed the original protocol, the reason for that ability was so that each mining rig in a "basement full of mining rigs" didn't need to have its own connection to send shares. In contrast, the protocol does not provide the ability to receive shares directed to individual miners.
This solution worked fine when the protocol was developed in 2011, because bitcoin was the only game in town. Miners mined the bitcoin chain only. When a new block was received, everyone in the pool was sent the same work. When that block was stale, it was fine to send all the miners the same work again.
Years later, this paradigm is obsolete, but the protocol hasn't changed. Merge mining, for example, doesn't make sense if every miner is resent work every time a new miner authorizes, because there is no need to send merge mined work for every new block. Static difficulties cannot be accurately computed with multiple miners per connection, especially when one of the miners wants a variable difficulty. Most importantly, mining a static coin with one miner but not with another in the same connection is impossible. These are all because every time work is sent in stratum, there is no way to target a specific mining rig.
Lozshor has encountered this problem. He apparently has two miners connected with different users (lozshor and MineCoins247) on the same connection. One of the miners is set to static mine litecoins, while the other isn't. The disconnections are occurring because the work submitted from each miner doesn't make sense for the other miner, which is mining a different coin.
We're trying to figure out how to deal with this issue, and suggestions are welcome. For now, one way to deal with this is to validate all password arguments for miners who are authenticated in such a way, so that the only way to connect multiple miners would be if all of them have the same password arguments. If there are two miners with differing coins on the same connection, for example, then the default would be chosen, which is to mine the most profitable coin. An error message would be presented to the user indicating that. Unfortunately, there is no way that it is possible to work around this issue because we can't modify the messages the client accepts.
Another proposal that has been discussed is encouraging the formation of a committee to implement changes to the stratum protocol to deal with this and other issues. The problems with the stratum protocol have been mounting for some time, and it would be nice to be able to extend the protocol with features like a method of obtaining what algorithms the client supports and instructing it to mine a specific algorithm.
Most customers use one miner per connection. However, the stratum protocol provides the ability to authorize multiple miners per connection. According to slush, who designed the original protocol, the reason for that ability was so that each mining rig in a "basement full of mining rigs" didn't need to have its own connection to send shares. In contrast, the protocol does not provide the ability to receive shares directed to individual miners.
This solution worked fine when the protocol was developed in 2011, because bitcoin was the only game in town. Miners mined the bitcoin chain only. When a new block was received, everyone in the pool was sent the same work. When that block was stale, it was fine to send all the miners the same work again.
Years later, this paradigm is obsolete, but the protocol hasn't changed. Merge mining, for example, doesn't make sense if every miner is resent work every time a new miner authorizes, because there is no need to send merge mined work for every new block. Static difficulties cannot be accurately computed with multiple miners per connection, especially when one of the miners wants a variable difficulty. Most importantly, mining a static coin with one miner but not with another in the same connection is impossible. These are all because every time work is sent in stratum, there is no way to target a specific mining rig.
Lozshor has encountered this problem. He apparently has two miners connected with different users (lozshor and MineCoins247) on the same connection. One of the miners is set to static mine litecoins, while the other isn't. The disconnections are occurring because the work submitted from each miner doesn't make sense for the other miner, which is mining a different coin.
We're trying to figure out how to deal with this issue, and suggestions are welcome. For now, one way to deal with this is to validate all password arguments for miners who are authenticated in such a way, so that the only way to connect multiple miners would be if all of them have the same password arguments. If there are two miners with differing coins on the same connection, for example, then the default would be chosen, which is to mine the most profitable coin. An error message would be presented to the user indicating that. Unfortunately, there is no way that it is possible to work around this issue because we can't modify the messages the client accepts.
Another proposal that has been discussed is encouraging the formation of a committee to implement changes to the stratum protocol to deal with this and other issues. The problems with the stratum protocol have been mounting for some time, and it would be nice to be able to extend the protocol with features like a method of obtaining what algorithms the client supports and instructing it to mine a specific algorithm.