<p>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.</p>

<p>So, a working curl command would be:</p>

<blockquote>
  <p>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]</p>
</blockquote>

CC BY-SA 3.0
2013-11-05T05:16:07.023Z
2013-11-05T05:16:07.023Z
Aviad Ben Dov
<p>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.</p>

<p>And here's my question: using the following JSON for GBT (the JSON copied from <a href="https://en.bitcoin.it/wiki/Getblocktemplate" rel="nofollow">here</a>), 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:</p>

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

<p>However, that yields:</p>

<blockquote>
  <p>{"error": {"message": "Parse error", "code": -32700, "data": null}, "jsonrpc": "2.0", "id": null, "result": null}</p>
</blockquote>

<p>What am I doing wrong?</p>

<p>Thanks ahead!</p>

CC BY-SA 3.0
2013-11-04T06:05:24.043Z
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
CC BY-SA 3.0
2013-11-04T08:57:18.077Z
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 [ask] for additional hints.
Murch
CC BY-SA 3.0
2013-11-04T14:54:54.833Z
@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
CC BY-SA 3.0
2013-11-05T04:32:03.490Z
@Murch I've edited my question, please tell me if it's clearer now.
Aviad Ben Dov
<json-rpc><development><p2pool><mining-software>
How do I communicate with the BTC network?
Aviad Ben Dov
# How do I communicate with the BTC network?

(Asked by: username_0 on 2013-11-04)

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](https://en.bitcoin.it/wiki/Getblocktemplate)), 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!

**Tags:** json-rpc, development, p2pool, mining-software

> **Comments:**
> **username_1**: 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.  
> **username_2**: 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 [ask] for additional hints.  
> **username_0**: @username_1 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?  
> **username_0**: @username_2 I've edited my question, please tell me if it's clearer now.  

---

## 1 answers

### Answer by username_0 on 2013-11-05. Score: 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]


---

