Skip to content

Commit 23b199e

Browse files
Merge pull request #157 from Divyn/main
base tx balance tracker pages
2 parents 6c0f781 + b94b26d commit 23b199e

File tree

9 files changed

+1570
-0
lines changed

9 files changed

+1570
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Transaction Balance Tracker"
3+
}
4+
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# Base Gas Balance Tracker
6+
7+
The Base Gas Balance Tracker API provides real-time balance updates related to Gas Fee activities, including transaction fee rewards, monitoring gas fee spent, and other GAS-related balance changes.
8+
9+
<head>
10+
<meta name="title" content="Base Gas Balance Tracker API & Streams"/>
11+
<meta name="description" content="Learn how to track Base Gas-related balance changes, transaction fee rewards, Gas Fee Spent and GAS Fee returned using Bitquery's Gas Balance Tracker API."/>
12+
<meta name="keywords" content="base Gas balance, Gas tracker, Gas balance api, transaction fee rewards, Gas burnt, Gas returned, base Gas api"/>
13+
<meta name="robots" content="index, follow"/>
14+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
15+
<meta name="language" content="English"/>
16+
17+
<!-- Open Graph / Facebook -->
18+
<meta property="og:type" content="website" />
19+
<meta
20+
property="og:title"
21+
content="Base Gas Balance Tracker API & Streams"
22+
/>
23+
<meta
24+
property="og:description"
25+
content="Learn how to track Base Gas-related balance changes, transaction fee rewards, Gas Fee Spent and Gas Fee returned using Bitquery's Gas Balance Tracker API."
26+
/>
27+
28+
<!-- Twitter -->
29+
<meta property="twitter:card" content="summary_large_image" />
30+
<meta property="twitter:title" content="Base Gas Balance Tracker API & Streams" />
31+
<meta property="twitter:description" content="Learn how to track Base Gas-related balance changes, transaction fee rewards, Gas Fee Spent and Gas Fee returned using Bitquery's Gas Balance Tracker API." />
32+
</head>
33+
34+
## Get Top Gas Fee Collectors
35+
36+
[This](https://ide.bitquery.io/top-gas-fee-collectors-base) API endpoint returns the list of top gas fee collectors. We are tracking the Gas Collection Event causing Balance Update by appliying condition on `BalanceChangeReasonCode` to be equal to `5`.
37+
38+
```graphql
39+
query TopGasGainers {
40+
EVM(network: base) {
41+
TransactionBalances(
42+
where: {TokenBalance: {BalanceChangeReasonCode: {eq: 5}}}
43+
orderBy: {descendingByField: "gain", descending: Block_Time}
44+
limitBy: {by: TokenBalance_Address, count: 1}
45+
) {
46+
TokenBalance {
47+
Address
48+
Currency {
49+
Name
50+
Symbol
51+
SmartContract
52+
}
53+
PreBalance
54+
PostBalance
55+
}
56+
gain: calculate(
57+
expression: "$TokenBalance_PostBalance - $TokenBalance_PreBalance"
58+
)
59+
}
60+
}
61+
}
62+
```
63+
64+
## Track the Balance after Latest Gas Fee Burn
65+
66+
[This](https://ide.bitquery.io/Latest-balance-and-gas-fee-paid-for-an-address-base_1) API endpoint returns the Balance and the Gas Fee burnt for a particular address after the latest Gas Fee Burn Event. We are tracking the Gas Burn Event causing Balance Update by appliying condition on `BalanceChangeReasonCode` to be equal to `6`.
67+
68+
```graphql
69+
query MyQuery {
70+
EVM(network: base) {
71+
TransactionBalances(
72+
where: {TokenBalance: {BalanceChangeReasonCode: {eq: 6}, Address: {is: "0xYourAddressInput"}}}
73+
limit: {count: 1}
74+
orderBy: {descending: Block_Time}
75+
) {
76+
Block{
77+
Time
78+
}
79+
TokenBalance {
80+
PreBalance
81+
PreBalanceInUSD
82+
PostBalance
83+
PostBalanceInUSD
84+
}
85+
fee_paid: calculate(
86+
expression: "$TokenBalance_PreBalance - $TokenBalance_PostBalance"
87+
)
88+
fee_paid_usd: calculate(
89+
expression: "$TokenBalance_PreBalanceInUSD - $TokenBalance_PostBalanceInUSD"
90+
)
91+
}
92+
}
93+
}
94+
```
95+
96+
## Track the Balance after Latest Gas Fee Burn for Multiple Addresses
97+
98+
[This](https://ide.bitquery.io/Latest-balance-and-gas-fee-paid-for-multiple-addresses-base) API endpoint returns the Balance and the Gas Fee burnt for a list of addresses after the latest Gas Fee Burn Event.
99+
100+
```graphql
101+
query MyQuery {
102+
EVM(network: base) {
103+
TransactionBalances(
104+
where: {TokenBalance: {BalanceChangeReasonCode: {eq: 6}, Address: {in: ["0xYourAddressInput1", "0xYourAddressInput2"]}}}
105+
limitBy: {by: TokenBalance_Address count: 1}
106+
orderBy: {descending: Block_Time}
107+
) {
108+
Block{
109+
Time
110+
}
111+
TokenBalance {
112+
PreBalance
113+
PreBalanceInUSD
114+
PostBalance
115+
PostBalanceInUSD
116+
}
117+
fee_paid: calculate(
118+
expression: "$TokenBalance_PreBalance - $TokenBalance_PostBalance"
119+
)
120+
fee_paid_usd: calculate(
121+
expression: "$TokenBalance_PreBalanceInUSD - $TokenBalance_PostBalanceInUSD"
122+
)
123+
}
124+
}
125+
}
126+
```
127+
128+
## Monitoring Balance after Latest Gas Fee Burn
129+
130+
[This](https://ide.bitquery.io/Monitor-balance-and-gas-fee-paid-for-an-address-using-stream-base) stream returns the Balance and the Gas Fee burnt for a particular address in real time.
131+
132+
```graphql
133+
subscription {
134+
EVM(network: base) {
135+
TransactionBalances(
136+
where: {TokenBalance: {BalanceChangeReasonCode: {eq: 6}, Address: {is: "0xYourAddressInput"}}}
137+
) {
138+
Block{
139+
Time
140+
}
141+
TokenBalance {
142+
PreBalance
143+
PreBalanceInUSD
144+
PostBalance
145+
PostBalanceInUSD
146+
}
147+
fee_paid: calculate(
148+
expression: "$TokenBalance_PreBalance - $TokenBalance_PostBalance"
149+
)
150+
fee_paid_usd: calculate(
151+
expression: "$TokenBalance_PreBalanceInUSD - $TokenBalance_PostBalanceInUSD"
152+
)
153+
}
154+
}
155+
}
156+
```
157+
158+
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
---
2+
sidebar_position: 4
3+
---
4+
5+
# Base MEV Balance Tracker
6+
7+
The Base MEV (Maximal Extractable Value) Balance Tracker API provides real-time balance updates related to MEV activities, including transaction fee rewards, block builder rewards, and other MEV-related balance changes.
8+
9+
<head>
10+
<meta name="title" content="Base MEV Balance Tracker API & Streams"/>
11+
<meta name="description" content="Learn how to track Base MEV-related balance changes, transaction fee rewards, and block builder rewards using Bitquery's MEV Balance Tracker API."/>
12+
<meta name="keywords" content="base mev balance, mev tracker, mev balance api, transaction fee rewards, block builder rewards, mev extraction, base mev api"/>
13+
<meta name="robots" content="index, follow"/>
14+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
15+
<meta name="language" content="English"/>
16+
17+
<!-- Open Graph / Facebook -->
18+
<meta property="og:type" content="website" />
19+
<meta
20+
property="og:title"
21+
content="Base MEV Balance Tracker API & Streams"
22+
/>
23+
<meta
24+
property="og:description"
25+
content="Learn how to track Base MEV-related balance changes, transaction fee rewards, and block builder rewards using Bitquery's MEV Balance Tracker API."
26+
/>
27+
28+
<!-- Twitter -->
29+
<meta property="twitter:card" content="summary_large_image" />
30+
<meta property="twitter:title" content="Base MEV Balance Tracker API & Streams" />
31+
<meta property="twitter:description" content="Learn how to track Base MEV-related balance changes, transaction fee rewards, and block builder rewards using Bitquery's MEV Balance Tracker API." />
32+
</head>
33+
34+
## Track MEV-Related Balance Updates
35+
36+
Monitor balance changes related to MEV activities, including transaction fee rewards and block builder rewards. Try the API [here](https://ide.bitquery.io/Track-MEV-Related-Balance-Updates-base).
37+
38+
```graphql
39+
subscription {
40+
EVM(network: base) {
41+
TransactionBalances(
42+
where: { TokenBalance: { BalanceChangeReasonCode: { eq: 5 } } }
43+
) {
44+
Block {
45+
Time
46+
Number
47+
}
48+
TokenBalance {
49+
Currency {
50+
Symbol
51+
}
52+
PreBalance
53+
PostBalance
54+
Address
55+
BalanceChangeReasonCode
56+
PostBalanceInUSD
57+
}
58+
Transaction {
59+
Hash
60+
}
61+
}
62+
}
63+
}
64+
```
65+
66+
**Balance Change Reason Code for MEV:**
67+
68+
- **Code 5**: `BalanceIncreaseRewardTransactionFee` - Transaction tip increasing block builder's balance (MEV-related)
69+
70+
## Track Block Builder Rewards
71+
72+
Monitor transaction fee rewards received by block builders (MEV extractors):
73+
Try the API [here](https://ide.bitquery.io/Track-Block-Builder-Rewards-base).
74+
75+
```graphql
76+
subscription {
77+
EVM(network: base) {
78+
TransactionBalances(
79+
where: {
80+
TokenBalance: { BalanceChangeReasonCode: { eq: 5 } }
81+
Block: { Number: { gt: "0" } }
82+
}
83+
) {
84+
Block {
85+
Time
86+
Number
87+
}
88+
TokenBalance {
89+
Currency {
90+
Symbol
91+
}
92+
PreBalance
93+
PostBalance
94+
Address
95+
BalanceChangeReasonCode
96+
PostBalanceInUSD
97+
}
98+
Transaction {
99+
Hash
100+
GasPrice
101+
}
102+
}
103+
}
104+
}
105+
```
106+
107+
## Filter by MEV Bot or Builder Address
108+
109+
Track balance changes for specific MEV bots or block builders:
110+
Try the API [here](https://ide.bitquery.io/Filter-by-MEV-Bot-or-Builder-Address-base).
111+
112+
```graphql
113+
subscription {
114+
EVM(network: base) {
115+
TransactionBalances(
116+
where: {
117+
TokenBalance: {
118+
Address: { is: "0xMEVBotOrBuilderAddressHere" }
119+
BalanceChangeReasonCode: { eq: 5 }
120+
}
121+
}
122+
) {
123+
Block {
124+
Time
125+
Number
126+
}
127+
TokenBalance {
128+
Currency {
129+
Symbol
130+
}
131+
PreBalance
132+
PostBalance
133+
Address
134+
BalanceChangeReasonCode
135+
PostBalanceInUSD
136+
}
137+
Transaction {
138+
Hash
139+
140+
GasPrice
141+
}
142+
}
143+
}
144+
}
145+
```
146+
147+
## Track Large MEV Transactions
148+
149+
Monitor large transaction fee rewards that may indicate significant MEV extraction:
150+
Try the API [here](https://ide.bitquery.io/Track-Large-MEV-Transactions-base).
151+
152+
```graphql
153+
subscription {
154+
EVM(network: base) {
155+
TransactionBalances(
156+
where: {
157+
TokenBalance: {
158+
BalanceChangeReasonCode: { eq: 5 }
159+
PostBalanceInUSD: { gt: "1000" }
160+
}
161+
}
162+
) {
163+
Block {
164+
Time
165+
Number
166+
}
167+
TokenBalance {
168+
Currency {
169+
Symbol
170+
}
171+
PreBalance
172+
PostBalance
173+
Address
174+
BalanceChangeReasonCode
175+
PostBalanceInUSD
176+
}
177+
Transaction {
178+
Hash
179+
180+
GasPrice
181+
}
182+
}
183+
}
184+
}
185+
```

0 commit comments

Comments
 (0)