How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol - Radicle

How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol - Radicle

Olubisi Idris Ayinde
·Jul 27, 2022·

6 min read

Play this article

Table of contents

Maintaining an open-source ecosystem is more critical than ever in a world where practically all software is based on open-source code.

The dissemination of vital open-source infrastructure is unsustainable if it’s dependent on centrally hosted platforms and corporations. Using such centralized services is incompatible with the values of the free and open-source ecosystem and threatens its survival.

However, a decentralized Git hosting protocol was created as an alternative to eliminate intermediaries and create a stable, effective, and secure peer-to-peer ecosystem.

This post will discuss how to build and push projects to a web3/decentralized Git hosting protocol: Radicle.

Prerequisites

Make sure to have Node/NPM installed on your computer. To install, click here for a guide.

What Is a Git Hosting Protocol?

Git protocol is a unique daemon that comes included with Git and listens on a specific port (9418) to provide a service comparable to SSH, but without any authentication.

It’s the quickest available for file transfers. It employs the same data-transfer technique as SSH, but without encryption and authentication costs.

We'll likely want to set up a Git Daemon to serve our project if we're providing a lot of traffic for a public project or hosting a big project that doesn't require user authentication for reading access.

What Is Radicle?

Radicle is an open, protocol-based, decentralized coding collaboration network. It allows developers to collaborate on code without relying on third parties.

Radicle was created to mimic the capabilities of centralized code collaboration platforms while maintaining Git's peer-to-peer nature, extending the benefits of distributed version control to eliminate intermediaries, and creating a stable, effective, and secure peer-to-peer ecosystem.

Project Setup and Installation

We’ll install the Radicle CLI to handle identity and interact with Git to push code to the network.

Installation using Cargo on Linux and x86_64 macOS

Install the Radicle CLI by running the following command:

cargo install --force --locked --path .

Or, directly from our seed node:

cargo install --force --locked --git https://seed.alt-clients.radicle.xyz/radicle-cli.git radicle-cli

Installation Using Homebrew

Install the Radicle CLI by running the following command:

brew tap radicle/cli https://seed.alt-clients.radicle.xyz/radicle-cli-homebrew.git
brew install radicle/cli/core

After installation, use the following command to verify the installation:

rad

We should have something similar to what we have below:

Installing Radicle CLI - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

Create Radicle Identity

To interact with the Radicle network, we need an identity, which we can generate with rad auth.

After choosing a display name and setting a passphrase, the Radicle CLI generates two unique identifiers:

  • Peer ID identifies our device and the code you publish on the Radicle network and is secured with an Ed25519 keypair.

  • Personal URN, which identifies the user across devices.

Next, we will run the following command:

rad auth

We should have something similar to what is shown below:

Installing Radicle CLI -  How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

According to the documentation, there’s currently no way to retrieve a lost or forgotten passphrase, so please store it safely!

Building a React Application

It's time to get our website up and running!

To create a new project, go to a directory of your choice and use the npx create-react-app command.

This command creates a React.js project.

To install the dependencies, copy and paste the commands below:

npx create-react-app <project name>
cd <project name>

You’ll then receive a message with instructions to connect to your project and execute it locally using the following command:

npm start

React.js will now start a hot-reloading development environment that’s accessible by default at http://localhost:3000.

Initializing a React application - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

This is a simple application; we can push any project to the decentralized Git hosting protocol.

Deploying to a Git Hosting Protocol Using Radicle

We can create a Radicle project from any existing Git repository and publish it on the Radicle network using two CLI commands — rad init and rad push.

Projects include all Git repository files, revision history, and Radicle-specific metadata, including names, descriptions, and delegates' information.

Initialize a Project

Navigate to your project directory locally, and run the following command:

rad init

Initializing local Radicle project - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

rad init created a project URN for our project and associated our Peer ID with it to share it on the Radicle network.

Pushing Our Project to the Radicle Network

The Radicle CLI uses peer-to-peer seed nodes, which act as replicas of the Radicle project data and are accessible over the internet via the web interface.

Radicle provides three default seed nodes, all of which have the same functionality as listed below:

  • pine.radicle.garden
  • willow.radicle.garden
  • maple.radicle.garden

Run the following command to push your project:

rad push

Once you run it in a new project, the CLI will ask which seed node to sync it with.

Select Radicle seed node - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

Next, we’ll see the URL our project is located at on the CLI.

How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol - Radicle

When we click on the URL shown on the CLI, in this case,https://app.radicle.network/seeds/willow.radicle.garden/rad:git:hnrkym4uq4bbwe41qr1en6hhex17a1srtee6y, we would see something like this:

Saving seed configuration to local git - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

Cloning a Project

We need to clone the project locally to start collaborating on a project.

When using the Radicle web interface, click on the “Clone” button to display a dropdown with the complete rad clone command, which you can copy and paste into your terminal.

Cloning a project from Radicle Network - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

We can also use the git command to clone our project using the following command:

git clone <URL>

Next, copy the URL from the Radicle interface below:

Cloning a project from Radicle Network - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol - Radicle

Committing/Updating an Existing Project

Update the README file in your project with the following code:

# Getting Started with Create React App pushed to Radicle

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

Commit your changes and push the updates to your existing repository on a decentralized Git hosting protocol with the following commands:

git add .
git commit -m "Update readme"
rad push

Commiting changes to project on Radicle Network - How to Build and Push Projects to a Web3 / Decentralized Git Hosting Protocol: Radicle

Accessing Current Profile Information

Access your profile information on the CLI by running the following command:

rad self

We’ll have something similar to what we have below, which shows information about the currently logged-in user profile:

Profile information on Radicle network

Here’s the official documentation to learn more about Radicle's decentralized Git hosting protocol.

Conclusion

In this article, we learned:

  • How to create a Radicle identity,
  • How to publish a project to the Radicle network,
  • How to clone a project from the Radicle network,
  • Committing/Updating an existing project, and
  • Accessing current Radicle profile information.

This article is a part of the Hashnode Web3 blog, where a team of curated writers are bringing out new resources to help you discover the universe of web3. Check us out for more on NFTs, DAOs, blockchains, and the decentralized future.

 
Share this