4

In Browser Solidity, there's a "Transaction" tab (paper plane icon). You can choose one of two addresses, and a value. But there's no "send" button or anything of the sort. What is this section supposed to do?

Fernando Tiberti
  • 2,299
  • 1
  • 15
  • 28

3 Answers3

3

By putting a non-zero value in the "value" field, you instruct the IDE to send that much (simulated) Ether along with any transaction it makes.

The equivalent of the "send" button that you are looking for is to simply put a value in the "value" field and then hit the (fallback) button. This will behave as if you simply sent a transaction to the contract with some Ether and no data.

Tjaden Hess
  • 37,046
  • 10
  • 91
  • 118
3
  1. create a simple contract

    contract testMSGVALUEinBrowser{
        uint lastSent;
        function test() public returns (uint lastSent) {
            lastSent = msg.value;
            return lastSent;
        }
        function get() constant returns( uint){
            return lastSent;
        }
    }
    
  2. Click the transaction tab

  3. Click the create red button

  4. Enter a number in the transaction Value field (1234 in the example)

  5. Click the test button that will trigger the test function, you can see it has sent 1234 Ether

  6. Click the get blue button, it retrieves the value sent properly

enter image description here

Fernando Tiberti
  • 2,299
  • 1
  • 15
  • 28
euri10
  • 4,640
  • 5
  • 24
  • 55
  • Make sure you set the Value field back to 0 before clicking the blue button. I got a bit confused when I was first using this and it kept showing double the amount I put in. – Tjaden Hess May 19 '16 at 23:08
  • I'm not seeing those buttons. Just trying to run the basic ballet contract. http://imgur.com/a/g1Omt ... appreciate any comments. – mowliv Aug 11 '16 at 21:13
1

I want to to make a tiny correction to the answer that begins with "create a simple contract". As it is shown, doesn't work at 2016-08-17.

The following does work at this date (browser-solidity/#version=0.3.6):

contract lastSentValue{  
  uint lastSent;  
  function set() public returns (uint) {  
    lastSent = msg.value;  
    return lastSent;  
  }  
  function get() public constant returns( uint){  
    return lastSent;  
  }  
}
user3953
  • 61
  • 1
  • 6