Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [timestamp]

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

1
vote
1answer
101 views

How can i implement deadlines in smartContract?

Suppose I am running a gallery and ask participants to submit there paintings before a specific date. After passing that date participant should not be able to submit their entry. How can I implement ...
1
vote
1answer
31 views

Ethereum extract transactions based on timestamp

I am trying to extract all transactions of Ethereum using the eth scan API. But I need transactions for specific time periods only. I tried running the API for all the blocks to try and extract all ...
1
vote
1answer
34 views

Ethereum transactions timestamp

Is it possible to extract individual timestamps of the transactions' execution time in a given block? The Ether-scan API gives only the timestamps of the block collation, doesn't mention anything ...
0
votes
1answer
19 views

Is there any protection in the Ethereum consensus or network protocol to avoid a block being mined with a timestamp 1000 years ahead of UTC time? [duplicate]

Will other nodes refuse the mined block if the timestamp is too far apart from local or UTC timestamp or will they blindely accept the block if the PoW is correct?
0
votes
1answer
18 views

time order when calling functions of smart contract

How can I check that the miner actually execute the right order of smart contracts function calls, if there is a necessity of orders?
1
vote
1answer
44 views

Unable to schedule a call using Aion Recurring Contract

So here's the contract that I deployed on Ropsten Network. I took code refer from here. pragma solidity ^0.4.24; // interface Aion contract Aion { uint256 public serviceFee; function ...
0
votes
2answers
43 views

Can we assume that Ethereum Events (aka Logs) are in-sequence

Lets consider a simple Contract that is to track a variable. A client App needs to access this variable's history to show a graph. I can create an Array inside the Contract, and push() the value ...
0
votes
1answer
25 views

How to allow the owner of a contract to set a deadline in days (and not have it inserted as seconds) in the constructor?

thanks for taking the time to read this. I'm having a bit of trouble handling time in Solidity. I want the owner of a contract to be able to set a deadline in days (which will be used in the rest of ...
0
votes
2answers
49 views

Solidity can't modify block.timestamp due to lvalue xpression

I have a problem regarding modifying block.timestamp. I would like to modify timestamp in my network and change block.timestamp to unix timestamp, but I got an error at modification: TypeError: ...
1
vote
1answer
33 views

How can I increase EVM time in web3.py?

When working with web3.js, Truffle and Ganache, I can do this: web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); How can I do the equivalent in web3.py? When I do: ...
0
votes
2answers
63 views

How to get multiple blocks timestamps with a single JSON RPC call?

Is there a way to get data similar to the ones provided by web3.eth.getBlock(blockNumber) but with multiple blocks at once? The goal is to get the timestamps for 100 blocks in a row without ...
0
votes
1answer
40 views

crypto-signing in a smart contract -> verify the identity of a smart contract

my Question in short is: -> is it possible to digitally sign some data by a smart contract (e.g. with a secret key of the contract) and thus confirm that it was exactly this smart contract, who ...
0
votes
1answer
86 views

How to map multiple time and index value on same address

I wish to map the time to the address key. But currently it is working on the index key only. I just want to map time as well. Means the current time. So that I can able to get the record with time as ...
0
votes
1answer
44 views

I want a function locked for a certain amount of time, what's the safest way to achieve this?

I want a store where someone can become tokenOwner for a certain amount of time. The following solutions seems the easiest: pragma solidity ^0.4.24; import "../node_modules/zeppelin-solidity/...
3
votes
1answer
114 views

Why time values should be used as uint256?

Is there a reason to use the time value as uint256? Is not uint128 enough? UnixTime...
3
votes
1answer
40 views

Setting time requirements in Solidity

I want a function to only be able to be called after a certain specific period of time has passed from the contract's inception. Generally, I was using block.number for that. As in: require(block....
1
vote
1answer
106 views

Receive data in a smart contract

How can a smart contract receive data (strings or int) from an html page? I would like to receive some information that a user con insert in a web page, in order to save them in the blockchain (for ...
2
votes
1answer
103 views

How Can I Convert Between A Solidity Timestamp And Year/Month/Day Hour:Minute:Second?

Solidity provides the uint256 now or block.timestamp Special Variable. How can I convert between this Solidity timestamp and year/month/day hour:minute:second?
1
vote
1answer
835 views

Block time and confirmation time

I have been reading in different papers and comments these two concepts and I would like to know the difference between them(if there is, sometimes it is a bit confusing). I understand that the block ...
1
vote
2answers
286 views

Slackness issue and time in smart contracts

At a high level, slackness issue says, it is not possible to guarantee that at any given point in time all honest miners see exactly the same blockchain length [1]. On the other hand, as we know the ...
0
votes
3answers
99 views

How to allow an account to withdraw from another one?

The goal is to create a contract which allows party B to withdraw from party A's account according to some formula. I don't want to use an escrow model, rather just to: Let A attest that they are ...
0
votes
1answer
16 views

Using unix timestamp and making clients get token

I'm trying to make a function that uses unix timestamp for setting a limited time and after the limited time is over I would like to make clients get their token by themselves Does anyone have any ...
1
vote
2answers
107 views

What does this code return? block.timestamp / 1 days

function today() private view returns (uint256) { return block.timestamp / 1 days; } Why do we need this function?
0
votes
1answer
61 views

converting “now” to “day”?

Consider we need to determine an expiry date for a contract such that after this date the contract will be destroyed as follows: uint256 public expiryDate; constructor(uint256 duration) ...
1
vote
1answer
25 views

How to find the first block after given timepoint in solidity?

function firstBlockAfter (uint timepoint) returns (uint) { // returns the first block number after timepoint } Is there any solution except iterating the latest 256 blocks?
1
vote
1answer
65 views

How to do performance evaluation?

How to do the performance evaluation in terms of secs or minutes? what is the command to use in solidity?
0
votes
1answer
132 views

Keccak256 of msg.sender and timestamp: what's the likelihood of an output coincidence?

Let's think about this code: function publishEtherBox (bytes32 _label, string _ownerUrl, uint _lifespan) external onlyWhenRunning() payable { require(ownerToEtherBoxes[msg.sender].length < ...
3
votes
2answers
86 views

Balance of an address depending on a time variable

is there a way to compare the balance of an address at two different times or in general check the balance of an address at a specific time? I would like to do something like... uint256 public ...
0
votes
0answers
36 views

Mesure time elasped from a block number

I want to have a payable function with the equiv of ~1000€ in eth. Because the price of 1 ETH may change in the future, i want to ask a Oracle the price in ether for 0.01€. I've found a website that ...
1
vote
1answer
22 views

Can a full mining node choose to keep a transaction for itself and pass it in the next mined block?

the idea is if a malicious mining node choose to keep a transaction for itself and not propagate it to the network until the same node find a block and post that transaction in it, so the node will be ...
0
votes
1answer
213 views

using block.blockhash instead of block.timestamp for 30 minutes

I would like to check if the time has passed 30 minutes before executing a function in my contract. I know how it is done using block.timstamp .. But I want to use block.clockhash as it is more secure....
2
votes
3answers
291 views

How to get the block number which is the closest to a given timestamp?

Is there any method(ology) in web3 which allows to get the block number at a given date? In particular, I have two dates as an input and I want to effectively get all events between those two dates. ...
1
vote
2answers
65 views

How can I send eth on specific time?

How can I send eth on specific time? In case the ICO crowd sale starts on 9:00:00 UTC, how can I make txid on 9:00:00 exactly when I send eth?
1
vote
1answer
260 views

How can you add a certain number of months to a timestamp (uint)?

I am writing a contract that will calculate interest on a periodic basis using the exact number of days in each period. So, for example, if I use Jan 1st 2018 to March 31st 2018 as an example, there ...
0
votes
0answers
105 views

How can I mock past time?

I know there are ways to skip block times using something like https://github.com/DigixGlobal/tempo but are there any ways to timetravel back to past time? Ganache page says I can set time on a ...
4
votes
2answers
273 views

Check that the timestamp of the block is greater than that of the previous block and less than 2 hours into the future?

I am reading the White Paper of Ethereum. And at the Mining Section, I do not understand the this part "less than 2 hours into the future" of the following sentence: Check that the timestamp of the ...
0
votes
1answer
204 views

How to give opening and closing time for contract in remix

I have implemented a timed crowdsale contract and it's constructor is like this: function NeoCrowdsale(uint256 _openingTime, uint256 _closingTime) public { require(_openingTime >= now); ...
1
vote
1answer
126 views

Can you store and query time series data on ethereum network?

I am interested in facilitated decentralised ownership of smart meter data by putting it on a blockchain of some description. Would it be possible to do this through the ETH network? Obviously it ...
2
votes
0answers
324 views

Working with time in smart contracts

I know there have been quite a few questions surrounding time, and the use of block.timestamp. However, I still have a few questions design-wise. At what point exactly is it 'dangerous' to use block....
-1
votes
0answers
73 views

How to replace now timestamp to avoid miners modify

how to replace the now timestamp to avoid miners modify? //Proof of work bytes32 public currentChallenge; // The coin starts with a challenge uint public timeOfLastProof; ...
1
vote
1answer
236 views

What recommended amount of storage for storing timestamps?

E.g: uint8, uint16, uint32, uint64, uint128, uint256? Which of these is best recommended to future-proof the application? And given each uint, what year is the furthest it could be stored?
0
votes
1answer
961 views

How can I get current time?

My project is fully based on time. Is there any way to get current time without using NOW? NOW is just returns time when block was mined and always shows "transaction will fail" when I do require(now &...
0
votes
1answer
400 views

how to define start time and end time of crowdsale in constructor

I am pretty much stuck with my crowdsale contract. I think i am missing the correct entries in the constructor like time and rate. Can someone help me on how to fill in the correct values? I am ...
5
votes
2answers
284 views

How Geth and Parity resolve timestamps when validating block headers?

Geth and Parity nodes differ in a fundamental way when they validate block headers. Background According to the yellow paper 4.3 timestamp: A scalar value equal to the reasonable output of Unix's ...
1
vote
0answers
21 views

Can't check if time is over using NOW

I'm coding a smart contract for an ICO and I have a problem. I have a modifier wich checks if NOW > timestamp, but it's not working for some reason. Here is the function: function DeleteModerator(...
1
vote
1answer
46 views

Get the time a block was mined

My front-end displays the timestamps of various contract actions that have taken place. However, the current block.timestamp it's using isn't very accurate, because the miner has some leeway in ...
0
votes
1answer
47 views

Which is going to be the very last block of 2017?

I know that the last moment of the year depends in which time zone you are. But lets assume that we want the very last moment, so let's consider the last time zone (+12), I believe is Fiji or New ...
6
votes
2answers
2k views

How does CryptoKitties track time?

I'm looking at KittyBreeding.sol and see /// @dev Set the cooldownEndTime for the given Kitty, based on its current cooldownIndex. /// Also increments the cooldownIndex (unless it has hit the ...
3
votes
1answer
1k views

How to avoid block.timestamp warning?

I am aware that miner can have influence on block.timestamp My question is, how to avoid this warning?
0
votes
1answer
59 views

Uncle timestamp validity

Regarding acceptance/rejection of uncle blocks, what are acceptable block timestamps for an uncle block? Say: block123_timestamp = Y uncle123_timestamp = X Where X < Y. Is uncle123 a valid uncle, ...