16

Reading the documentation of web3.js I have come across sending transactions and raw transactions.In the documentation it's specified that send raw transaction sends an already signed transaction.

Does this imply that web3.js does not sign transactions when sendTransaction() is called?

1 Answer 1

16

All transactions need to be signed. Otherwise they are considered invalid transactions and will not be included in the blockchain.

A raw transaction is a transaction in raw bytes. If one has the raw bytes of a valid transaction, they can use sendRawTransaction. Otherwise, web3.js creates the signed transaction's bytes for you automatically as part of sendTransaction(). web3.js converts the JSON transaction {from:..., to:..., value:...} to the raw bytes and signs it for you automatically.

Raw bytes are required if you are using a platform like infura.io which does not handle private keys but deal only with signed transactions.

2
  • I asked a related / follow up question here: ethereum.stackexchange.com/questions/18928/…
    – Tesa
    Jun 27, 2017 at 17:35
  • @Tesa Thanks. I will try to write a good answer for it (someone fast has already written one), might take few days.
    – eth
    Jun 28, 2017 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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