New answers tagged

0 votes

In a smart contract storage layout, Is it 100% beneficial to pack reduced-size variables in one slot?

Deciding whether to pack variables or use single-slot storage for each reduced-size variable depends on the specific use case and the frequency of reads/writes for each variable. Ultimately, the best ...
  • 112
0 votes

How to measure gas usage for each function call in Hardhat?

You can use ethers imported from 'hardhat' to estimateGas if it's in the test environment. I haven't checked on the hardhat console, but it may be better to check the gas cost using hardhat-gas-...
  • 101
0 votes

I need to know gas price C# Nethereum

I was facing the same issue some time ago. Before showing the code, keep in mind that: Fee = GasPrice * Gas The GasPrice is the same for all network parties. What changes per transaction is the ...
0 votes
Accepted

Can I show execution cost when I call function every loop?

You can use the gasleft() function to check how much gas is left after each operation. Subtracting this from the gas you had before the operation gives you the amount of gas used. function ...
0 votes

Can I show execution cost when I call function every loop?

The only way to do anything remotely similar to that is to go to Remix debugger mode. There you can see the gas cost of each individual step. However, that might be a bit too complex to do. I myself ...
  • 1,663
1 vote

Gas Fees for 10k NFT

Opensea uses lazy minting for NFT mints, which means the NFTs are not actually minted on a chain before someone else buys them. There are several options that could help you achieve your goal: You ...
0 votes

Gas estimation errored with the following message,execution reverted

Usually it’s an error with the syntax. I’m unsure why you’ve denoted the withdrawal functionality as payable, as it isn’t intending to receive ether or modify any state variables. This would likely ...
  • 324
0 votes

What is the optimal way to estimate dependent transactions together?

I would recommend you check out tenderly.co 's transaction simulator, where you can call desired contract's functions and it gives you all the details about the transaction including gas costs.
0 votes

Replace storage with the use of events. Considerations, risks?

You will be dependent to projects that saves the events (TheGraph/Moralis/Covalent). For a huge amount of data this is the only way you can do it since interrogating function views will fail (dos ...
  • 112
0 votes

best practice for airdrops and gas usage

The best approach is a merkle tree airdrop, where the on-chain contains a compressed list of address receivers and the airdrop receiver pays the gas. See https://medium.com/hackernoon/evolution-of-...
0 votes

How to transfer all the coins that an account may have?

Firstly you will need to have enough ETH in the wallet for the transaction, otherwise, you will not be able to send anything. Secondly most tokens on ETH chain are following the ERC20 standard, which ...
1 vote

best practice for airdrops and gas usage

Could just use an automated solution such as BlockBucket which is like a Token MultiSender Dapp with really little fees (0.01 ETH) we built it to offer a cheaper solution to MultiSender which takes ...
1 vote

insufficient funds for intrinsic transaction cost

I also had parseEther at ("1") and increased the amount of ETH in my wallet to above 1 using the goerli faucet. This fixed the problem for me. my code: const sendValue = ethers.utils....
0 votes

Should we use uint64 for storing block.timestamp(instead of uint256)?

Storage in a solidity pack 32bytes to 1 slot that 32*8=256 bit, so uint8, uint16,... uint256 is the same to use 1 slot in solidity, but when you using uint8 EVM need to downscale from 256bit -> ...
2 votes

Does it make any sense to specify reference type function input parameters as calldata if the given function is only called contract to contract?

I am wondering however what is the point of specifying the input argument in a function as calldata, if you know that it will only be called from a contract (hence no gas savings of using the real ...
  • 6,768
0 votes

Interfaces and gas savings

I'm not entirely clear on what the situation is, so my answer might not be relevant to what you're looking for (or indeed it may be mistaken). My understanding is that if you're deploying a contract ...
0 votes
Accepted

Intrinsic Gas Too Low - Where Do I Add The Gas?

Solved my own issue here. Changed web3 = new Web3(`wss://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_API_KEY}`) To web3 = new Web3(Web3.givenProvider || wss://eth-mainnet.alchemyapi.io/v2/${...

Top 50 recent answers are included