opentimestamps / opentimestamps-client

OpenTimestamps client
Other
286 stars 81 forks source link

Tweetable timestamps #57

Open kanzure opened 6 years ago

kanzure commented 6 years ago

When the proof is short enough, it's possible to link the proof in a URL shortener and post on twitter, including the entire matured timestamp. It would be nice if the client would give me a link in the following format:

https://opentimestamps.org/info.html?ots={serialized_timestamp}

This can get URL shortened and the URL shortener stores the proof and gives you a short URL to pass around in public. Fits nicely into a tweet, too.

Also, I believe the serialized timestamp should only include one attestation, not all of the available attestations from the OTS file.

When a timestamp was made from a merkle tree of many other elements, maybe the client should complain to the user and say that a URL shortener will not be likely to accept the input. These services often have a length limit, it's not like they gladly accept gif/webm data: URIs.

petertodd commented 6 years ago

Hmm, that's an interesting idea.

What's the limit on maximum URL size for the shortener?

kanzure commented 6 years ago

This doesn't seem to do quite what I want (serialization problems):

diff --git a/otsclient/cmds.py b/otsclient/cmds.py
index 84c3b19..51ccf05 100644
--- a/otsclient/cmds.py
+++ b/otsclient/cmds.py
@@ -505,6 +504,15 @@ def info_command(args):
     print("Timestamp:")
     print(detached_timestamp.timestamp.str_tree(verbosity=args.verbosity))

+def twitter_command(args):
+    ctx = StreamDeserializationContext(args.file)
+    detached_timestamp = DetachedTimestampFile.deserialize(ctx)
+    detached_timestamp.timestamp.attestations = set(list(detached_timestamp.timestamp.all_attestations())[-1])
+    detached_timestamp.timestamp.ops = list(detached_timestamp.timestamp.ops.values())[-1]
+    with open("twitter.ots", 'wb') as new_stamp_fd:
+        ctx = StreamSerializationContext(new_stamp_fd)
+        detached_timestamp.serialize(ctx)
+    print("Wrote to twitter.ots")
petertodd commented 6 years ago

Mind copying-n-pasting the error message you get?

jonathancross commented 5 years ago

@kanzure ?