4

I'm using Solidity in order to create smart contracts. From contract only has access to the current state, I can't see where I'm able to get directly the address where this contract has been mined.

The only way I see to achieve this, is to use the Web3 JavaScript API so as to get contract.address, and then call a setter function,implemented inside the smart contract with contract.address as input parameter.

Is this the only way to do it?

Thanks

1

1 Answer 1

5

You can use the global variable this.

address myAddress = address (this)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.