New to Ethereum. Started working with a simple sample contract. It's working correctly except for the fact that I simply cannot seem to increase its balance. Any thoughts?

contract Faucet {
    address owner;
    uint256 sendAmount;

    function Faucet() {
        owner = msg.sender;
        sendAmount = 1000000000000000000;

    function getBalance() returns (uint) {
         return this.balance;

    function getWei() returns (bool) {
        return msg.sender.send(sendAmount);

    function sendWei(address toWhom) returns (bool) {
        return toWhom.send(sendAmount);

    function getSendAmount() returns (uint256) {
        return sendAmount;

    function killMe() returns (bool) {
        if (msg.sender == owner) {
            return true;

Then, using Geth :



eth.sendTransaction({from:eth.coinbase, to:faucetAddress, amount:1000000000000000000})

Block is mined, then:


No increase.

Here's my transaction receipt. Many thanks in advance.

 blockHash: "0x6dacad47ad5f6a4e8dbb38a70bbe77b1d2ef019df396642c0490afc7e5ad2c8c",
 blockNumber: 1526,
 contractAddress: null,
 cumulativeGasUsed: 90000,
 from: "0x245d5fef6bf170a0fc6b464f033bff2aea020dbd",
 gasUsed: 90000,
 logs: [],
 root: "9da791d719134c34bdad70c6cfcc424a1daa1a1573a6319f475a61b7d2728b80",
 to: "0xeff6f295823648420cd1e6707caf99340c2343d0",
 transactionHash: "0xbc6c596afe9e05eb496d85472ade592fbb179fd7b4e0a619cba84bd8930da35b",
 transactionIndex: 0

As of Solidity 0.4, contracts must explicitly allow themselves to receive ETH by defining a fallback function with the payable modifier. It would look like this in your case:

function() payable {}

Just put that at the bottom of your contract and you should be good to go. Note that any function that wants to accept ETH must now use the payable modifier.

This is the relevant release note

Contracts that want to receive Ether with a plain "send" have to implement a fallback function with the payable modifier. Contracts now throw if no payable fallback function is defined and no function matches the signature.

See all breaking changes and release notes: https://github.com/ethereum/solidity/releases/tag/v0.4.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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