I currently trying to develop a simple Bitcoin miner in c++ for a project on my university. For parsing the 'getblocktemplate'-data I'm using libblkmaker. Now I have to build the coinbase transaction for the 'blktmpl', but I don't really know how.

Anyone knows how to add a coinbase transaction to the block-template with 'libblkmaker'?

And how do I add my bitcoin address to this?

Thanks for your help, Sebastian

1 Answer 1


To set a generating address, use set_generate_addr. blkmk_init_generation3 may also be what you're looking for.

The author of that library also wrote a miner, BFGMiner, that uses his library. Look at how he calls these libblkmaker function to add a coinbase transaction to the block header in miner.c.

  • I also fund the function 'blkmk_init_generation' and it seems to work. Do I also have to call 'blkmk_append_coinbase_safe2'?
    – Salabasti
    Commented Feb 3, 2016 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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