Returned error: invalid sender

提示Error: Returned error: invalid sender ,这是heco主网节点,链id16进制的也试过了也不行

var Web3 = require('web3')
      var web3 = new Web3('https://http-mainnet-node.huobichain.com/')
      const EthereumTx = require('ethereumjs-tx').Transaction
      const privateKey = Buffer.from(
        'siyao',
        'hex',
      )
      const txParams = {
        gasPrice: '0x09184e72a000',
        gasLimit: '0x2710',
        to: '0xa89765D7B7b7f5eF981430Df85115a932234ac1d',
        value: '0x00',
        common: {
          customChain: {
            name: 'heco_main',
            networkId: '0x80',
            chainId: '0x80'
          }
        }
      }
      const tx = new EthereumTx(txParams)
      tx.sign(privateKey)
      const serializedTx = tx.serialize()
      console.log(serializedTx)
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
        if (!err) {
          console.log(hash)
        } else {
          console.log(err)
        }
      })
请先 登录 后评论

最佳答案 2021-05-17 09:47

半夜昏头了,id写错地方了。

请先 登录 后评论

其它 1 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 3 关注
  • 0 收藏,6080 浏览
  • 志辉 提出于 2021-05-17 02:49