1

I am developing a light wallet for a private network. I use ethereumjs-accounts for storing accounts locally and ethereum-tx for signing transactions. I have deployed custom token-contract. Here is my txParams object:

        nonce: nonce, //transaction count
        gasPrice: "0x0", //private network do not need gas
        gas: "0x0",
        from: account, //sender account
        to: contractParams.address,
        value: "0x0",
        data: this.contractInstance.sendFunds.getData(
            '0x07a204163f78bf9293c996f8c6d98a058a324b2d',
            '0xd9f0443219296744c91929fc0818b3e42d90b2eb',
            2,
            ''
        ) //calling functions to send tokens from 1 account to another

Than I sign the transaction and send it to the chain:

    let tx = new EthereumTx(txParams);

    tx.sign(privateKey);

    let serializedTx = '0x' + tx.serialize().toString('hex');

    this.web3.eth.sendRawTransaction(serializedTx, (err, hash) => {
        if(err) {
            console.info(err);
        }else{
            console.log('Transaction hash: ', hash);
        }
    });

After sending the transaction I receive tx hash but nothing more happens. I can get transaction by hash for 30-40 seconds after sending and then the transaction disappears, and if I try to get it after 40 seconds - I get null.

Any ideas what can cause this problem and how to debug it?

Transaction object from web3.eth.getTransaction(); enter image description here

1 Answer 1

1

are nonce and contractParams.address both hex-encoded with a leading 0x prefix?

ps) it would be a good idea to pad all hex-encoded values with a leading 0 if the length is odd.. to ensure that the length is even. (ie: 0x1 should be entered as 0x01, etc)

pps) txParams.from can be removed.. it has no meaning

1
  • Thanks for comment. Problem solved, but was at anotyher sing. Don't know why, but web3js couldn't get public key to fill from field. I have reinstalled lib and it works now.
    – Baga
    Commented Jul 24, 2017 at 21:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.