enter image description here

DeclarationError: Undeclared identifier.on line 8,12,14.

1 Answer 1


_success is not defined anywhere. Is just a parameter of the event isNotify but is not a field neither in your function nor in your contract.

So you need to define your local field and then use it to emit the event.

function register(string _name) public {
    bool _success = false;
    if (nameToAddress[_name] == address(0)) {
        nameToAddress[_name] = msg.sender;
        _success = true;

    emit isNotify(_success);

please note that tx.oring is not safe to use, better to use msg.sender; more info here and here.


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.