Powerful APIs for Web 3.0

An open-source framework for building powerful and tailored GraphQL APIs for your blockchain state history.

SUBSQUID API

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


type Account @entity {
    "Account address"
    id: ID!
    wallet: String!
    balance: BigInt!
    historicalBalances: [HistoricalBalance!] @derivedFrom(field:  account")
}

type HistoricalBalance @entity {
    id: ID!
    account: Account!
    balance: BigInt!
    timestamp: BigInt!
}
subsquid

Fast sync time

Process thousands of on-chain events and transactions in a single batch, even if they are spread out across many blocks. Get your query node in sync within minutes, not days. Move quickly.

subsquid

Custom queries

Want to add custom queries to the API? No problem! Easily extend your query node with virtually any SQL queries via custom GraphQL resolvers.

subsquid

GraphQL magic

Define the shape of your data in the schema file and get a powerful GraphQL backend automagically.

Multi-layered architecture

A multi-layer architecture unlocks data economy for analytics, on-chain data intelligence and oracle data aggregation.

Subsquid splits Query Nodes into services: Indexers, Processors and Gateways

subsquid

Indexers make the on-chain data queryable and accessible by downstream APIs

subsquid

Processors, reducing bandwidth and sync times by a factor of 10 to 100

subsquid

Hydra Features

Hydra is the most feature-rich query node framework on the market. It natively supports GraphQL fragments, interfaces, union types and even more

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

query {
    proposals(where: {
        bond_gt: "10000",
        status_eq: REJECTED,
        beneficiary: {  wallet_startsWith: "5abc"  }
    }, orderBy: value_ASC, limit: 5) {
        proposer
        value
        status
        beneficiary { wallet }
        bond
    }
}


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

query {
      page1: NFTConnection(orderBy: id_ASC, first: 10) {
          ...relayFields
      }
      page2: NFTConnection(orderBy: id_ASC, first: 10, after: "10") {
          ...relayFields
       }
  }

  fragment relayFields on NFTConnection {
      edges {
          node { id rarityScore imageURL }
          cursor
      }
      pageInfo {
          hasNextPage
          hasPreviousPage
          startCursor
          endCursor
      }
      totalCount
}



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

union StatusInfo =  Noob | Whale | Degen

type Account @entity {
    status: StatusInfo
    wallet: String!
}

type Whale {
    bag: Int!
    ticker: String!
}

type Degen {
    leverage: Int!
}

type Noob {
    handle: String
    follows: Account!
}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

# schema.graphql
interface HasBalance {
    balance: Int!
}

type Account implements HasBalance  @entity {
    wallet: String!
    balance: Int!
    history: [HistoricalBalance!] @derivedFrom(field: "account")
}

type HistoricalBalance implements HasBalance @entity {
    id: ID!
    timestamp: DateTime!
    balance: Int!
}

# query
query {
    accounts(where: {id_eq: "1"}) {
        ...balance
        history {
            ...balance
        }
    }
}

fragment balance on HasBalance {
    ... on Account {
        currentBalance: balance
    }
    ... on HistoricalBalance {
        balance
        timestamp
    }
}



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

# schema.graphql
type Post @entity {
    text: String @fulltext(query: "allFields"),
    title: String @fulltext(query: "allFields")
}

type Comment @entity {
    text: String @fulltext(query: "allFields"),
    title: String @fulltext(query: "allFields")
    likes: Int!
}


# query
query {
    allFields(text: "baz") {
        item {
            ... on Comment { likes }
            ... on Post { title text }
        }
        highlight
    }
}



Used by

Indexers

Indexers continuously collect all the data from chains to let you fetch it in seconds easily

subsquid

Subsocial

subsquid

Acala

subsquid

Moonbeam

subsquid

Kusama

subsquid

HydraDX

subsquid

Joystream

subsquid

Polkadot

subsquid

Centrifuge

subsquid

Edgeware

subsquid

Robonomics

Backed by

subsquid subsquid
subsquid subsquid subsquid subsquid subsquid subsquid subsquid subsquid
subsquid subsquid subsquid subsquid subsquid subsquid subsquid subsquid