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"

After transforming the inputs, IDrissHashIDrissHash and IDrissHashverifyIDrissHash_{verify} are generated using

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:

4133dbf2e0b2af2b9b006e71dc23fa804df49ce85409b77bebef1395d59531533c7b23062dd8a4e09f35da8fe4f1418f614b63942c0aff1d86a3b370807fe29d 4133dbf2e0b2af2b9b006e71dc23fa804df49ce85409b77bebef1395d5953153 \\ \downarrow \\ 3c7b23062dd8a4e09f35da8fe4f1418f614b63942c0aff1d86a3b370807fe29d

Second, the mapping that saves the resolving address to a given IDriss is mapped to from IDrissHashverifyIDrissHash_{verify}.​ In this example, the IDriss "[email protected]" resolves to the address 0x000...0000 with wallet tag "Metamask ETH".

3c7b23062dd8a4e09f35da8fe4f1418f614b63942c0aff1d86a3b370807fe29d0x00000000000000000000000000000000000000003c7b23062dd8a4e09f35da8fe4f1418f614b63942c0aff1d86a3b370807fe29d \\ \downarrow \\ 0x0000000000000000000000000000000000000000

Lastly, you can find IDriss ownerships in a mapping that stores your IDrissHashIDrissHash together with the address that has paid during sign-up. You are free to change the owner's address at any time. As this is an option, there might be a different means of payment in the future and therefore a different way of determining the original owner address. Head over to your Management Dashboard for any changes you would like to perform.

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.

4133dbf2e0b2af2b9b006e71dc23fa804df49ce85409b77bebef1395d59531530x00000000000000000000000000000000000000004133dbf2e0b2af2b9b006e71dc23fa804df49ce85409b77bebef1395d5953153\\ \downarrow \\ 0x0000000000000000000000000000000000000000

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