2

Some background: I'm looking into making my own miner. Even though there's some documentation out there, I find it hard to do without looking into loads of existing code, and while I do that, I prefer to look into some actual reference to learn from.

And here's my question: using the following JSON for GBT (the JSON copied from here), I'm trying to send it to some P2Pool IP and port, using my wallet ID as a user and a random password, as instructed. Here's the curl I'm using:

curl -u [ID:gibbrish] -d '{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}' http://[P2Pool Node IP:Port]

However, that yields:

{"error": {"message": "Parse error", "code": -32700, "data": null}, "jsonrpc": "2.0", "id": null, "result": null}

What am I doing wrong?

Thanks ahead!

closed as too broad by Murch, Dr.Haribo, Pieter Wuille, Colin Dean, cdecker Nov 7 '13 at 9:29

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    This sounds similar to this one: I want to create a plane. Completely from scratch, without studying anything, without looking how other planes are built. – Salvador Dali Nov 4 '13 at 6:05
  • So, what is the question? First you seem to be asking how one would create mining software then it looks like you need help with JSON. Please clarify what exactly your question is and make it specific enough that one can answer it without writing an essay. Check out How to Ask for additional hints. – Murch Nov 4 '13 at 8:57
  • 1
    @salvador I think you're overreacting much. I've been reading the code, I've been reading the wikis, I've been googling forums, and for all I know, I've done it "right". I guess it's not phrased the best way. What I am looking for is where to start. When I want to build a new plane, I don't want to look at the production like of Boeing, first I'd like to figure out, you know, elevation forces by myself. Otherwise I have no context to those plans. That's my question: how to start? And why is my basic start not working? – Aviad Ben Dov Nov 4 '13 at 14:54
  • @Murch I've edited my question, please tell me if it's clearer now. – Aviad Ben Dov Nov 5 '13 at 4:32
2

I think I figured it out. "curl" doesn't add the "Content-Type" header, which seems important to the pool when parsing the JSON body. Adding that header fixed it.

So, a working curl command would be:

curl -H "Content-Type: application/json" -u [Wallet ID:gibbrish] -d '{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}' http://[Pool IP:Port]

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