How does a mining pool coordinate with different Javascript clients?

0

I've been reading a little about those web sites taht surreptitiously had Javascript running on the page that is mining cryptocurrency. How do those pieces of JS work code generally? Specifically

  1. Do all pieces of Javascript code report back to a central server which maintains a mining pool?

  2. Does each piece of code get a separate piece of work to do (and get assigned a different worker ID) so the malicious web site can mine faster?

Dave

Posted 2018-01-25T18:38:26.380

Reputation: 375

You are talking about coinhive?ndsvw 2018-01-25T19:48:15.537

Sure if that's a useful examples taht demonstrates the theory.Dave 2018-01-25T22:13:37.700

Answers

1

The web site doing this don't need to be considered malicious, the visitor could willing agree to do the mining in order to help it. Said that,

  1. Yes, they need to, to know the hash of the merkle tree of the block the pool is trying to mine. Otherwise they would have to download the blockchain in the browser themselves, and that would take hours or days. They also should somehow receive transactions to include in their blocks. Javascript running on a webpage can't typically comunicate with a cryptocurrency node directly, only via http requests to the same page domain.
  2. Yes, they also need to, otherwise they would be wasting CPU time doing the same work. For example, visitor A could receive instructions to compute hashes for a block X with nounces ranging from 0 to 15999, visitor B with nounces from 16000 to 31999 and so on.

Osias Jota

Posted 2018-01-25T18:38:26.380

Reputation: 769