# Associate Address with web3name

{% hint style="info" %}
To create your DID in KILT network you can follow [these instructions.](https://kilt-protocol.org/get-did/index.html)

To claim your web3name on the KILT network you can follow [these instructions.](https://kilt-protocol.org/files/How-to-Guide-Get-Your-web3name.pdf)
{% endhint %}

There is currently no user-friendly interface for linking account information and web3name alias, work on them is ongoing hopefully they will appear soon. Now in order to perform this activity you will need:

* A script from <https://github.com/KILTprotocol/kilt-did-utilities>, also that repo contains pretty well described workflow how to do any operations with your DID.
* Utility from our repo - <https://github.com/nova-wallet/w3n_hash#blake2-multibase-hasher> which will use to take a hash from your data

To associate web3name with your account you should follow a few steps:

1. **Create a file with your accounts based on**  [**specification**](https://github.com/KILTprotocol/spec-KiltTransferAssetRecipientV1#data-structure)**.**\
   Example of that file:

```json
{
"polkadot:91b171bb158e2d3848fa23a9f1c25182/slip44:354": [
    {
      "account": "121eb2BdXbD2AbSno4qSpiGKL28TNGngzvfvLXQtN6qCmG7N",
      "description": "Polkadot Address"
    }
  ],
"polkadot:fc41b9bd8ef8fe53d58c7ea67c794c7e/slip44:787": [
    {
      "account": "251TW6p8iJCcg8Q2umib8QV9sfMAtVecX3o7vMqmMdzLYif7",
      "description": "Acala Address"
    }
  ]
}
```

{% hint style="info" %}
Please ensure to validate your JSON before submitting it!
{% endhint %}

2. **Publish that file somewhere like GitHub, IPFS, etc, store the link it will need in next step**
3. **Generate hash for this file** (refer to [this repo ](https://github.com/nova-wallet/w3n_hash#blake2-multibase-hasher)for more details)
   * Clone the repo on your local machine

     ```bash
     git clone git@github.com:nova-wallet/w3n_hash.git
     cd web3n_hash
     ```
   * &#x20;Install dependancies, ensure that you have [node](https://nodejs.org/en/download)[.js](https://nodejs.org/en/download) installed.

     ```bash
     npm install
     ```
   * Change path to file in [index.ts](https://github.com/nova-wallet/w3n_hash/blob/master/index.ts) with yours:

     ```bash
     main("https://url/to/yours/file")
     ```
   * Run the app

     ```bash
     npm start
     ```
   * As a result you will get a file content and the hash which will be used in next steps as **serviceEndpoint.id**\
     \
     Example of script output:

     <figure><img src="https://2862319636-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YRoR7fazGxiQsx9pH6m%2Fuploads%2FuotiNxm1HM0GFmpN8F9g%2FScreenshot%202023-04-12%20at%2019.04.36.png?alt=media&#x26;token=4e09ff8b-0115-4896-81eb-cbaf055b884c" alt=""><figcaption></figcaption></figure>
4. Now we need to go to the polkadot.js apps and generate encoded data for another script which will operate directly with our DID.
   * In order to do that open polkadot.js apps and select KILT network
   * Open `Developer > Extrinsics` menu and select ***did.addServiceEndpoint()***
   * Put **our hash** from previous operations as an id
   * ***serviceEndpoint.serviceTypes*** specify as `KiltTransferAssetRecipientV1`
   * In ***serviceEndpoints.urls*** put url to your accounts from previous steps
   * Now you can copy **encoded call data**, as shown on the screen bellow, the signer account does not matter. Save it it will need in next steps.

<figure><img src="https://2862319636-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YRoR7fazGxiQsx9pH6m%2Fuploads%2FUuoGeftmGl4anYTa2hfK%2FScreenshot%202023-04-12%20at%2019.58.17.png?alt=media&#x26;token=bda71fa8-0219-4830-b0ed-babeeffaf10d" alt=""><figcaption></figcaption></figure>

5. Now we are ready to generate a call itself, which associate your web3name with accounts from file.

* Clone the repo on your local machine

  ```bash
  git clone git@github.com:KILTprotocol/kilt-did-utilities.git
  cd kilt-did-utilities
  ```
* Install dependencies

  ```bash
  yarn install
  ```
* Export all necessary parameters

  ```json
  // all this parameters for example
  export SUBMITTER_ADDRESS="4oeAGb7uYHmjJH4X7drV4AfEfUxCLMkzciAH3WYGoPKY5G93"
  export WS_ADDRESS="wss://spiritnet.kilt.io"
  export ENCODED_CALL="0×40084554c374137436461674248754a6d75572d375341697864556d37614c63702d774f4b6d50515a626d556467733d04704696c745472616736665724173736574526563697069656745631046d0168747470733a22726177267697468756275736572636f674656742636f6d2£665668617226e676612d7574696c732f6d61737465722746573747326461746126173736574735776562336616d657326a736f6e"
  export DID_URI="did:kilt:409ngk66UATEdjxs9xUWYzHPrJMHWCZ6eATfJZHRuYjjEjjS"
  ```

  \
  You can find all information about that parameters in repo [itself](https://github.com/KILTprotocol/kilt-did-utilities#authorize-a-call-with-a-did-key), here a short description:

  `SUBMITTER_ADDRESS`: The KILT address (encoded with the KILT network prefix `38`) that is authorized to submit the transaction.

  `ENCODED_CALL`: The HEX-encoded call to DID-sign.

  `DID_URI`: The URI of the DID authorizing the operation
* Run script

  ```bash
  yarn run call-authorize
  ```
* As a result we will get an encoded DID-authorized operation, example bellow, save it for future step.

<figure><img src="https://2862319636-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YRoR7fazGxiQsx9pH6m%2Fuploads%2FttxVTNAXhYbIyIoJgUK4%2FScreenshot%202023-04-12%20at%2019.48.37.png?alt=media&#x26;token=4099c17e-d2c9-4c21-8495-b6e863b71875" alt=""><figcaption></figcaption></figure>

6. Now we need to return to the polkadot.js app, switch tab to Decode and put encoded operation from previous step, as it shown on a screen:<br>

   <figure><img src="https://2862319636-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YRoR7fazGxiQsx9pH6m%2Fuploads%2Fb56XmzEda1Gq1UXhjOVa%2FScreenshot%202023-04-12%20at%2019.53.24.png?alt=media&#x26;token=785cf0f3-2794-435f-b212-66cf3b5e61a6" alt=""><figcaption></figcaption></figure>
7. Switch to Submission tab and sign it from SUBMITTER\_ADDRESS
8. If everything was OK, you can find all accounts from file associated with your web3name alias in the Nova Wallet.
