parent
49605b257d
commit
07c4ebb7f2
|
@ -24,6 +24,8 @@ Create a *Historian* and send it *events* to generate an *event log*, where each
|
|||
is tagged with the historian's latest *hash*. Then ensure the order of events was not tampered
|
||||
with by verifying each entry's hash can be generated from the hash in the previous entry:
|
||||
|
||||
![historian](https://user-images.githubusercontent.com/55449/36492299-151c65e2-16ea-11e8-97b6-14f1d9b97985.png)
|
||||
|
||||
```rust
|
||||
extern crate silk;
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
msc {
|
||||
client,historian,logger;
|
||||
|
||||
client=>historian [ label = "Tick" ] ;
|
||||
historian=>logger [ label = "Tick" ] ;
|
||||
logger=>historian [ label = "e0 = Entry{hash: h0, n: 0, event: Tick}" ] ;
|
||||
logger=>logger [ label = "h1 = hash(h0)" ] ;
|
||||
logger=>logger [ label = "h2 = hash(h1)" ] ;
|
||||
client=>historian [ label = "UserData(d0)" ] ;
|
||||
historian=>logger [ label = "UserData(d0)" ] ;
|
||||
logger=>logger [ label = "h3 = hash(h2 + d0)" ] ;
|
||||
logger=>historian [ label = "e1 = Entry{hash: hash(h3), n: 2, event: UserData(d0)}" ] ;
|
||||
logger=>logger [ label = "h4 = hash(h3)" ] ;
|
||||
logger=>logger [ label = "h5 = hash(h4)" ] ;
|
||||
logger=>logger [ label = "h6 = hash(h5)" ] ;
|
||||
client=>historian [ label = "Tick" ] ;
|
||||
historian=>logger [ label = "Tick" ] ;
|
||||
logger=>historian [ label = "e2 = Entry{hash: h6, n: 3, event: Tick}" ] ;
|
||||
client=>historian [ label = "collect()" ] ;
|
||||
historian=>client [ label = "entries = [e0, e1, e2]" ] ;
|
||||
client=>client [ label = "verify_slice(entries)" ] ;
|
||||
}
|
Loading…
Reference in New Issue