3

If I send a transaction on the Client-Side (JavaScript) all the variables etc can be tampered with on that side. So if I signAndSendTransaction with Phantom Wallet there, how do I verify it on the Server-Side easily that the transaction contained all the details I expected it to and the Client-Side code wasn't tampered with to modify the transaction? I need to confirm on the Server-Side before sending the item they paid for.

1 Answer 1

2

If you want to make sure that the transaction isn't tampered, you can create a server API that creates the transaction that you want and sign it with a server keypair. Then the user can sign it and send it to the blockchain immediately. If they've tampered with the transaction, then your server's signature will be invalid, and the transaction will fail.

Alternatively, you can create an on-chain program to do the exchange. That way, anyone can send anything, but your program will only respond to proper requests, and your server won't be a centralized point of failure for the whole app.

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.