Creating an Ergo mining pool

And concrete scheme how to implement a pool with collaterals:

"This code shows how to do a client checking a Merkle-tree based membership proof against an incomplete header (so header without a proof-of-work solution). This could be useful for a decentralized pool with collaterals, where the pool checks shares from miners, and a share includes proof that a corresponding block contains a certain transaction (paying to the pool).

For example, an implementation for a decentralized pool could be as follows:
1. A miner is creating a transaction which is paying to the pool
(posting of the tx by the pool outside the block should be impossible)
2. The miner is creating block candidate with the tx included (via calling “mining/candidateWithTxs”).
The result would be like the following:
{
“msg” : “6cb37d0a202bc2984f43de003cbc5558804db45798d0fc8faae7390b96d42d15”,
“b” : 748014723576678314041035877227113663879264849498014394977645987,
“pk” : “0278011ec0cf5feb92d61adb51dcb75876627ace6fd9446ab4cabc5313ab7b39a7”,
“proof” : {
“msgPreimage” : “01fb9e35f8a73c128b73e8fde5c108228060d68f11a69359ee0fb9bfd84e7ecde6d19957ccbbe75b075b3baf1cac6126b6e80b5770258f4cec29fbde92337faeec74c851610658a40f5ae74aa3a4babd5751bd827a6ccc1fe069468ef487cb90a8c452f6f90ab0b6c818f19b5d17befd85de199d533893a359eb25e7804c8b5d7514d784c8e0e52dabae6e89a9d6ed9c84388b228e7cdee09462488c636a87931d656eb8b40f82a507008ccacbee05000000”,
“txProofs” : [{
“leaf” : “642c15c62553edd8fd9af9a6f754f3c7a6c03faacd0c9b9d5b7d11052c6c6fe8”,
“levels” : [
“0139b79af823a92aa72ced2c6d9e7f7f4687de5b5af7fab0ad205d3e54bda3f3ae”
]}]}}

  1. The miner is mining the block using “msg”, “b”, “pk” as it happens now. If block is found, the miner is posting the transaction to the network. However, if real difficulty of the solution is not enough to form a block but enough for a share, then the miner can post the share to the pool. The share consists of “msg”, “b”, “pk”, solution and the “proof”.

  2. The pool checks that the share is valid. In particular, the pool checks that:

    a) the “msgPreimage” (which is a header without a PoW solution) along with the PoW form a valid header with enough difficulty
    b) the header contains transaction by using “proof”

2 Likes