About the AccountIdentifier (generated wallet address)

Hello !

I am currently playing (locally) with the ledger canister and motoko.

There is an essential question that I ask myself concerning the address of wallet generated after going through an Internet Identity authentication. Is the wallet address unique for each canister / dapp (just like the identity)?

I wanted to see if the wallet address generated (with AccountIdentifier) was compliant for a withdrawal from an exchange and… yes it matches

Screenshot (ICP address match)

Actually, to sum up:

  • The Internet Identity is different for each canister
  • AccountIdentifier generates a different wallet address for each canister

All is correct ?

AccountIdentifier type : ledger-ref/Account.mo at 3ed0206afd231b9586c9e7b9a793948f10118297 · dfinity/ledger-ref · GitHub

Yes. II generates a different principal per user per service authenticated with it. And account IDs are calculated by concatenating a constant string, principal, and subaccount, and SHA-224 hashing the result; the odds of a SHA-224 collision, and thus a duplicate account ID, are about one in two billion.

1 Like