All phases of Avail's unification drop have now ended, 👉👉 check out this page 👈👈 for more information.

API reference
Fetch block data if available

Fetch block data if available

Gets the block data if available. Query parameter fields specifies whether to return decoded data and encoded extrinsic (with signature). If fields parameter is omitted, response contains hash and data, while extrinsic is omitted.

curl "https://api.lightclient.mainnet.avail.so/v2/blocks/{block_number}/data?fields=data,extrinsic"
Sample Response:

If block_status = "finished", data is available and the response is:

{
  "data_transactions": [
    {
      "data": "{base-64-encoded-data}" // Optional
      "extrinsic": "{base-64-encoded-extrinsic}", // Optional
    }
  ]
}

If block_status is not “finished”, or app mode is not enabled, data is not available and the response is:

Bad Request

The next few methods are used to submit data to the Avail network. But to use them:

  1. you need to configure an identity.toml file which will contain the seed phrase for an account that has some AVAIL tokens. You can learn how to do that here.

  2. You will also need to run the Avail LC in app-client mode. The command to do all this will look something like this:

curl -sL1 avail.sh | bash -s -- --app_id 1 --identity identity.toml --network mainnet