Suppose I sent a signed transaction using the web3.js library. But, I might be using some third party API like an Infura node or others. So there are chances of attacks and data manipulation. So, is there any way to verify if the all transaction data entered in the blockchain is same as the one entered by me or if it has been manipulated by someone?
1 Answer
You can look at the receipt of the transaction to verify the data yourself. The web3.js library's sendSignedTransaction
will return a receipt that you can check to verify the data.
Edit based on goodvibration's comments
My original answer was as follows:
A signed transaction cannot be altered, as the data within the transaction has already been signed. If any data is manipulated, then the signature would be invalid and the transaction would never be broadcasted.
However, this is not entirely true in the case where a user's private key is shared among other parties. Because of this, the original answer does not apply.
-
1Your initial statement, although correct by itself, misses a key issue here, probably as a result of assuming that this user is the sole owner of the private key (and you know what they say about assumptions, right?). Imagine that someone else holds the same private key, detects this user's transaction in the pending-transactions pool, and immediately overrides it using the same nonce and a higher gas-price. Commented Sep 15, 2020 at 15:25
-
1That's why, although my initial instinct was to answer this question in the same way that you did ("no one can alter your transaction"), looking slightly beyond our "regular blockchain perspective", I realized that there was actually an interesting point in the question once you looked at it from a higher (slightly "naive") perspective. Commented Sep 15, 2020 at 15:25
-
1Another example - suppose this user uses a node which keeps his/her account unlocked and signs the transactions itself, and this "naive" user somehow assumes that this is considered as "I sent a signed transaction using the web3.js library". Then somebody hacks the node and sends different transactions. In this scenario, the user would still want to assert that his/her intended transaction was successfully executed on the blockchain. Commented Sep 15, 2020 at 15:30
-
1Your first comment is a great point! I will update accordingly. Commented Sep 15, 2020 at 16:36
-
1Thanks ShaneFontaine and goodvibration for the valuable inputs. Initially I just thought only about the node getting hacked but did not thought about the private key being shared.– krritikCommented Sep 15, 2020 at 17:11