Docs
Generate an AppID

What do AppIds mean on Avail DA?

Introduction

As a general-purpose base layer, Avail is designed to support many modular chains at the same time, providing consensus and data availability to all of them simultaneously.

How does this work? Avail headers contain an index that allows a given modular chain (or "application" in Avail terminology) to determine and download only the sections of a block that have data for that particular application.

This has significant benefits, including:

  • Modular applications are mainly unaffected by other uses of the base layer at the same time.

  • Block sizes can increase without requiring applications to fetch more data because they don't need to fetch the whole block, only what's relevant to them.
    This filtering is done using the "application id" (AppId).

Data availability sampling is still done on the entire block, however--this is the process where clients sample tiny parts of the block at random to verify availability.

If you'd like to learn how your idea could benefit from Avail, please join our Discord (opens in a new tab). We'd love to chat.

Tell me more

Let's learn more about AppIds by going through a real-life example.

  1. We recommend you go through the whole page before trying to go through the same steps.

  2. Although there are multiple ways to retrieve existing AppIds and generate new ones, using the Avail DA explorer (opens in a new tab) to do so is a good way to start.

  3. The Avail DA explorer (opens in a new tab) is very powerful and can be used in a variety of ways. For now though, let's stick to AppIds.

  1. Make sure you're on the chain state section of the explorer. You can access it by simply clicking this link (opens in a new tab), or by navigating to it through the developer tab near the top right.

  2. Make sure you've selected the dataAvailability pallet and the appKeys method.


  1. Uncheck the include option toggle, and click on the + button next to the method name. You will fetch a list of all registered AppIds on Avail DA.

Each appID consists of 3 fields:

  • key: This is a string that is the name of the appID. Each appID should have a unique name.
  • owner: This is the address of the account that created the appID. A single address can create multiple AppIds.
  • id: This is the unique integer index of the appID. It is incremented by 1 everytime a new appID is created. Whenever a new appID is created, it is automatically assigned the next available id.
  1. Next, check the include option toggle, and enter based avail as the bytes input. Call the function. What do you see? You will be returned a pair of owner and id, which together with the key you entered, form a unique appID.

  1. The appKeys method is essentially a mapping that returns the owner and id of an appID given its key (key => (owner, id)).
  2. By checking the include option toggle, you are essentially filtering the output.

How to check the next available appID?

Anyone can create their own appID on Avail DA. The process is entirely democratic ๐Ÿ˜…, and it's rather simple too.

Let us first check out the next available appID on the newtork.

  1. Within the dataAvailability pallet, select the nextAppId method. No need to pass any params, just click the + button next to the method name.

  2. You will be returned the next available index/id for a new appID.


How to register my own appID?

  1. Make sure you have one or more Avail DA wallets connected to the explorer. If you don't know how to do so, you can follow our docs on setting up a new wallet.

  2. Simply click this link (opens in a new tab) OR navigate to the extrinsics section of the explorer through the developer tab.

Please note that the Developer tab does not show the extrinsics section at all if you don't have a wallet set up on the explorer or an extension wallet connected to it. So make sure you have an Avail DA wallet set up before moving forward.

  1. Select the dataAvailability pallet, and the createApplicationKey method.

  1. Enter a key for your appID. It can be anything you like, really.

  2. This is how it should look like in the end:


  1. Click on Submit Transaction, and then click on Sign and Submit in the box that pops up.

DO NOT CHANGE THE appID FOR THIS TRANSACTION

  1. Each and every single transaction on Avail DA has a unique appID associated with it.
  2. A transaction or data submission with the appID of 0 is used for chain-level operations.
  3. This is what we need to use for creating a new appID, since it has nothing to do with a specific 'app' on Avail DA.
  4. This field would instead have been a positive integer if we, for example, were submitting data to a specific application on Avail DA.
  1. Authorise the transaction through your wallet, and you're done! You've successfully created your own appID on Avail DA.

  2. You can verify 7 by using the steps covered earlier to query the appKeys method :)

A few more things of note

  1. As stated earlier, an the key and id fields of every appID are unique. This means if you try to create an appID with the same key as an existing one, the operation will fail. This is why it makes sense to use the appKeys method to check if your desired name is already taken.

  2. If you're a developer and are looking for more programmatic instructions, you can check out our API reference.

  3. Anyone can submit any sort of data to any appID regardless of whether or not they created it.
    But what does this mean? And is this an attack vector?

  • This is where it is important to understand that Avail DA is a DA layer, not an execution enviornment. We are not concerned with the validity of the data being submitted, only with its availability, which means we can support a wide variety of applications across multiple tech stacks.
  • This does not constitute an attack vector since that any app or execution layer building on top of Avail DA can always set up certain rules to filter out unwanted data submissions.
  • They could for example make it so that only data submitted with a particular signature, i.e. from a particular address, is accepted. All other data submitted to the particular appID is treated as spam, and ignored.