All Questions
Tagged with gas-estimate contract-development
21 questions
0
votes
1
answer
25
views
Gas estimation failed for marketplace contract
i receive an error upon trying to interact with buy function in my contract below
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol&...
0
votes
1
answer
41
views
Smart contract unpredictable gas for seemingly simple method
I'm having an issue where a method that seems straightforward is showing a huge amount of gas requirements. I tried to run it from the verified polygonscan UI and metamask tells me it can't estimate ...
1
vote
0
answers
27
views
I don't know why my contract have a problem. Gas estimation and Gas exceeds Problem [closed]
pragma solidity >=0.4.24 <=0.5.6;
contract Indian {
mapping (address => uint16) myGame;
address public owner;
constructor() public {
owner = msg.sender;
}
...
0
votes
1
answer
1k
views
How to refund gas to the smart contract caller? (What is the number?)
I have this function:
function setAccount(BaseUBI _ubi, address _user, uint256 _startTime, uint _esiaID, bool _setToZero) external {
uint256 _refund = (gasleft() + 0/*FIXME*/) * tx....
1
vote
0
answers
204
views
Execution erorr: Invalid opcode on estimateGas | Possible unhandled promise rejection
pragma solidity ^0.5.0;
I get invalid opcode error when trying to estimate gas needed for my transaction from react-native using the following line of code:
const gasAmount = await contract.methods
...
1
vote
1
answer
141
views
How can I reduce the gas price for the fallback function?
Below is my fallback function for ethereum. It currently require 91000 gaslimit which is way more than 21000. Metamask always starts the transaction with 21000 gas stipend due to which transaction ...
0
votes
1
answer
500
views
Calculated Gas Costs of Contract execution
I have a smart contract that maps a string to a string value and stores it on the Blockchain. I want to analyse the Gas Used by Transaction. One time the execution consumes 92,843 Gas (https://rinkeby....
1
vote
1
answer
4k
views
Estimate Gas For Smart Contract Always Fails
I have deployed a very simple contract to the Ethereum blockchain to be able to split a payment across two different outputs.
pragma solidity ^0.5.0;
contract MoonTrade
{
function multiSendETH( ...
1
vote
2
answers
1k
views
Measuring the efficiency/performance of a smart contract presented as an algorithm
I am trying to theoretically analyze the expected performance of a smart contract presented in the form of an algorithm which consists of multiple functions.
What is the best way to measure the ...
0
votes
1
answer
673
views
Error in Ethereum Wallet:"Couldn't estimate gas, resorting to default parameters. Transaction is likely cheaper than the estimate"
I am using ethereum wallet for deploying contracts in my private blockchain. But whenever I try to send a transaction in my ethereum wallet it shows an error that says, "Couldn't estimate gas, ...
0
votes
1
answer
739
views
Invalid opcode on estimateGas
This is my contract
pragma solidity ^0.4.20;
contract Test {
struct TestStruct {
bytes32 name;
mapping(uint => address) tesMapping;
}
TestStruct[] public testStructs;
...
1
vote
0
answers
404
views
Contract deploy estimateGas undefined
When ti try to estimate gas for my contract to deploy, I always get undefined result.
This is my code:
const toDeploy = contract.deploy({
data: '0x' + bytecode,
arguments: [[web3.utils....
2
votes
1
answer
571
views
Alternative solution for loops in subscription smart contract design
I am a new developer, working on a smart contract mostly for my own learning. I am developing a Smart Contract to handle subscriptions. The contract has the below features.
Subscribers can subscribe ...
1
vote
2
answers
1k
views
Maximum gas consumption of calling a contract method
I want to evaluate the maximum gas consumption (minimum safe gas limit that will not fail) that calling a specific contract method would consume given that I have the contract source code / byte code.
...
1
vote
1
answer
105
views
Where does gas comes from when I create a new Contract in a Contract [duplicate]
Let's say I am creating a contract from another contract by calling a function in a parent contract, is the gas required to create new contract included in running the function that creates new ...
2
votes
1
answer
127
views
Is it possible to estimate used gas based on algorithm's Big O?
[Example Algorithm 1]: I have an array of structs(PaymentReceipt[] paymentReceiptList;) and imagine there are around 1000 pushed items and array's size keep increases. Each item has a time_start and ...
6
votes
1
answer
1k
views
Gas estimation for mapping updating with web3js
The gas estimation for contract deploying with web3js will look like:
var res = web3.eth.estimateGas({
from: web3.eth.defaultAccount,
data: contractByteCode
});
For example, I have the ...
2
votes
1
answer
102
views
How do I figure out how much USD it will cost to deploy or execute methods on a contract?
Is there a simple tool for this or do I have to calculate it myself?
5
votes
1
answer
2k
views
How to minimize gas consumption during contract creation
I have trouble deploying a contract to the main network and I believe this is due to high gas consumption.
An earlier version of the contract worked on the main network. The current version works in ...
2
votes
2
answers
238
views
Contract transaction: Gas estimated doesn't fit gas used
After finding out how to estimate contract tx fees thx to How to estimate the cost to call a Smart Contract method? and Syntax for calling contract state changing methods I tried to use all that ...
9
votes
2
answers
6k
views
How to estimate the cost to call a Smart Contract method?
After succesfully deployed this Smart Contract on Ethereum testnet
https://testnet.etherscan.io/address/0x27c042342C9ba937214117e11A4970A6145034cB
is it possible to calculate how much gas is going ...