The Graph Allocation Optimization Tooling

Hey everyone :wave: ,

we at anyblock analytics have developed a script that allows to calculate the optimal allocation distribution of the stake on the subgraphs.

We are aware that there is only one subgraph at the moment, but this will change in the near future. From that point on, it will be interesting for many ecosystem participants to figure out how best to distribute their allocations to get the greatest indexing reward.

Our script calculates the optimal distribution of allocations, takes into account variable thresholds for creating an allocations script (e.g. 10% higher indexing rewards than the current indexing rewards), consideres parallel allocations and also possible diversification parameters (max x % of allocations on a subgraph).

Furthermore, the script takes into account transaction fees for closing and creating allocations and considers them in the reaching the threshold.

We would be very happy to receive feedback, suggestions for improvement as well as contributions and pull requests. We would love to constantly improve the tool and provide a useful tooling to all of you.

The Github repo can be reached here: GitHub - anyblockanalytics/thegraph-allocation-optimization: Allocation Optimization The Graph

If you have any questions, just leave me a message. :slightly_smiling_face:


This is very cool, I would like to dig into the code when I have time :slight_smile:

Should be very useful for many indexers

1 Like

This is really impressive, thank you for sharing. I look forward to seeing more collaborators contributing to this!

1 Like

First usage seemed to bring positive results indeed - looking forward to share notes on the effects for different people with different parameters.


This is really cool. May be dockerize version of this tool will be helpful for indexers to quickly try this out.
Nice work @yarkin_anyblock


Dockerizing the tool is a great idea, we will look into it! Just a short update: The script was updated. Now it is possible to supply a list of subgraphs as a config.json file that should be considered in the allocation. This allows everyone to customize the script to their own needs.

Also some errors were fixed:

  • So far the staked tokens were considered for an indexer. But this didn’t include the delegated tokens. Therefore this was changed to “tokenCapacity”
  • Included a minimal allocation per Subgraph (currently 1000 GRT and hardcoded), will be parameterized soon, so you can supply your own minimal allocation per subgraph.

It is necessary to enhance the tooling by some (historical) performance indicators to have a more detailed view of the effects and results of the optimization and how (much) it contributed to more indexing rewards. So if anyone is interested in contributing to the project, feel free and reach out to me :slight_smile:


Hey everyone, just wanted to share the current progress for the allocation optimization grant. Check out this blogpost.

The allocation optimization tool is now officially in beta. We are looking forward to your feedback, bugreports and suggestions for further features. We are especially interested in what metrics and charts you are curious about in terms of allocations as well as indexing rewards.

The documentation and installation instructions can be found here.

Check out the Roadmap and some features and ideas that can happen in the future. And please let us know which features from the backlog should be prioritized!

Check out the project repository!


Thanks for sharing, @yarkin_anyblock
Nice progress!

I’m looking forward to next week’s Indexer Office Hours, as well as the community feedback on this BETA version. :+1: