I have a contract successfully deployed and working well in the Javascript VM on Remix.

contract BlipCoinIco is PausableToken {

  function() isIcoOpen payable {
      totalRaised = totalRaised.add(msg.value);

      uint256 tokenAmount = calculateTokenAmount(msg.value);
      balances[fundsWallet] = balances[fundsWallet].sub(tokenAmount);
      balances[msg.sender] = balances[msg.sender].add(tokenAmount);
      Transfer(fundsWallet, msg.sender, tokenAmount);

      // immediately transfer ether to fundsWallet

  function calculateTokenAmount(uint256 weiAmount) constant returns(uint256) {
      // standard rate: 1 ETH : 50 ESP
      uint256 tokenAmount = weiAmount.mul(50);
      if (now <= startTimestamp + 7 days) {
          // +50% bonus during first week
          return tokenAmount.mul(150).div(100);
      } else {
          return tokenAmount;


The Javascript VM provides a couple of test accounts with preloaded Ether:

enter image description here

The contract owner and fund's wallet belongs to the first test account.

How can I send ether to the first test account, from the second test account, so that it hits the contract's isIcoOpen payable function?

I've tried using the send and transfer functions, but I can't get it to work.


You don’t have to send ether to the other account to trigger the function. The function you mention is a fallback function of the contract. To trigger it you have to send ether to the contract, not the accounts you list.

  • Right, I think I was just mixing up my terms, I understand. I have the contract address, how do I send ether from one of the test accounts to the contract so that it gives that account tokens? I have this contract working on the test net with MetaMask by the way, I just don't know how to transfer ether with these VM accounts.
    – Alex E
    Dec 10 '17 at 20:15
  • 1
    You could execute the fallback function (in red in Remix when you compile the contract) and supply ether to it by setting the value. Dec 10 '17 at 20:26
  • Yep, just figured this out myself. Thanks! Setting the 'Value' in the 'Run' tab where the accounts are listed, then hitting the 'fallback' function sends ether to the contract.
    – Alex E
    Dec 10 '17 at 20:27

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.