15
votes
Accepted
How to calculate gas and storage for an operation?
There's no other way, you have to simulate what the operation does if you want to estimate this value, and this is exactly what a dry run does. You could try to reimplement it outside of a node, but ...
9
votes
Accepted
Fees in proto 003?
The information is available from the official documentation in the « Baker » section
https://tezos.gitlab.io/mainnet/protocols/003_PsddFKi3.html
The basic formula specifies that fees are now ...
8
votes
What is the difference between fee and gaslimit?
In Tezos, the fee is independant from the gas : whatever the gas consumed, you always pay the full fee.
However, bakers will probably compute the ratio fee/gas, and prefer transactions with higher ...
8
votes
What is gas on the Tezos network?
Gas represents computational cost related to a transaction, e.g. gas for basic transactions are about 10,000 units, where as more costly transactions that invoke smart contracts can cost a lot more.
...
7
votes
Accepted
Relative gas cost of map vs bigmap
Let's find out. We start by running a sandbox node. We'll originate two contracts, one for maps, the other for bigmap.
parameter (pair address nat);
storage (big_map address nat);
code
{
UNPAIR;
...
7
votes
Gas costs types in Michelson
There are eight types of costs:
1 Reading cost
2 Deserialization cost
3 Parsing cost
4 Type comparison cost
5 Interpreter cost
6 Unparsing cost
7 Serialization cost
8 Writng ...
5
votes
What is the difference between fee and gaslimit?
The full fee is always paid for every transactions - the gas limit is just that, a cap on the amount of gas a given transaction can consume. A baker can be guaranteed that they are paid at least fee/...
4
votes
Accepted
Gas consumption in a chain of internal transfers
You cannot exceed the hard_gas_limit_per_operation = 400000. It will probably be increased in future protocols, though (see e.g. the "Athens" proposals).
Internal transfers can use up a lot of gas.
...
4
votes
How to calculate price of gas
In Tezos, gas does not have a monetary translation. It does not "cost" you anything to execute a contract with 10 gas vs 1M gas. Gas is simply an internal limitation to prevent contracts from running ...
3
votes
Accepted
Are contract views typechecked when only the main contract code is called?
Yes, I think that currently, all the code and views are type-checked.
A workaround is to declare views are global constants. But there is no support for this in high-level SC languages for the moment ...
3
votes
Is Tezos blockchain vulnerable to "frontrunning"?
Choosing the order in which operations are applied is a privilege of the baker. So yes, frontrunning is possible on Tezos and can either be done by setting high fees (the default baker strategy is to ...
3
votes
How to calculate price of gas
After asking, there is no equivalent of a gas price in Tezos. You pay a transaction fee, and this fee should include everything. Doing some stats on the fees you may get an upper-bound on the gas ...
3
votes
Accepted
Michelson contract files - spaces, new lines and comments
No, whitespace and comments do not affect storage or gas costs.
The syntax of Michelson code and values is called "Micheline".
The concrete syntax (the way you actually write Micheline expressions ...
3
votes
Michelson gas cost optimizations: any techniques, patterns and rules of thumb
You may find this article useful: https://medium.com/tqtezos/how-to-minimize-transaction-costs-of-tezos-smart-contracts-9962347faf64
3
votes
Translating gas and storage units to XTZ
Storage price is 0.25tez per kilobyte. Gas units are not directly charged, see https://forum.tezosagora.org/t/psa-do-not-quote-gas-cost-in-tez/1618.
3
votes
How do baking node choose the transactions from the mempool
A baker is free to include whatever operations it wants, as long as they are valid. By default a baker want to create the block that generate the highest amount of fees (most bakers will also have a ...
2
votes
Fees in proto 003?
The fees have been updated for proto004 (athens) please have a look here going forward
https://github.com/keefertaylor/TezosKit/blob/master/docs/AthensProtocolFees.md
2
votes
Accepted
Michelson gas cost optimizations: any techniques, patterns and rules of thumb
What are you doing to reduce gas costs?
The first thing to do is to do algorithmic optimisation, without worrying about Michelson's own constraints.
Then, to make additional savings, lower level ...
2
votes
Accepted
Can a FAILWITH error be caused by improper gas_limit or storage_limit?
The only thing that can trigger a FAILWITH error is the execution of the FAILWITH instruction. You might however get a gas exhaustion error during the interpretation of a FAILWITH instruction, this ...
2
votes
Can't see 35% gas optimization on protocol 009
Florence gas optimizations are only about the Michelson interpreter.
During a call to a smart contract, gas is charged for the following things:
checking the signature of the operation
account ...
2
votes
When does a contract get gas locked?
Being gas locked means that some functions of the smart contract are not possible within the gas limit per operation.
2
votes
Accepted
Gas Exhausted error
I think this is an estimation bug on pytezos side, which only seems to happen for transactions without parameters.
Try the following:
<...>.transaction(
destination=targetAddr,
amount=...
2
votes
Accepted
Is there any way to compute the transaction fee of transfering xtz in python?
Have you tried the autofill method as described in the quickstart
Edit:
After providing more details that you are looking to calculate the fee separately so you can enable max sends.
I've not used ...
2
votes
What's wrong with my calculation of fees and burn here?
You need to multiply paid_storage_size_diff by 250, instead of 1000, because according to the current procotol constants cost per byte is 0.000250 tez. Also, don't forget to add +100 in the fees ...
1
vote
Accepted
Do partitions reduce gas usage?
short answer is 20.
Indeed partitions are compiled as set containers of identifiers. So your usage of partitions seems good 👍.
1
vote
How to calculate gas fee for transaction?
Have a look at file estimate.ts in the taquito repository.
The base value is what you call low, from there you just need to define some thresholds for average and fast.
Also remember, there is a ...
1
vote
Accepted
When does a contract get gas locked?
When the contract transaction reaches the hard_gas_limit_per_operation limit, it means that the given entry point is gas-locked. Both the storage & code deserialization and entry point execution ...
1
vote
Does Tezos largely adopt the gas model from Ethereum?
There are gas caps per operation, and an overall gas cap per block. Each 'step' within a contract has a gas cost, so you can pre-calculate (in a sense) how much gas it could take. The cost of these ...
1
vote
Accepted
gas_exhausted.operation when sending max balance
The answer given by Raphael Cauderlier in the gitlab issue helped solve the issue:
"I have tried to reproduce this in sandbox (well, actually in mockup client); I think your problem is that 100 ...
1
vote
Increase gas_limit for tz1 to tz1 transfers
You can set the gas limit to whatever you want. Say 20000. Tezos will only consume however much it needs. If it only needs 5000, then it'll only consume 5000, not 20000.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
gas × 35fees × 9
smart-contracts × 7
michelson × 6
transactions × 5
protocol × 4
fee × 4
storage × 3
archetype × 3
baking × 2
rpc × 2
operation × 2
contract × 2
bigmap × 2
smartpy × 1
error × 1
liquidity × 1
security × 1
block × 1
blockchain × 1
mempool × 1
testing × 1
sandbox × 1
consensus × 1
performance × 1