Skip to main content
17 votes
Accepted

Is Solidity block.number more secure than timestamp?

The block number will always be correct by definition: It's number x in the chain, because it's chained on top of x-1. However, as you say block.timestamp can be gamed a little bit - or with the ...
Edmund Edgar's user avatar
  • 16.9k
15 votes
Accepted

What is the safest minimum block time to use without having any problem on Proof-of-Authority consensus?

PoA in Aura consensus engine of parity defaults to 5s, which has been tested to run with good stability. PoA network runs one such infrastructure. I have tested for a 1 sec PoA using aura running ...
Ayushya's user avatar
  • 1,698
13 votes
Accepted

How would a miner cope with a huge block time?

Summary A block mined by a miner that sets their computer time ahead of the current "real" time will have their winning block rejected by other Ethereum nodes. Other miners on the Ethereum network ...
BokkyPooBah's user avatar
  • 40.3k
10 votes

How to get the block number which is the closest to a given timestamp?

DeFiLlama has a new API that does this. https://defillama.com/docs/api Just GET https://coins.llama.fi/block/ethereum/1658171864 You can also check different chains
cwatkins's user avatar
  • 201
9 votes

How would a miner cope with a huge block time?

If a miner M sees a block B with a timestamp far in the future, here's what they would probably do: instead of building on B, they would publish their own block C with a more accurate timestamp. By ...
eth's user avatar
  • 85.9k
7 votes
Accepted

What is the measured distribution of block times since Homestead?

First of all it seems that I am too ignorant to understand Poissons Lamda! At least I have some R skills left: Summary: Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 5.00 10.00 14.35 ...
Roland Kofler's user avatar
7 votes
Accepted

How to get the block number which is the closest to a given timestamp?

Ethfinex just published a function that does exactly that. It's to "pixel perfect" but it's working really well so far, you give it a timestamp and it will walk the blockchain backwards until it ...
kroe's user avatar
  • 226
7 votes

Miner-modifiability of block timestamp after the Merge

Does that mean block timestamps can no longer be tweaked or fudged by miners, after the Merge? That's correct, (post-Merge) consensus on valid blocks is pre-determined timestamps that are not ...
eth's user avatar
  • 85.9k
6 votes
Accepted

What happened to the average blocktime during this period?

This was the Difficulty Bomb, originally put in place in the lead up to Proof of Stake being implemented. The aim was to make mining gradually more difficult before the switchover. See: What is the &...
Richard Horrocks's user avatar
6 votes

Increase block number on Ganache

In addition to goodvibration's answer, OpenZeppelin recently released their openzeppelin-test-helpers package. This library contains all kinds of helpers for testing smart contracts, including methods ...
Rosco Kalis's user avatar
  • 2,137
6 votes

Avoid using "now"

The use of block.timestamp (which is what now is an alias of) is often discouraged because it is somewhat manipulable by miners. This is only an issue if you need the time to be precise to within ~90 ...
Tjaden Hess's user avatar
  • 37.1k
5 votes

Why is avg. block time growing so much latley

This is due to the Ethereum 'Ice Age' - an incentive implemented in the code to switch from the current Proof of Work consensus mechanism to a Proof of Stake consensus mechanism or as Vitalik puts it ...
SteveJaxon's user avatar
  • 2,538
5 votes

Rinkeby not producing blocks

I checked https://www.rinkeby.io/#stats a few minutes ago. There was a problem with validators. To few were online. Now it runs again.
cqx's user avatar
  • 3,462
4 votes

How time difference can be calculated by block.number and how it is different from block.timestamp?

The timestamp can be easily gamed over short intervals. For instance, if block n is mined at 13:30:00, the miner of block n+1 can timestamp the next block at 13:30:01, even if they didn't really mine ...
Edmund Edgar's user avatar
  • 16.9k
4 votes
Accepted

Ensuring a transaction is included in a specific block

It's basically impossible to guarantee a transaction occurs in a given block. There's too many factors--network latency, the block gas limit, uncles, miners who mine empty blocks, other transactions, ...
Matthew Schmidt's user avatar
4 votes

How to speed up transaction confirmation time?

Miners pick up transactions by their gas cost. You can set gas price (not maximum gas limit) for your transaction. Take the default gas price value and multiple it with 2x - 3x for urgent transactions....
Mikko Ohtamaa's user avatar
4 votes

What is the safest minimum block time to use without having any problem on Proof-of-Authority consensus?

be it a PoA, PoW or PoS chain you want to build, the main point about the timing is for your nodes to be able to synchronize. If your network is private and you can ensure your network to have nodes ...
Asone's user avatar
  • 839
4 votes
Accepted

Ethereum's block times are under 10 seconds compared to most other coins which are in minutes. Why and How?

Average Ethereum blocktime is closer to 15 seconds. The reason blockchains generaly have larger block times is due to uncle rates. When 2 miners mine separate blocks at the same height, the network ...
natewelch_'s user avatar
  • 12.1k
4 votes
Accepted

Increase block number on Ganache

You can increase block.timestamp (aka now): web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); Note that this method is a Ganache-extension of the standard. So do not ...
goodvibration's user avatar
4 votes

Increase block number on Ganache

I needed a promise-based solution that didn't require installing a third-party library. Copy-pasting from Ethan Wessel's amazing article on truffle time testing: advanceTime = (time) => { return ...
Paul Razvan Berg's user avatar
3 votes
Accepted

Could I give higher priority to transactions to mined right away?

All smart contract functions calls as well as smart contract deployments are inherently transactions. Each transaction gets incorporated into a block whenever a miner chooses to do so. Currently in ...
SCBuergel's user avatar
  • 8,774
3 votes

How can we reduce the transaction time in ethereum?

Currently the average blocktime is ~ 14 s where a significant portion is just ~ 1 s. See my empirical asssesment here: https://github.com/rolandkofler/blocktime If you run your private net you can ...
Roland Kofler's user avatar
3 votes
Accepted

What happens if the block time changes to 5 seconds?

One thing to consider would be the orphan rate, which is alluded to in the comments for the thread you linked to. The lower you set the difficulty, the shorter the block time, which is what you're ...
Richard Horrocks's user avatar
3 votes
Accepted

How are the confirmation times distributed in Homestead?

WARNING: This does not take into account the difficulty adjustments that arise when blocks are off the average block time. This means that in reality the standard deviation of multiple confirmations ...
Roland Kofler's user avatar
3 votes
Accepted

Is code execution time limited by the block time?

Theoretically, yes, code execution time is limited by the block time. But on a practical level, gas costs and the block gas limit are what limit code execution time. Try writing a contract that ...
eth's user avatar
  • 85.9k
3 votes
Accepted

Once PoS and Casper is reached, what stops block times from dropping into the millisecond range?

I think the answer is basically latency, plus giving enough of the nodes enough of a reasonable amount of time to validate. Millisecond blocks would only really get responses from a minority of nodes, ...
Samuel Hawksby-Robinson's user avatar
3 votes
Accepted

How time difference can be calculated by block.number and how it is different from block.timestamp?

I believe the block.timestamp is the wall-clock date/time at which the block was mined. A block number set in the future based on some other block is based on an estimate of the rate of block mining. ...
lungj's user avatar
  • 6,680
3 votes
Accepted

fast blocktime in private net

It is actually quite easy to edit the source code for geth to do what you want. Simply comment out the body of CalcDifficulty (line 265 in core/block_validator.go) and replace it with return ...
Tjaden Hess's user avatar
  • 37.1k
3 votes

Speed of Ethereum for real time DApp

Currently the block time is around 17s The average is currently between 14 and 15 seconds. but the confirmation time is even longer around 2-3 minutes. That depends on the gas price you're ...
Richard Horrocks's user avatar
3 votes

How to get the block number which is the closest to a given timestamp?

This is an old question, but recently I wrote a plugin for this kind of task. Usually, it makes fewer requests than Ethfinex's script does (usually, not always 😂). Take a look: https://github.com/...
mnsx's user avatar
  • 31

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