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
2 votes
1 answer
16 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
20 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
  • 341
0 votes
0 answers
18 views

Get block from timestamp at given times

I'm looking for a way to find the block corresponding to a given timestamp; for a graph where you can see your balances per day in a graph. I tried to make it but my provider/node was using too much ...
  • 101
0 votes
0 answers
16 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
15 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
34 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,...
  • 107
0 votes
1 answer
18 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
24 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
65 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 ...
  • 105
0 votes
1 answer
256 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 ...
0 votes
0 answers
57 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
17 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
859 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
73 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
225 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 ...
  • 340
0 votes
0 answers
16 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 ...
  • 76
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 ...
  • 157
0 votes
0 answers
26 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 ...
  • 13
0 votes
0 answers
90 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....
0 votes
0 answers
78 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 ...
0 votes
0 answers
37 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 ...
0 votes
0 answers
37 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 ...
  • 418
5 votes
1 answer
1k 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 >= ...
  • 95
5 votes
1 answer
744 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,463
0 votes
2 answers
43 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
375 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 ...
  • 113
1 vote
0 answers
132 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
234 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 ...
  • 613
1 vote
1 answer
128 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 ...
  • 663
3 votes
1 answer
709 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 ...
  • 319
1 vote
2 answers
506 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,463
2 votes
0 answers
31 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 ...
  • 226
1 vote
0 answers
229 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
119 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
623 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 ...
  • 745
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
42 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
434 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 ...
  • 359
1 vote
1 answer
137 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
898 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
336 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
369 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
557 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
237 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 ...
0 votes
1 answer
144 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 ...
0 votes
1 answer
327 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 ...