Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [timestamp]

Questions related to the timestamp value of a block, or the use of Ethereum in timestamping.

Filter by
Sorted by
Tagged with
1 vote
1 answer
11 views

Solidity Add Timer So It Would Get Executed By Itself

Is there a way that set a time from 10 minutes from now and call a function by itself or a change a struct's element?
seojunchian's user avatar
0 votes
1 answer
31 views

How to write unit test with Timestamp base function?

I writing a contract for Staking Token to earn Token. It's similar to pancake MasterChef. The requirement is based on timestamp (not block). When I test the contract with hardhat, I call the deposit ...
MadTik's user avatar
  • 21
1 vote
1 answer
26 views

How can I check if the day is Valentine’s Day every year?

Happy Valentine’s Day fellow nerds! This year for Valentine’s Day I want to mint my gf a valentine NFT. Since I’m building it I want to turn it into an NFT project that is free to mint for the public ...
Technically Web3's user avatar
1 vote
2 answers
68 views

block.timestamp: will my function possibly fail?

I need to execute a function 24hrs after a certain timestamp is recorded in my contract. So my front-end starts a countdown, taking that contract timestamp as start. After 24 hrs, my front-end calls ...
user130657's user avatar
2 votes
1 answer
252 views

Can Arbitrum's block timestamp be trusted to the same degree as the L1 time?

L1 blocks cannot be fudged by validators. It is a value that can be safely used by apps. Can that be said about the value of block.timestamp on a L2 like Arbitrum?
Paul Razvan Berg's user avatar
2 votes
1 answer
56 views

Are block.timestamp and block.number still problematic under Proof of Stake?

As stated in the SWC116 (https://swcregistry.io/docs/SWC-116/) using block.timestamp and block.number in Smart Contracts under Proof of Work was problematic. Block.timestamp could be influenced by ...
Yleisnero's user avatar
0 votes
1 answer
28 views

Use offchain date time

in my contract, I need to do something based on time, and this is quite sensitive, and as we know, you cannot rely on the block.timestamp because it can be changed, I want to know if there is a way ...
Mehran Ra's user avatar
  • 590
1 vote
1 answer
207 views

Is it possible to set a custom start time and block number for a local Hardhat node?

I'd like to configure my Hardhat node to start at a specific timestamp t, where t is less than the current timestamp Tc. The goal is to replay past mainnet transactions locally by setting the exact ...
MShakeG's user avatar
  • 1,703
0 votes
1 answer
303 views

How to send signed data to backed and verify it?

On a web page I have some 3 fields, name, age and height, which a user authenticated via MetaMask sends to backend along with his wallet address. In JSON. In order to ensure that data that's sent ...
Camila326's user avatar
  • 115
0 votes
1 answer
192 views

How to get transaction timestamp?

Blockchain has two timestamps: one is transaction timestamp and other one is block timestamp. While in solidity we only have block.timestamp, idk which one is this for? Can't we find the other one?
Manav Notnani's user avatar
4 votes
2 answers
2k views

How to work with block timestamps in ethers and hardhat?

I have a time-dependent contract that has two require statements function launch(uint256 _goal, uint32 _startAt, uint32 _endAt) external { require(_startAt >= block.timestamp, "...
Kate Johnson's user avatar
1 vote
2 answers
43 views

Checking whether a timestamp has been surpassed in solidity

I’m trying to create a raffle system, where a smart contract will be holding a nft until a specific timestamp is passed. The timestamp is set at contract creation. I’m trying to think of some ...
TRS's user avatar
  • 131
0 votes
1 answer
27 views

Do you know what 15180 means in relation to timestamp?

I saw a staking smart contract made by BuildBear Dapp. https://github.com/BuildBearLabs/Tutorials/blob/main/Staking-with-BuildBear/contracts/Staking.sol // numDays = 30 or 90 or 120 Lockup Period ...
imelon2's user avatar
  • 558
0 votes
1 answer
26 views

What's wrong with timestamp here?

if (externalId == bytes32(0x00)) { bytes memory buffer = new bytes(64); assembly { mstore(add(buffer, 0x20), escrowId) mstore(add(buffer, 0x40), timestamp) ...
Vidhan Mangla's user avatar
1 vote
0 answers
24 views

Oscillating blocktime issue

I have three private blockchain networks: production development QA production and QA both have blockTime of 10 seconds and are behaving as expected. When I read their block timestamps, there is ...
Sky's user avatar
  • 2,322
0 votes
2 answers
21 views

Best way for developing/testing time-related features with frontend app

I'm looking for a solution to conveniently test how the app WILL look like in a few months after the project starts. I.e. - let's say that in the project we will periodically deploy contracts that ...
Jakub Biernaczyk's user avatar
0 votes
0 answers
38 views

why not getting hex value and isBigNumber boolean value in timestamp?

Terminal when contract deployed 0xf33fd6e51aad88f6f4ce6ab8827279cfffb92266 has waved A message [ [ '0xf33Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'A message', BigNumber { value: "...
vishal's user avatar
  • 23
0 votes
2 answers
63 views

Q&A: How to get current time in ms? [duplicate]

This part of own Q&A serial of posts which shares knowledge gained during work on one project I was looking for a way to do actions link to global time, but obtaining current timestamp was not a ...
Gleichmut's user avatar
  • 472
12 votes
3 answers
2k views

Miner-modifiability of block timestamp after the Merge

Under proof of work, the Ethereum block interval varied, but miners could modify the block timestamp by +/-15 seconds, as long as the modified value was greater than the parent timestamp, without the ...
Luke Hutchison's user avatar
0 votes
1 answer
267 views

Getting timestamp of ERC721 token minting

what is the correct approach to find minting time of a token? External services like alchemy do not provide the info fetching events via ethersjs or similar does not provide block/timestamp info
Stormsson's user avatar
  • 379
0 votes
0 answers
16 views

timeintervals in Solidity [duplicate]

Is there a way to do something at each time interval in solidity without having to write and sign a transaction (paying gas) each time the interval passed. For example. Say I have a glass of eWater on ...
AvocadoChocolate's user avatar
1 vote
1 answer
43 views

What this function implies?Why is aAdjusted and bAdjusted?

This function is from uniswap-v3/core/contracts/libraries/Oracle.sol /// @notice comparator for 32-bit timestamps /// @dev safe for 0 or 1 overflows, a and b _must_ be chronologically before or equal ...
user96949's user avatar
0 votes
1 answer
35 views

Does the age/timestamp of a transaction matter to a miner?

Up to now I know that miners choose transactions to be included in a block only based on their related transaction fees. Does the age (i.e. timestamp) of a transaction play any role in the priority ...
dcfg's user avatar
  • 103
0 votes
1 answer
159 views

Time-based token distribution in smart contract

Say I have a smart contract for exchanging 6 Token_A with 6 Token_B with an additional time condition when only 1 exchange can happen every 1 month (we don't care about msg.sender here. we can assume ...
Yar's user avatar
  • 125
1 vote
1 answer
736 views

Timestamp is lower than or equal to previous block

I have a function where a specific time should be passed to run it. function placeBid(...) { require(auction.startedAt <= block.timestamp, "not started yet"); ... } say startedAt is ...
bbusdriver's user avatar
  • 1,154
0 votes
1 answer
30 views

False positives for Block State Dependency vulnerability

I've been analysing the contract in https://github.com/SoftSec-KAIST/Smartian/blob/main/examples/sol/BD_false.sol, which contains false positives for the bug Block State Dependency (see https://...
fff's user avatar
  • 1
1 vote
3 answers
2k views

What is EXACTLY the meaning of block.timestamp

In a contract, when I execute block.timestamp what is exactly this value? Is it: The time the block was created? The time the block was mined? The time the execution is being run? Anything else? The ...
manija's user avatar
  • 11
0 votes
2 answers
627 views

Can anyone explain this function and significance of 86400?

I have a function which is used to check if 90 days have been passed or not after staking, but I can't figure out why 86400 is mentioned, like is it seconds or minutes or anything else and how can I ...
Priyanshu Jain's user avatar
0 votes
1 answer
507 views

How to delay sending a transaction in brownie?

Say I have a contract that has a method that implements a time expiration via a function parameter set by the user, how can I test that the expiration works as expected in brownie by delaying the ...
MShakeG's user avatar
  • 1,703
1 vote
1 answer
20 views

How to check if an amount is stacked on contract more than a one days

I have following struct on my contract : struct Token { address tokenAddress; uint256 stakedAmount; bool isUsed; uint256 lastTransactionDate; } It is used on ...
Xstahef's user avatar
  • 157
0 votes
0 answers
228 views

How do you convert block timestamps to GMT or any other timezone for oracles on EVM. Are GMTs the same as block timestamps on EVMs?

pragma solidity >=0.4.16 <0.9.0; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; import '@uniswap/lib/contracts/libraries/FixedPoint.sol'; // library with helper methods for ...
Bonsu's user avatar
  • 1
0 votes
0 answers
30 views

Is it allowed that the same address miner mine two blocks with the same block height at the same time?

I have the question after viewing the following two blocks. I post the url here: https://cn.etherscan.com/block/13821587 This block is in the main chain at the height of 13821587. https://cn....
tang tang's user avatar
6 votes
1 answer
2k views

How to write tests for time based contracts?

I have a function that requires 7 days to pass from the time of an event (lockTime) before the rest of it will execute: function resetGame () public onlyOwner { require (block.timestamp >= ...
dd0sxx's user avatar
  • 185
7 votes
1 answer
1k views

By what duration can a miner manipulate block.timestamp?

By what duration can a miner manipulate block.timestamp? Can they manipulate it by 10min, 5sec, 2hrs...? From here I can see that the average block time on the ethereum blockchain is 13 seconds. This ...
YulePale's user avatar
  • 1,853
0 votes
2 answers
51 views

Is it appropriate to use a timestamp to distribute tokens?

To distribute tokens daily (per 24 hours ) among my participants in my dapp, i want to use block.timestamp . is that enough safe ? or should i using block.number for estimate 24 hours? for example 24 *...
Pouya Nasehi's user avatar
2 votes
2 answers
1k views

How to get block -> timestamp in bulk, incl. possible 3rd party api

I'm looking to get my hands on a historical block -> timestamp mapping. Although it's possible to get this data using web3.eth.getBlock it's rather costly to do it for all individual blocks. Since ...
Geert-Jan's user avatar
  • 169
1 vote
0 answers
175 views

Timestamp of when address received a token

Trying to find a way or documentation in obtaining the timestamp of when an address received the token in a smart contract. I have read many reflection based contracts that apply different levels of ...
Darren's user avatar
  • 111
1 vote
1 answer
378 views

Will the ethereum blockchain have a problem with the timestamp in 2038?

I am reading that Ethereum EVM run over 32bits systems In base to this information: https://en.wikipedia.org/wiki/Year_2038_problem Will the ethereum blockchain have a problem with the timestamp in ...
JTCon's user avatar
  • 703
1 vote
1 answer
217 views

Is timestamp manipulation still possible? And if yes, can users spot that and did that happen?

I have readed an ethereum post from 2015 where it states that miners can manipulate the block timestamp up to 900 seconds. Can they in 2021 still do it and, if yes, can users see this and did this ...
dkb's user avatar
  • 723
4 votes
1 answer
1k views

Avoid using block.timestamp

I need to define a specific time phase. Therefore, I wanted to use opening timestamp and closing timestamp using block.timestamp. I get the following warning: Linter: security/no-block-members: Avoid ...
user66732's user avatar
  • 455
1 vote
2 answers
745 views

Can you use block times as a measure of duration?

I have read that it takes about 12 seconds for an ethereum block to be mined. Let’s us say I have a contract mined on block 100, can I set a function that can only be run at block 200 or more? Thus ...
YulePale's user avatar
  • 1,853
2 votes
0 answers
61 views

Can block timestamp be smaller than the time a transaction has been sent?

I have seen cases where the time that I sent my transaction (logged on local PC) is actually 'later' (by 10s of seconds) than the block.timestamp of the block that my transaction entered. I checked if ...
kmotoko's user avatar
  • 266
1 vote
0 answers
270 views

What is the theoretical average latency of data transmission?

I concluded a pretty simple test to measure some latencies. I connected to two providers (Infura and Quiknode) with Web3.js and subscribed to new block headers. Then I compared the time of arrival and ...
Wyctus's user avatar
  • 226
0 votes
0 answers
163 views

How can I call TX Timestamp info via Web3.JS

How can I call the timestamp information of the pending tx datas I tried everything I could not.?
Gökhan Özdemir's user avatar
2 votes
1 answer
1k views

Can block.timestamp value change during execution?

I'm facing a doubt while developing an Smart Contract. I was getting current date from block.timestamp several times inside a function. Could this value change during an Smart Contract execution? Or ...
Alexander Herranz's user avatar
1 vote
1 answer
1k views

Ethereum block timestamp

Is the timestamp of a block referring to the time that block is created or when it's mined by a miner? Suppose I subscribe to new incoming blocks using the following NodeJS code (with web3): web3.eth....
Fabrizio Sandri's user avatar
0 votes
1 answer
47 views

Time-dependent test unexpected behavior at 1st attempt, expected behavior at 2nd attempt

I'm trying to test a contract in which functions should require certain timestamps. Parts of code are eliminated for readability: Here's the problematic part of the contract : PCE_Contract.sol pragma ...
newbnoob's user avatar
0 votes
2 answers
2k views

how estimate average time for transactions to smart contract

I have created a decentralized application on the Ethereum Blockchain network. This application receives data from different addresses on the blockchain network and saves this data in the blockchain ...
esraa's user avatar
  • 7
2 votes
1 answer
3k views

best way to get transaction timestamps?

I'm building an analytics app that tracks transactions on Ethereum and wondering how to get the most accurate timestamp for each transaction. Using the web3.js library I'm able to see the following ...
Andrew Tang's user avatar
0 votes
1 answer
557 views

What is the proper way to store timestamp in blockchain?

I am trying to store the timestamp in the blockchain using block.timestamp or now. But that keeps throwing warning as Use of "block.timestamp": "block.timestamp" can be influenced ...
NinjaMAN's user avatar
  • 419