sendRawTransaction 与 sendSignedTransaction的区别:
sendRawTransaction是web3.js的旧版本的方法,新版本的web3.js已经将sendRawTransaction替换成了sendSignedTransaction。
web3.js对于sendTransaction()的处理逻辑:
(1)如果可以找到钱包,则使用from参数对应的私钥进行签名,然后调用eth_sendRawTransaction这个RPC接口。
(2)如果没找到钱包,则不做任何处理,直接发送sendTransaction这个RPC接口。
节点的sendTransaction()处理逻辑:
(1)如果可以找到钱包,则使用from参数对应的私钥进行签名, 然后提交这笔交易; 如果找不到from参数对应的私钥,则报错。
(2)如果没找到钱包,则会报错,不会广播这笔交易。
https://github.com/ethereum/wiki/wiki/JavaScript-API
https://web3js.readthedocs.io/en/v1.2.9/web3-eth.html#sendtransaction
https://web3js.readthedocs.io/en/v1.2.9/web3-eth.html#sendsignedtransaction
https://web3js.readthedocs.io/en/v1.2.9/web3-eth.html#signtransaction