-
Notifications
You must be signed in to change notification settings - Fork 237
/
schema-network.graphql
407 lines (290 loc) · 9.69 KB
/
schema-network.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# Subgraph Schema: Network
# Version: 1.2.0
# See https://github.com/messari/subgraphs/blob/master/docs/SCHEMA.md for details
enum SubgraphNetwork {
ARBITRUM_ONE
ARWEAVE_MAINNET
AURORA
AVALANCHE
BOBA
BSC # aka BNB Chain
CELO
CLOVER
COSMOS
CRONOS
MAINNET # Ethereum Mainnet
FANTOM
FUSE
HARMONY
JUNO
MOONBEAM
MOONRIVER
NEAR_MAINNET
OPTIMISM
OSMOSIS
MATIC # aka Polygon
GNOSIS
}
enum DataType {
AUTHORS
DIFFICULTY
GAS_USED
GAS_LIMIT
BURNT_FEES
REWARDS
SIZE
CHUNKS
SUPPLY
TRANSACTIONS
BLOCKS
BLOCK_INTERVAL
GAS_PRICE
}
# Stores statistical analytics for given metrics
type Stat @entity @regularPolling {
" { id of the snapshot this belongs to } - { DataType } "
id: Bytes!
" Number of times entity has been used in a time data entity "
count: Int!
" The average of all the values "
mean: BigDecimal!
" The maximum value in this entity "
max: BigInt!
" The minimum value in this data set "
min: BigInt!
" The sum of all the values "
sum: BigInt!
##### Calculated Statisitcal Fields #####
" The standard deviation of all values within this entity "
variance: BigDecimal
" This is the upper quartile where 75% of the values lie "
q3: BigDecimal
" This is the lower quartile where 25% of the values lie "
q1: BigDecimal
##### Helpers #####
_meanSquared: BigDecimal
}
##########################
#### Network Metadata ####
##########################
type Network @entity @regularPolling {
" Name of the network being indexed "
id: ID!
" The verison of the schema "
schemaVersion: String!
" The version of the subgraph "
subgraphVersion: String!
" The version of the methodology "
methodologyVersion: String!
#### Quantitative Data ####
" Number of cumulative unique authors (see type Author for explanation) "
cumulativeUniqueAuthors: Int!
" The total number of blocks in the blockchain "
blockHeight: Int!
" Total difficulty to reach the current block "
cumulativeDifficulty: BigInt
" Total gas used "
cumulativeGasUsed: BigInt
" Current gas limit "
gasLimit: BigInt
" Total burnt fees on the network in native asset "
cumulativeBurntFees: BigInt
" Total rewards emitted on the network in native asset "
cumulativeRewards: BigInt
" Total number of transactions that have occured on this network "
cumulativeTransactions: BigInt
" Total size of the network in native units (e.g. Bytes in Arweave and Ethereum) "
cumulativeSize: BigInt
" Current supply of the native asset "
totalSupply: BigInt
" Statistical analysis of blocks/day from daily snapshots "
dailyBlocks: Stat!
#### Snapshots ####
" Daily metrics for this blockchain "
dailySnapshots: [DailySnapshot!]! @derivedFrom(field: "network")
" Hourly metrics for this blockchain "
hourlySnapshots: [HourlySnapshot!]! @derivedFrom(field: "network")
}
###############################
#### Blockchain Timeseries ####
###############################
type DailySnapshot @entity @dailySnapshot {
" { number of days since UNIX epoch time } "
id: Bytes!
" ID of the network this snapshot belongs to "
network: Network!
#### Quantitative Data ####
" Block height at this day (aka, blockNumber) "
blockHeight: Int!
" Blocks created during this day (note, this is different from blocksPerDay) "
dailyBlocks: Int!
" Timestamp of this snapshot "
timestamp: BigInt!
" Number of cumulative unique authors (see type Author for explanation) "
cumulativeUniqueAuthors: Int!
" Statistical analysis of unique daily active authors "
dailyUniqueAuthors: Stat
" Total difficulty up until this day "
cumulativeDifficulty: BigInt
" Statistical analysis of difficulty during this day "
dailyDifficulty: Stat
" Total gas used up until this day "
cumulativeGasUsed: BigInt
" Statistical analysis of gas used during this day"
dailyGasUsed: Stat
" Statistical analysis of gas limit across blocks this day"
dailyGasLimit: Stat
" Total amount of fees burned "
cumulativeBurntFees: BigInt
" Statisical amount of burnt fees for this day "
dailyBurntFees: Stat
" Total amount of rewards emitted "
cumulativeRewards: BigInt
" Statistical analysis of rewards emitted on this day "
dailyRewards: Stat
" Total size of the entire network in this day (in native units) "
cumulativeSize: BigInt
" Statistical analysis of size in bytes of a block during this day "
dailySize: Stat
" Statistical analysis of chunks per block during this day "
dailyChunks: Stat
" Total amount of the native asset in circulation during this day "
totalSupply: BigInt
" Statisitcal analysis of the daily supply "
dailySupply: Stat
" Total number of transactions that have occured on this blockchain "
cumulativeTransactions: BigInt
" Statistical analysis of transactions per day "
dailyTransactions: Stat
" Statisical analysis of the block interval during this day "
dailyBlockInterval: Stat
" gas price at the end of this hour in network native gas units "
gasPrice: BigInt
" Statistical analysis of the gas price during this day "
dailyGasPrice: Stat
}
type HourlySnapshot @entity @hourlySnapshot {
" { number of hours since UNIX epoch time } "
id: Bytes!
" ID of the network this snapshot belongs to "
network: Network!
#### Quantitative Data ####
" Block height at this day (aka, blockNumber) "
blockHeight: Int!
" Blocks created during this day (note, this is different from blocksPerDay) "
hourlyBlocks: Int!
" Timestamp of this snapshot "
timestamp: BigInt!
" Number of cumulative unique authors (see type Author for explanation) "
cumulativeUniqueAuthors: Int!
" Statistical analysis of unique hourly active authors "
hourlyUniqueAuthors: Stat
" Total difficulty up until this hour "
cumulativeDifficulty: BigInt
" Statistical analysis of difficulty during this hour "
hourlyDifficulty: Stat
" Total gas used up until this hour "
cumulativeGasUsed: BigInt
" Statistical analysis of gas used during this hour"
hourlyGasUsed: Stat
" Statistical analysis of gas limit across blocks this hour"
hourlyGasLimit: Stat
" Total amount of fees burned "
cumulativeBurntFees: BigInt
" Statisical amount of burnt fees for this hour "
hourlyBurntFees: Stat
" Total amount of rewards emitted "
cumulativeRewards: BigInt
" Statistical analysis of rewards emitted on this hour "
hourlyRewards: Stat
" Total size of the entire network in this hour (in native units) "
cumulativeSize: BigInt
" Statistical analysis of size in bytes of a block during this hour "
hourlySize: Stat
" Statistical analysis of chunks per block during this hour "
hourlyChunks: Stat
" Total amount of the native asset in circulation during this hour "
totalSupply: BigInt
" Statisitcal analysis of the hourly supply "
hourlySupply: Stat
" Total number of transactions that have occured on this blockchain "
cumulativeTransactions: BigInt
" Statistical analysis of transactions per hour "
hourlyTransactions: Stat
" Statisical analysis of the block interval during this hour "
hourlyBlockInterval: Stat
" gas price at the end of this hour in network native gas units "
gasPrice: BigInt
" Statistical analysis of the gas price during this hour "
hourlyGasPrice: Stat
}
##########################
#### Block-level Data ####
##########################
type Block @entity(immutable: true) @regularPolling {
" { block number } "
id: Bytes!
" Hash of this block "
hash: Bytes!
" Timestamp of the block "
timestamp: BigInt!
" Author of this block (the entity that successfully found this block) "
author: Author
" Data size of the block in Bytes "
size: BigInt
" Minimum gasUsed multiplier for transaction to be included (note, post London upgrade) "
baseFeePerGas: BigInt
" Amount of effort required to create this block "
difficulty: BigInt
" Total gas limit provided from all transactions this block "
gasLimit: BigInt
" Total gas used in this block "
gasUsed: BigInt
" Percentage of gas filled in this block (e.g. gasUsed / gasLimit) "
blockUtilization: BigDecimal
" The price of gas in this block in network native gas units "
gasPrice: BigInt
" Burnt fees in native asset (baseFeePerGas * gasUsed) (note, post London upgrade) "
burntFees: BigInt
" Number of chunks in this block (e.g. shards on NEAR) "
chunkCount: BigInt
" Number of transactions in this block "
transactionCount: BigInt
" Rewards emitted in this block "
rewards: BigInt
}
# This is the node that found the next block (e.g. miner or validator)
type Author @entity @regularPolling {
" Address of the author "
id: Bytes!
" Number of blocks created "
cumulativeBlocksCreated: Int!
" Total difficulty secured on blockchain "
cumulativeDifficulty: BigInt
" A mapping to every block that this author has generated "
blocks: [Block!]! @derivedFrom(field: "author")
}
#################
#### Helpers ####
#################
# Helper entity for calculating daily/hourly active authors
type ActiveAuthor @entity(immutable: true) {
" { daily/hourly }-{ Address of the author }-{ Days/hours since Unix epoch } "
id: Bytes!
}
# Helper entitiy for NEAR protocol to keep track of chunks for metric aggregation
# Chunks are shards within a block on NEAR protocol: https://coinmarketcap.com/alexandria/glossary/chunk-near
type Chunk @entity(immutable: true) {
" { chunk hash } "
id: Bytes!
" The block this chunk belongs to "
block: Block!
" The gas used in this chunk "
gasUsed: BigInt
" The gas limit in this chunk "
gasLimit: BigInt
" The fees burnt in this chunk, also the total amount of fees "
burntFees: BigInt
" Gas utilization within this chunk (e.g. gasUsed / gasLimit) "
chunkUtilization: BigDecimal
}