首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >web3.eth.sendTransaction和web3.eth.personal.sendTransaction在Web3.js上有什么区别?

web3.eth.sendTransaction和web3.eth.personal.sendTransaction在Web3.js上有什么区别?
EN

Ethereum用户
提问于 2022-06-30 06:45:34
回答 1查看 441关注 0票数 1

我检查了sendTransactionsendSignedTransaction之间的区别。(有人能指出Web3.eth.sendTransaction和web3.eth.signTransaction的区别吗?)

但是我发现在sendTransaction上有两个web3.js (v1.7.4)方法。

第一个是web3.eth.sendTransaction。(https://web3js.readthedocs.io/en/v1.7.4/web3-eth.html#sendtransaction)

另一个是web3.eth.personal.sendTransaction。(https://web3js.readthedocs.io/en/v1.7.4/web3-eth-personal.html#sendtransaction)

后者似乎存在安全问题(与web3.eth.personal.unlockAccount一起使用),第一个问题的用途是什么?

我认为在web3.js上发送事务的一般方法如下。

1.web3.eth.signTransaction 2.web3.eth.sendSignedTransaction

那么,web3.eth.sendTransaction的用途是什么呢?

EN

回答 1

Ethereum用户

发布于 2022-07-01 15:05:37

这是来自web3.jsGitHub存储库问题的@nikoulai的答复。(https://github.com/ChainSafe/web3.js/issues/5191#issuecomment-1172155634)

这里有两个不同的问题。

首先,关于个人sendTransaction。摘自文件:

web3-eth-personal包允许您与Ethereum节点的帐户进行交互。因此,使用这个sendTransaction,您正在尝试使用节点中的一个帐户来执行事务。

关于第二部分,web3.eth.signTransaction & web3.eth.sendSignedTransactionweb3.eth.sendTransaction。在内部,sendTransaction签署事务,可能是最常用的。如果不同的步骤更灵活,则签署和发送事务。您可以使用一个帐户签署交易,另一个帐户发送和支付费用等。

票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/130977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档