1

How do you reset an address variable in Solidity? You cannot assign it Null or 0 but I want to be able to "deassign" an address somehow. Any ideas?

1

A solution similar to the following should work:

contract Test {
    address public someAddr;
    function nullifySomeAddr() {
        someAddr = address(0);
    }
}

The above code snippet will set the someAddr variable to its default type, the all 0 address (0x000000000000......)

1

There's no null in Solidity, but you can assign an address to 0x0

This is practically just 0 written in hexadecimal notation.

0x0 is essentially an abbreviation for the genesis address 0x0000000000000000000000000000000000000000, which most likely nobody has the private key for, so I've seen that being used for nullifying an address.

Have also a look at this: https://ethereum.stackexchange.com/a/18427/43751

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.