0

My goal is to make my own bitcoin miner (in Go). But I am having an issue: I am not getting coinbasetxn in my getblocktemplate request.

curl -u user:password --data-binary '{"jsonrpc": "1.1", "id":"0", "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}] }'   -H 'content-type: application/json;' http://127.0.0.1:8332/

Fields in result:

coinbaseaux
previousblockhash
target
noncerange
transactions
mintime
sigoplimit
curtime
capabilities
height
version
bits
coinbasevalue
sizelimit
mutable
longpollid

So I am assuming I have to build it by myself. What are the steps to do so please? Thanks a lot

migrated from stackoverflow.com Apr 14 '16 at 8:04

This question came from our site for professional and enthusiast programmers.

1

The coinbasetxn is a field that results from a request from a pool. Have you seen this link here? How to compute merkle root without coinbasetxn?

You are hitting your local block chain node which will give you the actual individual transactions in the transactions field. You can then use all the fields to create the coinbasetxn yourself.

To build it yourself, I recommend reading example/actual code in another language in conjunction with the docs. Check out this link: https://www.anintegratedworld.com/whats-in-a-block/ where you can read the wikipedia links and also see graphically the internals of a block.

Your Answer

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