tl;dr: Flowhub + IPFS + Ethereum = Decentralized Microservice
Awesomeness
It may take a while to understand the specifications and
implications of these systems. All of them are open source,
community oriented and promote decentralisation.
First, there is IPFS (
ipfs.io). It has two components:
Libp2p provides a peer to peer identity system with a public key
infrastructure (your node address is the hash of your public key)
and protocol agnostic communication between nodes.
IPFS could be described as a combination of Git, Bittorrent,
Kademlia and self certified file systems. It is build on top of
libp2p and allows you to distribute and receive content addressed
files over a peer to peer network.
In contrast to the current client-server model of the internet,
where files are addressed by their location, here they are addressed
by their hash. The network is queried for that hash and returns
which nodes host it. With this information, you can stream your file
from dozens of nodes at once. There is no "offline" anymore, only
various degrees of connectivity.
While IPFS is built on immutable datastructures, it also provides a
mechanism to publish mutable references to immutable files under
your node address, thereby authenticating their origin.
There will be another component that incentivises reliable,
untrusted, distributed storage, called Filecoin, but this does not
exist yet.
Both components are still in development, but very thought out.
Implementations in multiple languages (Go, Javascript, Python)
exist.
There exist more libraries that provide the same functionality as
libp2p, but they are not protocol agnostic. The multihash,
multiprotocol and multicodec definitions make it extremely flexible.
The third component addresses service registration, discovery,
reputation and payment. While one can use IPFS to make data publicly
accessible to the entire world at virtually no cost, most services
will require to be paid.
Real world services, hardware services and software services -
basically everything that a digital ontology can offer (e.g.
https://www.dvs.tu-darmstadt.de/staff/aherzog/a3me/Classification_A3ME.png)
could be accessed.
Some of you seem to be familiar with
cryptocurrencies. You might have heard about payment channels or the
"Lightning network" proposal. While the LN for Bitcoin is still a
work in progress, payment channels on the Ethereum blockchain
already work:
https://github.com/obscuren/whisper-payment-channel.
This schema allows one to make arbitrary micropayments and smart
contract interactions (verifiable computation) off-chain. This could
also include decentralised service registration and -discovery,
removing the necessity of lookups in a centralised database, as
Flowhub currently provides.
Ethereum is running in this very second:
https://stats.ethdev.com/
and continues to become more flexible as well. From speaking with
the respective developers I know that both projects might merge or
at least share a significant codebase.
I'm not a maximalist for any of the mentioned systems (probably
level 2 in the diagram, see the attachment), but think that they are
currently the most elegant and efficient way to implement this.
4. Flowhub
Now, where does Flowhub enter the equation, why is it needed, when
everything could be done locally? For two reasons, of which the
first already exists:
- It facilitates easy program creation. Even non-programmers can
use it to interact with services.
- It provides a trusted execution environment. The user does not
have to worry about hosting reliability and server management.
The same use cases that exist apply, but now especially service
interaction and task automatisation. Flowhub would be more flexible
than, say,
ifttt.com and
zapier.com. This requires developing a
service interface descriptor language, the implementation of
specialised nodes (libp2p-connector, ethereum-payment, -contract
interaction) and the creation of a service graph monitor.
As soon as we go meta and make the graph a service and couple it
with a graphical user interface, anyone could create their own
services.
5. Required components
noflo-ipfs - Interfacing with the default IPFS node ("ipfs")
https://github.com/ipfs/js-ipfs-apinoflo-web3 - Interfacing with the default Ethereum node ("geth")
https://github.com/ethereum/web3.js/tree/masterI started implementing noflo-ipfs, but am currently stuck, because adding files to the network requires giving a file path to the node - which would probably only work in a node environment.
6. Examples
For now, I'm assuming that the graphs are not used to implement the services themselves. Still, the following would be possible:
ifttt.com - style triggered interactions: "If the temperature sensor with the identity I published a value less then t, send me an SMS."
rundexter.com - style data flow processing: "Pipe my webcam stream to the NeuralTalk video descriptor service at identity I and pipe that to a local node doing voice synthesis"
automatic hosting: "If there is a new file in this folder, add it to IPFS, publish it under a name, contact a hosting service and schedule micropayments over a payment channel."
7. Enhancing components
Other possible improvements could be done in regards to the user interface.
Threenodes.js is great because it labels all inports and outports, as well as displays the current state of the node, if possible. The node state can even be modified (e.g. in a timer/function/color node).
http://idflood.github.io/ThreeNodes.jsHere is an example:
http://idflood.github.io/ThreeNodes.js/index_optimized.html#example/rotating_cube1.jsonIt reminds me of the Blender compositor, which has even more advanced functionality (node grouping etc.) - though that is already possible with FBP.
This is a moonshot and certainly crazy. But it might be worth it.
Please let me know what you think.
- Arndt
P.S. I'm 10+ years younger than I may sound, so please forgive my
excitement and naivety