We are very happy to announce an initial alpha release of ocaml-dmc
. ocaml-dmc
is an OCaml implementation of the DMC specification that we previously presented.
Introduction
As part of DREAM we are researching and developing data models that enable peer-to-peer group collaboration.
We believe that to enable decentralized and collective control over information new data models need to be researched and developed.
Based on our previous work we have implemented an OCaml library and a command-line interface tool that can be used to collectively manage a collection of data.
Implementation
An alpha version of ocaml-dmc is available in the Git repository: 0.1.0-alpha.
The implementation consists of a OCaml library and a Unix command-line-interface that can be used to to experiment with DMC containers from the comfort of your Unix shell.
Try it
You can try the DMC implementation in a suitable development environment by using Guix. Please see the repository README for detailed instructions.
Highlights
Irmin
Our DMC implementation uses the Irmin database. This allows the implementation to be portable and usable on many platforms that have working Irmin backends. This includes MirageOS, Web (via irmin-indexeddb) and Unix.
Irmin also provides distribution and synchronization functionality and allows direct implementation of CRDTs. We, however, do not use those functionalities of Irmin. We use Irmin as a portable key-value store. We do not rely on Irmin specific implementation details and allow other compatible implementations that are written in other languages and do not Irmin
Datalog
The DMC specification defines the computation of container state as Datalog programs. These rules (which are the core of the container logic) are used almost verbatim in the ocaml-dmc implementation (src/dmc/dmc.ml · main · DREAM / DROMEDAR / ocaml-dmc · GitLab). ocaml-dmc
includes a Datalog engine that computes the specification.
The Datalog engine can also be used for rich and interesting application level queries on data in DMC containers as well as for logical inference. We hope to explore and demonstrate this more clearly in future work.
ocaml-rdf
DMC uses RDF as underlying data model. The data model is very simple, well-adapted for distributed systems, allows the re-use of many existing vocabularies and ontologies and allows a high-level of compatibility with existing RDF systems (e.g. ActivityPub).
For this Alpha release we have developed an OCaml RDF library (DREAM / DROMEDAR / ocaml-rdf · GitLab). This RDF library includes basic RDF types and datastructures as well as support for the RDF/JSON and RDF/Turtle serialization formats.
ocaml-eris
DMC uses the Encoding for Robust Immutable Storage (ERIS) for transport-optimized content-addressing.
As part of the Alpha release we have developed an OCaml implementation of ERIS (DREAM / DROMEDAR / ocaml-eris · GitLab)
Outlook
Much work is still required to make the work practically usable and this is what we intend to work towards in the next months.
Transports
Currently the implementation allows writing and loading container state to/from CBOR. This allows out-of-band transport and synchronization of containers (e.g. as attachment to an e-mail).
Further work is required to research and develop more efficient and in-built means of transporting and synchronizing container state across networks.
Delegated Authorization
The implementation allows authorizing additional keys to mutate containers. We believe that this is a core functionality that allows collective control over data.
However, currently it is not yet possible to revoke the authorization from a public key. Further work is required to document and implement a revocation system.
Registers
This alpha implementation only implements the Set container (allowing multiple elements to be member of a container). This is already very useful for many applications and can be used to implement things like a map.
The DMC specification also defines a register that holds a single value. This is currently not yet implemented in our OCaml implementation. More work is required to overcome some technical limitations (representation of Literals in the RDF library and aggregation in the Datalog engine) to implement registers.
Queries and inference
Our DMC implementation contains a Datalog engine which is used to compute container state. Datalog is also capable of evaluating complex application-level queries as well as doing logical inference on data.You can get a small glimpse of the possibilities by starting up the Datalog REPL builtin to the CLI tool (see README.md · main · DREAM / DROMEDAR / ocaml-dmc · GitLab).
We believe that this is a key functionality of DMC and our implementation. Further work is required to highlight and demonstrate this functionality.
Thank you!
We welcome feedback and criticism! Our forum is open for friendly cooperation among #dream-catchers. Do not hesitate to contact us and contribute to the code: our research is made to improve the digital commons.