# (0) RAD::Getting started with Radicle

| Resources | Link/Reference | Source |
| --- | --- | --- |
| Introduction to Radicle | [How to Replace GitHub with Radicle to Take Ownership of Your Code (youtube.com)](https://www.youtube.com/watch?v=Y8pulFGOrMw) | Nader Dabit, Youtube |
| Radicle Guide, setting up | [Radicle User Guide](https://radicle.xyz/guides/user#1-getting-started) | The Radicle Team, Radicle website |
| Foundry, Fund Me | [https://updraft.cyfrin.io/courses/foundry](https://updraft.cyfrin.io/courses/foundry) | Updraft Foundry 101 |
| Visual Studio Code | [Visual Studio Code - Code Editing. Redefined](https://code.visualstudio.com/) | Visual Studio Website |
| WSL2 | \[Install WSL | Microsoft Learn\](https://learn.microsoft.com/en-us/windows/wsl/install) |
| VS Code WSL plugin | [Developing in the Windows Subsystem for Linux with Visual Studio Code](https://code.visualstudio.com/learn/develop-cloud/wsl) | Visual Studio Marketplace |
| Radicle plugin | [Radicle - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=radicle-ide-plugins-team.radicle) | Visual Studio Marketplace |

---

# [Who Am I?](https://marketplace.visualstudio.com/items?itemName=radicle-ide-plugins-team.radicle)

<div data-node-type="callout">
<div data-node-type="callout-emoji">👀</div>
<div data-node-type="callout-text"><a target="_blank" rel="noopener noreferrer nofollow" href="https://pxng0lin.hashnode.dev/pxng0linlaptop-echo-aboutme" style="pointer-events: none">Check my '$AboutMe' article</a></div>
</div>

---

# Purpose of activity?

I've used Github for quite some time, I'm no expert of course, but since I got into web2 hacking many moons ago, then in the past few years (as of May 2024) web3, I've been using it mainly for security research, a few python scripts, and early web3 learning (at the moment with Cyfrin's Updraft learning platform, go check it out [here](https://updraft.cyfrin.io)).

But, more recently I was hoping to build more of a portfolio whilst learning and stumbled across the video by Nader. Since decentralisation is thrown around frequently, even though it is relevant and has meaning; I thought I would steer more towards that with my own projects and see how it goes.

---

## Getting setup

I already have WSL2 setup on my Windows laptop, and the VS Code editor installed - including the plugin to connect to WSL and the Radicle plugin. So, I'll only need to follow the setup of the Radicle repo from here.

**Installation as per the instructions from the guide:**

```bash
curl -sSf https://radicle.xyz/install | sh
```

**Output:**

```bash
 Welcome to Radicle

Detecting operating system...
Downloading https://files.radicle.xyz/releases/latest/radicle-x86_64-unknown-linux-musl.tar.xz...
######################################################################## 100.0%
Downloading https://files.radicle.xyz/releases/latest/radicle-x86_64-unknown-linux-musl.tar.xz.sig...
######################################################################## 100.0%
Verifying radicle-x86_64-unknown-linux-musl.tar.xz...
Good "file" signature for cloudhead with ED25519 key SHA256:iTDjRHSIaoL8dpHbQ0mv+y0IQqPufGl2hQwk4TbXFlw
Installing Radicle into /home/pxng0lin/.radicle...
Configuring path variable in ~/.bashrc...

✓ Radicle 1.0.0-rc.9 was installed successfully.

Before running Radicle for the first time,
run `source ~/.bashrc` or open a new terminal.

Then, create your Radicle key pair with `rad auth`.
```

As per the instructions, we need to execute the commands in my `.bashrc` file by calling `source`. This basically re-reads the file which is only read upon start-up of Bash. Alternatively, we could open a new terminal window too.

```bash
source ~/.bashrc
```

Ok so now to check that it was successful by running the version command.

```bash
rad --version
```

**Output:**

```bash
rad 1.0.0-rc.9 (d56d619f)
```

**Great! I'm good so far.**

Next is creating a Radicle identity aka Radicle DID (Decentralised Identifier). This is a [cryptographic key pair](https://en.wikipedia.org/wiki/Public-key_cryptography), since we're on the network, which is used to identify and authenticate me/my node. Public is for the network and everyone can see, private, as indicated, is only used for authentication of my node, signing of code and other artifacts, and shouldn't be shared publicly.

```bash
rad auth
```

**Output:**

```bash

Initializing your radicle 👾 identity

✓ Enter your alias: rxdicle-1
✓ Enter a passphrase: [REDACTED *]
✓ Creating your Ed25519 keypair...
✓ Your Radicle DID is did:key:[REDACTED]. This identifies your device. Run `rad self` to show it at all times.
✓ You're all set.

✗ Hint: install ssh-agent to have it fill in your passphrase for you when signing.

To create a Radicle repository, run `rad init` from a Git repository with at least one commit.
To clone a repository, run `rad clone <rid>`. For example, `rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5` clones the Radicle 'heartwood' repository.
To get a list of all commands, run `rad`.
```

*NB: I didn't use ssh-agent, we will revisit this later.*

> Your Radicle DID is similar to your Node ID (NID), the difference is the former is formatted as a [Decentralized Identifier](https://en.wikipedia.org/wiki/Decentralized_identifier), [while the latter is jus](https://en.wikipedia.org/wiki/Decentralized_identifier)t the encoded public key. Share your Radicle DID freely with collaborators.

You can check your rad details by running a few commands, reference below, I used the `rad self` to check mine

```bash
Alias           rxdicle-1
DID             did:key:z6Mkg3Tu7aGDn3pLrshRiaCFLQJwEHyFKTCwYFoKDHts1YV2
└╴Node ID (NID) [REDACTED]
SSH             not running
├╴Key (hash)    [REDACTED]
└╴Key (full)    [REDACTED]
Home            /home/pxng0lin/.radicle
├╴Config        /home/pxng0lin/.radicle/config.json
├╴Storage       /home/pxng0lin/.radicle/storage
├╴Keys          /home/pxng0lin/.radicle/keys
└╴Node          /home/pxng0lin/.radicle/node
```

> Many of the other items you see in the `rad self` output can be viewed individually. Wondering about your alias? A quick `rad self --alias` has you covered. Need to pinpoint your Radicle home folder? `rad self --home` is your friend. And for your config file location, just hit up `rad self --config`.
> 
> If you’re ever feeling lost, `rad self --help` will lay out all your options.

*NB: I'm in the habit of redacting information, even if it's said to be ok for the public, call me over-cautious, I guess.*

---

## Node On?

A quick check on my node status, I expect it to be off since its my first install.

```bash
rad node status
```

**Output:**

```bash
Node is stopped.
To start it, run `rad node start`.
```

As expected it's not running, so we will fire it up with the provided command

`rad node start`

**Output:**

```bash
✓ Passphrase: 
✓ Node started (841691)
To stay in sync with the network, leave the node running in the background.
To learn more, run `rad node --help`.
```

For extra commands, and to find out how to stop the node use `rad node --help`

---

## Starting a new project

Moving to the Youtube video by Nader, we will now initiate a new repo, we will be using the tutorial from Updraft as my project, Fund Me. The only difference will be the replacement of Github for Radicle, everything else should be the same.

```bash
mkdir rad-foundry-fund-me-23
```

we then change directory into the project folder and initiate the Radicle project.

Because I'm creating a brand new project, we need to ensure have a git repo ready, so I'll initialise a git repo first, then the Radicle repo afterwards.

```bash
git init
```

**Output:**

```bash
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /home/pxng0lin/web3/projects/radicle_xyz/rad-foundry-fund-me/.git/
```

The Radicle repo requires at least 1 commit to be done, so I'll create a README.md file and commit this. I changed the initial branch name to 'main', this was only due to preference and not a requirement.

```bash
git branch -m main
touch README.md
git add README.md
git status
```

**Output:**

```bash
On branch main

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   README.md
```

We will commit this using the command `git commit`. It will ask for a comment to be added for the commit, then press `ctrl+o` to save, followed by `ctrl+x`, and we are good; now I'm ready to initialise the Radicle repo.

**Output:**

```bash
[main (root-commit) 9ff86ae] Creation of README.md file only
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README.md
```

Initialising the new Radicle repo.

```bash
rad init
```

*TIP: to clear any entered commands and returned outputs from your terminal, use either*`ctrl+l`*(ell) or type*`clear`*, I like to clean up the screen from time-to-time.*

So now we need to enter some information about the new project for the repo.

```bash
✓ Name foundry-fund-me
✓ Description A tutorial project in the Foundry 101 course on Cyfrin to learn how to professionally deploy code, master the art of creating fantastic tests, and gain insights into advanced debugging techniques.
✓ Default branch main
✓ Visibility public
✓ Passphrase: 
✓ Unsealing key...
✓ Repository foundry-fund-me created.

Your Repository ID (RID) is rad:z43pr3L72n8wT74KSHcty9fEY5JaL.
You can show it any time by running `rad .` from this directory.

◢ Upload done for rad:[REDACTED] to [REDACTED] : signal: 9 (SIGKILL)✓ Repository successfully synced to [REDACTED] 
◢ Uploading rad:[REDACTED] to [REDACTED] Compressing objects: 100% (8/8)✓ Repository successfully synced to [REDACTED] 
✓ Repository successfully synced to 2 node(s).

Your repository has been synced to the network and is now discoverable by peers.
View it in your browser at:

    https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z43pr3L72n8wT74KSHcty9fEY5JaL

To push changes, run `git push`.
```

**And we're off!**

So the setup is done, and I'm ready to begin the development stage. this will be the follow along as per the course. I'll end it here for today, and begin a new article as I complete the stages of the course as not to make this too long of a post.
