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
0 votes
0 answers
17 views

pending trasaction - get pending time

I'm listening to pending transactions using ethers.js like this: providerWS.on("pending", (tx) => { console.log("receiving pending tx:", tx); } Sometimes I'm getting trasactions ...
  • 13
0 votes
2 answers
21 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 ...
  • 101
0 votes
1 answer
19 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 ...
  • 189
0 votes
1 answer
15 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) ...
1 vote
0 answers
21 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 ...
  • 1,673
0 votes
2 answers
11 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 ...
0 votes
0 answers
19 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: "...
  • 23
0 votes
2 answers
13 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 ...
  • 380
4 votes
3 answers
294 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 ...
0 votes
1 answer
115 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
  • 351
0 votes
0 answers
33 views

Solidity - Claiming a reward once every N units of time

What is the workaround for logic where a user can only claim a reward once a month, I have noticed an exploit in the below code so that if a user calls the claim function multiple times before the ...
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 ...
0 votes
0 answers
55 views

Is using block.timestamp + appropriate for adding months even years into the future?

I have a smart contract that is date dependent. Intended to schedule events far into the future, like days, weeks, months even years into the future. As long as the events happen on the specified date,...
  • 137
0 votes
1 answer
24 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 ...
0 votes
1 answer
26 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 ...
  • 103
0 votes
1 answer
96 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 ...
  • 115
0 votes
1 answer
362 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 ...
  • 1,022
0 votes
0 answers
85 views

Is it better practice to use block.timestamp or parse in time from JS frontend from a web application?

Currently, I'm creating an election application which has set registration and voting periods, and therefore needs to check that the user's actions are within the set timeframe. I'm fairly new to ...
0 votes
1 answer
18 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://...
  • 1
0 votes
3 answers
1k 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 ...
  • 1
0 votes
2 answers
108 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 ...
0 votes
1 answer
370 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 ...
  • 431
1 vote
1 answer
17 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 ...
  • 157
0 votes
0 answers
131 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 ...
  • 1
0 votes
0 answers
20 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....
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 >= ...
  • 155
7 votes
1 answer
963 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 ...
  • 1,583
0 votes
2 answers
46 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 *...
1 vote
1 answer
562 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 ...
  • 137
1 vote
0 answers
150 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 ...
  • 111
0 votes
1 answer
278 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 ...
  • 643
1 vote
1 answer
158 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 ...
  • 673
3 votes
1 answer
865 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 ...
  • 383
1 vote
2 answers
611 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 ...
  • 1,583
2 votes
0 answers
48 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 ...
  • 246
1 vote
0 answers
244 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 ...
  • 116
0 votes
0 answers
138 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.?
1 vote
1 answer
755 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 ...
  • 885
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....
0 votes
1 answer
43 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 ...
0 votes
2 answers
1k 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 ...
  • 7
1 vote
1 answer
2k 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 ...
0 votes
1 answer
490 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 ...
  • 379
1 vote
1 answer
186 views

Why does Solidity not use the years keyword?

Solidity has keywords like seconds, minutes, hours, days and weeks that are used to specify units of time. Why do they not have years?
0 votes
0 answers
62 views

How does Etherscan compute mining times?

Etherscan identifies the miner that mined a block and the corresponding mining time. How does Etherscan compute the mining time? It seems that the mining time of a block is not the difference between ...
0 votes
1 answer
951 views

How could I measure the total delay (time) to confirm the transaction?

First of all, I'm new to the Erthereum world, I need some help in measuring the total delay (time) require for confirming the transaction. I have a decentralized application over a Rinkeby network, ...
  • 43
2 votes
1 answer
364 views

How to Calculate How Long an Address Has Held A Token? (for paying interest/rewards)

I'm writing a smart contract function that rewards users some rate of interest/reward for holding my stablecoin over owning competitors (Dai, Tether, etc). What is the most efficient manner to ...
  • 123
0 votes
2 answers
391 views

Unit testing time sensitive Provable smart contracts

I'm currently using Provable (formerly Oraclize) to make a CRON job : constructor() public payable { OAR = OracleAddrResolverI(0x6F486C8BD6fc43eA212E93CCF8ce047C7f1Cb475); provable_query(7 ...
0 votes
1 answer
643 views

How to get block size and block mining time while using ganache and truffle

I am using truffle framework and Ganache (GUI) as emulator. I want to know the size of the generated block. Also I want to know the time required to mine/generate/create a block after the command. I ...
0 votes
1 answer
277 views

Block.timestamp returning multiple values

I have a function inside my smart contract that fetches the timestamp of the block it's in: function getTime() public returns (uint256 time){ return block.timestamp;; } According to how I ...