I have a problem with raw Transaction. Using this code to send tokens to another contract, something does not work. The transaction is signed correctly, everything is sent to the network but it does not work.

   let gasCost = await tokenContract.transfer['address,uint256,bytes'].estimateGas(tradecenterAddress,web3.toWei(

        let count = web3.eth.getTransactionCount(this.creator);

        var rawTransaction = {


        let tx = new window.ethereumjs.Tx(rawTransaction);
        let privateKey = window.keythereum.recover(this.password,fileOb);
        privateKey = privateKey.toString('hex');
        let buf = Buffer.Buffer.from(privateKey,'hex');
        let serializedTx = tx.serialize();
        let recipt = await web3.eth.sendRawTransaction('0x'+serializedTx.toString('hex'));

Doing the same in this way everything works.

   let gasCost =  tokenContract.transfer['address,uint256,bytes'].estimateGas(tradecenterAddress,web3.toWei(44,"ether"),web3.fromAscii("fd"));
       let hashT =   tokenContract.transfer['address,uint256,bytes'].sendTransaction(tradecenterAddress,web3.toWei(44,"ether"),web3.fromAsci

  • What do you mean when you say it doesn't work? The transaction fails, it is marked pending and is never mined, or it is droped immediately? I'd suggest to check in your transaction if gasPrice and chainId are correct. – Ismael Aug 20 '18 at 23:50
  • Error say "Error: Returned error: known transaction: " and another time "Error: Transaction has been reverted by the EVM:" – Daniel Soe Aug 21 '18 at 22:43
  • If the transaction says it is reverted by the EVM it means the signature is ok, perhaps gas is too low. I don't know what the other error means perhaps you submitted the same transaction twice. – Ismael Aug 22 '18 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.