I'm using the monero cli and was wondering what is the difference from the spendkey and the view key. They both output a secret and public key. Do you give the public view and spend key to the person that is paying you?
Do you give the public view and spend key to the person that is paying you?
Yes. Both are conveniently packed inside your address. Think of them as "instruction to sender".
I'm using the monero cli and was wondering what is the difference from the spendkey and the view key.
Here's a quick overview of what each key is used for.
The sender reads the public spend key and public view key from your address, and uses them to construct a special one-time "container" which will hold the funds intended for you.
On the receiving end you check each TX against your secret view key (technically, you also need the public spend key) and when there's a match, your wallet takes note of that, adds it to the balance and saves the details into wallet cache.
When you want to spend, your wallet uses both the secret view key and secret spend key to reconstruct a key to the particular "container", and a key image of the container. With that you can spend, or just check if it was spent.
The view key is used to view incoming outputs, and the spend key is used to spend them. Your monero address is composed of (mostly) your public spend and view keys together.
The public/secret pairs are a feature of asymmetric cryptography (also called public key cryptography), as opposed to symmetric cryptography (such as block cyphers).