Error in sending value to an Ethereum Smart Contract.

0 votes

I have geth 1.5.2 and working on testnet with Mist-linux64-0-8-7.  When I try to send some ethers (value) to my contract by calling any function, I get stuck. For example, this dummy function does not work with non-zero value but works normally with zero value:

function t() returns (uint){
    return 1;
}

I can see a warning in Mist with the message "It seems this transaction will fail. If you submit it, it may consume all the gas you send." This does not depend on the gas amount that I provide. Even if I put 500,000 of gas the transaction seem not to complete.

The message I encounter is -

Warning! Error encountered during contract execution!

I tried to run different functions in different contracts. I was even using sendTransaction functionality to do the same from geth console directly but I still can't make it work. I didn't find if anybody had similar problem. Please help me if you have any idea.

Jul 23, 2018 in Blockchain by sabby
• 4,050 points
30 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

It is stated in Solidity 4.0 documentation that: "Functions that want to receive ethers have to specify the new payable modifier (otherwise the throw)." A throw consumes all gas, so use function t() payable returns (uint).

answered Jul 23, 2018 by Perry
• 16,450 points

Related Questions In Blockchain

0 votes
1 answer

How to get notified when an event triggers on ethereum smart contract?

Here's a simple example for web3js 1.0.0.beta*: function handler ...READ MORE

answered Jun 8, 2018 in Blockchain by ariaholic
• 7,320 points
210 views
0 votes
1 answer

Error when trying to deploy Ethereum smart contract using web3j

Create a new credential based on the Credentials.create ...READ MORE

answered Oct 3, 2018 in Blockchain by slayer
• 29,040 points
98 views
0 votes
1 answer

How is a request sent from an app to a smart contract?

Yes, the contract is distributed by every node ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 16,450 points
29 views
0 votes
1 answer

How to prevent the smart contract from being modified and deployed in the blockchain network?

To expand on Matthew's answer, each state ...READ MORE

answered Jul 5, 2018 in Blockchain by ariaholic
• 7,320 points
30 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
61 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 65,820 points
28 views
0 votes
1 answer
0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 16,450 points
171 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.