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,688
11 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
  • 211
8 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
  • 86.5k
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
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,147
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.3k
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
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

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

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.2k
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

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
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,784
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

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

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.3k
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
3 votes
Accepted

What happens to immutable contracts when Ethereum 2.0 will likely change the 15s block time?

The 15s block time is false assumption, making your question invalid. Ethereum was ticking 12s block times 2 years ago. It is not standard and fluctuates a lot of over longer period of time. You ...
Mikko Ohtamaa's user avatar
3 votes

Avoid using "now"

The community likes to use exact things like "block numbers" which cannot be tampered with by the miners. The now / block.timestamp can be manipulated by the miner to a certain degree as it relies ...
Micky Socaci's user avatar
  • 1,312
3 votes
Accepted

By what duration can a miner manipulate block.timestamp?

There is no written rule on this, miners and full nodes can set themselves what kind of block timestamp skew they tolerate. In practice, there has not been any notable timestamp skew ever. The block ...
Mikko Ohtamaa's user avatar
3 votes
Accepted

Why are Ethereum slots 12 seconds?

Ethereum slots are 12 seconds to allow a balance between decentralization and finality time. Basically, all validators must be able to handle work/load/messages within the slot time. Shorter slot ...
eth's user avatar
  • 86.5k
2 votes

Why doesn't ethereum have a fast relay network like Bitcoin?

To supplement this with Vitalik's answer on Gitter (quoted): Rewarding ommer blocks means miners have lesser incentive to mine on the latest block: basically means that miners' private incentive ...
kanu's user avatar
  • 143
2 votes

Does block difficulty adjust with different gas limits?

No. Currently, difficulty is computed as: adj_factor = max(1 - ((timestamp - parent.timestamp) // 10), -99) child_diff = int(max(parent.difficulty + (parent.difficulty // BLOCK_DIFF_FACTOR) * ...
eth's user avatar
  • 86.5k
2 votes

Estimating days with block solving frequency: sanity check

Current block number is 4154921, not 710908. The original design of 12 seconds (now more due to difficulty adjustment) was first chosen and research suggested that 12.6 seconds, but actually average ...
BinGoBinBin's user avatar
  • 2,161

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