Eth trx contains Gas price in wei.
In which unit gas limit is?
Example:
gasPrice:’4913004657’(this is in wei)
gaslimit:165188(in what unit this is?)
Dec 8, 2020, 3:49 PM
anyone?
like how i can calculate that this is the limit level of total ETH consumption for gas. If gas limit not in wei or Gwei or Ether?
Dec 8, 2020, 3:58 PM
Imagine you have to go from a to b with a small car. It will need 90 gas to go to it. But you have to fill your car up first. You go to a petrol station and offer them 1 WEI per gas. They accept every offer, no matter from who and how much, however, if now someone comes in and offers 2 WEI per gas, their offer will be taken faster. Now your offer gets accepted, you pay 90*1 WEI = 90 WEI and fill your tank with 90 gas and go from a to b.
- a and b are transaction operations (like send, calls etc.)
- Your car is the tx and how much gas it will need.
- Gas limit is how much gas you allow the tx to take, it won't take more than needed.
- Gas is the required gas to finish the tx.
- Gas price is what YOU offer, you can offer as low but also as high as you want PER GAS not for the full transaction (!)
- The tx price is gas * gas price, where the required gas is depending on the operations that are done and the gas price is your offer per gas.
Scenario 2: You fill your tank only with 80 gas. Your car won't reach b, the transaction will be reverted (not enough gas).
Scenario 3: You set the limit to 100. Since it only takes 80 gas to go from a to b (make the transaction) you also only pay 80 gas.
Scenario 4: Your car is way bigger (a truck) and you will need 150.000 gas (way more transactions and state changes). You set the gas limit to 160.000 but pay 150.000 * 1 WEI = 0,0015 ETH
Scenario 5 (WORST CASE): You accidentally offer 1.000 WEI per gas (gas price) as you misunderstand gas price and gas limit. You will pay 1.000 * 150.000 WEI = 1,5 ETH for the transaction.
- a and b are transaction operations (like send, calls etc.)
- Your car is the tx and how much gas it will need.
- Gas limit is how much gas you allow the tx to take, it won't take more than needed.
- Gas is the required gas to finish the tx.
- Gas price is what YOU offer, you can offer as low but also as high as you want PER GAS not for the full transaction (!)
- The tx price is gas * gas price, where the required gas is depending on the operations that are done and the gas price is your offer per gas.
Scenario 2: You fill your tank only with 80 gas. Your car won't reach b, the transaction will be reverted (not enough gas).
Scenario 3: You set the limit to 100. Since it only takes 80 gas to go from a to b (make the transaction) you also only pay 80 gas.
Scenario 4: Your car is way bigger (a truck) and you will need 150.000 gas (way more transactions and state changes). You set the gas limit to 160.000 but pay 150.000 * 1 WEI = 0,0015 ETH
Scenario 5 (WORST CASE): You accidentally offer 1.000 WEI per gas (gas price) as you misunderstand gas price and gas limit. You will pay 1.000 * 150.000 WEI = 1,5 ETH for the transaction.
Dec 8, 2020, 4:07 PM
Like always, Thanks to make me understand in such a brief way.
is there a way to estimate gas for a trx?
Dec 8, 2020, 4:15 PM
depends on network
Dec 8, 2020, 4:18 PM
if using eth mainnet and testnet then?
Dec 8, 2020, 4:19 PM
the gas usage remains same across the networks
Dec 8, 2020, 4:21 PM
yes usage remains same across the network.
Dec 8, 2020, 4:23 PM
https://etherscan.io/gastracker
Dec 8, 2020, 4:23 PM
Yes there is, for example when you interact with dApps via MetaMask, it will already send you an estimate of the required gas. Also in Remix when calling contract functions you can see "transaction costs" and "execution costs". However, note here that the cost may be different in the end in mainnet and testnets, I didn't test it yet.
Plus the costs are in gas, so to get a real tx cost you have to multiply it with the gas price you offered.
Dec 8, 2020, 4:35 PM
Correct
Dec 8, 2020, 4:35 PM
The best thing to do is to work for example with ropsten but set the gas price to the current price from the mainnet. You then *maybe* get accurate results.
Dec 8, 2020, 4:35 PM
Alright
Dec 8, 2020, 4:37 PM
Quick test: In the VM it costed 193646 gas to deploy the small contract I made while in ropsten it costed 168,218 and in mainnet it would cost the same. So really the thing you have to do is to just adjust the gas price to a price seen in a gas price tracker.
VM is never really accurate when it comes to possibilities (since for example already internal txs are limited).
Dec 8, 2020, 4:42 PM
what are the internal addresses like 0x0000000...0000 and others like 0x00000...1000? second I saw on binance smart chain.
second is smart contract from genesis block, but internally what is it? probably zeros are like self of contract but what about 0x1111111111 and so on
Dec 8, 2020, 5:54 PM
What do you mean with internal addresses?
Dec 8, 2020, 6:03 PM
I saw 0x000000000000 address many times in internal transactions of a contract
Dec 8, 2020, 6:36 PM
i have enough fund in my wallet but still i’m facing “insufficient fund for intrinsic transaction cost”
i also check by calculating through ((gaslimit* gasPrice)+ value)before trx and still fund are more than total value get by calculating. Any idea?
i also check by calculating through ((gaslimit* gasPrice)+ value)before trx and still fund are more than total value get by calculating. Any idea?
Dec 8, 2020, 6:40 PM
The address https://etherscan.io/address/0x0000000000000000000000000000000000000000 is also known as the burn address because noone has access to it and noone will ever get access to it. So it's an other way to burn tokens and reduce the token supply making each remaining token worth more.
What did you try to do and where does it show the error?
Dec 8, 2020, 6:46 PM
I was doing a mistake. now it’s fine
Dec 8, 2020, 7:23 PM
I know I meant they use it like for inside transaction.
I thought inside in sc some transfers to and from 0x000000 means contract itself?
I saw trx from 0x000000 not only to, I will find and show
I thought inside in sc some transfers to and from 0x000000 means contract itself?
I saw trx from 0x000000 not only to, I will find and show
btw why there is ethdev? 500k coins whould be enough for pos launch https://etherscan.io/address/0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae, but they decided to make a new one, what is ethdev for?
Dec 8, 2020, 7:28 PM
What do you mean?
Dec 8, 2020, 8:34 PM
https://ropsten.etherscan.io/address/0x0000000000000000000000000000000000000000
Dec 8, 2020, 10:54 PM
What has that to do with ethdev?
Dec 8, 2020, 10:58 PM
Nothing, it's different questions
Dec 8, 2020, 11:36 PM
I meant what do you mean with this 😅
Dec 8, 2020, 11:59 PM
smart contract named ethdev with 500k ether on it
Dec 9, 2020, 12:10 AM
"but they decided to make a new one, what is ethdev for?" the contract is 5 years old 😅
Dec 9, 2020, 12:12 AM
yes, they made eth2.0 contract to collect coins, but they already have 500k eth, what is that contract for?
Dec 9, 2020, 12:13 AM
The contract you sent is that of the Ethereum Foundation, basically the makers of ethereum. The contract that you mean, however, is the staking aka. deposit contract which does NOT go to them. It's, as the name suggest, part of Ethereum 2.0 which will work on proof of stake.
Dec 9, 2020, 12:28 AM
but why they need the first for eth foundation? it's like donation address or anything else?
Dec 9, 2020, 12:32 AM
That's for the development of ethereum. They have, no wonder, devs who do not work for free 😅
And much other costs etc.
Dec 9, 2020, 12:33 AM
Its the amount reserved for eth developers. Just like the token share when developing new erc20 tokens...
Dec 9, 2020, 6:17 AM
These are the people who are building ethereum day-in, day-out. Ofcourse, they’ll need their basic expenses taken care of, as well as infrastructure costs.
Dec 9, 2020, 6:22 AM
Exactly
Dec 9, 2020, 6:22 AM
From a security perspective, what is your opinion on grouping mulitple transactions in a single function?
On the hindsight, it saves a significant operational costs for a defi/dex product.
On the hindsight, it saves a significant operational costs for a defi/dex product.
Dec 9, 2020, 8:08 AM
Really depends on the case, but generally speaking that's not a problem, security wise.
Dec 9, 2020, 8:31 AM
Transaction in the sense multiple arithmetic/logic operations or ETH transfer?. In both case, there is no concern in security. Only transactions inside loops are to be taken care of
Dec 9, 2020, 8:35 AM