rps17

rps17

InterPlanetary File System (IPFS) - how to implement it in Elixir?

Hi,

recently I took contact with IPFS, an attempt to improve the current web making it permanent and more resilient. I found it very interesting and with great potential to help in the development of distributed apps (dapps).

The IPFS make use of Merkle DAG and characteristics of other applications.

Currently, IPFS is implemented with GO language. I was wondering how to implement it in Elixir. I think it worth while since Elixir language is more fun to code regarding GO.

I am learning Elixir yet and have few practice in development, but trying hard to improve my skills.

To see more about IPFS:

Juan Benet explaining the IPFS at the Standford University

Thanks

Most Liked

rps17

rps17

Hi! thanks for your interesting answer. Certainly it helped me to see the big challenge to implement IPFS using Elixir. I’ll try to understand the ibgib.

I also think IFPS iss approaching the transport layer.

Thanks again and good lucky!

ibgib

ibgib

Well, that is a huge, non-trivial question! :smile:

They’ve been at it according to github for a couple years now, with over a hundred of contributors and almost 200 current branches! So, you would need to ask not only an elixir expert, but also a IPFS expert - which I’m not sure if there are any experts in both (yet)!

That said, and with the caveat that I know next to nothing of their actual code implementation, I have been learning about how they’re structuring it conceptually. I can tell you that ibgib has many similarities with their goals. I’m using a mechanism that is very merkle-esque. Briefly, the data structure for ibgib is ib, gib, data, and rel8ns. The ib acts as a non-unique identifier, and the gib acts (usually) as a sha-256 hash of the ib, data, and rel8ns (i.e. the “content”). This is the only data struct in the application, as the actual content of the ibgib populations (persisted in the repo) contains the actual “data structures”. As such, it is also a monotonically-increasing database, with no deletes (no “unlinking”). So if you have an ib^gib address, then you have the address to a unique, immutable thing.

So the “heart” as he calls it, the merkle(ish) dag, is there.

Ibgib does not however concern itself with the transport layer, as it is strictly agnostic to how these data get created. And since the gib acts as a hash, it should not matter what the transport layer is. I think (perhaps!) that they’re more interested in supplanting current http infrastructure, and that just isn’t something I’m remotely interested at attempting to do.

But the one big foundational concept is the one he discusses about distributability. Because of this end goal in mind, I have created each individual ib_gib as a process. It is an “immutable state” process, but a process nonetheless. This way, in the future when it grows from a single repo and a single node to a cluster of nodes and whatever db substrate implementations (because the db is just a persistence mechanism), any users can talk to any of their “local” ibgib processes to interact with.

But one of the big problems with using Elixir, and this is probably important for you with regards to your question, is regarding what he discusses in the video you linked as the “offline” disconnected scenario. In order to effect this, you have to be able to have the engine running on any client. This is similar to how git can operate locally on any node and then merge changes/interact with servers, as the servers are just other nodes in the merkle dag.

Elixir, at the current time, only runs where erlang (the BEAM!) runs, and as best as I can tell, that does not currently include apple iOS or Android. Perhaps this is why the IPFS team is approaching the transport layer?

Anyway, I have no idea if this helps you on your question, but I just had to go ahead and respond because IPFS looks very interesting!

Where Next?

Popular in Discussions Top

jesse
Hi everyone, I hesitated to post this here because I don’t want you to think I’m spamming, but I’ve been working on a Platform-as-a-Serv...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18634 126
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement