📂 Concepts and Definitions

# Chain Providers

Table of Contents

Chain providers provide access to an evm on behalf of an API provider. Your Airnode will interact with one or more chain providers and respond to requests. You can use multiple chain providers for each chain and declare multiple chains each with one of more chain providers. Below are some of the chain providers you might use.

# One Chain: One Provider

As an example the chains field declares its use of blockchain 4, Rinkeby. The type is set to evm which is the only type currently supported by Airnode. It then applies an arbitrary name for the blockchain provider "infura_rinkeby" in the provider array.

"chains": [
  {
    "authorizers": [
      "0x5Fgh48...3F6f64180acc"
    ],
    "contracts": {
      "AirnodeRrp": "0xF6d267546...BC9A384fa418"
    },
    "id": "4",
    "type": "evm",
    "providers": [
      "infura_rinkeby": {
        "url": "${INFURA_RINKEBY_PROVIDER_URL}"
      }
    ]
  }
],
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# One Chain: Multiple Providers

Multiple providers can be used per chain. Simply add another object to providers. In this case both blockchain providers will have the same chain id and type.

"chains": [
  {
    "authorizers": [
      "0x5Fgh48...3F6f64180acc"
    ],
    "contracts": {
      "AirnodeRrp": "0xF6d267546...BC9A384fa418"
    },
    "id": "4",
    "type": "evm",
    "providers": [
      "infura_rinkeby": {
        "url": "${INFURA_RINKEBY_PROVIDER_URL}"
      },
      "infura_ropsten": {
        "url": "${ALCHEMY_RINKEBY_PROVIDER_URL}"
      }
    ]
  }
],
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Multiple Chains: Multiple Providers

Not as complicated as it sounds. First create two or more chain objects were each has a unique id and type and a list of providers for each.

"chains": [
  {
    "authorizers": [
      "0x5Fgh48...3F6f64180acc"
    ],
    "contracts": {
      "AirnodeRrp": "0xF6d267546...BC9A384fa418"
    },
    "id": "4",
    "type": "evm",
    "providers": [
      "infura_rinkeby": {
        "url": "${INFURA_RINKEBY_PROVIDER_URL}"
      },
      "infura_ropsten": {
        "url": "${ALCHEMY_RINKEBY_PROVIDER_URL}"
      }
    ]
  },
  {
    "authorizers": [
      "0x5gh48...3F6f6418dee9"
    ],
    "contracts": {
      "AirnodeRrp": "0xG9e39...BC9A384df3434"
    },
    "id": "3",
    "type": "evm",
    "providers": [
      "infura_ropsten": {
        "url": "${INFURA_ROPSTEN_PROVIDER_URL}"
      }
    ]
  }
],
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Last Updated: 3/7/2022, 8:32:47 AM