14 minutos
Guia das Ferramentas de Transferência para L2
O The Graph facilitou muito o processo de se mudar para a L2 no Arbitrum One. Para cada participante no protocolo, há um conjunto de Ferramentas de Transferência para L2 que suavizam o processo para todos os participantes na rede. Estas ferramentas exigem que você siga um conjunto específico de passos, dependente no que você transferir.
Some frequent questions about these tools are answered in the L2 Transfer Tools FAQ. The FAQs contain in-depth explanations of how to use the tools, how they work, and things to keep in mind when using them.
How to transfer your Subgraph to Arbitrum (L2)
Benefits of transferring your Subgraphs
A comunidade e os programadores centrais do The Graph andaram preparando as suas mudanças ao Arbitrum ao longo do último ano. O Arbitrum, uma blockchain layer 2, ou “L2”, herda a segurança do Ethereum, mas providencia taxas de gas muito menores.
When you publish or upgrade your Subgraph to The Graph Network, you’re interacting with smart contracts on the protocol and this requires paying for gas using ETH. By moving your Subgraphs to Arbitrum, any future updates to your Subgraph will require much lower gas fees. The lower fees, and the fact that curation bonding curves on L2 are flat, also make it easier for other Curators to curate on your Subgraph, increasing the rewards for Indexers on your Subgraph. This lower-cost environment also makes it cheaper for Indexers to index and serve your Subgraph. Indexing rewards will be increasing on Arbitrum and decreasing on Ethereum mainnet over the coming months, so more and more Indexers will be transferring their stake and setting up their operations on L2.
Understanding what happens with signal, your L1 Subgraph and query URLs
Transferring a Subgraph to Arbitrum uses the Arbitrum GRT bridge, which in turn uses the native Arbitrum bridge, to send the Subgraph to L2. The “transfer” will deprecate the Subgraph on mainnet and send the information to re-create the Subgraph on L2 using the bridge. It will also include the Subgraph owner’s signaled GRT, which must be more than zero for the bridge to accept the transfer.
When you choose to transfer the Subgraph, this will convert all of the Subgraph’s curation signal to GRT. This is equivalent to “deprecating” the Subgraph on mainnet. The GRT corresponding to your curation will be sent to L2 together with the Subgraph, where they will be used to mint signal on your behalf.
Other Curators can choose whether to withdraw their fraction of GRT, or also transfer it to L2 to mint signal on the same Subgraph. If a Subgraph owner does not transfer their Subgraph to L2 and manually deprecates it via a contract call, then Curators will be notified and will be able to withdraw their curation.
As soon as the Subgraph is transferred, since all curation is converted to GRT, Indexers will no longer receive rewards for indexing the Subgraph. However, there will be Indexers that will 1) keep serving transferred Subgraphs for 24 hours, and 2) immediately start indexing the Subgraph on L2. Since these Indexers already have the Subgraph indexed, there should be no need to wait for the Subgraph to sync, and it will be possible to query the L2 Subgraph almost immediately.
Queries to the L2 Subgraph will need to be done to a different URL (on arbitrum-gateway.thegraph.com
), but the L1 URL will continue working for at least 48 hours. After that, the L1 gateway will forward queries to the L2 gateway (for some time), but this will add latency so it is recommended to switch all your queries to the new URL as soon as possible.
Como escolher a sua carteira na L2
When you published your Subgraph on mainnet, you used a connected wallet to create the Subgraph, and this wallet owns the NFT that represents this Subgraph and allows you to publish updates.
When transferring the Subgraph to Arbitrum, you can choose a different wallet that will own this Subgraph NFT on L2.
Se você usar uma carteira “regular” como o MetaMask (uma Conta de Titularidade Externa, ou EOA, por ex. uma carteira que não é um contrato inteligente), então isto é opcional, e é recomendado manter o mesmo endereço titular que o da L1.
If you’re using a smart contract wallet, like a multisig (e.g. a Safe), then choosing a different L2 wallet address is mandatory, as it is most likely that this account only exists on mainnet and you will not be able to make transactions on Arbitrum using this wallet. If you want to keep using a smart contract wallet or multisig, create a new wallet on Arbitrum and use its address as the L2 owner of your Subgraph.
It is very important to use a wallet address that you control, and that can make transactions on Arbitrum. Otherwise, the Subgraph will be lost and cannot be recovered.
Preparações para a transferência: bridging de ETH
Transferring the Subgraph involves sending a transaction through the bridge, and then executing another transaction on Arbitrum. The first transaction uses ETH on mainnet, and includes some ETH to pay for gas when the message is received on L2. However, if this gas is insufficient, you will have to retry the transaction and pay for the gas directly on L2 (this is “Step 3: Confirming the transfer” below). This step must be executed within 7 days of starting the transfer. Moreover, the second transaction (“Step 4: Finishing the transfer on L2”) will be done directly on Arbitrum. For these reasons, you will need some ETH on an Arbitrum wallet. If you’re using a multisig or smart contract account, the ETH will need to be in the regular (EOA) wallet that you are using to execute the transactions, not on the multisig wallet itself.
Você pode comprar ETH em algumas exchanges e retirá-la diretamente no Arbitrum, ou você pode usar a bridge do Arbitrum para enviar ETH de uma carteira na mainnet para a L2: bridge.arbitrum.io. Como as taxas de gas no Arbitrum são menores, você só deve precisar de uma quantidade pequena. É recomendado começar em um limite baixo (por ex. 0.01 ETH) para que a sua transação seja aprovada.
Finding the Subgraph Transfer Tool
You can find the L2 Transfer Tool when you’re looking at your Subgraph’s page on Subgraph Studio:

It is also available on Explorer if you’re connected with the wallet that owns a Subgraph and on that Subgraph’s page on Explorer:

Clicar no botão Transfer to L2 (Transferir para L2) abrirá a ferramenta de transferências, onde você poderá começar o processo.
1º Passo: Como começar a transferência
Before starting the transfer, you must decide which address will own the Subgraph on L2 (see “Choosing your L2 wallet” above), and it is strongly recommend having some ETH for gas already bridged on Arbitrum (see “Preparing for the transfer: bridging some ETH” above).
Also please note transferring the Subgraph requires having a nonzero amount of signal on the Subgraph with the same account that owns the Subgraph; if you haven’t signaled on the Subgraph you will have to add a bit of curation (adding a small amount like 1 GRT would suffice).
After opening the Transfer Tool, you will be able to input the L2 wallet address into the “Receiving wallet address” field - make sure you’ve entered the correct address here. Clicking on Transfer Subgraph will prompt you to execute the transaction on your wallet (note some ETH value is included to pay for L2 gas); this will initiate the transfer and deprecate your L1 Subgraph (see “Understanding what happens with signal, your L1 Subgraph and query URLs” above for more details on what goes on behind the scenes).
If you execute this step, make sure you proceed until completing step 3 in less than 7 days, or the Subgraph and your signal GRT will be lost. This is due to how L1-L2 messaging works on Arbitrum: messages that are sent through the bridge are “retry-able tickets” that must be executed within 7 days, and the initial execution might need a retry if there are spikes in the gas price on Arbitrum.

Step 2: Waiting for the Subgraph to get to L2
After you start the transfer, the message that sends your L1 Subgraph to L2 must propagate through the Arbitrum bridge. This takes approximately 20 minutes (the bridge waits for the mainnet block containing the transaction to be “safe” from potential chain reorgs).
Quando esta espera acabar, o Arbitrum tentará executar a transferência automaticamente nos contratos na L2.

3º Passo: Como confirmar a transferência
In most cases, this step will auto-execute as the L2 gas included in step 1 should be sufficient to execute the transaction that receives the Subgraph on the Arbitrum contracts. In some cases, however, it is possible that a spike in gas prices on Arbitrum causes this auto-execution to fail. In this case, the “ticket” that sends your Subgraph to L2 will be pending and require a retry within 7 days.
Se este for o caso, você deverá se conectar com uma carteira L2 que tenha um pouco de ETH no Arbitrum, trocar a rede da sua carteira para Arbitrum, e clicar em “Confirmar Transferência” para tentar a transação novamente.

4º Passo: A finalização da transferência à L2
At this point, your Subgraph and GRT have been received on Arbitrum, but the Subgraph is not published yet. You will need to connect using the L2 wallet that you chose as the receiving wallet, switch your wallet network to Arbitrum, and click “Publish Subgraph.”


This will publish the Subgraph so that Indexers that are operating on Arbitrum can start serving it. It will also mint curation signal using the GRT that were transferred from L1.
5º passo: Atualização da URL de query
Your Subgraph has been successfully transferred to Arbitrum! To query the Subgraph, the new URL will be :
https://arbitrum-gateway.thegraph.com/api/[api-key]/subgraphs/id/[l2-subgraph-id]
Note that the Subgraph ID on Arbitrum will be a different than the one you had on mainnet, but you can always find it on Explorer or Studio. As mentioned above (see “Understanding what happens with signal, your L1 Subgraph and query URLs”) the old L1 URL will be supported for a short while, but you should switch your queries to the new address as soon as the Subgraph has been synced on L2.
Como transferir a sua curadoria ao Arbitrum (L2)
Understanding what happens to curation on Subgraph transfers to L2
When the owner of a Subgraph transfers a Subgraph to Arbitrum, all of the Subgraph’s signal is converted to GRT at the same time. This applies to “auto-migrated” signal, i.e. signal that is not specific to a Subgraph version or deployment but that follows the latest version of a Subgraph.
This conversion from signal to GRT is the same as what would happen if the Subgraph owner deprecated the Subgraph in L1. When the Subgraph is deprecated or transferred, all curation signal is “burned” simultaneously (using the curation bonding curve) and the resulting GRT is held by the GNS smart contract (that is the contract that handles Subgraph upgrades and auto-migrated signal). Each Curator on that Subgraph therefore has a claim to that GRT proportional to the amount of shares they had for the Subgraph.
A fraction of these GRT corresponding to the Subgraph owner is sent to L2 together with the Subgraph.
At this point, the curated GRT will not accrue any more query fees, so Curators can choose to withdraw their GRT or transfer it to the same Subgraph on L2, where it can be used to mint new curation signal. There is no rush to do this as the GRT can be help indefinitely and everybody gets an amount proportional to their shares, irrespective of when they do it.
Como escolher a sua carteira na L2
Caso você decida transferir o seu GRT curado à L2, você pode escolher uma carteira diferente que será titular do sinal de curadoria na L2.
Se você usar uma carteira “regular” como o MetaMask (uma Conta de Titularidade Externa, ou EOA, por ex. uma carteira que não é um contrato inteligente), então isto é opcional, e é recomendado manter o mesmo endereço de curadoria que o da L1.
Se você usar uma carteira de contrato inteligente, como uma multisig (por ex. uma Safe), então escolher um endereço de carteira diferente na L2 é obrigatório, pois as chances são altas desta conta só existir na mainnet, e você não poderá fazer transações no Arbitrum enquanto usar esta carteira. Se quiser continuar a usar uma carteira de contrato inteligente ou multisig, crie uma nova carteira no Arbitrum e use o seu endereço lá como o endereço destinatário na L2.
É muito importante usar um endereço de carteira que você controle, e possa fazer transações no Arbitrum. Caso contrário, a curadoria será perdida e não poderá ser recuperada.
1º Passo: Como enviar curadoria à L2
Antes de iniciar a transferência, você deve decidir qual endereço será titular da curadoria na L2 (ver “Como escolher a sua carteira na L2” acima), e é recomendado ter um pouco de ETH para o gas já em bridge no Arbitrum, caso seja necessário tentar a execução da mensagem na L2 novamente. Você pode comprar ETH em algumas exchanges e retirá-lo diretamente no Arbitrum, ou você pode usar a bridge do Arbitrum para enviar ETH de uma carteira na mainnet à L2: bridge.arbitrum.io - como as taxas de gas no Arbitrum são menores, você só deve precisar de uma quantidade pequena; por ex. 0.01 ETH deve ser mais que o suficiente.
If a Subgraph that you curate to has been transferred to L2, you will see a message on Explorer telling you that you’re curating to a transferred Subgraph.
When looking at the Subgraph page, you can choose to withdraw or transfer the curation. Clicking on “Transfer Signal to Arbitrum” will open the transfer tool.

Após abrir a Ferramenta de Transferências, você pode receber um pedido para colocar ETH na sua carteira se não tiver nenhum. Depois, você poderá colocar o endereço da carteira na L2 no campo “Receiving wallet address” (endereço da carteira destinatária) - certifique-se que inseriu o endereço correto. Clicar em Transfer Signal (transferir sinal) resultará em um pedido para executar a transação na sua carteira (note que um valor em ETH é incluído para pagar pelo gas na L2); isto iniciará a transferência.
Ao executar este passo, garanta que executará o 3º passo em menos de 7 dias, ou o seu GRT de sinalização será perdido. Isto se deve à maneira de como as mensagens L1-L2 funcionam no Arbitrum: mensagens enviadas através da bridge são “bilhetes de tentativas extras” que devem ser executadas dentro de 7 dias, e a execução inicial pode exigir outra tentativa se houver um surto no preço de gas no Arbitrum.
2º Passo: Como enviar curadoria à L2
Como começar a transferência:

Após iniciar a transferência, a mensagem que envia a sua curadoria da L1 para a L2 deve propagar pela bridge do Arbitrum. Isto leva cerca de 20 minutos (a bridge espera que o bloco da mainnet que contém a transação esteja “seguro” de reorganizações potenciais da chain).
Quando esta espera acabar, o Arbitrum tentará executar a transferência automaticamente nos contratos na L2.

3º Passo: Como enviar curadoria à L2
Geralmente, este passo será executado automaticamente, já que o gas na L2 incluído no primeiro passo deverá ser suficiente para executar a transação que recebe a curadoria nos contratos do Arbitrum. Porém, em alguns casos, é possível que um surto nos preços de gas do Arbitrum faça com que esta execução automática falhe. Neste caso, o “bilhete” que envia a sua curadoria à L2 estará pendente e exigirá outra tentativa dentro de 7 dias.
Se este for o caso, você deverá se conectar com uma carteira L2 que tenha um pouco de ETH no Arbitrum, trocar a rede da sua carteira para Arbitrum, e clicar em “Confirmar Transferência” para tentar a transação novamente.

Como retirar a sua curadoria na L1
If you prefer not to send your GRT to L2, or you’d rather bridge the GRT manually, you can withdraw your curated GRT on L1. On the banner on the Subgraph page, choose “Withdraw Signal” and confirm the transaction; the GRT will be sent to your Curator address.