1

Monero accounts and subaddresses are conceptually well illustrated at https://medium.com/@anhdres/how-moneros-accounts-and-subaddresses-work-in-monerujo-4fa7df0a58e4.

And page 125 of Mastering Monero does a good job of describing how subaddresses associated with account #0 are calculated.

My question is, how are the deterministic Monero public spend and view keys calculated for accounts other than account #0?

1

Each account is simply another subaddress. Therefore the math is identical to the usual subaddresses calculation - it is still represented by an i index in:

PSi = Hs(pV0 || i) G + PS0

(using Mastering Monero's notation).

However, it's worth noting that the calculation for the subaddress secret key is actually m = Hs(a || index_major || index_minor), and for its public key, M = mG, where index_major is the account index and index_minor is the subaddress index. Thus i is the concatenation of index_major || index_minor.

Therefore the Master Monero example is a little misleading. The subaddress, regardless of which account it is in, is actually calculated like:

PSij = Hs(pV0 || j || i) G + PS0

Or in the common notation used in the code and elsewhere:

m = Hs(a || index_major || index_minor)
M = mG
D = M + B

D being your public view and spend keys for account # subaddress #.

Sources: device_default.cpp#L144 and device_default.cpp#L198

  • Oh thanks for the suggestion! – SerHack May 29 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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