My contract instance is created like:

var instance = web3.eth.contract(abi).at(addressA); 

instance.sendTransaction is showing error in this case, what's the correct way to send ether to this contract?


2 Answers 2


you can use web3.eth.sendTransaction() and set the contract's address in the "to" field of your transaction object.

Here is how to send a transaction :

var abi=[//your abi array];
var contractAddress = "//your contract address";
var contract = web3.eth.contract(abi).at(contractAddress);

//if you have the fallback payable :

web3.eth.sendTransaction({from:web3.eth.accounts[X],to:contractAddress , value:web3.utils.toWei('0.0000001','ether')}) //the value is an example    

// if you have a specific payable function

 contract.functionName.sendTransaction(parameter_1,parameter_2,parameter_n,{{from:web3.eth.accounts[X], value:xyz}},function (error, result){   if(!error){
                    } else{

The contract can not send ether unless you write a function that does it. sendTransaction is not a function of your contract that is why you get the error: "instance.sendTransaction is not a function". You either send a normal transaction as smarx wrote in the comments or If you need the ether to come from a contract that does something in your application, you can add this function:

function resendEther(address recipient) public payable{

Then you can use the instance:

instance = web3.eth.contract(abi).at(addressA);
instance.resendEther('recipientaddress', {value: 'etheramount'});

Hope this helps.

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.