Bitcoin

bitcoin core – How to create a Coinbase transaction in Python

I know there are a lot of questions about this topic on this forum, and I’ve checked all of them (most, if not all), but I can’t find a solution for my task. I am creating my own algorithm to mine Bitcoin in Python. This is for solo mining. So I wrote all the methods needed for this, including Merkle root hashing, block header calculations, etc. But now I’ve been about a few weeks into Coinbase trading. I’ve read about this here (https://learnmeabitcoin.com/technical/mining/coinbase-transaction/) and I’m trying to implement all the logic for it, but I don’t fully understand how to make it. I would like to include new rules (BIP34 – block header, BIP141 – SegWit tx) in this algorithm, but my knowledge of hashing is not enough. Can someone provide more material, some code samples, or explain the details of creating a Coinbase transaction? Any information would be very helpful. Also I am training on Bitcoin core in regtest mode and when I use “generatetoaddress” method (for block generation) it does not generate coinbase tx as per BIP34 and BIP141 requirements. , maybe I need to set up some more configuration for this. I found someone talking about blockversion arg. Is it true? P.S. If I’m missing any details about a task, feel free to ask and I’ll provide you with all the information I have. , code sample I have (not working)

Related Articles

Back to top button