I do know that on this discussion board a variety of questions on this matter, I’ve checked most of those, however cannot discover the answer for my activity. I’m creating my very own algorithm for solo mining bitcoin on Python. I wrote all obligatory strategies for that, together with hashing the Merkle root, calculating the block header and so on. However now, I’m caught for a number of weeks on the coinbase transaction. I’ve studied the coinbase transaction web page on LearnMeABitcoin.com and tried to implement all logic for it, however cannot absolutely perceive methods to make one. I need to embody new guidelines (BIP34 – block header, BIP141 – SegWit tx) on this algorithm, however my information about hashing this isn’t sufficient. 🙁
Can somebody present perhaps extra supplies, some samples of code, or describe particulars about producing a coinbase transaction? Any info shall be very useful, hope in your assist.
Additionally, I’m coaching on Bitcoin core in regtest mode, and after I use "generatetoaddress" technique (for generate blocks) this one would not gen coinbase tx with BIP34 & BIP141 necessities, perhaps I want set extra config for this one? I discovered somebody say about blockversion arg, is it true?
Thanks all ^^
P.S. If i miss some particulars about my activity, fell free to ask and I present all data which I’ve, of pattern of code which I’ve (it isn’t working)
UPDATE
I’ve greate information, I discover the answer and full this) thanks all for yout help, some later I share my code for gen coinbaseTx in python.
However left just one query, i exploit object for generate tx like on display, and it have some distinction with coinbase tx from generataing by Bitcoin Core utilizing generatetoaddress solely in a single place, filed n in first output, and it at all times "00000000", like 0 in little-endian with 4 bytes I hope. Can somebody clarify what it’s? I exploit p2wpkh script for hashing handle, perhaps this one is kind for this? After I add this worth all labored superb, and I efficiently gen CoinbaseTx, after construct block header and full block and broadcast it to node. However only for absolutely understanding my code, wanna to know what this "00000000" imply) Title "n" for subject was by me, simply short-term title.