5

I was just wondering what function does the public keys in a wallet address have in creating a transaction or receiving a transaction from someone?

1 Answer 1

11

You have a public and private spend key, and a public and private view key.

The public spend and view keys are used to create an output that only you can see that exists, and that only you can spend.

You use your private view key and public spend key to detect the existence of that output.

You use your private view key and private spend key to spend the output.

In algebra, your public view and spend keys are A and B.

Your private view and spend keys are a and b.

The output created for you is P = Hs(rA)G+B, where r is a random value known only to the sender.

You detect it by calculating P' = Hs(aR)G+B, and checking if P'==P. (Where R is a value published with the transaction, and is calculated as rG. Note that just as R=rG, A=aG and B=bG. Hs() is a hashing function that returns a type of number called a scalar).

The reason that P'==P is because rA==arG==aR, and this is called an Elliptic Curve Diffie Hellman Exchange.

The output P is actually a public key, for which you need the corresponding output private key to spend.

The corresponding output private key is x = Hs(aR) + b, according to the laws of Elliptic Curve Cryptography algebra.

Note: P is also known as a stealth address, because it is a one-time value written into the blockchain instead of your wallet address being written into the blockchain (as it would be in Bitcoin). An observer cannot determine that P is linked to your public view or spend keys, because this can only be determined if your private view key a is known.

7
  • How does the public keys work with creating stealth addresses? Or are the public keys not part of that
    – samwellj
    May 23, 2017 at 1:44
  • 1
    The output public key P is the stealth address. It's one time address for that output, and P appears in the blockchain instead of your wallet address.
    – knaccc
    May 23, 2017 at 1:45
  • Ok interesting. Quickly mention that in the answer too if you could :)
    – samwellj
    May 23, 2017 at 1:46
  • 2
    @DougWilson G is a "base point" on the elliptic curve which is universally agreed upon as part of the Monero specification. If you multiply something by G, you can't look at the result and go backwards to determine what was multiplied by G. The same applies if any other point on the curve was used instead of G. This is the 'trap door' function that all cryptographic systems require. It is why if your private spend key is "b", someone cannot look at your public spend key B=bG and figure out what "b" was from "B".
    – knaccc
    Jun 18, 2017 at 23:16
  • 1
    Ok, I found the formulas here: cryptonote.org/whitepaper.pdf (page 6)
    – Viet
    Dec 7, 2017 at 19:47

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.