Deploying > Что такое Hosted Service?

Что такое Hosted Service?

Reading time: 3 min

Please note, hosted service endpoints will no longer be available after June 12th 2024 as all subgraphs will need to upgrade to The Graph Network. Please read more in the Sunrise FAQ

This section will walk you through deploying a subgraph to the hosted service.

If you don't have an account on the hosted service, you can sign up with your GitHub account. Once you authenticate, you can start creating subgraphs through the UI and deploying them from your terminal. The hosted service supports a number of networks, such as Polygon, Gnosis Chain, BNB Chain, Optimism, Arbitrum, and more.

For a comprehensive list, see Supported Networks.

Создать подграф

Ссылка на этот раздел

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

Из существующего контракта

Ссылка на этот раздел

If you already have a smart contract deployed to your network of choice, 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 the block explorer.

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 the block explorer, 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> - это имя вашего пользователя или организации на GitHub, <SUBGRAPH_NAME> - имя вашего подграфа, а <DIRECTORY> - необязательное имя каталога, куда graph init поместит пример манифеста подграфа. <CONTRACT_ADDRESS> - это адрес вашего существующего контракта. <ETHEREUM_NETWORK> - это имя сети, в которой находится контракт. <FILE> - это локальный путь к ABI-файлу контракта. ** И --network, и --abi являются необязательными.**

Из примера подграфа

Ссылка на этот раздел

Второй режим, который поддерживает graph init, - это создание нового проекта из примера подграфа. Следующая команда делает это:

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

Пример подграфа основан на контракте Gravity от Dani Grant, который управляет пользовательскими аватарами и выдает события NewGravatar или UpdateGravatar всякий раз, когда создаются или обновляются аватары. Подграф обрабатывает эти события, записывая объекты Gravatar в хранилище нод Graph и обеспечивая их обновление в соответствии с событиями. Перейдите к манифесту подграфа, чтобы лучше понять, на какие события из ваших смарт-контрактов следует обратить внимание, маппинг и многое другое.

To build a subgraph tailored for monitoring a Proxy contract, initialize the subgraph by specifying the address of the implementation contract. Once the initialization process is concluded, the last step involves updating the network name in the subgraph.yaml file to the address of the Proxy contract. You can use the command below.

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

Supported Networks on the hosted service

Ссылка на этот раздел

Вы можете найти список поддерживаемых сетей здесь.

Редактировать страницу

Предыдущий
Развертывание подграфа Arweave в Hosted Service
Следующий
Публикация подграфа в децентрализованной сети
Редактировать страницу