{
  "$id": "https://thegraph.com/schemas/networks-registry.schema.json",
  "$schema": "http://json-schema.org/schema#",
  "title": "The Graph networks registry schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "minLength": 10,
      "format": "uri",
      "description": "Reference to this schema file"
    },
    "title": { "type": "string" },
    "description": { "type": "string" },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Version of the registry"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time of the last update"
    },
    "networks": {
      "type": "array",
      "items": { "$ref": "#/$defs/Network" },
      "description": "List of networks"
    }
  },
  "required": [
    "networks",
    "title",
    "description",
    "updatedAt",
    "version",
    "$schema"
  ],
  "additionalProperties": false,
  "$defs": {
    "SubgraphsService": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": ["gateway", "studio", "backstop", "curation"],
          "description": "Kind of Subgraph service entry"
        },
        "provider": {
          "type": "string",
          "description": "Provider identifier or URL for this entry, e.g. a gateway/studio deployment URL or a backstop provider like infradao or a curation provider like the-graph-foundation"
        },
        "description": {
          "type": "string",
          "description": "[optional] Human-readable description of the entry"
        }
      },
      "required": ["kind", "provider"],
      "additionalProperties": false
    },
    "Network": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(?!-)[a-z0-9-]{3,}(?<!-)$",
          "description": "Established name of the network in The Graph ecosystem, e.g. mainnet, btc, arweave-mainnet, near-testnet"
        },
        "shortName": {
          "type": "string",
          "description": "Short display name of the network, e.g. Ethereum, BNB"
        },
        "secondName": {
          "type": "string",
          "description": "Second display name of the network, e.g. Sepolia, Nova"
        },
        "fullName": {
          "type": "string",
          "description": "Display name of the network, e.g. Ethereum Mainnet, Bitcoin Testnet"
        },
        "caip2Id": {
          "type": "string",
          "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$",
          "description": "CAIP-2 Chain ID, e.g. eip155:1, bip122:000000000019d6689c085ae165831e93"
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(?!-)[a-z0-9-]{3,}(?<!-)$"
          },
          "description": "[optional] List of possible aliases for the network id, e.g. ethereum, eth, mainnet, eth-mainnet"
        },
        "networkType": {
          "type": "string",
          "enum": ["mainnet", "testnet", "devnet", "beacon"],
          "description": "Whether the network is a mainnet/testnet/devnet"
        },
        "relations": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "testnetOf",
                  "beaconOf",
                  "forkedFrom",
                  "l2Of",
                  "shardOf",
                  "evmOf",
                  "svmOf",
                  "other"
                ],
                "description": "Kind of relation"
              },
              "network": {
                "type": "string",
                "pattern": "^[a-z0-9-]+$",
                "description": "ID of the related network, e.g. mainnet, near-mainnet"
              }
            },
            "required": ["kind", "network"],
            "additionalProperties": false
          },
          "description": "Relations to other networks in the registry"
        },
        "firehose": {
          "type": "object",
          "properties": {
            "blockType": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9.]+$",
              "description": "Block type, e.g. sf.ethereum.type.v2.Block"
            },
            "bytesEncoding": {
              "type": "string",
              "enum": ["hex", "0xhex", "base58", "base64", "other"],
              "description": "Bytes encoding, e.g. hex, 0xhex, base58"
            },
            "bufUrl": {
              "type": "string",
              "format": "uri",
              "description": "Protobuf definitions on buf.build, e.g. https://buf.build/streamingfast/firehose-ethereum"
            },
            "evmExtendedModel": {
              "type": "boolean",
              "description": "[optional] Whether there is support for extended EVM block model"
            },
            "blockFeatures": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(base|hybrid|extended|extended@[0-9]+)$"
              },
              "uniqueItems": true,
              "description": "Block features supported by the network"
            },
            "firstStreamableBlock": {
              "type": "object",
              "properties": {
                "height": {
                  "type": "integer",
                  "description": "Block height of the first streamable block. Can be different from genesis",
                  "minimum": 0
                },
                "id": {
                  "type": "string",
                  "description": "Id of the first streamable block either in 0x-prefixed hex or base58",
                  "pattern": "^(0x[a-fA-F0-9]+|[1-9A-HJ-NP-Za-km-z]+)$"
                }
              },
              "required": ["id", "height"],
              "additionalProperties": false,
              "description": "First available block information"
            },
            "deprecatedAt": {
              "type": "string",
              "format": "date-time",
              "description": "[optional] Timestamp when the network was deprecated in Firehose software"
            }
          },
          "required": ["blockType", "bytesEncoding", "bufUrl"],
          "additionalProperties": false,
          "description": "Firehose block information"
        },
        "tokenApi": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "features": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["tokens", "dexes", "nfts", "other"],
                "description": "List of Token API features supported"
              }
            },
            "networkId": {
              "type": "string",
              "pattern": "^(?!-)[a-z0-9-]{3,}(?<!-)$",
              "description": "Network ID in Token API, has to be an ID or alias of an existing network"
            },
            "deprecatedAt": {
              "type": "string",
              "format": "date-time",
              "description": "[optional] Timestamp when the network was deprecated in Token API software"
            }
          },
          "description": "Token API specific configuration information"
        },
        "nativeToken": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9]+$",
          "description": "Symbol of the native token"
        },
        "graphNode": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "protocol": {
              "type": "string",
              "enum": [
                "ethereum",
                "near",
                "arweave",
                "cosmos",
                "starknet",
                "other"
              ],
              "description": "[optional] Protocol name in graph-node, e.g. ethereum, near, arweave"
            },
            "deprecatedAt": {
              "type": "string",
              "format": "date-time",
              "description": "[optional] Timestamp when the network was deprecated in Graph Node software"
            }
          },
          "description": "Graph Node specific configuration information"
        },
        "explorerUrls": {
          "type": "array",
          "items": { "type": "string", "format": "uri" },
          "description": "URLs for the block explorers"
        },
        "services": {
          "type": "object",
          "properties": {
            "subgraphs": {
              "type": "array",
              "items": { "$ref": "#/$defs/SubgraphsService" },
              "description": "Subgraph service entries (gateway, studio, backstop, curation)"
            },
            "firehose": {
              "type": "array",
              "items": { "type": "string", "format": "uri-template" },
              "description": "Firehose gRPC URLs, e.g. eth.firehose.pinax.network:443"
            },
            "substreams": {
              "type": "array",
              "items": { "type": "string", "format": "uri-template" },
              "description": "Substreams gRPC URLs, e.g. eth.substreams.pinax.network:443"
            },
            "tokenApi": {
              "type": "array",
              "items": { "type": "string", "format": "uri-template" },
              "description": "Token API URLs, e.g. https://token-api.thegraph.com"
            }
          },
          "additionalProperties": false,
          "description": "Services available for the network in the ecosystem"
        },
        "issuanceRewards": {
          "type": "boolean",
          "description": "Issuance rewards on the Graph Network for this chain"
        },
        "icon": {
          "type": "object",
          "properties": {
            "web3Icons": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z0-9-]+$",
                  "description": "Web3Icons icon ID"
                },
                "variants": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^(mono|branded|background)$"
                  },
                  "uniqueItems": true,
                  "description": "Variants of the icon, if none specified - all are available"
                }
              },
              "required": ["name"],
              "additionalProperties": false,
              "description": "Web3Icons icon - see https://github.com/0xa3k5/web3icons"
            }
          },
          "additionalProperties": false,
          "description": "Icons for the network"
        },
        "rpcUrls": {
          "type": "array",
          "items": { "type": "string", "format": "uri-template" },
          "description": "List of RPC URLs for the chain. Use {CUSTOM_API_KEY} as a placeholder for a private API key"
        },
        "apiUrls": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": { "type": "string", "format": "uri-template" },
              "kind": {
                "type": "string",
                "enum": [
                  "etherscan",
                  "blockscout",
                  "ethplorer",
                  "subscan",
                  "other"
                ],
                "description": "Kind of API"
              }
            },
            "required": ["url", "kind"],
            "additionalProperties": false
          },
          "description": "List of API URLs for the network, i.e. Etherescan-like API to get ABI. Use {CUSTOM_API_KEY} as a placeholder for a private API key"
        },
        "docsUrl": {
          "type": "string",
          "format": "uri",
          "description": "URL to the chain documentation"
        },
        "indexerDocsUrls": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "url",
                "description": "URL to the documentation, e.g. https://docs.infradao.com/archive-nodes-101/arbitrum"
              },
              "description": {
                "type": "string",
                "description": "Docs description, e.g. Arbitrum 101"
              }
            },
            "required": ["url"],
            "additionalProperties": false
          },
          "description": "Documentation to run indexer components for this network"
        }
      },
      "required": [
        "id",
        "caip2Id",
        "shortName",
        "fullName",
        "networkType",
        "services",
        "issuanceRewards"
      ],
      "additionalProperties": false
    }
  }
}
