I'm currently using version 1.2.9 and Using Infura Rinkeby as Provider. So basically I'm building a node application with Inbuilt wallet. Now I have successfully Created an Account and Used that account to Send ETH transactions to other wallets by Sign Transactions and Send Transactions. Now When I have to send Contract Methods in a transaction my code thinks im sending ETH to that address my code is:

var contractAddress = account.asset[req.body.assetType].tokenAddress; var user_addressTo = req.body.toAccount;

var amountSent = req.body.valusent; const myContract = new web3.eth.Contract(ABI,contractAddress);

const result =   {
from: account.address,
gasPrice: web3.utils.toHex(web3.utils.toWei(gasPrice, 'gwei')),

var signPromise  =  await web3.eth.accounts.signTransaction(result,key);
var z = await web3.eth.sendSignedTransaction(signPromise.rawTransaction);

I have checked multiple times the values im sending In. Each Value works just fine Now the Response I get from Blockchain is

blockNumber: 7645527,
contractAddress: null,
cumulativeGasUsed: 494263,
from: '0xe6f2332b8758148de0e7739177544d28a4225807',
gasUsed: 21620,
logs: [],
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
status: true,
to: '0x3dea86e3170ab1e93ff033cee4ae07bb19c75ab7',
transactionHash: '0xca08aa4560de4bae21bceaa36ed2b8c23f218ca05cf7d9adad1845ac8b817dcc',
transactionIndex: 2

I have followed a lot of tutorials and answers from different platforms but each gives out this result. Can you guys help me?

  • Now When I have to send Contract Methods in a transaction my code thinks im sending ETH to that address Why do you think so? Dec 2 '20 at 9:46
  • Because the transaction on etherscan doesnt show any token transfter info It just states that 0 ETH was transferred and even in the InputData there is just a hash its not computed in functions and ID like in normal contract function call Dec 2 '20 at 9:50
  • Please give a link to the transaction as it would be very relevant to help you with the question. Dec 2 '20 at 9:52

Contract address does not contain any smart contract code:


Please deploy your token smart contract first before using its ABI.

  • 1
    Ohhh... I just realized what the mistake is. In toAddress im sending address of the person im suppose to transfer token rather than address of the contract. I changed that and its working fine now !!! .Thanks brother for all the help Dec 2 '20 at 9:58
  • No problem Syed. Please mark answer closed if it solved your problem. Dec 2 '20 at 10:00

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.