I have been searching for ever on how to get my own genesis tx for a monero fork. Everything I have tried has not work. I have tried using a cryptonote currency to generate a genesis tx then replacing the values the same everywhere. I have also tried decoding the genesis block trying to figure out which parts to change "How can I create a new Monero genesis block?". None of this has worked. If anyone has any idea on how to do this I would greatly appreciate it.

The error I get when i put in my own genesis tx and run the daemon is Failed to generate genesis block.

Edit: The article How to generate a new genesis tx? does not seem to explain how to get a genesis tx. It shows how to get a genesis block.

  • 3
    Please be a lot more specific about what you mean by "none of this has worked". Do you get an error message? Does the code not compile? Please document your steps and the problem. To get a unique genesis block, you should be able to just alter the GENESIS_NONCE value to another integer in this file github.com/monero-project/monero/blob/master/src/… – knaccc May 31 '18 at 13:25
  • The code compiles fine but when I run the daemon I get an error: Failed to generate genesis block – Jarrod Jun 1 '18 at 4:44
  • Is that the exact text of the error message? I couldn't find that error in the code base. You literally only changed the GENESIS_NONCE, and that causes that error? – knaccc Jun 1 '18 at 8:17
  • 2
    Possible duplicate of How to generate a new genesis tx? – dEBRUYNE Jun 1 '18 at 9:03
  • Its not a duplicate of that post. The guy that asked had a custom --print-gensis-tx program he wrote. Monero does not have that feature and I do not wan to custom program one. – Jarrod Jun 1 '18 at 16:07

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;

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;

//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;

  • I'm going to give this a try, currently my issue is, my genesis block gets created however i don't see the funds in the genesis account. Do you know a work around for that? – Wesley Jun 27 '18 at 19:47
  • @Wesley Here is my updated wallet2::process_blocks to force processing of genesis transaction: gist.github.com/atanmarko/63815fc18a936d8a985a37e64d84b06d – Marko A. Jun 28 '18 at 20:51

protected by Community Jan 22 at 19:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.