I'm using remix to practice and learn Solidity. Sometimes I need to pass an argument of type address type to a function manually using GUI provided by remix. But whatever address I insert, syntax error shows up. However, if I hard code, I can use something like:

 address a=0x123;

But I cannot insert 0x123 into the box provided by the browser.

Question: What address format should I use to pass it to a function manually in remix?

  • Did you try address value in double quotes? Aug 17 '17 at 18:10
  • @Thank you very much! Yes, I wasn't using double quotes. It's working now. Shall I delete the question?
    – user153465
    Aug 17 '17 at 18:14
  • @user153465 no need but instead post an answer and accept it
    – Badr Bellaj
    Aug 17 '17 at 18:40
  • 1
    I get the same error, but when i enclose the address with double quotes as the suggested solution I get "Error: Argument is not a number". Are you sure that you're supposed to enclose an address type variable with quotation marks?
    – user19596
    Sep 21 '17 at 15:50
  • In your case is because of a recent bug in the IDE. See github.com/ethereum/browser-solidity/issues/809
    – AdrianClv
    Sep 21 '17 at 16:12

I'm using Remix and had the same question. You can eitherway use

for the address of the sender

address owner = msg.sender;

for the address of a contract

Contract contract = new Contract();
address contractAddress = address(contract);

Or if you need an address for Testing in Remix

address receiver= address(number);
  • Short addition - if you're testing in Remix and wondering how you should get some addresses, just use: address account0 = accounts(0); address account1 = accounts(1); Jan 25 '19 at 19:43

Thanks for the comments.

It must be enclosed in double quotes, e.g. "0x123"; otherwise syntax error would show up in the browser.


The answer is a bit more detailed. The function’ user input box accept addresses “as they are” (without any double quote) up to two parameters, one of which is an address. After that, it requires to double quote at least from the second address.

This strange behavior depends on JavaScript to Solidity conversion, that use strings as console input when troubles arise.

On the other hand from the last version (0.7.5) if you write an address as parameter in any multiparameter function input space and then open the “column type” interface (just click on ^ sign in the input block) the system automatically copies the existing address add double quotes them automatically. So we can presume that double quotes are very probably ever well accepted.

Any valid address can be used. In particular if it is the single (or the first of the two) address of the function, it never requires double quote.

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.