1

So based on this 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?

user77556
  • 11
  • 1
  • If you want c++, the code to form coinbase is here: https://github.com/bitcoin/bitcoin/blob/1afc22a7667a7a5c66b4b5d7f50832356dd5ec12/src/miner.cpp#L161 – skang404 Feb 26 '18 at 17:46

1 Answers1

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.

Shabahat M. Ayubi
  • 1,479
  • 10
  • 25