Ethereum-SE06

Web3

1
geth attach http://localhost:8545

eth

getStorageAt

获取存储值

1
2
/// 获取 WBTC 的 totalSupply
eth.getStorageAt('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 1)

https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#getstorageat

EIP-1559

baseFeePerGas(不可配置):交易基础费用(会被直接燃烧掉)

maxPriorityFeePerGas:最大支付给矿工的费用(给矿工的小费,可提高交易成功率)

maxFeePerGasbaseFeePerGas + maxPriorityFeePerGas

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// web3 1.5.1
if (tx.gasPrice) {
// Using legacy gasPrice property on an eip-1559 network,
// so use gasPrice as both fee properties
maxPriorityFeePerGas = tx.gasPrice;
maxFeePerGas = tx.gasPrice;
delete tx.gasPrice;
} else {
maxPriorityFeePerGas = tx.maxPriorityFeePerGas || '0x3B9ACA00'; // 1 Gwei
maxFeePerGas = tx.maxFeePerGas ||
utils.toHex(
utils.toBN(block.baseFeePerGas)
.mul(utils.toBN(2))
.add(utils.toBN(maxPriorityFeePerGas))
);
}

baseFeePerGas在计算的时候可以给多一点,因为多余的会被退回来。可以通过getBlockByNumber('latest')获取最后一个区块的baseFeePerGas