Deployando > ¿Qué es el Servicio Alojado?

¿Qué es el Servicio Alojado?

Please note, the hosted service will begin sunsetting in 2023, but it will remain available to networks that are not supported on the decentralized network. Developers are encouraged to upgrade their subgraphs to The Graph Network as more networks are supported. Each network will have their hosted service equivalents gradually sunset to ensure developers have enough time to upgrade subgraphs to the decentralized network. Read more about the sunsetting of the hosted service here.

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.

Para una lista completa, consulta Redes Soportadas.

Crear un Subgrafo

Enlace a esta sección

Primero sigue las instrucciones aquí para instalar Graph CLI. Crea un subgrafo pasando graph init --product hosted-service

Desde un Contrato Existente

Enlace a esta sección

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.

Puedes utilizar este comando para crear un subgrafo que indexe todos los eventos de un contrato existente. Esto intentará obtener el contrato ABI de Etherscan.

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

Además, puedes utilizar los siguientes argumentos opcionales. Si la ABI no puede ser obtenida de Etherscan, vuelve a solicitar una ruta de archivo local. Si falta algún argumento opcional en el comando, éste te lleva a través de un formulario interactivo.

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

El <GITHUB_USER> en este caso es tu nombre de usuario u organización de GitHub, <SUBGRAPH_NAME> es el nombre de tu subgrafo y <DIRECTORY> es el nombre opcional del directorio donde el graph init colocará el manifiesto del subgrafo de ejemplo. El <CONTRACT_ADDRESS> es la dirección de tu contrato existente. <ETHEREUM_NETWORK> es el nombre de la red Ethereum en la que vive el contrato. <FILE> es una ruta local a un archivo ABI de contrato. Tanto --la red como --abi son opcionales.

De un Subgrafo de Ejemplo

Enlace a esta sección

El segundo modo que admite graph init es la creación de un nuevo proyecto a partir de un subgrafo de ejemplo. El siguiente comando lo hace:

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

El subgrafo de ejemplo se basa en el contrato Gravity de Dani Grant que administra los avatares de los usuarios y emite eventos UpdateGravatar o UpdateGravatar cada vez que se crean o actualizan avatares. El subgrafo maneja estos eventos escribiendo entidades Gravatar en el almacén de Graph Node y asegurándose de que se actualicen de acuerdo con los eventos. Continúa con el manifiesto del subgrafo para comprender mejor a qué eventos de sus contratos inteligentes debe prestar atención, mappings y más.

From a Proxy Contract

Enlace a esta sección

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

Enlace a esta sección

Puedes encontrar la lista de las redes admitidas Aquí.

Editar página

Anterior
Preguntas Frecuentes sobre Subgraph Studio
Siguiente
Despliegue de un subgrafo en el Servicio Alojado
Editar página