2022 Developer Survey is open! Take 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
0 votes
0 answers
14 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,...
user avatar
  • 107
0 votes
1 answer
15 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 ...
user avatar
0 votes
1 answer
18 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 ...
user avatar
  • 103
0 votes
1 answer
32 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 ...
user avatar
  • 105
0 votes
1 answer
111 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 ...
user avatar
0 votes
0 answers
28 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 ...
user avatar
0 votes
1 answer
14 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://...
user avatar
  • 1
0 votes
2 answers
319 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 ...
user avatar
  • 1
0 votes
2 answers
51 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 ...
user avatar
0 votes
1 answer
111 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 ...
user avatar
  • 180
0 votes
0 answers
15 views

How do you get the timestamp of the current block within a contract?

The situation is this: I want to create a function that sets a timer that starts at the point of time where the function is called. However, I do not want the user to set the starting timestamp. How ...
user avatar
  • 66
1 vote
1 answer
16 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 ...
user avatar
  • 157
0 votes
0 answers
23 views

The basic algorithm for vesting/timelocking?

In vesting or timing smart contracts, in the simplest cases, how does the process or algorithm of releasing tokens usually work? (1) Does the admin call a function called something like ...
user avatar
  • 13
0 votes
0 answers
46 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 ...
user avatar
  • 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....
user avatar
0 votes
0 answers
54 views

How to make a list of addresses balance of which increased by >0 every 10 hours?

Is it possible to make a list of addresses balance of which increased by >0 every 10 hours from contract deployment, so that it will loop returning to "0" every 10 hours and start making ...
user avatar
0 votes
0 answers
27 views

Unable to simulate openingTime for a TimedCrowdsale while testing

I'm writing the tests for a TimedCrowdsale smart contract and I'm not being able to simulate the openingTime. I'm doing this: it('should accept payments after start', async function () { await ...
user avatar
0 votes
0 answers
26 views

Best way to use timestamp to automatic activate function or allow function execution

What is the best way to use the timestamp to automatically activate function or allow function execution? For example, I want to allow a user to buy a token only if is in the timestamp interval that I ...
user avatar
  • 309
5 votes
1 answer
987 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 >= ...
user avatar
  • 65
3 votes
1 answer
495 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 ...
user avatar
  • 1,243
0 votes
2 answers
42 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 *...
user avatar
0 votes
0 answers
32 views

Getting last buy timestamp for msg.sender in Solidity

I am looking for a way to implement an increased tax fee for msg.sender if they sell a smart contract token within a certain time frame from the last time they received the token. In Solidity, is it ...
user avatar
  • 111
0 votes
1 answer
224 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 ...
user avatar
  • 101
1 vote
0 answers
113 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 ...
user avatar
  • 111
0 votes
1 answer
178 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 ...
user avatar
  • 549
0 votes
0 answers
13 views

Is it possible to stop a deposit, while being in process by the contract owner?

function disableDeposit() onlyowner public{ require(timeToWait + userdeposit[msg.sender].timeCreate < block.timestamp); ERC20(tokenContract).transfer(msg.sender, userdeposit[amount]); } Would I ...
user avatar
1 vote
1 answer
104 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 ...
user avatar
  • 615
3 votes
1 answer
473 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 ...
user avatar
  • 189
1 vote
2 answers
413 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 ...
user avatar
  • 1,243
1 vote
0 answers
29 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 ...
user avatar
  • 206
1 vote
0 answers
185 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 ...
user avatar
  • 106
0 votes
0 answers
93 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.?
user avatar
1 vote
1 answer
484 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 ...
user avatar
  • 584
1 vote
1 answer
965 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....
user avatar
0 votes
1 answer
40 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 ...
user avatar
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 ...
user avatar
  • 7
1 vote
1 answer
1k 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 ...
user avatar
0 votes
1 answer
356 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 ...
user avatar
  • 359
1 vote
1 answer
92 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?
user avatar
0 votes
0 answers
54 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 ...
user avatar
0 votes
1 answer
829 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, ...
user avatar
  • 43
2 votes
1 answer
309 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 ...
user avatar
  • 123
0 votes
2 answers
328 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 ...
user avatar
0 votes
1 answer
459 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 ...
user avatar
0 votes
1 answer
174 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 ...
user avatar
0 votes
1 answer
141 views

Gas Estimation Failed error when scheduling Aion call

I am trying to understand the Aion scheduling system, so I tried their code example from here. Below is the code snippet: pragma solidity ^0.4.24; // interface Aion contract Aion { uint256 ...
user avatar
0 votes
1 answer
281 views

In web3, how can I fetch a range of block timestamps most efficiently?

Given a range of block numbers, how can I most efficiently fetch the timestamps for those blocks? I couldn't find a simple call to fetch the timestamp at a certain height other than fetching the full ...
user avatar
0 votes
1 answer
1k views

Solidity: Is there any way to store the start time of solidity code? now() function returns block.timestamp only

I wanted to get a start time of solidity code, so I used now() previous which only returns block.timestamp whenever the solidity got started. Is there any way to store or know the start time of ...
user avatar
  • 63
3 votes
1 answer
656 views

Can the block number be set back in ganache?

I know about tools like ganache-time-traveler that let you advance the block number. But is it possible to go back to a lower value?
user avatar
0 votes
1 answer
69 views

What are some practical considerations for leap seconds?

From the solidity docs on time units: Take care if you perform calendar calculations using these units, because not every year equals 365 days and not even every day has 24 hours because of leap ...
user avatar