Skip to main content

Feedback

Loading...

Creating a DID

While there exists many DIDs, this tutorial will focus only on ethr DID. At the moment, TradeTrust only supports ethr DID.

The creation of an ethr DID is identical to the creation of a wallet, as it relies entirely on the ethereum architecture. Once the wallet will be created, we will need to retrieve its private key:

  • Using the wallet created in the prerequisite step, we run this command on the CLI to retrieve the private key:

     tradetrust wallet decrypt wallet.json
    ⚠  warning   You are about to reveal the private key of your wallet. Please type the following word into the terminal to prove that you understand the risks: environmental-maroon-scorpion
    ? ack: environmental-maroon-scorpion
    ℹ info User consented to risks
    ? Wallet password [hidden]
    … awaiting Decrypting Wallet [====================] [100/100%]
    ℹ info Wallet successfully decrypted
    ✔ success Wallet information:
    - address: 0xaCc51f664D647C9928196c4e33D46fd98FDaA91D
    - public key: 0x041582ae06ae170b4c5610599c8a5fee37414da84f7e2a3b3c48789199c3202f2c7673f3e32dfead4543247ccb792aa4f54dbd3e701172723434e88f770dd64823
    - private key 0x7b227ac59116f3eeb2b265422cf3cbfbd244c525961fb297eb52153ec62aa845

There are two information to keep very importantly for the next steps:

  • the wallet address (0xaCc51f664D647C9928196c4e33D46fd98FDaA91D in the example above)
  • the private key (0x7b227ac59116f3eeb2b265422cf3cbfbd244c525961fb297eb52153ec62aa845 in the example above)

Please note that you will definitely get different values.

In order to make the tutorial easier to follow, we decided to reveal all the information about the wallet we used, including the private key. We used a throw-away wallet for that purpose. That means that we will never use this wallet again. It's very important that you NEVER SHARE THE PRIVATE KEY of your wallet.

Next, we will be constructing the DID string.

All you need to do is to append the wallet address to the did:ethr: string.

For example, the DID string will be "did:ethr:0xaCc51f664D647C9928196c4e33D46fd98FDaA91D".

Once you have the DID string, you can check your DID at https://dev.uniresolver.io/1.0/identifiers/did:ethr:CHANGE_BY_YOUR_WALLET_ADDRESS (for instance with check this url with the example above) )

Remember the DID string, "did:ethr:<YOUR_WALLET_ADDRESS>", as it will be used in the next step.