In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How the block of Eth is packed, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
The maximum number of transactions packaged in a chunk is determined by the gas limit of the chunk. Note that the gas limit here is the gas limit of the chunk, not the gas limit of the transaction. It can be approximately understood that the gas limit of a block is the sum of the actual gas used by all transactions in that block.
In a block, the order in which transactions are packaged is in the order of gas price. Of course, absenteeism's own transactions are usually at the top of the list.
May be the reason for absenteeism mining software, there are a lot of empty blocks.
The gas limit of each transaction may be very different from the gas actually used by the deal.
Question:
When multiple transactions have the same gas price, how is the order in the block determined?
Import {JsonRpcProvider} from "@ ethersproject/providers"; import {ethers} from "ethers" / / get the information of the transaction block and there is no gasUsed field in the transaction list / / transaction list of this block. If you need to obtain gasUsed, you need to call the API getTransactionReceipt to query async function getBlockTxs (provider: JsonRpcProvider, block: number | string) {return provider.getBlockWithTransactions (block)}. (async () = > {let localProvider = new ethers.providers.JsonRpcProvider ({url:''}, 'mainnet') let block = 11372138 for (let I = 0; I < 50) I + +) {let txs = await getBlockTxs (localProvider, block+i) let gasLimit = txs.gasLimit.toNumber () / / console.log ('block gas limit:', gasLimit) let transactions = txs.transactions, totalGas = 0, totalUsed = 0 / / console.log (transactions [0]) for (let I = 0; I < transactions.length ) {let tx = transactions [I] totalGas + = tx.gasLimit.toNumber () let rTx = await localProvider.getTransactionReceipt (tx.hash) totalUsed + = rTx.gasUsed.toNumber () / / console.info ('block=%d index=%d gasPrice=%d gasLimit=%d usedRatio=%d totalGas=%d totalUsed=%d', block, / / I, tx.gasPrice.div (GWei). ToNumber () Tx.gasLimit.toNumber (), rTx.gasUsed.mul (100) .div (tx.gasLimit). ToNumber (), totalGas, totalUsed)} console.info ('block=%d blockGasLimit=%d totalGas=%d totalUsed=%d', block+i, gasLimit, totalGas TotalUsed)}}) () block=11372138 blockGasLimit=12481619 totalGas=25997923 totalUsed=12473572block=11372139 blockGasLimit=12493807 totalGas=42940607 totalUsed=12476950block=11372140 blockGasLimit=12481608 totalGas=25078349 totalUsed=12043096block=11372141 blockGasLimit=12493796 totalGas=27022444 totalUsed=12487147block=11372142 blockGasLimit=12500000 totalGas=22645996 totalUsed=12493723block=11372143 blockGasLimit=12506095 totalGas=22893218 totalUsed=12496704block=11372144 blockGasLimit=12500000 totalGas=31048160 totalUsed=12480116block=11372145 blockGasLimit=12487794 totalGas=22559614 totalUsed=12309872block=11372146 blockGasLimit=12499988 totalGas=24119898 totalUsed=12492163block=11372147 blockGasLimit=12506081 totalGas=21924202 totalUsed=12496671block=11372148 blockGasLimit=12493870 totalGas=24220866 totalUsed=12485457block=11372149 blockGasLimit=12481670 totalGas=30033765 totalUsed=12427012block=11372150 blockGasLimit=12493858 totalGas=28686643 totalUsed=12483406block=11372151 blockGasLimit=12500000 totalGas=31961412 totalUsed=12497551block=11372152 blockGasLimit=12487794 totalGas=33613986 totalUsed=12458057block=11372153 blockGasLimit=12499988 totalGas=24284337 totalUsed=12491038block=11372154 blockGasLimit=12506079 totalGas=26059761 totalUsed=12506039block=11372155 blockGasLimit=12493868 totalGas=32729299 totalUsed=12492179block=11372156 blockGasLimit=12499967 totalGas=23658650 totalUsed=12486884block=11372157 blockGasLimit=12487762 totalGas=21961423 totalUsed=12474256block=11372158 blockGasLimit=12499956 totalGas=33268172 totalUsed=12483959block=11372159 blockGasLimit=12506038 totalGas=0 totalUsed=0block=11372160 blockGasLimit=12493827 totalGas=39459443 totalUsed=12492541block=11372161 blockGasLimit=12500000 totalGas=31209609 totalUsed=12498393block=11372162 blockGasLimit=12506102 totalGas=27257576 totalUsed=12503912block=11372163 blockGasLimit=12518284 totalGas=50218838 totalUsed=12503856block=11372164 blockGasLimit=12506061 totalGas=27976755 totalUsed=12505035block=11372165 blockGasLimit=12493850 totalGas=54951578 totalUsed=12477118block=11372166 blockGasLimit=12500000 totalGas=30783166 totalUsed=12484261block=11372167 blockGasLimit=12506081 totalGas=27590667 totalUsed=12500771block=11372168 blockGasLimit=12493870 totalGas=32379572 totalUsed=12473748block=11372169 blockGasLimit=12481670 totalGas=27596013 totalUsed=12472659block=11372170 blockGasLimit=12469482 totalGas=25644061 totalUsed=12449695block=11372171 blockGasLimit=12481658 totalGas=27973875 totalUsed=12473614block=11372172 blockGasLimit=12493846 totalGas=28867697 totalUsed=12335617block=11372173 blockGasLimit=12500000 totalGas=24431156 totalUsed=12489721block=11372174 blockGasLimit=12512206 totalGas=27373387 Is it helpful for totalUsed=12492328block=11372175 blockGasLimit=12518288 totalGas=21555614 totalUsed=12501095block=11372176 blockGasLimit=12506065 totalGas=56709220 totalUsed=12497070block=11372177 blockGasLimit=12512160 totalGas=24697457 totalUsed=12505347block=11372178 blockGasLimit=12499943 totalGas=19120028 totalUsed=12479333block=11372179 blockGasLimit=12506018 totalGas=25932080 totalUsed=12496731block=11372180 blockGasLimit=12493807 totalGas=41795302 totalUsed=12481165block=11372181 blockGasLimit=12481608 totalGas=25959547 totalUsed=12469426block=11372182 blockGasLimit=12469420 totalGas=52977503 totalUsed=12464632block=11372183 blockGasLimit=12481596 totalGas=25338396 totalUsed=12472763block=11372184 blockGasLimit=12493784 totalGas=35134413 totalUsed=12487281block=11372185 blockGasLimit=12500000 totalGas=36800994 totalUsed=12498440block=11372186 blockGasLimit=12487794 totalGas=20094351 totalUsed=12475535block=11372187 blockGasLimit=12499988 totalGas=20561891 totalUsed=12487291 to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.