Interplanetary git in Remix — that’s git with IPFS

Filip Mertens
Remix Project
Published in
4 min readSep 17, 2021

If you’re interested in using git and GitHub in Remix you should first read this https://medium.com/remix-ide/github-in-remix-ide-356de378f7da and then come back here.

Interplanetary…

Now that you have read up on how to use git with dGIT plugin in Remix, we can move on.

IPFS, the interplanetary filesystem, provides as way to store data in a decentralised way. It is a static public storage, this means, once it is there you can’t change it, it can only be removed.

When using dGit you have the option to export your data to IPFS.

Every time you ‘export’ (as we call it) your repo to IPFS you’ll get a new clone of your repo in IPFS. This is represented by a hash.

So when you change something, you get a new hash. And this hash represents the whole repo, complete with history!

But… why?

IPFS can be a fire-and-forget approach to sharing your work, you don’t need a cloud service or use GitHub, you can just put it there and others can access it without you having to do anything. Great for snippets, projects that do need a lot of changes anymore or are just by nature very static. But there is a catch…

More git-like control using Pinata

One of the downsides of IPFS is it is not persistent unless you ‘pin’ the data. Pinata is an IPFS cloud pinning service that allows you to store 1GB of free data. Enough for quite for a few contracts.
https://www.pinata.cloud/

Setting your Pinata API credentials in dGit will allow you to export to IPFS.

The added value of that is dGIT keeps track of your previous exports. This means if you export the same repo again dGit will tell you that you can delete the old version from IPFS.

This way you keep your Pinata pins clean.

Collaboration

So how do you share your work if you are using IPFS?

From the perspective of dGit the best thing is to share the IPFS hash of your exported repo. Use the ‘Copy hash to clipboard’ button.

Using the import function, a collaborator can work on your files.

Mix it up!

You can of course combine the GitHub support in dGIT with IPFS.

Work in GitHub for a while and when you are done publish it in IPFS, complete with history and branches. All of this works.

Using custom IPFS nodes & privacy

Sometimes public IPFS nodes are slow or won’t find your files. This happens. Click on ‘View files’ to see if your files are available. Sometimes it takes a while.

Also once your data is in IPFS everyone can see it. There is no private storage in IPFS.

Using your own IPFS nodes usually fixes this.. You can set your own ‘pinning’ policies and let all collaborators use your node.

To access a custom node you will need to configure it to allow other origins. This is an example configuration, of course. This is one too open, but you get the drill.

"API": {
"HTTPHeaders": {
"Access-Control-Allow-Credentials": [
"true"
],
"Access-Control-Allow-Headers": [
"Authorization"
],
"Access-Control-Allow-Methods": [
"GET",
"POST"
],
"Access-Control-Allow-Origin": [
"*"
],
"Access-Control-Expose-Headers": [
"Location"
]
}
}

Remix IPFS

By default you will see dGit is configured to use the Remix’s IPFS server. Please note this server won’t pin your work. Pin the hash on Pinata or another service and it will persist. We always send all the data to this server for easy access but you will need to pin it too.

Your feedback is most welcome

You can post your issues here:

https://github.com/bunsenstraat/remix-storage-plugin

--

--