I built a private testnet with reference to this guide.

In order to understand how the secret transaction key is generated, I examined how many times the open_tx function (in device_default.cpp) was executed with a transfer command from the monero-wallet-cli. open_tx is the function used in construct_tx_and_get_tx_key function (in cryptonote_tx_utils.cpp) to generate a secret transaction key.

It turned out that open_tx was executed twice per one transfer command. Why is open_tx executed twice instead of once?

1 Answer 1


In short, tests.

You can see this by following the path taken by the CLI wallet when doing a transfer, as you essentially end up in create_transactions_2. If you follow through that, you will see transfer_selected_rct gets called from various places (1/2 & 3), and it's that which makes calls through to open_tx via construct_tx_and_get_tx_key. Thus a test tx performed in create_transactions_2 will call through to open_tx, as will the final real one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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