Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Created April 13, 2022 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/a8d8b53ce33353ccbafa66245f151bae to your computer and use it in GitHub Desktop.
Save nathanleclaire/a8d8b53ce33353ccbafa66245f151bae to your computer and use it in GitHub Desktop.
(async () => {
console.log('LFG');
const startBlock = 117416695;
const blocks = range(startBlock, startBlock + 100000);
let fees = 0;
for (const i of blocks.values()) {
try {
const solConn = new sol.Connection(
'solapi.com',
{
httpHeaders: {
Referer: 'redacted',
},
}
);
const blockInfo = await solConn.getBlock(i);
const blockFees = blockInfo?.transactions.reduce(
(partialSum: number, a) =>
!a.meta ? partialSum : partialSum + a.meta?.fee,
0
);
console.log(`BLOCK FEES (${i}): ${blockFees}`);
fees += blockFees || 0;
if (i % 100 === 0)
console.log(
`TOTAL FEES: blocks=${i} lamports=${fees} sol=${
fees / sol.LAMPORTS_PER_SOL
}`
);
} catch (e) {}
}
console.log(
`TOTAL FEES: lamports=${fees} sol=${fees / sol.LAMPORTS_PER_SOL}`
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment