3

I would like to learn more about the nuts and bolts of how monero implements stealth addresses.

I have read the cryptonote whitepaper and have a handle on the math and premise of the concept. But I want to look at a real world implementation.

Can someone please direct me to the place in the code where:

  • public addresses are generated

  • stealth addresses are generated

  • stealth addresses are identified via view key.

I want to be able to step through the code and match it up against the whitepaper.

Thanks :)

user40176
  • 161
  • 4

1 Answers1

3

Private spend and view keys for public Monero addresses are generated here: https://github.com/monero-project/monero/blob/102a51bcd48a3cd2cb794aab7dbe243393f155b3/src/cryptonote_basic/account.cpp#L81

Stealth addresses are generated here as part of generating a transaction: https://github.com/monero-project/monero/blob/102a51bcd48a3cd2cb794aab7dbe243393f155b3/src/cryptonote_core/cryptonote_tx_utils.cpp#L197

Stealth addresses are identified as belonging to a user's address through use of the private view key here: https://github.com/monero-project/monero/blob/102a51bcd48a3cd2cb794aab7dbe243393f155b3/src/cryptonote_basic/cryptonote_format_utils.cpp#L638 and https://github.com/monero-project/monero/blob/102a51bcd48a3cd2cb794aab7dbe243393f155b3/src/cryptonote_basic/cryptonote_format_utils.cpp#L595

Note that the Cryptonote whitepaper was written before subaddresses were devised. Subaddresses increase the complexity of scanning for outputs destined for a wallet. Subaddresses are explained here: https://github.com/b-g-goodell/research-lab/blob/master/publications/bulletins/MRL-0006-subaddy/MRL-0006-subaddresses.pdf

knaccc
  • 8,518
  • 17
  • 23