[Ethereum] Gas limit and transaction fee in clique POA chain

go-ethereum

I set a private POA private chain using default setting of Puppeth tool.
The gaslimit in genesis.json is:

"gasLimit": "0x47b760"

The decimal number of gasLimit is 4700000

then I start node by command:

geth --networkid 123456 --rpc --rpcport "8545" --rpccorsdomain "*" --datadir ./enode1/data --syncmode 'full' --port "2001"  --rpcaddr "0.0.0.0" --rpcapi "admin,db,eth,miner,web3,net,personal,txpool" --unlock '0x3261d0a3ed09ab00f67537e1df22741217d6bf04' --password password.txt

I sent a transaction form one account to another. I found the coin.base account got block signature reward:

> eth.getBalance(eth.coinbase)
0
> eth.sendTransaction({from:'0x4fa18a0cbbdc16dbadd4ffda9adad8ec68eec87b',to:'0xf16a44cf48cca573c89de520b21f7fe00391c705',value:web3.toWei(1,"ether")})
"0xe97cee9e7aa36d3569b90c6290d363e12308ed33e0c4c73f73da56e053cc3e06"
> eth.getBalance(eth.coinbase)
21000000000000
> eth.gasPrice
1000000000

Question:
Why is transaction fee 21000000000000 Wei here,how is it calculated?
For gas price, it is set to 1000000000 by default, how to change it?

I get the gasLimit of each block as below:

> web3.eth.getBlock(0).gasLimit
4700000
> web3.eth.getBlock(1).gasLimit
4704588
> web3.eth.getBlock('latest').gasLimit
6816517
> web3.eth.getBlock('latest').gasLimit
6829834
> web3.eth.getBlock('latest').gasLimit
6836502
> web3.eth.getBlock('latest').gasLimit
6836502
> web3.eth.getBlock('latest').gasLimit
6836502
> web3.eth.getBlock('latest').gasLimit
8000000
> web3.eth.getBlock('latest').gasLimit
8000000
> web3.eth.getBlock('latest').gasLimit
8000000

Why does the gasLimit increase gradually? it keeps constant when it reaches 8000000.
I think the gasLimit value should be set 8000000 by default,where it is configured,and how to change it?

Thanks.

Best Answer

Simple Ethereum transaction is 21000 GWei ( 21000000000000 Wei ) and this is the minimum - contract interactions are taking more gas. The gas price is provided from the sender of the transaction. On the node you can set a minimum acceptable gasprice with

--gasprice "18000000000" Minimal gas price to accept for mining a transactions

gasLimit is configured in your genesis block json file, but it's a dynamic value and also from https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options

--targetgaslimit value Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)

Related Topic