Technical Deep Dive

The registry contract deployed on the Polygon network is the foundation of the address book. The contract has undergone verification, and its source code is open for review here.

At its core, IDriss is made up of three mappings. First, we generate a hash called IDrissHash. It is a hash of the identifier, an optional (and encouraged) secret word (secretWord) , and an additional hash identifying the chosen wallet tag. The identifier is either an email, phone number, or Twitter user ID (which does not change when changing your Twitter username).

\begin{align} &IDrissHash = sha256(identifier+secretWord_{optional}+walletTag_{hash}) \\ \\ &IDrissHash_{verify}= sha256(IDrissHash+verifier_{key}) \\ \\ &IDrissHash \rightarrow IDrissHash_{verify}\end{align}

To normalize the input variables, we provide a number of methods to follow before generating the hashes:

def convertNumber(number):
    conv = re.sub(r'[^\d]+', '', number)
    return "+" + conv

def convertSecretWord(input_):
    input_ = re.sub(r'[^a-zA-Z]', '', input_)
    return input_

# Some input fields automatically start with capitalized inputs
# Use this for every input
func = lambda s: s[:1].lower() + s[1:] if s else ''

# regular expressions to identify the type of input
if re.match(r"^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$", input_):
    return "email"
elif re.match(r"^(\+\(?\d{1,4}\s?)\)?\-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$", input_):
    return "phone"
elif re.match(r"^@[a-zA-Z0-9_]{1,15}$", input_):
    return "twitter"
def hashHex(s):
    return hashlib.sha256(s.encode()).hexdigest()

In an example, let's consider the IDriss identifier to be "[email protected]", the wallet tag hash "ETH_MM" for MetaMask Eth, and "gm" as the verifier key. No secret word is chosen. The resulting mapping looks as follows:

Beware: only the owner address is verified to change ownership of your IDriss. Make sure you do not lose access to this address. The owner address can also delete an IDriss from the registry.

In this example, the address 0x000..0000 owns the IDriss "[email protected]", meaning the owner address is the same as the address saved in the registry.

Last updated