I have an idea and wish to make a site which will let users register a username on a contract. By calling the contract from their address this will also confirm ownership.

I am wondering is there any examples currently out there for a simple username register?


An example would be:

contract Usernames {
    mapping (address => bytes32) public names;
    mapping (bytes32 => address) public owners;

    function associateNameForEver(bytes32 name) {
        if (owners[name] !=0) throw;
        if (names[msg.sender] != 0) throw;
        owners[name] = msg.sender;
        names[msg.sender] = name;

Once set, it cannot be unset nor changed.


For example, you can see proofofphone.com and his source code https://github.com/blocknotary/proofofphone

  • Please post the relevant details on this site. Answers that are just links are not considered helpful as the linked site may cease to exist. – Chenmunka Sep 20 '16 at 9:22

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.