I am struggling to validate my custom miner against the testnet network and I can't seem to add a block of mine to the chain. I've noticed that all the other miners are appending version 2 blocks, so I decided to do the same. As I've read the block height should be included in the coinbase transaction script. So my question is if there is any relation between block version and transaction version because that's the only thing (in my opinion), that I could be doing wrong. I would appreciate an example of how should my block look like as byte array so it would be accepted by the network (testnet).
Have you seen the Bitcoin Protocol Specifications?– John TMar 17, 2014 at 18:24
I would send your solved block to a core node of your own and then check the debug.log file to see why it wasn't accepted.
But, no, in general there is no necessary relationship between the version of the block and the version of transactions. Version numbers just give a signal to other nodes if there is any special way to handle new blocks/transactions.
As per BIP34, version 2 blocks now have the block height put into the scriptSig of the coinbase input so that no one can make a transaction with a duplicate transaction id (hash).