KNN3 GraphX API Quick Start

GraphX: a real-time and flexible Web3 relationship graph network designed for graph-based queries

Introduction

KNN3 Network is a one-stop Web3 User-centric DataFi solution for d/Apps and smart contracts. KNN3 allows d/Apps & smart contracts to interact with cross-platform user-centric data in multiple algo-friendly ways.

If you are a Web3 d/App builder or a web3-native data analyst, GraphX is something you should look into. GraphX contains plenty of relational data among users, assets & communities, these relationships are fully backed by web3 users' live on-chain activities.

Graphql Endpoint: https://master.graphql.knn3.xyz/graphql

Start with your first query

*Please note that the address must be in lowercase, otherwise the correct result will not be returned.

A sample query to explore NFTs held by a given address.

Sample code

query {
  addrs(where:{address:"0xae89ad222e67205e8d947f131fdc9fa139828745"}) {
    address
    holdNfts {
      contract
      imageUrl
      symbol
    }
  }
}

The following result only shows a fragment of NFTs. To see the complete data result, you can visit the link above and try it yourself.

{
  "data": {
    "addrs": [
      {
        "address": "0xae89ad222e67205e8d947f131fdc9fa139828745",
        "holdnfts": [
          {
            "contract": "0x5c400511fb292a50b4d81e601815f617db804302",
            "imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0x5c400511fb292a50b4D81e601815f617DB804302/logo.gif",
            "symbol": "SFGG"
          },
          {
            "contract": "0xc7bda35c92aabcc129379d18024a32f6bae5faca",
            "imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0xc7Bda35c92aabcC129379d18024A32F6bAE5FaCA/logo.gif",
            "symbol": "GAME"
          },
          {
            "contract": "0xafc156b83295aa31ad7ac420b5ab0aa2ac39741c",
            "imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0xaFc156B83295Aa31Ad7AC420B5AB0AA2ac39741c/logo.gif",
            "symbol": "DOGGY"
          },
          ...
        ]
      }
    ]
  }
}

Limit

To help manage the sheer volume of the requests we receive on our api, limits are placed on the number of requests that can be made. These limits help us provide the reliable and scalable API that our developer community relies on.

For a better user experience, there is a limit=10 for each query by default. You can modify this parameter to a maximum of 30 items for each query.

If you require a higher limit, please contact us at builder@knn3.xyz and we will be happy to assist you.

Pagination

Like most GraphQL queries, you can specify pagination queries through the options parameter:

query {
  addrs(options:{limit:30,offset:30}){
    address
    ens
  }
}

Aggregate Query

You can use aggregate queries in the form of xxxAggregate to obtain the likes of count data. See below for an example where the total number of addresses is queried.

query {
  addrsAggregate{
    count
  }
}

Last updated