<p>The link you mentioned has a few code snippets, so I am assuming the code you want to write in C is the simple mining program. The python code can act as your pseudo code and very well write your mining program in C.</p>

<p>Alt coins which have been forked from bitcoin and do not have many changes in the mining algorithm can be very easily mined by the same methods described.</p>

<p>The most you would have to change is the hashing algorithm used which can be different from BTC's sha256.</p>

<p>When connecting with a mining pool,  it is generally advisable to use already existing mining softwares like cgminers wherein you just need to pass the stratum url and port (also  the hashing algorithhm in a few cases). A huge amount of code runs delegating the chunks of the mining problem to the miners connected to it.</p>

CC BY-SA 3.0
2018-02-25T22:03:04.553Z
2018-02-25T22:03:04.553Z
Shabahat M. Ayubi
<p>So based on <a href="http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html" rel="nofollow noreferrer">this</a> after getting the right information from the pool, you will form a coinbase transaction, But how is it done in C lang.</p>

<p>Does the method above also works for altcoins?</p>

CC BY-SA 3.0
2018-02-26T17:46:07.977Z
If you want c++, the code to form coinbase is here: https://github.com/bitcoin/bitcoin/blob/1afc22a7667a7a5c66b4b5d7f50832356dd5ec12/src/miner.cpp#L161
skang404
<mining-theory><c>
what is "forming a coinbase transaction"?
user77556
# what is "forming a coinbase transaction"?

(Asked by: username_0 on 2018-02-23)

So based on [this](http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html) after getting the right information from the pool, you will form a coinbase transaction, But how is it done in C lang.

Does the method above also works for altcoins?

**Tags:** mining-theory, c

> **Comments:**
> **username_1**: If you want c++, the code to form coinbase is here: https://github.com/bitcoin/bitcoin/blob/1afc22a7667a7a5c66b4b5d7f50832356dd5ec12/src/miner.cpp#L161  

---

## 1 answers

### Answer by username_2 on 2018-02-25. Score: 1

The link you mentioned has a few code snippets, so I am assuming the code you want to write in C is the simple mining program. The python code can act as your pseudo code and very well write your mining program in C.

Alt coins which have been forked from bitcoin and do not have many changes in the mining algorithm can be very easily mined by the same methods described.

The most you would have to change is the hashing algorithm used which can be different from BTC's sha256.

When connecting with a mining pool, it is generally advisable to use already existing mining softwares like cgminers wherein you just need to pass the stratum url and port (also the hashing algorithhm in a few cases). A huge amount of code runs delegating the chunks of the mining problem to the miners connected to it.


---

