Commit Graph

2046 Commits

Author SHA1 Message Date
Greg Fitzgerald ab5252c750 Move entry verification out of Entry impl 2018-02-26 14:39:01 -07:00
Greg Fitzgerald b02eab57d2 Extend the event log with a Transaction event to transfer possession
This implementation assumes 'from' is the current owner of 'data'.
Once that's verified, the signature ensures that nobody modified
'data' (the asset being transferred) or 'to' the entity taking
ownership.

Fixes #14
2018-02-26 11:09:11 -07:00
Greg Fitzgerald b8d52cc3e4 Make the Discovery event into a struct instead of a tuple 2018-02-24 11:15:03 -07:00
Greg Fitzgerald d78082f5e4 Test bad signature 2018-02-24 10:27:51 -07:00
Greg Fitzgerald 08e501e57b Extend the event log with a Claim event to claim possession
Unlike a Discovery event, a Claim event associates a public key
with a hash. It's intended to to be used to claim ownership of
some hashable data. For example, a graphic designer could claim
copyright by hashing some image they created, signing it with
their private key, and publishing the hash-signature pair via
the historian. If someone else tries to claim it as their own,
the designer can point to the historian's log as cryptographically
secure evidence that the designer's copy existed before anyone
else's.

Note there's nothing here that verifies the first claim is the actual
content owner, only that the first claim almost certainly happened
before a second.
2018-02-24 10:09:49 -07:00
Greg Fitzgerald 29a607427d Rename UserDataKey to Discovery
From the perspective of the log, when some data's hash is added,
that data is "discovered" by the historian.  Another event
might be a "claim" that some signed data belongs to the owner of a
public key.
2018-02-24 05:25:19 -07:00
Greg Fitzgerald c1326ac3d5 Up the time to sleep so that ticks are generated 2018-02-21 12:22:23 -07:00
Greg Fitzgerald 7871b38c80 Update demo to use self-ticking logger 2018-02-21 11:52:03 -07:00
Greg Fitzgerald b34d2d7dee Allow the logger to inject Tick events on its own 2018-02-21 11:33:42 -07:00
Greg Fitzgerald fa4e232d73 Add serialization/deseriation support to event log
See bincode and serde_json for usage:
https://github.com/TyOverby/bincode

Fixes #1
2018-02-20 16:26:13 -07:00
Greg Fitzgerald 6e37f70d55 Test reorder attack 2018-02-20 14:46:36 -07:00
Greg Fitzgerald d97112d7f0 Explain proof-of-history in the readme
Also:
* Hash userdata so that verification works as the readme describes.
* Drop itertools package. Found a way to use std::iter instead.

Fixes #8
2018-02-20 14:04:49 -07:00
Greg Fitzgerald ba90e43f72 Update benchmark
* Add asm, though it doesn't make it faster. TODO: use avx instructions.
* Do 10x less hashes, since sha256 is more expensive.
2018-02-19 16:51:35 -07:00
Greg Fitzgerald 0297edaf1f Use sha256 hashes instead of Rust's builtin hasher.
Causes a 20x performance degradation. Enabling asm did not
speed things up.
2018-02-19 16:23:53 -07:00
Greg Fitzgerald bb22522e45 Remove assertions that fail in the kcov docker container 2018-02-19 12:54:01 -07:00
Greg Fitzgerald bd3fe5fac9 Sleep a little longer to ensure Travis context switches 2018-02-19 12:33:33 -07:00
Greg Fitzgerald 10a70a238b Cleanup demo 2018-02-19 12:25:57 -07:00
Greg Fitzgerald 4a7156de43 Move hash generation into stateless function 2018-02-19 12:09:58 -07:00
Greg Fitzgerald d88d1b2a09 Reset historian's hasher between events
Hasher will generate different hashes for the same input if it
had already generated a hash.

Also add a binary to ensure the example in the README works.
2018-02-19 12:03:06 -07:00
Greg Fitzgerald 5e3c7816bd Ensure verify_slice succeeds 2018-02-19 09:09:24 -07:00
Greg Fitzgerald ceb65c2669 Better function names 2018-02-18 10:05:54 -07:00
Greg Fitzgerald fd209ef1a9 Rename event crate to log 2018-02-18 09:59:33 -07:00
Greg Fitzgerald 471f036444 Better names
Event -> Entry
EventData -> Event
2018-02-18 09:53:40 -07:00
Greg Fitzgerald 4c94754661 More coverage 2018-02-17 21:13:52 -07:00
Greg Fitzgerald 831e2cbdc9 Add historian
A microservice that continuously generates hashes, only stopping to
tag messages with the latest hash.

Fixes #8
2018-02-17 20:58:23 -07:00
Greg Fitzgerald 69f70cfe72 Add separate benchmarks for seq and par versions of verify_slice 2018-02-16 09:38:12 -08:00
Greg Fitzgerald 1c2e0af69b Docs cleanup 2018-02-16 09:56:10 -07:00
Greg Fitzgerald a857ae514b Test sequential version of verify_slice with same tests 2018-02-16 09:14:42 -07:00
Greg Fitzgerald 09ccc1ee6d Use create_ticks() outside of benchmark for improved code coverage 2018-02-16 09:06:25 -07:00
Greg Fitzgerald 38485b09c7 Move tests to expose them to rustfmt and kcov 2018-02-15 17:47:54 -07:00
Greg Fitzgerald fb168fcee0 Cleanup
Make it so the parallel and sequential verification implementations
are only different in one line.

For reasons I don't understand Rayon's `all()` isn't `mut`.
2018-02-15 16:00:53 -07:00
Greg Fitzgerald b5645bc776 Rename project 2018-02-15 13:59:33 -07:00
Greg Fitzgerald 3cef50056b Consistent naming 2018-02-15 11:50:48 -07:00
Greg Fitzgerald a20e114a80 Cleanup tests 2018-02-15 11:48:18 -07:00
Greg Fitzgerald 0dc0ae506d Better names 2018-02-15 11:45:04 -07:00
Greg Fitzgerald 9723c827f5 mut hash -> end_hash 2018-02-15 11:29:09 -07:00
Greg Fitzgerald 75d091bd3c More descriptive event data 2018-02-15 10:57:32 -07:00
Greg Fitzgerald d21ad9357c More descriptive field names 2018-02-15 10:48:30 -07:00
Greg Fitzgerald a74540470a Rename Tick to Event
* Define a tick to be an event with no user data.
* Use the term "event log" for now.
** Reserve the word "entry" for hash entries, and "item" for array items.
** Reserve the word "blockchain" for when the event is a block of something.
** Reserve the word "ledger" for when the event is of a particular type,
   such as transactions.
2018-02-15 10:13:59 -07:00
Greg Fitzgerald beb4a643ad Add back a more traditional version of new() 2018-02-14 16:52:09 -07:00
Greg Fitzgerald cdf3cffcae Rename Tick::new() to Tick::run() 2018-02-14 16:45:42 -07:00
Greg Fitzgerald 8a521ba163 Make space for user data 2018-02-14 16:18:06 -07:00
Greg Fitzgerald 31d79727b6 Parallelize verification 2018-02-14 15:23:13 -07:00
Greg Fitzgerald 8ff8e90c5e Cleanup slice verification 2018-02-14 13:02:39 -07:00
Greg Fitzgerald d23fda1936 First go at Proof of History 2018-02-14 11:00:01 -07:00
Greg Fitzgerald bad95b7712 cargo init 2018-02-14 07:23:59 -07:00