Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from the terminal.

3 important things... I am using Truffle develop and connected to the network, i have already successfully gotten an instance of contract and I was able to call the other functions in the terminal. This withdrw function i am unable to call. Since it takes a uint I am simply putting in uint but when i call the function it doesn't work. instance.withdraw(22); Shouldn't this call the function or do i need to put it in ether or something?

function withdraw(uint withdrawAmount) public returns (uint) {
        require(balances[msg.sender]>= withdrawAmount);
        balances[msg.sender] -= withdrawAmount;
        emit LogWithdrawal(msg.sender,
        return balances[msg.sender];

Again just to be clear, i am looking for the command in the truffle develop terminal to call this function. I am using instance.withdraw(22); which is not working.

1 Answer 1


First, be sure that you have defined the instance of the contract correctly. Then try to use async/await correctly in your orders in terminal. Finally, give this page a read : "https://www.trufflesuite.com/docs/truffle/getting-started/interacting-with-your-contracts"

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.