Open Source

libznipfs

A C-style library implemented in Go to retrieve the seedlist from ZeroNet and IPFS
The project
Overview

During the time I worked on the Scala cryptocurrency we needed a way to alter the list of seed nodes as well as store our blockchain checkpoints without requiring an update to our software. We ended up using a combination of ZeroNet and IPFS to achieve that goal. You can read one of the blog posts on how this works on the Scala blog .

Description

The core service in the Scala cryptocurrency is known as the daemon. Users of the cryptocurrency run this service to sync with the network which enables transactions. This daemon is written in C/C++.

libznipfs was implemented to allow the daemon to communicate with ZeroNet and IPFS. The library exposes functions to the daemon to retrieve content from a ZeroNet address, which in this case holds the IPFS address of the seed list. From there the daemon uses the library again to fetch the actual content from IPFS.

Why Go and not C or C++

Currently, no simple implementation or API exists for ZeroNet and IPFS in C or C++. Instead of writing, or re-writing, large parts of ZeroNet and IPFS in C or C++ we rather use Go and compile it to a C or C++ compatible library. IPFS is implemented in Go already and a Go library for ZeroNet already exists.

The final advantage of this approach is that the library can be compiled and linked directly into the daemon service, thus requiring no other dependencies to be installed apart from the daemon itself.

The IPFS team invited us to talk about this project at their online meetup in 2021. The video below starts just before I discuss the work I did in the project and how we use it to secure the blockchain.

The IPFS Meetup talk

Additional information
— About ZeroNet

ZeroNet is a decentralised web-like network of peer-to-peer users where your content is distributed directly to other visitors without any central server. As of 2016, there was no way to take down a ZeroNet page that still had users hosting it.

More at ZeroNet.io

— About IPFS, the InterPlanetary File System

IPFS allows users to not only receive but host content, in a similar manner to BitTorrent. As opposed to a centrally located server, IPFS is built around a decentralised system of user-operators who hold a portion of the overall data, creating a resilient system of file storage and sharing. Content stored in IPFS can not be altered.

More at IPFS.io