Thursday, September 4, 2025
HomeBitcoinmining idea - The best way to create coinbase? The best way...

mining idea – The best way to create coinbase? The best way to use witness?

BIP141 provides a brand new rule referred to as “witness dedication”. The doc says: “The dedication is recorded in a scriptPubKey of the coinbase transaction.” I did not fairly perceive what that meant, Due to this fact, I immediately positioned the ‘default_witness_commitment’ supplied by the block template within the scriptPubKey location when creating coinbase. This is my code:

def makeCoinbase()->None:
    international coinbase,tmpl
    model=pack('

The variable tmpl is the template obtained utilizing the “getblocktemplate” command.I am testing my code in regtest. Once I submit a block, Bitcoin Core does create a brand new block. And my stability did go up.
Nevertheless, once I checked coinbases within the newly generated block, the consequence was as follows:

{
    'txid': '9cb794f3292d1ece3af6c1d3055cf6fb26cf2126ff48b39b229bfec5ec651ec4', 
    'hash': 'de081b2a9552ac559d3501ed0669f675530fe9890e27d263c1aff65e678ddc4e', 
    'model': 1, 
    'measurement': 153, 
    'vsize': 126, 
    'weight': 504, 
    'locktime': 0, 
    'vin': [{
        'coinbase': '016c54686520477265617420476f642050616e', 
        'txinwitness': ['0000000000000000000000000000000000000000000000000000000000000000'], 
        'sequence': 4294967295}], 
    'vout': [{
        'value': Decimal('50.00063100'), 
        'n': 0, 
        'scriptPubKey': {
            'asm': 'OP_RETURN aa21a9edb14717ddf39dacad0babfff4d8d951c076e95d11d2b1f328632c32f98c015d2c', 
            'desc': 'raw(6a24aa21a9edb14717ddf39dacad0babfff4d8d951c076e95d11d2b1f328632c32f98c015d2c)#psf60z3m', 
            'hex': '6a24aa21a9edb14717ddf39dacad0babfff4d8d951c076e95d11d2b1f328632c32f98c015d2c', 
            'type': 'nulldata'
        }
    }], 
    'hex': '010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff13016c54686520477265617420476f642050616effffffff017ce8062a01000000266a24aa21a9edb14717ddf39dacad0babfff4d8d951c076e95d11d2b1f328632c32f98c015d2c0120000000000000000000000000000000000000000000000000000000000000000000000000'
}

As you possibly can see, it accommodates just one vout. And that vout doesn’t comprise tackle. However I have a look at coinbase for blocks in the primary community, and it at all times accommodates a couple of vout, and the vout accommodates the tackle.My query is am I constructing coinbase the proper manner? If not, how do I repair it? Though the Bitcoin core didn’t report errors, I at all times suspected that I had misplaced the miner’s tackle.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments