0

If I was sending data to a smart contract, do I need to encrypt it before transmitting and decrypt it in the smart contract? Or is this done automatically?

  • Apologies if the question was not clear. I wanted to know if one has to encrypt the data before transmission in case of data corruption during transmission. I am not concerned about privacy as i know Ethereum is public and permissionless. – Bobby Mar 19 at 18:10
  • Encryption does not prevent data corruption. A hash signature, bundled with the data payload, can allow the receiver to verify the data contents. But no, there is no encryption needed. – MSwezey Mar 19 at 18:54
  • @Bobby - Ah, okay, understood. I've removed my suggested duplicate flag. – Richard Horrocks Mar 19 at 19:13
  • @shane The question is about transaction data while on transit not when it is in the contract storage. – Ismael Mar 20 at 15:06
0

Communication at the p2p level are encrypted between the nodes.

Between your wallet and the node it depends on the wallet. Some wallets use https so the transactions are encrypted by that protocol.

  • I am playing around with web3.py to interact with smart contracts. Would it make sense to encrypt the data to ensure data integrity? – Bobby Mar 19 at 20:05
  • Your transaction data is signed with your private key so it cannot be manipulated easily while on transit. – Ismael Mar 19 at 21:27
  • yes this is what i wanted to know, signing the transaction data with the private key. But do we need to sign it explicitly or is this done 'under the hood'? – Bobby Mar 20 at 14:30
  • @Bobby All transactions have to be signed. If it explicit or implicit depends on the client/framework you are using to send transactions. – Ismael Mar 20 at 15:09
  • in the case of using web3.py, does one need to sign transactions explicitly? – Bobby Mar 20 at 16:30
0

If data get compromised, signature verification fails.

when Ethereum nodes receive transactions, they verify transactions using their signatures.

signature = hashing_algorithm(transaction informations)

If the signature does not match the transaction values, the transaction will become an invalid transaction, removed and not be saved in the transaction pool.

  • I am aware Ethereum is permisionless and I am not talking about privacy, I want to know if one has to encrypt it during transmission in case data gets compromised – Bobby Mar 19 at 18:06
  • understood, I've edited my answer. – TLHBM Mar 20 at 6:14
  • yes this is what i wanted to know, signing the transaction data with the private key. But do we need to sign it explicitly or is this done 'under the hood'? – Bobby Mar 20 at 14:30
  • the signature is essential in the transaction. If we don't have a private key when we create a transaction, we can't attempt to create it. When we try to create a transaction, automatically signature is made from a private key. The public key generated from the private key is used for verifying the transaction. The public key is exposed to others. – TLHBM Mar 21 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.