I have created a solidity contract where I can store application

pragma solidity ^0.4.17;

contract Applications {

  address applicant;

  mapping(uint => string) Application;

  function Applications() internal {
    applicant = msg.sender;

  modifier ifApplicant() {
    if (applicant != msg.sender) {
    } else {

  function setApplication(uint id, string data) public {
    Application[id] = data;

  function getApplication(uint id) ifApplicant public view returns (string) {
     return Application[id];

When I try to access the setApplication method via web3 I get the above error Attempting to run transaction which calls a contract function, but recipient address is not a contract address

const Web3 = require('web3');
const contract = require('truffle-contract');

const web3 = new Web3(
    new Web3.providers.HttpProvider('http://localhost:8545')
const ApplicationContract = require('./../blockchain/build/contracts/Applications.json');
const application = contract(ApplicationContract);
//web3 has deprecated sendAsync func whereas truffle-contract relies on it - this is patch hack
web3.currentProvider.sendAsync = web3.currentProvider.send;

web3.eth.getAccounts().then(accounts => {
                from: accounts[0],
                gas: '4700000',
        ).then((contract) => {if (typeof contract.address !== 'undefined') {
                    const ApplicationContract = new web3.eth.Contract(
                        .setApplication(1, 'form')
                        .call({ from: accounts[0] })
                        .then(data => console.log(data))
                        .catch(err => console.log(err));
                        'Contract mined! address: ' +
                            contract.address +
                            ' transactionHash: ' +

I am running ganache-cli for local development.

PS: I am very new to Solidity

  • .call().send(...) looks suspicious. Do one or the other. (You probably want send here, so methods.setApplication(1, 'from').send(...).)
    – user19510
    Commented Mar 11, 2018 at 7:47
  • But also, probably ApplicationContract.methods.setApplication..., right? Or what is methods?
    – user19510
    Commented Mar 11, 2018 at 7:47
  • @smarx Corrected. Yes, you are right. I get the same error when I do setApplication.call({from: ''}) and I invoke send I get error VM4711:1 Error: Returned error: sender account not recognized Commented Mar 11, 2018 at 7:59
  • It looks like you're trying to send the transaction from the contract's address. You can't do that. Use web3.eth.accounts to see what accounts ganache knows about. You can send transactions from those.
    – user19510
    Commented Mar 11, 2018 at 8:01
  • 2
    Please answer my questions. They were designed to help you to be more specific about how you obtained the address.
    – user19510
    Commented Mar 11, 2018 at 10:08

5 Answers 5


Run this from your command line

truffle networks --clean

this will clean your local network of previously built network...


I think you are using call for a write operation, where it should be used to just read values from Blockchain.

ApplicationContract.methods .setApplication(1, 'form') .call

Replace the call with a sendTransaction and it should work.

Please read web3.eth.call vs web3.eth.sendTransaction

For your reference What is the difference between a transaction and a call?


This answer explains what is causing this error. Running truffle migrate --reset should fix it.


I removed build/contracts folders and re-run :

  1. truffle build
  2. truffle migrate

After that, the error message disappears.


Try it.

var adoptionInstance;

web3.eth.getAccounts(function(error, accounts) {

    if (error) {

    var account = accounts[0];
    App.contracts.ApplicationContract.deployed().then(function(instance) {
    contractInstance = instance;
    //Execute adopt as a transaction by sending account
    console.log("Pedding Function");
    return contractInstance.setApplication(1,'form', {from: account, value: web3.toWei(prices, "ether")});
}).then(function(result) {
    console.log("Success Adopt");
}).catch(function(err) {
    console.log("Error Adopt " + err.message);

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.