20
votes
Accepted
Is there a maximum number of transactions a block can hold?
Both the block size and the transaction size are defined as protocol parameters. These can be changed at any time by IOG, or voted on once we have Voltaire. Blocks come on average every 20 seconds, ...
12
votes
Accepted
How to convert posixTime to slot number on Cardano Testnet
I share this code snippet with the converter.
module Week03.Converter ( posixTimeToSlotTestnetConverter ) where
import Ledger ( POSIXTime(POSIXTime), Slot(Slot) )
import Ledger.TimeSlot ( ...
10
votes
Accepted
Calculate timestamp from slot
You did not account for Byron, where one slot was 20 seconds.
To make it easier, take the start time of epoch 209 which is the Shelley hardfork and started at 1596491091 unix time on slot 4924800.
...
7
votes
Accepted
How does Cardano execute real time transactions if block time is 20 seconds?
Block time is 20 seconds in average. Sometimes we have blocks at shorter intervals, sometimes much longer. I saw sometimes sequences of 4 or 5 blocks at one second interval from each other. And ...
5
votes
Is there a maximum number of transactions a block can hold?
Expanding on Andrew's excellent answer with some examples.
The lowest amount of transactions that could be in a block is maxBlockBodySize / maxTxSize, currently equal to 4.
It might be more practical ...
4
votes
Accepted
When was the slot duration set to 1 sec on Cardano Testnet?
I did a little bit of digging. Block 1597133, created on 2020/07/28 20:20:16 was the first block to use 1 second per slot.
Epoch
Slot
Block
Created
Delta Next Slot
Delta Next Created
Time Per Slot
...
4
votes
How to convert posixTime to slot number on Cardano Testnet
The accepted answer already explains how the calculation must be made and provides a sample code in Haskell; however, I will also leave here a simple snippet of code in Java, removing all the Haskell ...
3
votes
Accepted
How to implement Vesting smartcontract with time period longer than 36 hours?
Lars is right. There is no guarantee that 1 slot remains equal to 1 second because a parameter update could happen at any time and be applied for future epochs. There are currently no plans to change ...
2
votes
Calculate timestamp from slot
Note this answer could change if a hard fork changes parameters.
The Shelly unix time is the start time of the Shelly era and the Shelly slot is the corresponding slot. We use these values to ignore ...
2
votes
Accepted
How many slots did Byron era (testnet) have?
As far as I know, Shelley started at epoch 1, i.e. after a single Byron epoch 0 on Cardano Testnet.
Byron started on Testnet:
epoch 0 ... slot 1031 ... block 1 ... date 2019/07/25 ... time 02:03:56
...
2
votes
Accepted
Is there a way for a validator to get the current time?
The usual way to handle time in Plutus is using Slot ranges. This means that the script does not query the time. Instead it checks that the validation happens in a given slot interval that corresponds ...
2
votes
Accepted
How to have a contract on chain for extended periods of time?
Just a guess, but you might be referring to the POSIX time <-> slot conversion, where Lars noted in week 3 (see notes here), that - if you require a definite upper bound for a slot interval - ...
2
votes
Accepted
Whats the function to get the current time in Plutus?
each transaction on Cardano has a ttl (Time To Live) determined in the moment of transaction creation, it can't be submitted outside that interval, and even if the transaction is submited, other node ...
1
vote
How to calculate the slot time of a given date?
This depends on the slot length which can be changed. You can't be certain about a slot number for sometime that is a long time in the future.
If you assume you know the slot config then you can use
...
1
vote
Is there a way for a validator to get the current time?
How about parameterizing the validator with Slot or POSIXTime and passing the current time from the contract to the validator script using Contract.currentTime or Contract.currentSlot?
That way, the ...
1
vote
Calculate timestamp from slot
Calculating a timestamp from a slot number is risky!
Theoretically, the slot duration could be changed by a hard fork for example because of performance reasons (as has already happened). So it's ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
slottime × 15time × 6
plutus-pioneer-program × 5
plutus × 4
smart-contract × 4
posixtime × 4
cardano-node × 3
testnet × 3
cardano-cli × 1
on-chain × 1
statemachines × 1
validator × 1
block-production × 1
validation × 1
blocksize × 1
txinfovalidrange × 1