As required in BIP 34, how miners put the Block Height to their coinbase transaction I created a coinbase transaction with the createrawtransaction method as follow:
createrawtransaction '[{&quot;txid&quot;:&quot;0000000000000000000000000000000000000000000000000000000000000000&quot;,&quot;vout&quot;:0}]{&quot;kgjdtruea5w3mz7t3tudtlplm9xht4sjwg0e3tihgtr&quot;:6.25000000}'
the response to this call is:
020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0140be40250000000017a9145ea405d95b789aa887e229d8b1da44c2964054248700000000


I understand that the number of pushed bytes and the Height of the block must be included to the scriptsig of this raw data as follow:
Actually 03 + The height of the block in little endian
In this exemple must i put this just between the ffffffff and  0140be40250000?
I saw some exemples but i am confused, as there's the size of the scriptsig before the scryptsig
Help is appreciated
Thank you to all of you
In this transaction, the scriptSig is of size 0 because it isn't filled out yet. You have also used a txid of all 0's and a vout of 0, so this size of 0 gets lost in your large string of zeroes.
00000000000000000000000000000000000000000000000000000000000000000000000000ffffffff is the input data.
The first 32 bytes of this is the previous txid. The 4 bytes following that is the vout. This leaves us with 00ffffffff. That remaining 0x00 byte is the length of the scriptSig, currently length 0. The ffffffff is the sequence number.
What you have to do is replace that 0x00 byte with your scriptSig. The scriptSig is prepended by it's length, so what you replace that with would look like 040334cc09.
Note that currently your transaction would not be a valid coinbase transaction. The vout for a coinbase transaction is 0xffffffff, not 0.