I had the same problem. I had to solve it by writing custom function. It generates new account, save account keys to file, and sends block 0 reward money to it in genesis transaction. It also generates source code line to be changed in the cryptonote config file.
Note: Monero CLI wallet would not see block reward sent in this transaction because it does not process genesis tx - processing of it has to be forced in wallet code.
I have also added command line option --print-genesis-tx to src/daemon/main.cpp where I call this function.
// Helper function to generate genesis transaction
void print_genesis_tx_hex(uint8_t nettype) {
using namespace cryptonote;
account_base miner_acc1;
miner_acc1.generate();
std::cout << "Gennerating miner wallet..." << std::endl;
std::cout << "Miner account address:" << std::endl;
std::cout << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
std::cout << std::endl << "Miner spend secret key:" << std::endl;
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
std::cout << std::endl << "Miner view secret key:" << std::endl;
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
std::cout << std::endl << std::endl;
//Create file with miner keys information
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
std::stringstream key_fine_name_ss;
key_fine_name_ss << "./miner01_keys" << std::put_time(&tm, "%Y%m%d%H%M%S") << ".dat";
std::string key_file_name = key_fine_name_ss.str();
std::ofstream miner_key_file;
miner_key_file.open (key_file_name);
miner_key_file << "Miner account address:" << std::endl;
miner_key_file << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
miner_key_file << std::endl<< "Miner spend secret key:" << std::endl;
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
miner_key_file << std::endl << "Miner view secret key:" << std::endl;
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
miner_key_file << std::endl << std::endl;
miner_key_file.close();
//Prepare genesis_tx
cryptonote::transaction tx_genesis;
cryptonote::construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().m_account_address, tx_genesis);
std::cout << "Object:" << std::endl;
std::cout << obj_to_json_str(tx_genesis) << std::endl << std::endl;
std::stringstream ss;
binary_archive<true> ba(ss);
::serialization::serialize(ba, tx_genesis);
std::string tx_hex = ss.str();
std::cout << "Insert this line into your coin configuration file: " << std::endl;
std::cout << "std::string const GENESIS_TX = \"" << string_tools::buff_to_hex_nodelimer(tx_hex) << "\";" << std::endl;
return;
}
Failed to generate genesis block