Hot answers tagged

15

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 the approach would be the same.


9

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 dependent on 3 parameters: a fixed minimum fee, a fee by storage unit and a fee by gas unit (reflection the cost of performing calculations). Those 3 parameters are ...


8

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 fee/gas, i.e. more reward for less computation.


8

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. Currently there is a fixed gas limit per operation of 400,000 units, and a fixed gas limit per block of 4,000,000 units. This is quite limiting for transactions ...


7

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 cost More documentation is available in this document https://gitlab.com/morley-framework/morley/-/blob/e2d3cf9197804a2cfa92715e1a4d640fe5b87af7/docs/...


7

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; UNPAIR; DIP { SOME }; UPDATE; NIL operation; PAIR; }; (this is the big_map version, the map version is the same with the type "bigmap" ...


5

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/gas_limit per unit of gas consumed, even if they consume less. Some bakers will also enforce a minimum per_gas fee, which is currently set to 0.1 mutez (or 1 ...


4

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. First, there is a fixed cost of 10000 gas per transfer. Second, and more importantly, when a contract is 'parsed', the contract's entire code and storage are ...


3

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 apply transactions with high fees first) or by the bakers themselves when they build their blocks. The simplest protection against frontrunning is to run your ...


3

You may find this article useful: https://medium.com/tqtezos/how-to-minimize-transaction-costs-of-tezos-smart-contracts-9962347faf64


3

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

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 in text, with whitespace and comments, etc) is used by clients for the convenience of humans. It is also validated to prevent some obfuscation tricks -- ...


3

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 amok. https://forum.tezosagora.org/t/psa-do-not-quote-gas-cost-in-tez/1618


3

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 minimum fee threshold to pass prevalidation). In combinatorial optimization this is described as a knapsack problem. So how the baker choose transactions is ...


2

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

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 price.


2

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 optimisations can be done : • organise the stack so as to reduce the number of stack operations, • In a complex contract where the optimisation of one entry ...


2

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 can happen for example if the value that is thrown by FAILWITH is large because it will be costly to serialize.


2

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 management (debiting the caller and crediting the smart contract) fetching the script and the storage of the contract from disk conversion from a byte sequence to an ...


1

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 extra gas units are not enough to empty an account, apparently this consumes 400 gas units. Here is what I did (mockup_client is an alias for tezos-client --mode ...


1

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.


1

According to the official documentation available here you can get the gas and storage cost of the operation you plan to broadcast to the network by passing the parameter --dry-run to the client node Quoting the doc it mentions Another important use of validation is to determine gas and storage limits. The node first simulates the execution of a ...


Only top voted, non community-wiki answers of a minimum length are eligible