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
0answers
19 views

How can I use bitcoin block stamp as seed for random number generation?

I am trying to create an ethereum based smart contract that shall generate random number. After searching around, I get to know that ethereum block stamp is vulnerable to miners hacks and false ...
0
votes
1answer
11 views

Can I rely on certain oracle to know the precise and reliable timestamp?

I am learning the security impact of smart contract on system properties like block.timestamp and block.number. I understood that block.timestamp can be controlled by the miner to certain degree and ...
1
vote
2answers
38 views

Understanding ganache timestamps

Sometimes, when I use the ganache specific evm_increaseTime method and advance to the next block, the next timestamp is NOT: current timestamp + advanced time But instead: current timestamp + ...
1
vote
2answers
31 views

Decentralized Time server to get time in Dapps? [closed]

So basically i want to ask that how can we programmatically get the accurate, exact and current time in a DApp, without relying on the system's time or a centralized time server ? Is there a ...
0
votes
1answer
15 views

How do I add 7 years to a current time expressed as a block.timestamp?

Being new to solidity, I find the docs on the Internet very confusing. I simply want to add 7 years to a uint timeInSevenYearsFromNow = (block.timestamp).add(????); What is the value of ???? and ...
0
votes
0answers
23 views

Time in blockchain and HTML

I'm trying to get time once data is submitted off-chain, since only way to get on-chain is via now to get the block time. Off-chain I'm using "document.getElementById("demo").innerHTML = Date()" to ...
4
votes
1answer
40 views

Timestamp in Ethereum

I have a smart contract where the user inputs temperature readings, I'd like to add a time stamp to relate those reading with a current time of submission. I understand that in Ethereum we only have ...
0
votes
1answer
28 views

How can I wait if it's not possible in smart contracts? [duplicate]

From my understanding, waiting in a solidity smart contract would create a total disaster for the whole Ethereum's blockchain. I can see in some circumstances that solidity offers block.timestamp ...
1
vote
1answer
32 views

Are block timestamps decentralized?

One thing I don't understand about the Ethereum protocol is how timestamps work. If I, as miner, have a reason to fiddle with timestamps (such as adding a few minutes to decrease the mining difficulty)...
3
votes
1answer
244 views

Is “now” UTC time in Solidity?

The now keyword in Solidity returns a uint256 with the current block timestamp. Is the timestamp in UTC time? (ie. the number of seconds since 1st January 1970)
0
votes
1answer
17 views

Understand the potential issue of miner controlled gaslimit

I am aware that smart contracts running on top of EVM can access certain system properties such as timestamp, block number, and gas limit. I am also aware that such properties can be controlled by ...
0
votes
1answer
35 views

How long does an ether transaction take until verification (and where do I get this data?)

I am wondering if data is stored in the ETH blockchain on the time the transaction got send to the mempool such that I can deduce the time until it got included in a public afterwards (not to be ...
0
votes
0answers
10 views

Transaction added to already mined block

i run a private blockchain and i have realized some strange behaviour there. Concret i started a transaction and save the timestamp, when it has been started. Then i wanted to figure out, how long ...
1
vote
1answer
135 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
105 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
124 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
24 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
21 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
159 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
81 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
58 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
83 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
73 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
168 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
94 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
162 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
80 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
157 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
53 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
165 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
233 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
2k 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
121 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
162 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
91 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
29 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
85 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
191 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
95 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 ...
1
vote
1answer
26 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
312 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
555 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
68 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
362 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 ...
4
votes
2answers
366 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
2answers
297 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
145 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
386 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....