Billing on Subgraph Studio
For a quick demo of how billing works on the Subgraph Studio, check out the video below:
Invoices are statements of payment amounts owed by a customer and are typically generated on a weekly basis in the system. You'll be required to pay fees based on the query fees you generate using your API keys. While The Graph protocol operates on Ethereum Mainnet, the billing contract lives on the Polygon network to reduce transaction times and cost. It'll allow you to:
- Add and remove GRT from your wallet
- Keep track of your balances based on how much GRT you have added to your account, how much you have removed, and your invoices
- automatically pay invoices based on query fees generated, as long as there is enough billing balance in your account.
There are 4 states your invoice can be in:
- Pending - the invoice is in the queue to be paid from your billing balance
- Paid - your invoice has been successfully paid
- Unpaid - there is not enough GRT in your billing balance
- Partially Paid - only part of the invoice was paid, since there was not enough billing balance
See the diagram below for more information:
Before making queries on The Graph Network, you will need to add GRT to your account. This will take about 10-30 minutes depending on network traffic. To add GRT to your account, take the following steps:
Purchase GRT and ETH on an exchange or decentralized exchange of your choice
Send the GRT and ETH to your wallet
Bridge GRT to Polygon using the Subgraph Studio UI
a) You will receive 0.001 Matic within a few minutes of sending GRT to the Polygon bridge. You can monitor the transaction by inputting your wallet address into the search bar on Polygonscan.
Add bridged GRT to the billing contract on Polygon in the Subgraph Studio UI. The billing contract address is: 0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE.
a) In order to complete step #4, you must switch from Ethereum to the Polygon network. You can do this using the Subgraph Studio.
If you used your API keys over the course of any given week, you will receive an invoice based on the query fees you have generated during this period. This invoice will be paid using GRT available in your balance. Query volume is evaluated by the API keys you own. Your balance will be updated after fees are withdrawn.
When using The Graph Network, dapps and users pay for query fees in GRT, the protocol's native work-utility token. Maintaining a positive balance for an account is the user's or dapp's responsibility.
Here are ways to be notified about and/or check a query fee balance:
You can set up a billing notification that will be sent to an email address here.
You can query the billing subgraph API directly here
Also, you can learn how to (re)fill your query fee balance by watching this video.
IMPORTANT: If there are 2 unpaid invoices, Indexers will stop serving queries for all API Keys associated with the account. Indexers will automatically start serving queries again once the billing balance is paid in full and GRT is added to the account for future query fees.
Lastly, learn how to prioritize price, speed, data freshness (among other factors) for your queries by watching this video. If you have any questions, please ask in The Graph Discord and the community will be happy to help.
Multisigs are smart contracts that can exist only on the network they have been created, so if you created one on Ethereum Mainnet - it will only exist on Mainnet. Since our billing uses Polygon, if you were to bridge GRT to the multisig address on Polygon the funds would be lost.
To overcome this issue, we created a dedicated tool that will help you deposit GRT on our billing contract (on behalf of the multisig) with a standard wallet / EOA (an account controlled by a private key).
You can access our Multisig Billing Tool here: https://multisig-billing.thegraph.com/
This tool will guide you to go through the following steps:
- Connect your standard wallet / EOA (this wallet needs to own some ETH as well as the GRT you want to deposit)
- Bridge GRT to Polygon. You will have to wait 7-8 minutes after the transaction is complete for the bridge transfer to be finalized.
- Once your GRT is available on your Polygon balance you can deposit them to the billing contract while specifying the multisig address you are funding in the
Once the deposit transaction has been confirmed you can go back to Subgraph Studio and connect with your Gnosis Safe Multisig to create API keys and use them to generate queries.
Those queries will generate invoices that will be paid automatically using the multisig's billing balance.