I am trying to send the args on function from owner account but getting Returned error.

I am using web3 1.0 .

Function in contract :

* @dev Adds single address to whitelist.
* @param trusted Address to be added to the whitelist
function addToWhiteList(address trusted) public onlyOwner {
    whitelist[trusted] = true;

    emit UserWhitelist(true);

Code on index.html :

// Add user on whitelist
.send({ from: "0x61A44075419C4402f6DE631341d875Ece6A3922e" })
.on("receipt", function(receipt) {
.on("error", function(error) {

ERROR : Returned error: The method eth_sendTransaction does not exist/is not available

Note : I add web3 in script tag :

<script language="javascript" type="text/javascript" src="web3.min.js"></script>

and init. like this :

web3 = new Web3(new Web3.providers.WebsocketProvider("wss://ropsten.infura.io/ws"));
  • Your code seems to be perfect. Maybe something is broken with Inura. I hope you are unlocking seders add before sending tx. Commented May 16, 2018 at 19:20
  • @PrashantPrabhakarSingh, I didn't get you. I am sending tx. from owner account and I add the owner public key in from . Commented May 17, 2018 at 3:54
  • You need to unlock the owner's account. Check personal.unlock(owner) Commented May 17, 2018 at 5:07
  • @PrashantPrabhakarSingh, I tried but didn't get any success. Can you please let me know in separate answer so I can accept your answer also. Commented May 17, 2018 at 5:36
  • Infura doesn't support sendTransaction you have to sign your own transactions and use sendSignedTransaction, or use a plugin like MetaMask to sign transactions.
    – Ismael
    Commented May 17, 2018 at 16:53

1 Answer 1


I am not sure if this is the reason. But try unlockking account before sending transaction. The senders account needs to be unlocked. Generally you get please unlock your account error. But may be this is not allowing you to send tx. A sample code looks like:

    return new Promise(function(fullfill,reject){
        /* add basic checks like if user has sufficient balance , address are valid etc*/
        web3.eth.personal.unlockAccount(from, password).then(function(result,e){
            console.log("Account "+from+" unlocked successfully");
            amount = parseFloat(amount);
            amount = amount *decimalMultiplier;
            cnkContract.methods.transfer(to ,amount).send({from:from})
                    console.log("Transaction hash : "+txHash);
                    console.log("Unable to send transaction. Error:"+error);
                    reject("Sending transaction on blockchain failed");
            logger.error("Incorrect transaction password for account: "+from);
            reject("Incorrect transaction password.");
  • I tried like this : web3.eth.personal.unlockAccount("0x61A44075419C4402f6DE631341d875Ece6A3922e", "12egjec308").then(function(result,e) { console.log("Account unlocked successfully"); }); but still getting error : Returned error: The method personal_unlockAccount does not exist/is not available Commented May 17, 2018 at 6:10
  • The reason for this is you need you need to enable perosnal api over rpc (by default this is disabled for security reasons). When you set-up geth you enable this under rpc flag like --rpcapi web3,eth,net,personal,db. If you don't enable this you cann't access personal methods. Since you are using infura node, check if they have enabled the same. Commented May 17, 2018 at 8:12
  • If you are doing testing and all, I shall recommed setup a private node which will be under yiur control to test your app better. You can check my medium post here for same. Commented May 17, 2018 at 8:14
  • Thanks for your words ! But thing is that want to test on infura node ? Commented May 17, 2018 at 8:32
  • Then you need to check if they are exposing personal over rpc. Commented May 17, 2018 at 9:14

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