GraphQL (deprecated)

Explore the Avalanche platform easily using Avascan's API endpoints. Docs will be updated weekly as we approach Avalanche mainnet. API is still under development.

API version 0.3

GraphQL APIs are deprecated for now. We will provide new APIs when our new Norge v2 indexer is complete.

Avascan API

Avascan is the most complete, fast and privacy-focused explorer for the Avalanche network. With Avascan API developers can build apps and tools. You can start queries by accessing the GraphQL Avascan API Playground.

Note: currently queries only show results for X-Chain. P-Chain and C-Chain are not indexed yet.

Blockchains

Avalanche is the 'internet of blockchains', and as such, you can browse and extract info about a given blockchain. Currently, there are only three permissionless blockchains nicknamed P-Chain, X-Chain and C-Chain. There are also permissioned blockchains, and both permissionless and permissioned will likely increase in number when the mainnet is launched. You can browse blockchains with a simple query: you will get the number of blockchains in the Avalanche network.

query {
  blockchains {
    count
  }
}

You can also get more specific information about a single blockchain.

query {
  blockchains(limit: 5, offset: 0) {
    count
    results {
      id
      name
      subnet
      vm

Transactions

If you want more info on a specific blockchain, query its transactions. Do it by passing the assetID and you can order it by any attribute, desc or asc. You need to specify the attributes you want to get in the result response, as shown below:

query {
  transactions(
    assetID: "3ofDwYQKgBvsZQTBXJnqdvcns4aGikwSnGie2kc6xWJM7MAGb"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}

Note: ordering by certain variables may not be available yet.

You can also filter the transactions to obtain the ones that are specific to a certain asset filtering by assetID:

query {
  transactions(
    assetID: "3ofDwYQKgBvsZQTBXJnqdvcns4aGikwSnGie2kc6xWJM7MAGb"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}

Or you can filter by address:

query {
  transactions(
    address: "X-avax149ssfat0569urv3xgppnz08ffrch5yjkzfs3xz"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}

Address outputs

Get a series of UTXO-related info for a specific address by including a redeemingTransactionID that shows if the output related to that address has already been spent.

query {
  outputs: outputs(address: "X-avax149ssfat0569urv3xgppnz08ffrch5yjkzfs3xz") {
    count
    results {
      ... on XOutput {
        id
        transactionID
        outputIndex
        assetID
        outputType
        amount
        locktime
        threshold
        addresses
        redeemingTransactionID
        type
      }
    }
  }
}

Get the list of validators

Get a complete list of validators, both active and pending. You can order the result by startTime, endTime, weight, address, subnet or id.

query {
  validators(
    status: "active"
    limit: 10
    offset: 0
    orderBy: { endTime: "asc" }
  ) {
    count
    results {
      id
      weight
      beneficiary {
        addresses
      }
      startTime
      endTime
      subnet
      status
      delegatedWeights
      delegations
      subnets {
        weight
        startTime
        endTime
        subnet
        status
        delegatedWeights
        delegations
      }
    }
  }
}

Get the list of delegators

query {
  transactions(
    chainID: "p-chain"
    limit: 10
    type: "P_ADD_DEFAULT_SUBNET_DELEGATOR"
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on PAddDefaultSubnetDelegator {
        id
        chainID
        type
        acceptedAt
        weight
        from
        nodeID
        beneficiary {
          addresses
        }
        startTime
        endTime
      }
    }
  }
}

The Avascan API Platform is still under heavy development, and many more endpoints will become available soon.

Join our Discord chat to stay updated and connect with the team, ask for new features or give feedback.

Last updated