<p>To set a generating address, use <a href="https://github.com/luke-jr/bfgminer/blob/bfgminer/miner.c#L1343" rel="nofollow"><code>set_generate_addr</code></a>. <a href="https://github.com/bitcoin/libblkmaker/blob/master/blkmaker.c#L50" rel="nofollow"><code>blkmk_init_generation3</code></a> may also be what you're looking for.</p>

<p>The author of that library also wrote a miner, <a href="https://github.com/luke-jr/bfgminer/" rel="nofollow">BFGMiner</a>, that uses his library. Look at how he calls these <code>libblkmaker</code> function to add a coinbase transaction to the block header in <a href="https://github.com/luke-jr/bfgminer/blob/bfgminer/miner.c" rel="nofollow"><code>miner.c</code></a>.</p>

CC BY-SA 3.0
2016-02-03T09:54:43.693Z
I also fund the function 'blkmk_init_generation' and it seems to work. Do I also have to call 'blkmk_append_coinbase_safe2'?
Salabasti
CC BY-SA 3.0
2016-02-03T00:04:48.980Z
2016-02-03T16:48:35.990Z
2016-02-03T16:48:35.990Z
Geremia
<p>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 <a href="https://github.com/bitcoin/libblkmaker" rel="nofollow">libblkmaker</a>.
Now I have to build the coinbase transaction for the 'blktmpl', but I don't really know how. </p>

<p><strong>Anyone knows how to add a coinbase transaction to the block-template with 'libblkmaker'?</strong></p>

<p><strong>And how do I add my bitcoin address to this?</strong></p>

<p>Thanks for your help,
Sebastian</p>

<block><coinbase-transaction>
How to add coinbase transaction with libblkmaker
Salabasti
# How to add coinbase transaction with libblkmaker

(Asked by: username_0 on 2016-02-02)

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](https://github.com/bitcoin/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

**Tags:** block, coinbase-transaction


---

## 1 answers

### Answer by username_1 on 2016-02-03. Score: 1

To set a generating address, use [`set_generate_addr`](https://github.com/luke-jr/bfgminer/blob/bfgminer/miner.c#L1343). [`blkmk_init_generation3`](https://github.com/bitcoin/libblkmaker/blob/master/blkmaker.c#L50) may also be what you're looking for.

The author of that library also wrote a miner, [BFGMiner](https://github.com/luke-jr/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`](https://github.com/luke-jr/bfgminer/blob/bfgminer/miner.c).

> **Comments:**
> **username_0**: I also fund the function 'blkmk_init_generation' and it seems to work. Do I also have to call 'blkmk_append_coinbase_safe2'?  

---

