January 24, 2026

Capitalizations Index – B ∞/21M

Ethereum gas, gas limit, gas price

Ethereum gas, gas limit, gas price

Ethereum gas, gas limit, gas price

Ethereum gas, gas limit, gas priceThis video explains what Ethereum gas is and why you need to specify a gas limit and gas price when you make a transaction.

When a solidity contract is compiled it is converted into a sequence of operation codes also known as opcodes.
Opcodes are referenced by their mnemonic names such as ADD (for addition) or MUL (for multiplication).
All opcodes and their descriptions are available in the Ethereum yellow paper:
https://ethereum.github.io/yellowpaper/paper.pdf

Side note:
Byte codes are similar to opcodes but are represented by hexidecimal numbers.
The Ethereum Virtual Machine (EVM) executes the byte codes.

Each opcode has a fixed amount of gas assigned and is a measure of computational effort.
For example ADD requires 3 gas units, calculating SHA256 requires 60 gas units.
Gas is the execution fee, paid by the sender of the transaction that triggered the computation.
By default the minimum gas limit for all transactions = 21000 gas
Sending ether from one account to another = 21000 gas
Interacting with a smart contract = 21000 gas + all executed opcodes gas

For users it is impossible to know how much gas a transaction will actual require.
When executing a transaction a user can specify the maximum amount of gas it is willing to spend on the transaction.
This can be done in the gas limit field.
If the transaction is executed but is exceeds the gas limit, all changes are reversed but the user will still have to pay for performed computation, which is the gas limit.
If the transaction is executed but requires less gas than the gas limit, the user will only pay for the actual gas used.
It is not recommended to specify a large gas limit.
If you interact with a smart contract and the contract contains a bug you may exceed your gas limit.

Total fee = the total amount of gas used x gas price
The gas price is not fixed.
The user decides which gas price it is willing to pay in Gwei/gas.
The mainnet current gas price and block gas limit can be found at: https://ethstats.net
The rinkeby testnet current gas price and block gas limit can be found at: https://www.rinkeby.io
Miners prefers transactions with a higher fee.
Transactions with a lower fee will take longer to be included in a block.

Side note:
A block also has a gas limit field.
It defines the maximum amount of gas all transactions in the block combined are allowed to consume.
This block gas limit determines the maximum number of transactions within the block.
This block gas limit is not fixed.
The block gas limit is set by miners.
If the block gas limit is increased more transaction fees they get, but the more bandwidth and computing they would have to do.

Check out all my other Ethereum related tutorial videos:
https://goo.gl/eNJVXe

Subscribe to my YouTube channel:
https://goo.gl/61NFzK

The presentation used in this video tutorial can be found at:
http://www.mobilefish.com/developer/blockchain/blockchain_quickguide_ethereum_related_tutorials.html

The DemoContract.sol used in the video:
http://www.mobilefish.com/download/ethereum/DemoContract.sol.txt

To interact with the DemoContract.sol use the demonstration Ethereum Dapp (using Javascript Promises):
http://www.mobilefish.com/download/ethereum/DemoDapp.html

#mobilefish #howto #ethereum

Previous Article

Huobi Launches Cryptocurrency Exchange in Australia

Next Article

Huobi Launches Cryptocurrency Exchange in Australia

You might be interested in …

Bitcoin - web wednesday v83 - 063

Bitcoin – Web Wednesday V83 – 063

bitcoin – Web Wednesday V83 – 063bitcoin at Web Wednesday HK – 19th March 2014 83rd social mixer event – networking for the Hong Kong’s internet entrepreneurs and digital media executives. An interview with two […]

Midterms See Largest US State Elect Pro-Bitcoin Governor

Crypto New Media Midterms See Largest US State Elect Pro-bitcoin Governor Crypto New Media Press Twitter Facebook LinkedIn Only $89.00Ledger Nano S bitcoin and Ethereum Cryptocurrency Hardware Wallethttp://topchaneloutlet.infoOnly $2.50Bitcoin Rare 1oz. 999 Pre Solid Gold […]