# Node Setup Guide
[TOC]
## Install heimdall
This part will explain how to install the `heimdalld` and `heimdallcli` onto your system. With these installed on a server, you can participate in the mainnet or testnet as either a Full Node or a Validator.
## Install Go
Install go by following the [official docs](https://golang.org/doc/install). Remember to set your `$GOPATH`, `$GOBIN`, and`$PATH` environment variables, for example:
```bash
$ mkdir -p $HOME/go/bin
$ echo "export GOPATH=$HOME/go" >> ~/.bash_profile
$ echo "export GOBIN=$GOPATH/bin" >> ~/.bash_profile
$ echo "export PATH=$PATH:$GOBIN" >> ~/.bash_profile
$ source ~/.bash_profile
```
> Note: Go version 1.11+ is recommended
>
>[name=ateeta] first time, gopath wasn't correct. so updated it again. then later while running $ heimdallcli version, gobin path wasn't correct
## Install NodeJs
Instructions on how to install nodejs here
# Heimdall
## What is heimdall?
Heimdall is the name of the validator layer for the Matic Network. It comes with 2 main entrypoints:
- heimdalld: The heimdall Daemon, runs a full-node of the heimdall application.
- heimdallcli: The Heimdall command-line interface, which enables interaction with a heimdalld full-node.
## Install Heimdall
Next, let's install the latest version of Heimdall. Here we'll use the master branch, which contains the latest stable release. If necessary, make sure you `git checkout` the correct [released version](https://github.com/maticnetwork/heimdall/releases)
```bash
$ mkdir -p $GOPATH/src/github.com/maticnetwork
$ cd $GOPATH/src/github.com/maticnetwork
$ git clone https://github.com/maticnetwork/heimdall
$ cd heimdall && git checkout master
$ make dep && make install
```
>[name=ateeta] dep not found
## Setting up a new node
```
$ heimdalld init
```
That will install the heimdalld and heimdalldcli binaries. Verify that everything is OK:
```bash
$ heimdalld --help
```
# Bor
```bash
$ mkdir -p $GOPATH/src/github.com/maticnetwork
$ cd $GOPATH/src/github.com/maticnetwork
$ git clone https://github.com/maticnetwork/bor
$ cd bor && git checkout master
$ make geth
```
## Deploying plasma contracts
For running a private testnet or local single valiator version we need to deploy plasma contracts.
#### Clone the contracts repo
>[name=ateeta] it didn't ask me to go back, i was in bor folder :| looking to simply copy paste
```bash
$ git clone https://github.com/maticnetwork/contracts
```
#### Install dependencies
```bash
$ npm i
```
> Note: You need to install nodejs for running [npm](https://github.com/nvm-sh/nvm)
#### Deploying contracts
We need to install 2 set of contracts, one on base chain and one on side-chain, the instructions to do that can be found [here](https://github.com/maticnetwork/contracts/tree/master/deploy-migrations)
## Create your own testnet
We have a pre-generated package with all configrations present which you can use to run a version of Matic Network locally!
#### Clone configrations
```bash
$ git clone https://github.com/maticnetwork/public-testnets
```
#### Setup single validator testnet
To setup single validator testnet follow the details available [here](https://github.com/maticnetwork/public-testnets/tree/master/sample-config)
>[name=ateeta] what does this section to do? mention next steps to config single validator reading which file; bor and heimdall and from there to relevant repos
## Join public testnets
While we have counter stake running you can join any of the testests present [here](https://github.com/maticnetwork/public-testnets)
> See the [testnet repo](https://github.com/maticnetwork/public-testnets) for information on the latest testnet, including the correct version of the Heimdall to use and details about the genesis file.