我正在尝试使用“ethereumjs”库,但它不起作用。我收到以下错误消息:“TypeError: Tx不是构造函数”,代码“const= new (TxObject)”。
这是我的代码:
const Tx = require(‘ethereumjs-tx’)
const txObject = {
nonce: web3.utils.toHex(txCount),
to: account2,
value: web3.utils.toHex(web3.utils.toWei('0.3', 'ether')),
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei'))
}
const tx = new Tx(txObject)谢谢你的帮助
保重
皮埃尔
发布于 2020-07-18 15:16:44
我是const Tx = require('ethereumjs-tx').Transaction。
下面是来自Github存储库的示例:https://github.com/ethereumjs/ethereumjs-tx。
https://ethereum.stackexchange.com/questions/85098
复制相似问题