generated at
web3.js - Block Gas Limit を取得する
web3.js を使用して、Ethereum の Block Gas Limit を取得する方法です。
web3.eth.getBlock で返されるオブジェクトの gasLimit プロパティの値を参照します。

サンプルコード
example.js
web3.eth.getBlock("latest", false, (error, result) => { console.log(result.gasLimit) // => 8000029 });

動作デモ
demo.js
const web3 = new Web3(Web3.givenProvider || 'wss://mainnet.infura.io/ws') web3.eth.getBlock("latest", false, (error, result) => { console.log(result.gasLimit) $(document.body).append('<h1>The latest Block Gas Limit</h1>') $(document.body).append('<p><input type="text" size="10" value="' + result.gasLimit + '" readonly> gas</p>') })

メモ
Block Gas Limit についてのメモは Ethereum の Block Gas Limit を取得 を参照してください。

参考

関連