15

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?

13

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.

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.