What is the Hosted Service?

This section will walk you through deploying a subgraph to the Hosted Service, otherwise known as the Hosted Service. As a reminder, the Hosted Service will not be shut down soon. We will gradually sunset the Hosted Service once we reach feature parity with the decentralized network. Your subgraphs deployed on the Hosted Service are still available here.

If you don't have an account on the Hosted Service, you can signup with your Github account. Once you authenticate, you can start creating subgraphs through the UI and deploying them from your terminal. Graph Node supports a number of Ethereum testnets (Rinkeby, Ropsten, Kovan) in addition to mainnet.

Create a Subgraph

First follow the instructions here to install the Graph CLI. Create a subgraph by passing in graph init --product hosted-service

From an Existing Contract

If you already have a smart contract deployed to Ethereum mainnet or one of the testnets, bootstrapping a new subgraph from this contract can be a good way to get started on the Hosted Service.

You can use this command to create a subgraph that indexes all events from an existing contract. This will attempt to fetch the contract ABI from Etherscan.

graph init \  --product hosted-service  --from-contract <CONTRACT_ADDRESS> \  <GITHUB_USER>/<SUBGRAPH_NAME> [<DIRECTORY>]

Additionally, you can use the following optional arguments. If the ABI cannot be fetched from Etherscan, it falls back to requesting a local file path. If any optional arguments are missing from the command, it takes you through an interactive form.

--network <ETHEREUM_NETWORK> \--abi <FILE> \

The <GITHUB_USER> in this case is your GitHub user or organization name, <SUBGRAPH_NAME> is the name for your subgraph, and <DIRECTORY> is the optional name of the directory where graph init will put the example subgraph manifest. The <CONTRACT_ADDRESS> is the address of your existing contract. <ETHEREUM_NETWORK> is the name of the Ethereum network that the contract lives on. <FILE> is a local path to a contract ABI file. Both --network and --abi are optional.

From an Example Subgraph

The second mode graph init supports is creating a new project from an example subgraph. The following command does this:

graph init --from-example --product hosted-service <GITHUB_USER>/<SUBGRAPH_NAME> [<DIRECTORY>]

The example subgraph is based on the Gravity contract by Dani Grant that manages user avatars and emits NewGravatar or UpdateGravatar events whenever avatars are created or updated. The subgraph handles these events by writing Gravatar entities to the Graph Node store and ensuring these are updated according to the events. Continue on to the subgraph manifest to better understand which events from your smart contracts to pay attention to, mappings, and more.

Supported Networks on the Hosted Service

Please note that the following networks are supported on the Hosted Service. Networks outside of Ethereum mainnet ('mainnet') are not currently supported on The Graph Explorer.

  • mainnet

  • kovan

  • rinkeby

  • ropsten

  • goerli

  • poa-core

  • poa-sokol

  • xdai (now known as Gnosis Chain)

  • near-mainnet

  • near-testnet

  • matic (now known as Polygon)

  • mumbai

  • fantom

  • bsc (now known as BNB Chain)

  • chapel

  • clover

  • avalanche

  • fuji

  • celo

  • celo-alfajores

  • fuse

  • moonriver

  • mbase

  • arbitrum-one

  • arbitrum-rinkeby

  • optimism

  • optimism-kovan

  • aurora

  • aurora-testnet

  • boba

Last updated