user287: 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!

user287: 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]


287: <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>
 287: <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>
