From b66a3ff867fcc3edbafde572d52f73e4c4c6ae55 Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Thu, 7 Mar 2024 16:03:50 +0530 Subject: [PATCH 1/6] chore: fix gasAnalysis --- scripts/gasAnalyze.js | 229 ++++++++++++++++++++++++------------------ 1 file changed, 133 insertions(+), 96 deletions(-) mode change 100644 => 100755 scripts/gasAnalyze.js diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js old mode 100644 new mode 100755 index d0454a51..ba1c7240 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -1,5 +1,6 @@ const getJSON = require('get-json'); const json = require('../gasReporterOutput.json'); +const hre = require('hardhat'); function median(numbers) { const sorted = numbers.slice().sort((a, b) => a - b); @@ -12,126 +13,162 @@ function median(numbers) { return sorted[middle]; } +async function getGasFeeData(rpc){ + try{ + const provider = new hre.ethers.providers.JsonRpcProvider(rpc); + const gasPrice = await provider.getFeeData(); + const formatted = hre.ethers.utils.formatUnits(gasPrice.gasPrice, 'gwei'); + console.log("Current Gas Price", formatted); + return formatted; + } + catch(e){ + console.log(e); + } +} + const ethGasApi = 'https://ethgasstation.info/api/ethgasAPI.json'; const ethPrice = 'https://api.gemini.com/v1/pubticker/ethusd'; const polygonGasApi = 'https://gasstation-mainnet.matic.network/'; const maticPrice = 'https://api.gemini.com/v1/pubticker/maticusd'; const commits = json.info.methods.VoteManager_40f84925.gasData; -const reveals = json.info.methods.VoteManager_45502afa.gasData; -const proposes = json.info.methods.BlockManager_accd8f53.gasData; +const reveals = json.info.methods.VoteManager_f110a0fa.gasData; +const proposes = json.info.methods.BlockManager_dc82a745.gasData; -// console.log(commits) -getJSON(ethGasApi, function (error, response) { - const gwei = response.average / 10; - getJSON(ethPrice, function (error, response) { - const ethusd = response.last; - // - // tx cost = gas * gasprice - // gas * gasPriceInWei/10**9 +async function main() { + const gwei = await getGasFeeData("https://eth-mainnet.alchemyapi.io/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const polyGwei = await getGasFeeData("https://polygon-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + getJSON(ethPrice, function (error, response) { + + const ethusd = response.last; + + console.log("ETHUSD", ethusd); + // tx cost = gas * gasprice + // gas * gasPriceInWei/10**9 - let commitcost = Number(ethusd) * Number(gwei) * Number(median(commits)) / 10 ** 9; - let revealcost = Number(ethusd) * Number(gwei) * Number(median(reveals)) / 10 ** 9; - let proposecost = Number(ethusd) * Number(gwei) * Number(median(proposes)) / 10 ** 9; - let epochcost = commitcost + revealcost + revealcost; - // console.log(Number(ethusd),Number(gwei),Number(commits)) - console.log('On ethereum network. It will take take following cost for tx'); - console.log('Commit: $', commitcost); - console.log('reveal: $', proposecost); - console.log('propose: $', revealcost); - console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 10min: $', epochcost * 6 * 24); - console.log('cost per week if epoch = 10min: $', epochcost * 6 * 24 * 7); - console.log('cost per month if epoch = 10min: $', epochcost * 6 * 24 * 30); - console.log('cost per day if epoch = 1 hour: $', epochcost * 24); - console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); - console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); - console.log('========================================================'); - getJSON(polygonGasApi, function (error, response) { - const polyGwei = response.standard; - getJSON(maticPrice, function (error, response) { - const maticusd = response.last; - - commitcost = Number(maticusd) * Number(polyGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(maticusd) * Number(polyGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(maticusd) * Number(polyGwei) * Number(median(proposes)) / 10 ** 9; - epochcost = commitcost + revealcost + revealcost; - // console.log(Number(ethusd),Number(gwei),Number(commits)) - console.log('On Polygon network. It will take take following cost for tx'); + let commitcost = Number(ethusd) * Number(gwei) * Number(median(commits)) / 10 ** 9; + let revealcost = Number(ethusd) * Number(gwei) * Number(median(reveals)) / 10 ** 9; + let proposecost = Number(ethusd) * Number(gwei) * Number(median(proposes)) / 10 ** 9; + let epochcost = commitcost + revealcost + revealcost; + console.log(commitcost, revealcost, proposecost, epochcost) + console.log('On ethereum network. It will take take following cost for tx'); console.log('Commit: $', commitcost); console.log('reveal: $', proposecost); console.log('propose: $', revealcost); console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 10min: $', epochcost * 6 * 24); - console.log('cost per week if epoch = 10min: $', epochcost * 6 * 24 * 7); - console.log('cost per month if epoch = 10min: $', epochcost * 6 * 24 * 30); + console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); - const arbitrumGwei = 0.45; + console.log('========================================================'); + - commitcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(ethusd) * Number(arbitrumGwei) * Number(median(proposes)) / 10 ** 9; + console.log("ETHUSD", ethusd); + commitcost = Number(ethusd) * Number(opgwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(ethusd) * Number(opgwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(ethusd) * Number(opgwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; - // console.log(Number(ethusd),Number(gwei),Number(commits)) - console.log('On Arbitrum network. It will take take following cost for tx (Not real time)'); + console.log(commitcost, revealcost, proposecost, epochcost) + console.log('On OP Mainnet network. It will take take following cost for tx'); console.log('Commit: $', commitcost); console.log('reveal: $', proposecost); console.log('propose: $', revealcost); console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 10min: $', epochcost * 6 * 24); - console.log('cost per week if epoch = 10min: $', epochcost * 6 * 24 * 7); - console.log('cost per month if epoch = 10min: $', epochcost * 6 * 24 * 30); + console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); - const avaGwei = 225; - const avaxPrice = 'https://api.coingecko.com/api/v3/simple/price?ids=avalanche-2&vs_currencies=usd'; - getJSON(avaxPrice, function (error, response) { - console.log('========================================================'); - const avaxusd = response['avalanche-2'].usd; - - commitcost = Number(avaxusd) * Number(avaGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(avaxusd) * Number(avaGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(avaxusd) * Number(avaGwei) * Number(median(proposes)) / 10 ** 9; - epochcost = commitcost + revealcost + revealcost; - // console.log(Number(ethusd),Number(gwei),Number(commits)) - console.log('On Avalanche network. It will take take following cost for tx'); - console.log('Commit: $', commitcost); - console.log('reveal: $', proposecost); - console.log('propose: $', revealcost); - console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 10min: $', epochcost * 6 * 24); - console.log('cost per week if epoch = 10min: $', epochcost * 6 * 24 * 7); - console.log('cost per month if epoch = 10min: $', epochcost * 6 * 24 * 30); - console.log('cost per day if epoch = 1 hour: $', epochcost * 24); - console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); - console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + console.log('========================================================'); + getJSON(maticPrice, function (error, response) { + const maticusd = response.last; + console.log("MATICUSD:", maticusd); + commitcost = Number(maticusd) * Number(polyGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(maticusd) * Number(polyGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(maticusd) * Number(polyGwei) * Number(median(proposes)) / 10 ** 9; + epochcost = commitcost + revealcost + revealcost; + // console.log(Number(ethusd),Number(gwei),Number(commits)) + console.log('On Polygon network. It will take take following cost for tx'); + console.log('Commit: $', commitcost); + console.log('reveal: $', proposecost); + console.log('propose: $', revealcost); + console.log('cost per epoch: $', epochcost); + console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + // const arbitrumGwei = 0.45; + + // commitcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(commits)) / 10 ** 9; + // revealcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(reveals)) / 10 ** 9; + // proposecost = Number(ethusd) * Number(arbitrumGwei) * Number(median(proposes)) / 10 ** 9; + // epochcost = commitcost + revealcost + revealcost; + // // console.log(Number(ethusd),Number(gwei),Number(commits)) + // console.log('On Arbitrum network. It will take take following cost for tx (Not real time)'); + // console.log('Commit: $', commitcost); + // console.log('reveal: $', proposecost); + // console.log('propose: $', revealcost); + // console.log('cost per epoch: $', epochcost); + // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + // const avaGwei = 225; + // const avaxPrice = 'https://api.coingecko.com/api/v3/simple/price?ids=avalanche-2&vs_currencies=usd'; + // getJSON(avaxPrice, function (error, response) { + // console.log('========================================================'); + // const avaxusd = response['avalanche-2'].usd; + + // commitcost = Number(avaxusd) * Number(avaGwei) * Number(median(commits)) / 10 ** 9; + // revealcost = Number(avaxusd) * Number(avaGwei) * Number(median(reveals)) / 10 ** 9; + // proposecost = Number(avaxusd) * Number(avaGwei) * Number(median(proposes)) / 10 ** 9; + // epochcost = commitcost + revealcost + revealcost; + // // console.log(Number(ethusd),Number(gwei),Number(commits)) + // console.log('On Avalanche network. It will take take following cost for tx'); + // console.log('Commit: $', commitcost); + // console.log('reveal: $', proposecost); + // console.log('propose: $', revealcost); + // console.log('cost per epoch: $', epochcost); + // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + + // console.log('========================================================'); + // const xdaiusd = 1; + // const xdaigwei = 1; + + // commitcost = Number(xdaiusd) * Number(xdaigwei) * Number(median(commits)) / 10 ** 9; + // revealcost = Number(xdaiusd) * Number(xdaigwei) * Number(median(reveals)) / 10 ** 9; + // proposecost = Number(xdaiusd) * Number(xdaigwei) * Number(median(proposes)) / 10 ** 9; + // epochcost = commitcost + revealcost + revealcost; + // // console.log(Number(ethusd),Number(gwei),Number(commits)) + // console.log('On xDAI network. It will take take following cost for tx (Not real time)'); + // console.log('Commit: $', commitcost); + // console.log('reveal: $', proposecost); + // console.log('propose: $', revealcost); + // console.log('cost per epoch: $', epochcost); + // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); + // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + // }); + }); + }); - console.log('========================================================'); - const xdaiusd = 1; - const xdaigwei = 1; +} - commitcost = Number(xdaiusd) * Number(xdaigwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(xdaiusd) * Number(xdaigwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(xdaiusd) * Number(xdaigwei) * Number(median(proposes)) / 10 ** 9; - epochcost = commitcost + revealcost + revealcost; - // console.log(Number(ethusd),Number(gwei),Number(commits)) - console.log('On xDAI network. It will take take following cost for tx (Not real time)'); - console.log('Commit: $', commitcost); - console.log('reveal: $', proposecost); - console.log('propose: $', revealcost); - console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 10min: $', epochcost * 6 * 24); - console.log('cost per week if epoch = 10min: $', epochcost * 6 * 24 * 7); - console.log('cost per month if epoch = 10min: $', epochcost * 6 * 24 * 30); - console.log('cost per day if epoch = 1 hour: $', epochcost * 24); - console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); - console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); - }); - }); - }); - }); -}); +main().catch(console.error); From 3672625786dbed4b69333b83226cfe6991b490a4 Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Mon, 11 Mar 2024 11:03:36 +0530 Subject: [PATCH 2/6] chore: add arb one --- scripts/gasAnalyze.js | 57 +++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js index ba1c7240..145adc6c 100755 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -40,6 +40,7 @@ async function main() { const gwei = await getGasFeeData("https://eth-mainnet.alchemyapi.io/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); const polyGwei = await getGasFeeData("https://polygon-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const arbitrumGwei = await getGasFeeData("https://arb-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); getJSON(ethPrice, function (error, response) { const ethusd = response.last; @@ -58,9 +59,9 @@ async function main() { console.log('reveal: $', proposecost); console.log('propose: $', revealcost); console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); @@ -78,9 +79,29 @@ async function main() { console.log('reveal: $', proposecost); console.log('propose: $', revealcost); console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); + console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + console.log('========================================================'); + + + console.log("ETHUSD", ethusd); + commitcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(ethusd) * Number(arbitrumGwei) * Number(median(proposes)) / 10 ** 9; + epochcost = commitcost + revealcost + revealcost; + console.log(commitcost, revealcost, proposecost, epochcost) + console.log('On ArbitrumOne Mainnet network. It will take take following cost for tx'); + console.log('Commit: $', commitcost); + console.log('reveal: $', proposecost); + console.log('propose: $', revealcost); + console.log('cost per epoch: $', epochcost); + console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); @@ -98,9 +119,9 @@ async function main() { console.log('reveal: $', proposecost); console.log('propose: $', revealcost); console.log('cost per epoch: $', epochcost); - console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); @@ -116,9 +137,9 @@ async function main() { // console.log('reveal: $', proposecost); // console.log('propose: $', revealcost); // console.log('cost per epoch: $', epochcost); - // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + // console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); @@ -138,9 +159,9 @@ async function main() { // console.log('reveal: $', proposecost); // console.log('propose: $', revealcost); // console.log('cost per epoch: $', epochcost); - // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + // console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); @@ -159,9 +180,9 @@ async function main() { // console.log('reveal: $', proposecost); // console.log('propose: $', revealcost); // console.log('cost per epoch: $', epochcost); - // console.log('cost per day if epoch = 5min: $', epochcost * 6 * 24 * 2); - // console.log('cost per week if epoch = 5min: $', epochcost * 6 * 24 * 2 * 7); - // console.log('cost per month if epoch = 5min: $', epochcost * 6 * 24 * 2 * 30); + // console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + // console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + // console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); // console.log('cost per day if epoch = 1 hour: $', epochcost * 24); // console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); // console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); From 19d152299ea654608ce3718a1c545d49c408d92f Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Wed, 3 Apr 2024 15:05:07 +0530 Subject: [PATCH 3/6] chore: use Custom self hosted OPStack --- scripts/gasAnalyze.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js index 145adc6c..d2f161b3 100755 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -38,7 +38,7 @@ const proposes = json.info.methods.BlockManager_dc82a745.gasData; async function main() { const gwei = await getGasFeeData("https://eth-mainnet.alchemyapi.io/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); - const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const opgwei = await getGasFeeData("http://35.240.132.193:8545"); const polyGwei = await getGasFeeData("https://polygon-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); const arbitrumGwei = await getGasFeeData("https://arb-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); getJSON(ethPrice, function (error, response) { From b9e4c3c7638fe3def46f829be6aedf282906f0cb Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Mon, 13 May 2024 13:41:39 +0530 Subject: [PATCH 4/6] chore: add custom op stack to gas cost estimation for 5min epoch --- scripts/gasAnalyze.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js index d2f161b3..32cb9031 100755 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -18,7 +18,7 @@ async function getGasFeeData(rpc){ const provider = new hre.ethers.providers.JsonRpcProvider(rpc); const gasPrice = await provider.getFeeData(); const formatted = hre.ethers.utils.formatUnits(gasPrice.gasPrice, 'gwei'); - console.log("Current Gas Price", formatted); + console.log("Current Gas Price", formatted, rpc); return formatted; } catch(e){ @@ -37,10 +37,10 @@ const proposes = json.info.methods.BlockManager_dc82a745.gasData; async function main() { - const gwei = await getGasFeeData("https://eth-mainnet.alchemyapi.io/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); - const opgwei = await getGasFeeData("http://35.240.132.193:8545"); - const polyGwei = await getGasFeeData("https://polygon-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); - const arbitrumGwei = await getGasFeeData("https://arb-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const gwei = await getGasFeeData("https://rpc.lokibuilder.xyz/wallet"); + const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); + const baseGwei = await getGasFeeData("https://base.meowrpc.com"); + const opStackGwei = await getGasFeeData("http://35.246.50.60:8545"); getJSON(ethPrice, function (error, response) { const ethusd = response.last; @@ -89,9 +89,9 @@ async function main() { console.log("ETHUSD", ethusd); - commitcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(ethusd) * Number(arbitrumGwei) * Number(median(proposes)) / 10 ** 9; + commitcost = Number(ethusd) * Number(opStackGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(ethusd) * Number(opStackGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(ethusd) * Number(opStackGwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; console.log(commitcost, revealcost, proposecost, epochcost) console.log('On ArbitrumOne Mainnet network. It will take take following cost for tx'); @@ -109,9 +109,9 @@ async function main() { getJSON(maticPrice, function (error, response) { const maticusd = response.last; console.log("MATICUSD:", maticusd); - commitcost = Number(maticusd) * Number(polyGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(maticusd) * Number(polyGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(maticusd) * Number(polyGwei) * Number(median(proposes)) / 10 ** 9; + commitcost = Number(maticusd) * Number(baseGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(maticusd) * Number(baseGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(maticusd) * Number(baseGwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; // console.log(Number(ethusd),Number(gwei),Number(commits)) console.log('On Polygon network. It will take take following cost for tx'); @@ -125,11 +125,11 @@ async function main() { console.log('cost per day if epoch = 1 hour: $', epochcost * 24); console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); - // const arbitrumGwei = 0.45; + // const opStackGwei = 0.45; - // commitcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(commits)) / 10 ** 9; - // revealcost = Number(ethusd) * Number(arbitrumGwei) * Number(median(reveals)) / 10 ** 9; - // proposecost = Number(ethusd) * Number(arbitrumGwei) * Number(median(proposes)) / 10 ** 9; + // commitcost = Number(ethusd) * Number(opStackGwei) * Number(median(commits)) / 10 ** 9; + // revealcost = Number(ethusd) * Number(opStackGwei) * Number(median(reveals)) / 10 ** 9; + // proposecost = Number(ethusd) * Number(opStackGwei) * Number(median(proposes)) / 10 ** 9; // epochcost = commitcost + revealcost + revealcost; // // console.log(Number(ethusd),Number(gwei),Number(commits)) // console.log('On Arbitrum network. It will take take following cost for tx (Not real time)'); From d51908332b9ca828cc271ed2e6dbcef526028f60 Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Mon, 13 May 2024 13:44:56 +0530 Subject: [PATCH 5/6] chore: add custom op stack to gas cost estimation for 5min epoch --- scripts/gasAnalyze.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js index 32cb9031..32e25e74 100755 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -40,6 +40,7 @@ async function main() { const gwei = await getGasFeeData("https://rpc.lokibuilder.xyz/wallet"); const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); const baseGwei = await getGasFeeData("https://base.meowrpc.com"); + const polyGwei = await getGasFeeData("https://rpc-mainnet.maticvigil.com"); const opStackGwei = await getGasFeeData("http://35.246.50.60:8545"); getJSON(ethPrice, function (error, response) { @@ -94,7 +95,7 @@ async function main() { proposecost = Number(ethusd) * Number(opStackGwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; console.log(commitcost, revealcost, proposecost, epochcost) - console.log('On ArbitrumOne Mainnet network. It will take take following cost for tx'); + console.log('On OP Stack Testnet network. It will take take following cost for tx'); console.log('Commit: $', commitcost); console.log('reveal: $', proposecost); console.log('propose: $', revealcost); @@ -106,12 +107,32 @@ async function main() { console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); console.log('========================================================'); + + console.log("ETHUSD", ethusd); + commitcost = Number(ethusd) * Number(baseGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(ethusd) * Number(baseGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(ethusd) * Number(baseGwei) * Number(median(proposes)) / 10 ** 9; + epochcost = commitcost + revealcost + revealcost; + console.log(commitcost, revealcost, proposecost, epochcost) + console.log('On Base Mainnet network. It will take take following cost for tx'); + console.log('Commit: $', commitcost); + console.log('reveal: $', proposecost); + console.log('propose: $', revealcost); + console.log('cost per epoch: $', epochcost); + console.log('cost per day if epoch = 5min: $', epochcost * 12 * 24); + console.log('cost per week if epoch = 5min: $', epochcost * 12 * 24 * 7); + console.log('cost per month if epoch = 5min: $', epochcost * 12 * 24 * 30); + console.log('cost per day if epoch = 1 hour: $', epochcost * 24); + console.log('cost per week if epoch = 1 hour: $', epochcost * 24 * 7); + console.log('cost per month if epoch = 1 hour: $', epochcost * 24 * 30); + console.log('========================================================'); + getJSON(maticPrice, function (error, response) { const maticusd = response.last; console.log("MATICUSD:", maticusd); - commitcost = Number(maticusd) * Number(baseGwei) * Number(median(commits)) / 10 ** 9; - revealcost = Number(maticusd) * Number(baseGwei) * Number(median(reveals)) / 10 ** 9; - proposecost = Number(maticusd) * Number(baseGwei) * Number(median(proposes)) / 10 ** 9; + commitcost = Number(maticusd) * Number(polyGwei) * Number(median(commits)) / 10 ** 9; + revealcost = Number(maticusd) * Number(polyGwei) * Number(median(reveals)) / 10 ** 9; + proposecost = Number(maticusd) * Number(polyGwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; // console.log(Number(ethusd),Number(gwei),Number(commits)) console.log('On Polygon network. It will take take following cost for tx'); From 3358d46e1a61ec072a3ae325db18c8d846019033 Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Tue, 21 May 2024 16:43:20 +0530 Subject: [PATCH 6/6] chore: conduit arb l3 --- scripts/gasAnalyze.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gasAnalyze.js b/scripts/gasAnalyze.js index 32e25e74..141c747a 100755 --- a/scripts/gasAnalyze.js +++ b/scripts/gasAnalyze.js @@ -41,7 +41,7 @@ async function main() { const opgwei = await getGasFeeData("https://opt-mainnet.g.alchemy.com/v2/B2TSPVLHcfePftR4ZdgRsjwoaWNAPP65"); const baseGwei = await getGasFeeData("https://base.meowrpc.com"); const polyGwei = await getGasFeeData("https://rpc-mainnet.maticvigil.com"); - const opStackGwei = await getGasFeeData("http://35.246.50.60:8545"); + const opStackGwei = await getGasFeeData("http://35.240.132.193:8547"); getJSON(ethPrice, function (error, response) { const ethusd = response.last; @@ -95,7 +95,7 @@ async function main() { proposecost = Number(ethusd) * Number(opStackGwei) * Number(median(proposes)) / 10 ** 9; epochcost = commitcost + revealcost + revealcost; console.log(commitcost, revealcost, proposecost, epochcost) - console.log('On OP Stack Testnet network. It will take take following cost for tx'); + console.log('On ARB L3 Stack Testnet network. It will take take following cost for tx'); console.log('Commit: $', commitcost); console.log('reveal: $', proposecost); console.log('propose: $', revealcost);