- README.md
- Pre-requisites
- Getting Started
- Advanced Configuration
- Setting Up Allocations
- Setting Up Cost Models <- you are here
- Tips and Tricks
- Troubleshooting
Cost models are indexer tools that they can use in order to set a price for the data that they serve.
You cannot earn GRT for the queries that you serve without a cost model.
The cost models are denominated in decimal GRT.
Cost models can have two parts:
- The model — should contain the queries that you want to price
- The variables — should contain the variables that the queries use
You can either have a static, simple cost model, or you can dive into complicated cost models based on your database access times for different queries that you serve across different subgraphs, etc.
The decision here is totally up to you 🙂
The easiest cost model you can set, can look something like this:
default => price;
or
query {...} => price;
Example — you're serving every query at 0.01 GRT / query
default => 0.01;
Connect to your CLI
./shell cli
Create a default cost model by creating a default file using nano default
and the adding the following to the new file.
default => 0.00005;
Note: This will serve each query at 0.00005 GRT / query
Save and exit the file, then apply this setting to each of your indexed subgraphs
graph indexer cost set model <IPFS HASH> default
Once you have applied the default cost model to each you can review them by typeing graph indexer cost get all
{
"VALUE-1": "10.0006390502074853",
"VALUE-2": "5",
"VALUE-3": "3",
"VALUE-4": "1"
}