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.
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.
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> \
<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.
The second mode
graph initsupports 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
UpdateGravatarevents whenever avatars are created or updated. The subgraph handles these events by writing
Gravatarentities 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.
xdai(now known as Gnosis Chain)
matic(now known as Polygon)
bsc(now known as BNB Chain)