2

This contract correctly connect an username to their public address. But when I used the function to display the name by their address, the user name isn't shown but instead of that their is an address but not the actual name. (see picture below). How can I make it happen to show the users name instead of a address?

      contract Users {

    mapping (address => bytes32) public names;
    mapping (bytes32 => address) public owners;

    function register(bytes32 name) {

            owners[name] = msg.sender;
            names[msg.sender] = name;


    }
}

enter image description here

1 Answer 1

1

you have in result 6572696b which is "erik" in hexadecimal not an address. while you are using bytes you will get this result so think of converting bytes to string as discussed in this link

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .