0

I created a testnet environment, successfully created the genesis block, however don't see it reflected in the wallet-cli with the correct genesis wallet.

Is there perhaps a unlock time on the genesis block?

unlock time (varint, height, 60 here)
3c

I loaded up a little test blockexplorer and checked that the genesis block was created successfully.

W. Kadou
  • 125
  • 8
  • What method did you use to create the output public key that you put into the genesis block? – knaccc Jun 26 '18 at 00:05
  • @knaccc I created a transaction on the Monero Mainnet and used the TX id of that transaction to extract the tx public key and output key + nonce, applied it to the my testnet genesis tx. – W. Kadou Jun 26 '18 at 08:22
  • Note that output public keys have the output index as part of their construction, so you can't take the second output from one transaction and use it as the first output of another transaction and expect it to work. Yes there is an unlock time on the genesis block and on all coinbase transactions, which is 60 blocks. – knaccc Jun 26 '18 at 10:24
  • Monero Mainnet https://xmrchain.net/tx/c88ce9783b4f11190d7b9c17a69c1c52200f9faaee8e98dd07e6811175177139 we can see the Tx public key: 7767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1 and the Output key 9b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd088071 from the Genesis TX in https://github.com/monero-project/monero/blob/master/src/cryptonote_config.h -- I basically did a transaction on Mainnet to my personal wallet address. Found the transaction on blockexplorer and used the Tx public key and output key of my own transaction from the Monero Mainnet in my testnet. – W. Kadou Jun 26 '18 at 10:45
  • 1
    It sounds like you've done it right. What you should do is debug the CLI wallet and see what stage it specifically it gets to when it examines the genesis block transaction and then rejects the transaction as being destined for the wallet and decides to ignore it. Then report back here and link us to the line of code in github where it fails – knaccc Jun 26 '18 at 19:04
  • Excuse my ignorance but what are the perimeters i need to use in order to debug the CLI wallet to examine the genesis block transaction? – W. Kadou Jun 26 '18 at 22:27
  • You need to have a C development environment with a debugger. You need to find the part of the CLI code that scans each transaction on the blockchain, and put your breakpoints there. Then run the CLI and enter the command to rescan the blockchain, and wait for your breakpoints to be triggered. In your C debugger, you'll be able to step through the code that runs, and see it visit the genesis block. You'll then see where it ignores the genesis transaction because it doesn't think it is destined for your wallet, and you'll be able to see exactly why it didn't think it was yours. – knaccc Jun 26 '18 at 23:13
  • Should I use GNU debugger or LMDB? I just want to say thank you for all the help you have provided, if i could donate monero to you I would, if you are accepting donations for your time – W. Kadou Jun 27 '18 at 07:09
  • LMDB is Monero's database, I think you must have misspoken. You can use any C debugger that you want, as long as it lets you step through the code line by line as it is executing and lets you inspect variables. Eclipse and CLion seem popular. – knaccc Jun 27 '18 at 12:33
  • Sorry, that was a stupid question. What I intended to ask was, do you know what files (code) specifically to look for that scans the blockchain? Ive tried looking in src/daemonizer but can't exactly find the code so that i can place the breakpoints. Could you perhaps point me to the right lines? – W. Kadou Jun 27 '18 at 14:11
  • I just realized something, would debugging beable to find the genesis block transaction issue?.. isnt the transaction only made once the daemon is started for the first time? – W. Kadou Jun 27 '18 at 15:39
  • You're looking to debug the wallet, not the daemon. The wallet connects to the daemon to look at the blockchain. If you then ask the wallet to rescan the blockchain, it'll visit every transaction in every block and attempt to check if the transaction is destined for the wallet. This will be an adventure in putting breakpoints into the wallet to see what it does when you enter the command to rescan the blockchain. I think you need to spend a lot more time learning about how Monero works, because otherwise you'll be a bit lost. – knaccc Jun 27 '18 at 21:55

1 Answers1

1

i had the same problem. The thing is that the wallet does not process the genesis coinbase tx.

To process it, edit the src/wallet/wallet2.cpp after line #2131.

add

if ((m_blockchain.size() == 1) && (start_height == 0)) { cryptonote::block genesis; generate_genesis(genesis); if (m_blockchain[0] == get_block_hash(genesis)) { LOG_PRINT_L2("Processing genesis transaction: " << string_tools::pod_to_hex(get_transaction_hash(genesis.miner_tx))); std::vector o_indices_genesis = {0}; //genesis transaction output process_new_transaction(get_transaction_hash(genesis.miner_tx), genesis.miner_tx, o_indices_genesis, 0, genesis.timestamp, true, false, false, {}); } else { LOG_ERROR("Skip processing of genesis transaction, genesis block hash does not match: " << string_tools::pod_to_hex(get_block_hash(genesis))); } }

reference : gist.github.com/atanmarko/63815fc18a936d8a985a37e64d84b06d

make sure the one-time pub key at the genesis-hex-tx is well generated. if it is so , with this code you should see the reward on your wallet.

if it not so see

Monero Genesis transaction & nonce - clarification

hope this helps you

jszwako
  • 23
  • 6
  • You should explain what that code addition does and why you need to add it. – cialu Dec 28 '18 at 07:42
  • That code force processing the génesis transacción. – jszwako Dec 28 '18 at 11:12
  • and he needs to add it, like i needed, if he wants to see the genesis reward of his monero fork on his wallet. – jszwako Dec 28 '18 at 12:13
  • i did exactly the above steps and create keys like this https://monero.stackexchange.com/questions/1409/constructing-a-stealth-monero-address/ but unfortunately i have compile errors "[ 85%] Building CXX object src/wallet/CMakeFiles/obj_wallet.dir/wallet2.cpp.o monero-gui/monero/src/wallet/wallet2.cpp: In member function ‘void tools::wallet2::process_parsed_blocks(uint64_t, const std::vectorcryptonote::block_complete_entry&, const std::vectortools::wallet2::parsed_block&, uint64_t&, std::map<std::pair<long unsigned int, long unsigned int>, long unsigned int>*)’: monero-gui/monero/src/walle – zdrt Jun 03 '19 at 07:48