New answers tagged

1

Short answer is: not necessary. ERC-20 standard requires token owner to personally initiate, or at least approve all transfers of his tokens, so when using ERC-20 functions, token owner has to execute some transaction from his own address in order to move tokens forward. If token owner uses an Externally Owned Address (EOA) to hold tokens, then executing ...


0

Mostly: yes. They can receive the tokens but if they want to transfer them onwards they need Ether to pay for the gas fees. There are various schemes to let someone else pay for the gas, see for example here: How to make someone else pay for Gas? . One option not (directly) mentioned there is meta transactions but that is also something quite new and not ...


0

For calls, gas is charged only when called by a contract. When you call a view function, it is executed locally. the transaction is not broadcast. it is free. But when the view function is called by a contract. it is executed by others, the transaction may be recorded on blockchain.


0

This kind of strange results are caused by different optimizations performed by the compiler. I'm really not an expert in compiler optimization but the idea is to pack similar functionality into chunks to reduce the size. In some cases adding unrelated things to the contract breaks optimization of the existing code and the earlier code is not so efficient ...


1

You can follow this website they have provided their API as well click here and you can get a lot of other detailed information as well


2

There is no cost associated with calling bytes32[] off-chain. If you are using this data for your application, then the off-chain call is free. If you are calling it on-chain, there will be a cost associated with each lookup and therefore it will be possible to run out of gas. To get each value of the array, you will need to loop through the array. The cost ...


0

I have seen this when calling the same contract method twice from JavaScript without waiting for the first call to finish by either await or calling a second time in the success callback. My guess is that contract methods in web3js are not thread safe.


0

Because if not paid one could spam miners with setting insufficient gas limits, making miner execute the transaction and not get paid. Think of this as the opportunity cost of the miner.


4

A reverted transaction generally means that the logic of the smart contract being used failed or there's not enough gas to complete the transaction. The transaction was still executed by the miner, and any gas used prior to the transaction being reverted needs to be paid for. Based on this, the reverted transaction is still mined and included into the block ...


0

I tried to compile your contract with Solidity 0.4.18 with optimizations disabled, and deploy costs 3,224,320 gas for me. However, with optimizations it consts only 1,682,401 gas. So either enable optimizations or increase gas limit. The warning about infinite gas look like static analyser bug. The following line is treated as consuming infinite gas: ...


0

I do non know your application, but there I see a “decimal()” with infinite gas estimation. If it is something like the same function in ERC20 it is not justified. May be you are dereferencing to other SC that are not known at the deploy time, or that you use dynamic arrays, strings included, or that you have for loops with indefinite maximum number of ...


0

Apparently if you want to forward all the balance in a contract, you cannot have any amount available to pay the gas needed for the transaction. That is: you need to have the sum of the contract balance (the amount you want to forward) + the gas needed to run the transaction and, unluckily, you have “the balance” only. Let’s say that you send 100 ether to ...


0

Based on the comments, it's likely just gas estimation problem and you can resolve it by supplying more gas. You can force a certain amount of gas to be sent forward using a syntax that might look a little scary. This sort of a long-hand way to do a send: bool success = address(0).call.value(msg.value).gas(2300)(abi.encodeWithSelector("")); Some caveats: ...


2

Overall fee you pay for a transaction, counted in fiat currency (EUR, USD, etc), depends on the following things: Ether to fiat exchange rate (may change over time, out of your control) Gas price (set by you, but miners may reject mining your transaction if gas price is too low) Actual gas used, this depends on what smart contract actually do and how ...


Top 50 recent answers are included