#ifndef BLOCK_BUILDER_H #define BLOCK_BUILDER_H #include #include #include "types.h" char *tx_encode_coinbase_height(int height); int is_segwit_tx(const char *raw_hex); int build_coinbase_transaction( const BlockTemplate *tpl, const char *miner_script_pubkey, const char *extranonce1, const char *extranonce2, const char *coinbase_message, char **coinbase_hex_out, char **coinbase_txid_out ); char *calculate_merkle_root(const char *coinbase_txid_hex, const TemplateTransaction *txs, size_t tx_count); int build_block_header_bytes( int version, const char *prev_hash_hex, const char *merkle_root_hex, uint32_t timestamp, const char *bits_hex, uint32_t nonce, uint8_t out_header[80] ); char *build_block_header_hex( int version, const char *prev_hash_hex, const char *merkle_root_hex, uint32_t timestamp, const char *bits_hex, uint32_t nonce ); char *serialize_block(const char *header_hex, const char *coinbase_tx_hex, const TemplateTransaction *txs, size_t tx_count); #endif