From ea6895cd169cb346ab73934fbaaf7f1290db7e5b Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Wed, 27 Sep 2023 15:56:57 +0800 Subject: [PATCH 1/6] testnet params --- scripts/deploy.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index 488fa32..d02fa2b 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -2,26 +2,33 @@ const hre = require("hardhat"); async function main() { let StorageContract = await hre.ethers.getContractFactory("TestEthStorageContractKZG"); + const startTime = Math.floor(new Date().getTime() / 1000); + let storageContract = await StorageContract.deploy( [ - 17, // maxKvSizeBits - 30, // shardSizeBits ~ 1G + 17, // maxKvSizeBits, 131072 + 40, // shardSizeBits ~ 1T 2, // randomChecks - 1000000, // minimumDiff - 60, // cutoff + 10000000, // minimumDiff 10000000 / 60 = 16,666 sample/s is enable to mine, and one sAX101 can provide 1M/12 = 83,333 sample/s power + 60, // cutoff, means 1 minute for testnet and may need to change longer later 1024, // diffAdjDivisor - 100, // treasuryShare + 100, // treasuryShare, means 1% ], - 0, // startTime - 0, // storageCost - 0, // dcfFactor - 1048576, // nonceLimit + startTime, // startTime + 10000, // storageCost - 300GWei per year per blob - https://ethresear.ch/t/ethstorage-scaling-ethereum-storage-via-l2-and-da/14223/6#incentivization-for-storing-m-physical-replicas-1 + 340282365167313208607671216367074279424n, // dcfFactor, it mean 0.85 for yearly discount + 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s "0x0000000000000000000000000000000000000000", // treasury - 0, // prepaidAmount + 10000000, // prepaidAmount - ~ 1000 blob cost, and for 1T data, it is about 1000 / 8388608 = 0.00012 { gasPrice: 30000000000 } ); await storageContract.deployed(); console.log("storage contract address is ", storageContract.address); + + // fund 1 eth into the storage contract to give reward for empty mining + const tx = await storageContract.sendValue({ value: ethers.utils.parseEther("1") }); + await tx.wait(); + console.log("balance of " + storageContract.address, await hre.ethers.provider.getBalance(storageContract.address)); } // We recommend this pattern to be able to use async/await everywhere From 22bef157638ea5e2dee63f5c23e386f04a4d5875 Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Wed, 27 Sep 2023 18:57:04 +0800 Subject: [PATCH 2/6] 1T to 1G --- scripts/deploy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index d02fa2b..789441a 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -7,7 +7,7 @@ async function main() { let storageContract = await StorageContract.deploy( [ 17, // maxKvSizeBits, 131072 - 40, // shardSizeBits ~ 1T + 30, // shardSizeBits ~ 1G 2, // randomChecks 10000000, // minimumDiff 10000000 / 60 = 16,666 sample/s is enable to mine, and one sAX101 can provide 1M/12 = 83,333 sample/s power 60, // cutoff, means 1 minute for testnet and may need to change longer later @@ -19,7 +19,7 @@ async function main() { 340282365167313208607671216367074279424n, // dcfFactor, it mean 0.85 for yearly discount 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s "0x0000000000000000000000000000000000000000", // treasury - 10000000, // prepaidAmount - ~ 1000 blob cost, and for 1T data, it is about 1000 / 8388608 = 0.00012 + 10000000, // prepaidAmount - ~ 1000 blob cost, and for 1G data, it is about 1000 / 8192 = 0.12 { gasPrice: 30000000000 } ); await storageContract.deployed(); From 906ef2f7c8dc92bc10cf3809a1c4a05442e9457f Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Thu, 28 Sep 2023 16:00:06 +0800 Subject: [PATCH 3/6] adjust param --- scripts/deploy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index 789441a..bf1c6f5 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -15,11 +15,11 @@ async function main() { 100, // treasuryShare, means 1% ], startTime, // startTime - 10000, // storageCost - 300GWei per year per blob - https://ethresear.ch/t/ethstorage-scaling-ethereum-storage-via-l2-and-da/14223/6#incentivization-for-storing-m-physical-replicas-1 + 2000000000000, // storageCost - 2000Gwei forever per blob - https://ethresear.ch/t/ethstorage-scaling-ethereum-storage-via-l2-and-da/14223/6#incentivization-for-storing-m-physical-replicas-1 340282365167313208607671216367074279424n, // dcfFactor, it mean 0.85 for yearly discount 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s "0x0000000000000000000000000000000000000000", // treasury - 10000000, // prepaidAmount - ~ 1000 blob cost, and for 1G data, it is about 1000 / 8192 = 0.12 + 200000000000000, // prepaidAmount - ~ 100 blob cost, and for 1G data, it is about 100 / 8192 = 0.012 { gasPrice: 30000000000 } ); await storageContract.deployed(); From 8bb475a14c6d85ae33a247e9d76df62be05847e7 Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Tue, 17 Oct 2023 11:46:41 +0800 Subject: [PATCH 4/6] more comments --- scripts/deploy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index bf1c6f5..21ae946 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -9,7 +9,7 @@ async function main() { 17, // maxKvSizeBits, 131072 30, // shardSizeBits ~ 1G 2, // randomChecks - 10000000, // minimumDiff 10000000 / 60 = 16,666 sample/s is enable to mine, and one sAX101 can provide 1M/12 = 83,333 sample/s power + 10000000, // minimumDiff 10000000 / 60 = 16,666 sample/s is enable to mine, and one AX101 can provide 1M/12 = 83,333 sample/s power 60, // cutoff, means 1 minute for testnet and may need to change longer later 1024, // diffAdjDivisor 100, // treasuryShare, means 1% @@ -17,9 +17,9 @@ async function main() { startTime, // startTime 2000000000000, // storageCost - 2000Gwei forever per blob - https://ethresear.ch/t/ethstorage-scaling-ethereum-storage-via-l2-and-da/14223/6#incentivization-for-storing-m-physical-replicas-1 340282365167313208607671216367074279424n, // dcfFactor, it mean 0.85 for yearly discount - 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s + 1048576, // nonceLimit 1024 * 1024 = 1M samples and finish sampling in 1.3s with IO rate 6144 MB/s: 4k * 2(random checks) / 6144 = 1.3s "0x0000000000000000000000000000000000000000", // treasury - 200000000000000, // prepaidAmount - ~ 100 blob cost, and for 1G data, it is about 100 / 8192 = 0.012 + 8192000000000000, // prepaidAmount - ~ 50% discount, 4096 blob cost for 1G data { gasPrice: 30000000000 } ); await storageContract.deployed(); From c8949c7b8a83956a11b5830a83e43574e47a3e91 Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Tue, 17 Oct 2023 11:48:04 +0800 Subject: [PATCH 5/6] refund 10 eth to the contract --- scripts/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index 21ae946..a3e7ca8 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -26,7 +26,7 @@ async function main() { console.log("storage contract address is ", storageContract.address); // fund 1 eth into the storage contract to give reward for empty mining - const tx = await storageContract.sendValue({ value: ethers.utils.parseEther("1") }); + const tx = await storageContract.sendValue({ value: ethers.utils.parseEther("10") }); await tx.wait(); console.log("balance of " + storageContract.address, await hre.ethers.provider.getBalance(storageContract.address)); } From 3f60f0e65b46061947cc033b64dcb6a6b63835a5 Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Tue, 17 Oct 2023 11:48:38 +0800 Subject: [PATCH 6/6] comment --- scripts/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index a3e7ca8..12aeed8 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -25,7 +25,7 @@ async function main() { await storageContract.deployed(); console.log("storage contract address is ", storageContract.address); - // fund 1 eth into the storage contract to give reward for empty mining + // fund 10 eth into the storage contract to give reward for empty mining const tx = await storageContract.sendValue({ value: ethers.utils.parseEther("10") }); await tx.wait(); console.log("balance of " + storageContract.address, await hre.ethers.provider.getBalance(storageContract.address));