To demonstrate an more realistic usecase of Validated Streams, we have set up an example of a validators listening on an IRC channel, submitting events from it to a blockchain, and reporting back to users when those events have been finalized. As it is, extending the example to support a token economics or to verify user identities is left as an exercise to the reader.
Running the example:
-
Build the necessary docker images:
docker-compose build
-
Start the local network of validators, trusted clients, and an IRC server:
docker-compose up -d
-
Connect to the local IRC server at
localhost:6667
(non-TLS), join#validated-stream
and send a message. Sample interaction:* Now talking on #validated-stream <user> bot-bob: help <bot-bob> user: !w[itness] <data> -- create and witness a validated-streams event <user> !w this is a test event for the README <bot-charlie> user: witnessing BE807ED3F92D7C8228302829F829B827E2F7C8338B17A736CAF8AF18403E68F1... <bot-charlie> user: BE807ED3F92D7C8228302829F829B827E2F7C8338B17A736CAF8AF18403E68F1 validated!
Empirical testing shows that events are validated (finalized) in roughly ~16 seconds by the sample network. It is plausible that tuning the node configuration could produce faster finalizations.
-
Stop the network when you are finished:
docker-compose down
The goal of this example is to observe the real-world events of a user sending a specially-formatted text message on a specific IRC channel, then witness those on a Validated Streams chain. Drawn as an architectural diagram, our example would resemble the following:
Since this is a toy example, we won't delve into what happens on the chain after the event is received. (Perhaps it is the entry point to a smart contract that later interprets the messages as votes from DAO members or perhaps it is all just a guestbook where visitors leave notes.) Instead, what we would do is wait for a confirmation that the message has been irreversibly stored in the chain and relay that back to the user. Conceptually, inversing the diagram above:
At this point, the user will have confirmation that their message has been stored on the Validated Streams chain.