3

I am looking for documentation or specification of communication/protocol between client and pool. Is there some or do I have to dig into source code of geth?

(Yes, I know about the RPC documentation, I am looking for something that describes what data are transmitter, how does miner initiate communication with pool, etc.)

2

Easiest place I know of is to look into the source code of sammy007/open-ethereum-pool.

Here are the main JSON-RPC methods you will need to support, from sammy007/open-ethereum-pool/proxy/proxy.go, lines 232-269:

switch req.Method {
    case "eth_getWork":
        reply, errReply := s.handleGetWorkRPC(cs)
        if errReply != nil {
            cs.sendError(req.Id, errReply)
            break
        }
        cs.sendResult(req.Id, &reply)
    case "eth_submitWork":
        if req.Params != nil {
            var params []string
            err := json.Unmarshal(*req.Params, &params)
            if err != nil {
                log.Printf("Unable to parse params from %v", cs.ip)
                s.policy.ApplyMalformedPolicy(cs.ip)
                break
            }
            reply, errReply := s.handleSubmitRPC(cs, login, vars["id"], params)
            if errReply != nil {
                err = cs.sendError(req.Id, errReply)
                break
            }
            cs.sendResult(req.Id, &reply)
        } else {
            s.policy.ApplyMalformedPolicy(cs.ip)
            errReply := &ErrorReply{Code: -1, Message: "Malformed request"}
            cs.sendError(req.Id, errReply)
        }
    case "eth_getBlockByNumber":
        reply := s.handleGetBlockByNumberRPC()
        cs.sendResult(req.Id, reply)
    case "eth_submitHashrate":
        cs.sendResult(req.Id, true)
    default:
        errReply := s.handleUnknownRPC(cs, req.Method)
        cs.sendError(req.Id, errReply)
    }
}

And the easiest way to work out what data is transmitted is to compile it, insert debug statements and view the data being transmitted.

You may also want to look at sammy007/ether-proxy, a simpler version of sammy007's pool mining software.



EDIT 17/06/2016 - Adding links to the JSON-RPC calls for completeness

Here is the documentation for the JSON-RPC calls required:

  • Thanks, I knew about these projects but I was hoping there was some kind of documentation. – Visgean Skeloru Jun 16 '16 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.