# Using Local Node

This guide outlines steps to create a standalone local node to test CLV compatibility with Ethereum. Follow this guide and you will have a CLV node running in your local environment, which can be connected to the default Polkadot JS GUI.

## 1. Install build tools & libraries <a href="#docusaurus" id="docusaurus"></a>

CLV is the easiest to be set up on Unix-based operating systems like macOS or Linux. Here is the instruction on installing Rust's toolchains. If you have already done this, please go to the Step 3.

#### macOS

Open the Terminal application and execute the following commands:

```bash
# Install Homebrew if necessary https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Make sure Homebrew is up-to-date, install openssl and cmake
brew update
brew install openssl cmake
```

#### Ubuntu/Debian

Use a terminal shell to execute the following commands:

```bash
sudo apt update
# May prompt for location information
sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl
```

#### Arch Linux

Run these commands from a terminal:

```bash
pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 pkgconf git clang
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0"
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
```

## 2. Install Rust toolchain

This guide uses [`rustup`](https://rustup.rs/) to help manage the Rust toolchain. First, install and configure `rustup`:

```bash
# Install
curl https://sh.rustup.rs -sSf | sh
# Configure
source ~/.cargo/env
```

## 3. Compile the node

Let's start by cloning the master branch of the CLV repo that you can find here: <https://github.com/clover-network/clover>

```bash
git clone git@github.com:clover-network/clover.git
cd clover
```

Once you have followed all of the steps above, it's time to build the standalone node by running:

```bash
cargo build --release --features clover-testnet
```

{% hint style="info" %}
The initial build will take a while, depending on your hardware. It may take 30 minutes for the build process to complete.
{% endhint %}

## 4. Run the Node

Then you will want to run the node in dev mode using the following command:

```
./target/release/clover --dev --rpc-cors=all  --unsafe-rpc-external  --unsafe-ws-external --validator --tmp -lruntime=debug
```

You should see an output that looks like the following, showing that blocks are being produced:

![](https://2554429456-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOiTA8__-bqyZtI7JYS%2F-MP3Pa9dyyRV_xZHACF9%2F-MP3TbJbBsNdpWlNlJ7x%2F1608540371482.jpg?alt=media\&token=134b354f-6f59-46aa-8de2-808b65ac00eb)

{% hint style="info" %}
The local standalone CLV node provides two RPC endpoints:

* HTTP: `http://127.0.0.1:9933`
* WS: `ws://127.0.0.1:9944`
  {% endhint %}

### Connecting Polkadot JS Apps to a Local CLV Node <a href="#connecting-polkadot-js-apps-to-a-local-moonbeam-node" id="connecting-polkadot-js-apps-to-a-local-moonbeam-node"></a>

The locally-running CLV node is a Substrate-based node, so we can interact with it using standard Substrate tools. Let’s start by connecting it with CLV JS Apps.\
Visit <https://apps.clover.finance/#/explorer> and you will see Polkadot JS Apps and are automatically connected to the Polkadot MainNet.

![](https://2554429456-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOiTA8__-bqyZtI7JYS%2F-MPhObpUwhxFIokk6Yl1%2F-MPhQ3KHsku_KwVkk6DW%2F1609227317438.jpg?alt=media\&token=5b0a7272-d7de-4b76-ac19-6d7682f2d5d8)

Click on the top left corner to open the menu and configure the networks, then navigate down to open the Development sub-menu. Select the "Local Node" option which points Polkadot JS Apps to `ws://127.0.0.1:9944`. Next, click on the Switch button and the site should be successfully connected to your standalone CLV node.

![](https://2554429456-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOiTA8__-bqyZtI7JYS%2F-MPhQ9ovhBhNkCyUtTUA%2F-MPhQVOkybG95rpXZHiS%2F1609227432992.jpg?alt=media\&token=9af0e80b-2f73-4c06-882e-f8f4ec896926)

With Polkadot JS Apps connected, you will see the standalone CLV node producing blocks.

![](https://2554429456-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOiTA8__-bqyZtI7JYS%2F-MPhQZ1ywXDl18HRvLhd%2F-MPhQzxWO4uq6i7IgAFA%2F1609227552510.jpg?alt=media\&token=05970fff-0286-4a39-a4d0-24a09a1406ad)
