1

I'm working on a mining script and i just want to really be certain for sure as I wouldn't want to waste Time & resources.

Q1 - Is the coinbase transaction automatically generated by the getblocktemplate or do i have to implement it myself.

Q1(b). If the inclusion of the coinbase transaction is not done automatically and as such is not the first transaction on the list of transactions returned by the getblocktemplate (as it should be)...... How would I go around generating the coinbase? Is there a function in the main bitcoin source code that handles this, something I can crop out and make a portable function?


Q2. Assuming coinbase transaction has been provided via blockchains protocol to ensure empty blocks are never created again, Is it safe to assume that the coinbase has been generated with the bitcoin address linked to my full node?

Q2(b). If it has been created and my address set to recieve the rewards, what happens when I currently have more than 1 btc wallet address linked to my wallet?? Is there a way I can specify the address to be used for mining within my bitcoin.conf file ?



"The hashing/mining tests to be carried out are being spearheaded by a CPU System. To be more specific, A Custom Dynamic Multi-Processor Mining Rig, being fed data and instructions via CPU. The CPU does a bit of mining itself using a different merkleHash generated."



Q3. The generate=1 option within the bitcoin.conf file, does it mean that my cpu begins mining internally or is it an option that has to be turned ON if a user(miner) intends to mine with their CPU(either alone or with mining rigs handling the hashing process)??

What I'm asking is.. If the generate parameter is not defined or is = 0 within bitcoin.conf, does that mean that all mining efforts are wasted ?? or is it only related to the internal mining script deemed to be inefficient?


And lastly.....

Q4. Miners are advised to use different addresses for a level of privacy and anonymity. The question, Would I have to manually create new addresses at every successful block mined or is there an option to automatically handle that or a button that toggles such a feature off/on within the GUI?

I do hope these questions can be answered by someone.... It's extremely important.. Thanks so much in advance.


UPDATE !! 10/12/2021 01:10AM

Hamita successfully answered Questions 1,2 & 3.

Question 4 remains unanswered but since majority of questions have been answered, I'll accept Hamita's answer as a valid answer to my posted question.

2 Answers 2

1

The coinbase transaction is not generated automatically from bitcoin core, you need to generate it yourself with the createrawtransaction command.

For the setgenerate is no longer available in the options and you can't use it.

6
  • So once I generate the coinbase using the createrawtransaction command, is it safe to assume that it has been added to the list of transactions unique to my getblocktemplate rpc call?? And if that's the case, would I have to redo the entire step each time I attempt to mine a new block? Commented Dec 7, 2021 at 22:30
  • when you generate your coinbase transaction you will need it to build your merkleroot, with getblocktemplate you will receive other data to build your blockheader
    – Hamita
    Commented Dec 9, 2021 at 14:04
  • @Hamita Thanks a great deal. This answers my first 2 questions. I would love to select this as the answer but it only solves half of it. What do you think I should do? Commented Dec 9, 2021 at 23:50
  • And If you wouldn't mind helping your greenhorn friend overhere....... How do I insert the height of block to mined into the coinbase transaction?? I know its stored in hex format and is the starting point of the coinbases's scriptsig -> Your Answer To a question relating to the creation of the coinbase Commented Dec 10, 2021 at 0:07
  • 1
    For the actual block height The scriptsig begin with 0350e40a, the 03 for the next 150 years will remain the same, 50e40a The height of the block in little endian, note that you must include the size before that, and it can't not be greater that 100 bytes
    – Hamita
    Commented Dec 12, 2021 at 9:36
1

Regarding question 4, you need to manually create/request a new address each time you need one.

1
  • Thanks for taking the time to answer my question Commented Dec 28, 2021 at 1:23

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.