5

Here's a simple contract:

contract C {
    event myEvent(bool x, address y);
    address someAddress;

    function someAddressExist(){
        if(someAddress != 0){
            myEvent(true, someAddress);
        }
    }    

    function setSomeAddress(address y){
        someAddress = y;
    }
}

When I try to send a transaction to any address on the test network, except 0x1, it works. What's so special about this address? Are there any other addresses like that?

2

Im not sure...what is your understanding of a valid address? In your example the argument you specify is a perfect valid address.

An address is just a variable that can hold a 20 byte value.

To answer the edited question of the OP I can link to this thread: Not all addresses created equal?. Basically some addresses hold some precompiled contracts so they will execute code if transactions are sent to them.

  • when I do web3.isAddress('0x1') is returns false. A bit confusing. I was thinking that maybe Solidity pads it to look like 0x10000000000000000000, but it returns 0x1 in the log. I wonder if it's possible to do something like address('0x1').send() – manidos Aug 13 '16 at 11:30
  • Strange but isAddress() is not documented in the javascript api...you can see that in the solidity documents the type of address can be of.the form you mentioned solidity.readthedocs.io/en/latest/types.html. And im still not sure what you understand by a valid address – dragosb Aug 13 '16 at 11:47
  • well, to me a valid address is a 20 bytes HEX string which I can send transactions to. If I try to send some wei from inside the contractt using address.send() to 0x1000000000000000000000000000000000000000, it works, but if try to send to 0x0000000000000000000000000000000000000001 as well as to 0x1 it doesn't work. What might be the problem here? – manidos Aug 14 '16 at 4:32
  • 1
    I think you got the answer in another thread :) If that is the case i will link that answer here – dragosb Aug 14 '16 at 17:34

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.