The timestamping service has been launched.
The final contract has been tweaked a bit:
- There is no timestamping fee and the service is free. Spender just has to pay tx fee
- There is a buffer of 5 blocks, so the timestamp must be considered to have an error margin of 5
Please see this page for the contracts actually used.
Overview
The timestamp is a proof to the claim that a box with a given Id indeed existed on the blockchain at some height h
. The proof works even after the box has been spent, as long as the timestamp remains in the blockchain (which is at least several years or more depending on how much storage rent was provided).
This has many applications:
- It can emulate the
DEPTH
instruction - It can be used a notarisation service for an arbitrary document. Store the document in R4 of some box and then generate a timestamp of that box. The notarisation is valid even if the original box gets spent
- DEX orderbooks to sort equal-rate orders by time (with a period to allow disputes)
Bootstrap
The bootstrap tx for the master box is this
The master box address is 2vTQnMx5uFfFfJjL6ucuprpWSUeXHAqbyPLkW46DfMgw7ENGFbGBVPHJPVXwJWg5e1DdqPv28syDEJQGQy5vss2Wvh6Srrd98fSSTVfkEb5VcehCqhoGD8826imCkAfC2mDhGcTuYKcFvy4JrC8GoAbx6NZomHZAmESCL8QyQ2utraCF7TebrZGudEDehwho4AMQkq9oDkaVdyQ2NNuYQ8NwtQcBrfCZRFSGGeitPmnoCQgK8vQDxBifiQcW1avYexPYdb9CXHGT8EtKaRj5JXcqcuwwsXp5GXfG
It can be checked that there are exactly 100000000000 tokens minted with id dbea46d988e86b1e60181b69936a3b927c3a4871aa6ed5258d3e4df155750bea
Based on the contracts and the above observation, we can conclude that if a box contains the above token id and has the address 4MQyMKvMbnCJG3aJ
(corresponding to the script sigmaProp(false)
), then it is guaranteed that the box is a valid timestamp box.
First emission box
The first “timestamp emission box” (or simply, the “emission box”) creation tx is this.
The timestamp emission box address is 2z93aPPTpVrZJHkQN54V7PatEfg3Ac1zKesFxUz8TGGZwPT4Rr5q6tBwsjEjounQU4KNZVqbFAUsCNipEKZmMdx2WTqFEyUURcZCW2CrSqKJ8YNtSVDGm7eHcrbPki9VRsyGpnpEQvirpz6GKZgghcTRDwyp1XtuXoG7XWPC4bT1U53LhiM3exE2iUDgDkme2e5hx9dMyBUi9TSNLNY1oPy2MjJ5seYmGuXCTRPLqrsi
First timestamp
The first timestamp was generated for box Id d2b9b6536287b242f436436ce5a1e4a117d7b4843a13ce3abe3168bff99924a1
in this transaction
Incidentally, this box was also spent in the same transaction that timestamped it (thus, Ergo allows us to have the same box both as a data input and normal input in a transaction)
The timestamp box Id is b59ba88bb706439615bfe5035abcd6c248a027c70a82d4587d90350c15919191
. This has an unspendable script, so it should remain in the blockchain until garbage collected.
How to use
In order to use timestamps the following code snippet should be used
val box: Box = ... // some box whose timestamp is to be checked
val timestampBox = CONTEXT.dataInputs(0)
val boxId = timestampBox.R4[Coll[Byte]].get
val token = timestampBox.tokens(0)._1
val script = timestampBox.propositionBytes
val validTimestamp = box.id == boxId &&
token == timestampToken &&
script == timestampScript
val timestamp = timestampBox.R5[Int].get
// use timestamp for any purpose, including DEPTH
validTimestamp && // other condition
The value of timestampToken
is already given. The serialized hex of timestampScript
is 10010100d17300
which corresponds to the address 4MQyMKvMbnCJG3aJ
and the script sigmaProp(false)
.