MultiversX Tracker is Live!

How to serialize the CBlock Class in C++ and print the hex to terminal?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 143 Views

I have tried to serialize as follows without success: bitcoin tag v22.0 from github.

In the file src/miner.cpp and the function

function std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)

I have placed the line std::cout << pblock << std::endl; at the very end before it returns (Here). The value that is printed to the terminal is:

0x7fc9f4009410

This is too little data, I would expect the entire block data to be serialized and printed in hex. What am I doing wrong? I know pblock is a pointer to a CBlock class, but it should still work.

What is the proper way to serialize CBlock data, and also the CBlockHeader data?

Thank you!


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments