If someone sends a transaction to the network, let's say they execute the transfer function on a solidity contract, is there any way for someone to see their interaction with the contract? Meaning the amount and whom they sent it to? A sort of way like XSS scripting to act as a go-in-between? To peer inside and see what's going on? Can miners see or decrypt transactions?
Of course everyone can see the transaction contents, because it is not encrypted by the sender and decrypted by the receiver, but signed by the sender and verified by the receiver.
The difference between these two schemes is this:
- In the encryption/decryption scheme, everyone can encrypt the message (using a publicly known key), but only the receiver can decrypt it (using his/her private key)
- In the signature/verification scheme, only the sender can sign the message (using his/her private key), but everyone can verify it (using a publicly known key)
Subsequently, this means that:
- In the encryption/decryption scheme, only the receiver can see the message contents
- In the signature/verification scheme, everyone can see the message contents
In case you were wondering, the fact that everyone can see everyone else's transactions is actually a crucial part of the blockchain's idea and one of its basic concepts - security is achieved via exposure instead of via concealing. In other words, the fact that everybody knows what the data should be, makes it is very hard for one malicious user to change it.