0

I get an error

Error: TypedTransaction with ID 40 unknown at t.TransactionFactory.fromSerializedData

HERE IS MY CODE:

const txData = { nonce: "0x" + parseInt(nonce, 10).toString(16), from: address, to: to, gasLimit: "0x" + parseInt(gasAmount, 10).toString(16), gasPrice: "0x" + parseInt(fee, 10).toString(16), value: "0x" + parseInt(balance, 10).toString(16), };

console.log(txData)

let hexObject = new ethereumjs.Tx(txData);
let hexString = '0x' + hexObject.serialize().toString('hex'),
    encoded = {
        encoding: 'hex'
    }
const rawHash = web3.utils.sha3(hexString, encoded);

console.log('rawHash: ' + rawHash)

let txHash = await web3.eth.sign(rawHash, address);
console.log('txHash: ' + txHash)

const createReceipt = await web3.eth.sendSignedTransaction(txHash, function (error, hash) {
  if (error) {
    console.log(error)
  }
  else {
    console.log(hash)
  }
})

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.