提示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)
}
})