I'm calling a function that will write information to contract, and MetaMask will list it as a 'Contract Deployment'. It is on the Rinkeby testnet. But if I run it locally using Truffle/Ganache, it will list it as a 'Contract Call', as opposed to a 'Contract Creation'.

Here is my code:

this.contract = new web3.eth.Contract(ABI, contractAddress)

let accounts = web3.eth.getAccounts()
let contractFunctionData = this.contract.methods.contractFunction(params).encodeABI()
  from: accounts[0],
  data: contractFunctionData
}, function(err, result) {

when it logs result it returns the address of the new contract created.

This only happens with write functions. Read functions work as expected and return the right output.


It looks like your code is missing a to address. If you send a transaction to address 0 (the default), it creates a new contract. Adding to: contractAddress should work.

BTW, you might also consider just letting the contract instance do the work rather than using web3.eth.sendTransaction directly:


This would ensure that the right data and to address are used.

  • I changed my code according to what you suggested and it worked, with MetaMask listing it as a 'transaction' instead of a 'contract creation'! The only this is I was getting a TypeError when I tried to use .sendTransaction()', but when I tried using .send()` it worked. Jan 26 '19 at 2:30
  • 1
    My mistake! Edited to have .send() instead.
    – user19510
    Jan 26 '19 at 3:02

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.