---
# System prepended metadata

title: Notes

---

# Notes
Purpose of components:

* Witness: 
    - create and sign receipts,
    - store kel,
    - 🤔🤔🤔 __Now, to add event to kel it needs to be fully witnessed, so witness needs to collect other witnesses' receipts. Maybe it shouldn't care about other witnesses receipts? Just sign and insert to its database first seen event which match kel__
   
* Resolver 
    - publish witnesses addresses,
    - publish identifier Key Event State (or full kel?),
    - 🤔🤔🤔 __should resolver store all events and receipts? Or just state and don't care about kel because it can be found by asking witness. But how to decide that witness can be trusted?__

* Controller
    - manage keys,
    - publish key changes to witnesses.
 
# Tak jest teraz
```plantuml
@startuml
Controller->Witness1: Send event
Controller->Witness2: Send event
Witness1-->Controller: Send receipt
Witness2-->Controller: Send receipt
Note left of Controller: Collect receipts
Controller->Witness1: Send rest of receipts
Controller->Witness2: Send rest of receipts
Note right of Witness1: Check if event\nis fully witnessed
Witness1 -> Resolver: Update the state, please
Note right of Witness2: Check if event\nis fully witnessed
Witness2 -> Resolver: Update the state, please
Controller2-->Resolver: Get ksn/kes of identifier
Resolver->Controller2: Send ksn/kes and witnesses addres
Note right of Controller2: Now can as witnesses \nabout kel they have.
@enduml
```

__Note__ `Update the state, please` means sending the state, not full kel and receipts. Then Resolver doesn't check anything, just updates state to new one, sent by witness.

🤔🤔🤔 __To be able to verify kel it needs to have all kel events and their receipts, `ksn` message or just serialized id state is not enough. So should resolver has all events in its database, or just state sent and signed by witness? It should be possible to verify event having just last state and receipts of this event, but it need some extra work in keriox__

# Jak by było gdyby resolver nie musiał polegać na witnessach tylko sam miał wszystkie eventy

```plantuml
@startuml
Controller->Witness1: Send event
Controller->Witness2: Send event
Witness1-->Controller: Send receipt
Witness2-->Controller: Send receipt
Note left of Controller: Collect receipts
Witness1-->Resolver: Send event and receipt
Witness2-->Resolver: Send event and receipt
Controller2-->Resolver: Get ksn/kes/kel of identifier
Note right of Resolver: Compute state (ignore not fully witnessed events)
Resolver->Controller2: Send ksn/kes/kel and witnesses addres
Note right of Controller2: Now can as witnesses \nabout kel they have.
@enduml
```

Here witnesses just send events they got to resolver, and resolver decides if it is fully witnesses while computing state of identifier. It let witnesses don't care about other witnesses receipts and witness threshold, they can just accept first seen event of given sn.

🤔🤔🤔 __But in this case we can get full kel from resolver, so why ever would we ask witness about it?__