Monday, January 30, 2023
HomeBitcoinphp - What's scriptpubkey for within the coinbase transaction ? (and extra..)

php – What’s scriptpubkey for within the coinbase transaction ? (and extra..)

I am about to mine and I reached an element after I wish to generate the coinbase transaction.
I will not complicate issues by placing within the new block transactions and getting the charges for them.
All that issues is to mine a block (appears that the coinbase transaction is counted as 1 transaction for the entire block? True?)

Check out this PHP perform and test the feedback (let me know if I am mistaken someplace)

perform coinbase_gen($block_height){         //(decimal)$block_height can be the final official block quantity +1
$ver="01000000";                             // appears that this model will not change anytime quickly?
$i_count="01";                              // In that state of affairs it's all the time 01?
$txid='0000000000000000000000000000000000000000000000000000000000000000';   //all the time as effectively
$vout="ffffffff";                          // all the time?


$block_height=SwapEndianess(dechex($block_height)); //reassign the peak to VarInt

$sequence="ffffffff";                 // Some folks put 0000000 in right here.. Why?
$o_value="40be402500000000";          //6.25 BTC !!!
$script_pubkey='76a914bfd3ebb5485b49a6cf1657824623ead693b5a45888ac'; //Please reply..
$locktime="00000000"; // Appears good
return $ver.$i_count.$txid.$vout.$sig_size.$sig.$sequence.$o_count.$o_value.$pubkeysize.$script_pubkey.$locktime;
coinbase_gen((int)$last_blockn); // simply instance how I am going to generate it.

As you may see I’ve many questions within the code, however I must find out about that $script_pubkey. Some weblog posted it as instance to mine,however I really feel that any bitcoin mined will reward $script_pubkey which is somebodies pockets public key (encrypted) ? OR this doesn’t matter for the coinbase transaction and after I submit the block with bitcoind RPC it’s going to be sure that it’s going to go to my pockets?
That is vital to know. Thanks.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments