1

I am trying to call a contract method ( a write operation ) and sign the transaction manually using my privatekey. The transaction hash is being generated but when I go to etherscan, the transaction shows failed. My web3.js code is as follows.

 var tx = new ethereumjs.Tx({
                from: '0x3dCDe57Ad49d639c4D702b607Dd5eBc0aB54A671',
                nonce: web3.toHex(txCount),
                gasLimit: web3.toHex(1000000),
                gasPrice: web3.toHex(web3.toWei('10', 'gwei')),
                data: contractInstance.incrementTest.getData(10).
            });

I have doubt in the data part of the transaction object. Is this the correct way to use it? incrementTest is the contract method and 10 is the parameter i wish to pass to incrementTest.

Error displayed in etherscan : Warning! Error Encounter during Contract Execution [stack underflow (0 <=> 15)

the error is different for different contract methods ie; when i change the data value in the transaction object.

0

try with:

data: contractInstance.methods.incrementTest(10).encodeABI()

Your Answer

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

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