4 Synced Subgraphs

Next, our goal is to figure out which subgraphs we want to open new allocations for. To start, we want to get to a list of synced subgraphs as potential candidates for new allocations.

You can and should do this using the status endpoint of the indexer. Ricky wanted full access to all the data, so the example below connects to the graph node database directly.

## [1] "Connecting to database..."
## [1] "Executing query..."
## [1] "Processed sync state data:"
## # A tibble: 350 × 6
##    deployment             network shard synced current_block synced_at          
##    <chr>                  <chr>   <chr> <chr>  <chr>         <dttm>             
##  1 QmZ3Cuso8BeNYjPdEG3BT… base    subg… true   <NA>          2025-05-04 01:58:55
##  2 QmSrPAGCzBapQXyRtV3PS… base    subg… true   <NA>          2025-04-29 14:20:29
##  3 QmefHBEBk7sFi9r4SFT35… base    subg… true   <NA>          2025-04-28 09:18:54
##  4 QmUzRg2HHMpbgf6Q4VHKN… arbitr… subg… true   <NA>          2025-04-28 08:59:03
##  5 QmVyhWS9Q32kcr3si1JNY… base    subg… true   <NA>          2025-04-28 06:33:44
##  6 QmXvdb33USYAq4XfPyAYZ… base    subg… true   <NA>          2025-04-28 06:27:45
##  7 QmXLQ8QGxn8veGB9xUEmV… base    subg… true   <NA>          2025-04-28 03:42:10
##  8 QmNR4EtKBGFrfdBJQhn7T… base    subg… true   <NA>          2025-04-28 03:19:42
##  9 QmQuCY9bwTF13ZkPdpgy7… arbitr… subg… true   <NA>          2025-04-27 21:56:54
## 10 QmZjMSBvMuW3H1kjmgujF… mainnet subg… true   <NA>          2025-04-27 21:43:32
## # ℹ 340 more rows
## [1] "Closing database connection..."
## # A tibble: 350 × 6
##    deployment             network shard synced current_block synced_at          
##    <chr>                  <chr>   <chr> <chr>  <chr>         <dttm>             
##  1 QmZ3Cuso8BeNYjPdEG3BT… base    subg… true   <NA>          2025-05-04 01:58:55
##  2 QmSrPAGCzBapQXyRtV3PS… base    subg… true   <NA>          2025-04-29 14:20:29
##  3 QmefHBEBk7sFi9r4SFT35… base    subg… true   <NA>          2025-04-28 09:18:54
##  4 QmUzRg2HHMpbgf6Q4VHKN… arbitr… subg… true   <NA>          2025-04-28 08:59:03
##  5 QmVyhWS9Q32kcr3si1JNY… base    subg… true   <NA>          2025-04-28 06:33:44
##  6 QmXvdb33USYAq4XfPyAYZ… base    subg… true   <NA>          2025-04-28 06:27:45
##  7 QmXLQ8QGxn8veGB9xUEmV… base    subg… true   <NA>          2025-04-28 03:42:10
##  8 QmNR4EtKBGFrfdBJQhn7T… base    subg… true   <NA>          2025-04-28 03:19:42
##  9 QmQuCY9bwTF13ZkPdpgy7… arbitr… subg… true   <NA>          2025-04-27 21:56:54
## 10 QmZjMSBvMuW3H1kjmgujF… mainnet subg… true   <NA>          2025-04-27 21:43:32
## # ℹ 340 more rows

Add whether they are synced:

# Filter for synced subgraphs (skip block filtering since current_block is NULL)
synced_subgraphs = sync_state %>%
  filter(synced == 'true') %>%
  select(deployment, network, synced_at)

# Display summary by network if we have that data
if ("network" %in% names(synced_subgraphs)) {
  print("Synced subgraphs by network:")
  print(synced_subgraphs %>% 
    group_by(network) %>%
    summarise(
      count = n(),
      most_recent_sync = max(synced_at, na.rm = TRUE),
      .groups = 'drop'
    ))
}
## [1] "Synced subgraphs by network:"
## # A tibble: 4 × 3
##   network      count most_recent_sync   
##   <chr>        <int> <dttm>             
## 1 arbitrum-one    91 2025-04-28 08:59:03
## 2 base            71 2025-05-04 01:58:55
## 3 gnosis          16 2025-04-27 17:10:09
## 4 mainnet        172 2025-04-27 21:43:32
# View the actual synced subgraphs
print("Detailed synced subgraphs:")
## [1] "Detailed synced subgraphs:"
print(synced_subgraphs)
## # A tibble: 350 × 3
##    deployment                                     network    synced_at          
##    <chr>                                          <chr>      <dttm>             
##  1 QmZ3Cuso8BeNYjPdEG3BT2raaNC9GghrhH3tuJHSUUDxtE base       2025-05-04 01:58:55
##  2 QmSrPAGCzBapQXyRtV3PS8hdS55UTB8UDh2mdkfJaoR7MT base       2025-04-29 14:20:29
##  3 QmefHBEBk7sFi9r4SFT35w517FG1hH9CYDE6mEQHQZkHtq base       2025-04-28 09:18:54
##  4 QmUzRg2HHMpbgf6Q4VHKNDbtBEJnyp5JWCh2gUX9AV6jXv arbitrum-… 2025-04-28 08:59:03
##  5 QmVyhWS9Q32kcr3si1JNYWxPUdKqYsq2wgXwiYiwtxSm6j base       2025-04-28 06:33:44
##  6 QmXvdb33USYAq4XfPyAYZXDMHH4DrUtdfeGUjJejo4TEL7 base       2025-04-28 06:27:45
##  7 QmXLQ8QGxn8veGB9xUEmVafsZxshfQhBQudpSUZF2Z5UQ7 base       2025-04-28 03:42:10
##  8 QmNR4EtKBGFrfdBJQhn7TRvP1xXL94fmsA6mhEVmANjXEL base       2025-04-28 03:19:42
##  9 QmQuCY9bwTF13ZkPdpgy7MZKHYVyqnoV4yXc3XcrZCdMPE arbitrum-… 2025-04-27 21:56:54
## 10 QmZjMSBvMuW3H1kjmgujFXWbLkaFpjCe16frsfnEKQz4rd mainnet    2025-04-27 21:43:32
## # ℹ 340 more rows
## # A tibble: 350 × 3
##    deployment                                     network    synced_at          
##    <chr>                                          <chr>      <dttm>             
##  1 QmZ3Cuso8BeNYjPdEG3BT2raaNC9GghrhH3tuJHSUUDxtE base       2025-05-04 01:58:55
##  2 QmSrPAGCzBapQXyRtV3PS8hdS55UTB8UDh2mdkfJaoR7MT base       2025-04-29 14:20:29
##  3 QmefHBEBk7sFi9r4SFT35w517FG1hH9CYDE6mEQHQZkHtq base       2025-04-28 09:18:54
##  4 QmUzRg2HHMpbgf6Q4VHKNDbtBEJnyp5JWCh2gUX9AV6jXv arbitrum-… 2025-04-28 08:59:03
##  5 QmVyhWS9Q32kcr3si1JNYWxPUdKqYsq2wgXwiYiwtxSm6j base       2025-04-28 06:33:44
##  6 QmXvdb33USYAq4XfPyAYZXDMHH4DrUtdfeGUjJejo4TEL7 base       2025-04-28 06:27:45
##  7 QmXLQ8QGxn8veGB9xUEmVafsZxshfQhBQudpSUZF2Z5UQ7 base       2025-04-28 03:42:10
##  8 QmNR4EtKBGFrfdBJQhn7TRvP1xXL94fmsA6mhEVmANjXEL base       2025-04-28 03:19:42
##  9 QmQuCY9bwTF13ZkPdpgy7MZKHYVyqnoV4yXc3XcrZCdMPE arbitrum-… 2025-04-27 21:56:54
## 10 QmZjMSBvMuW3H1kjmgujFXWbLkaFpjCe16frsfnEKQz4rd mainnet    2025-04-27 21:43:32
## # ℹ 340 more rows

Great! Next, we will figure out the synced subgraphs that offer the best indexing rewards. Next section

save.image('/root/github/indexer_analytics_tutorial/data/chapters_snapshots/05-synced_subgraphs.RData')