# Private KardiaChain Network

## System Requirement:

Recommending using Cloud compute service with the following requirements.

### &#x20;   Hardware requirement and Function:

| Function                                                   | Nodes | CPU (Cores) | RAM (GB) | SSD Storage (GB) |
| ---------------------------------------------------------- | ----- | ----------- | -------- | ---------------- |
| KardiaChain Network-BlockChain Network-Backend-DB-Explorer | 6     | 16          | 8        | 512              |
| Kubernetes Services                                        | 1     | 16          | 64       | 1,000            |
| Frontend                                                   | 1     | 4           | 8        | 256              |
| Elastic Search                                             | 3     | 4           | 8        | 512              |
| DB+Caching                                                 | 3     | 4           | 8        | 512              |

### &#x20;  OS Requirements:

&#x20;   Operating system: CentOS or Ubuntu (manual compiling and build) or with Docker Compose installed.

&#x20;   Linux OS: <https://docs.docker.com/engine/installation/>

&#x20;  **Internet Requirement:**

&#x20;   Bandwidth: 1GBps

### &#x20;   **Firewall:**

&#x20;   Port open: TCP/UDP 3000 (internet exposure), TCP 8545 (for JSON RPC).

## Preparing Environment for KardiaChain Network

When the system or cloud instance is ready, proceeding with the following steps for preparing the environment.

### &#x20;   Installing go-kardia

#### &#x20;    ***From Source***

&#x20;   You'll need go [installed](https://golang.org/doc/install) and the required environment variables set, which can be done with the   following commands:

```
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

```

#### &#x20;   ***Get Source Code***

```
git clone https://github.com/kardiachain/go-kardia.git $GOPATH
```

### &#x20;   Direct Installation

#### &#x20;    ***Prerequisites***

&#x20;    Install [libzmq](https://github.com/zeromq/libzmq)

#### &#x20;   ***Compiling and Installing***

```
cd $GOPATH/src/github.com/kardiachain/go-kardia/cmd
go install

```

&#x20;    **Notes:** *the latest cmd command is now installed.*

&#x20;  &#x20;

### &#x20;    Docker Installation

#### &#x20;   *Prerequisites*

&#x20;    Install Docker following the installation guide for Linux OS

* [CentOS](https://docs.docker.com/install/linux/docker-ce/centos)&#x20;
* [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu)

&#x20;   Install docker [compose](https://docs.docker.com/compose/install)

#### &#x20;  &#x20;

#### &#x20;   *Installation Files:*

&#x20;   *Download the following file* [docker-compose.yaml](https://github.com/kardiachain/go-kardia/blob/master/deployment/local/docker-compose.yaml),  [genesis\_devnet.yaml](https://github.com/kardiachain/go-kardia/blob/master/deployment/local/genesis_devnet.yaml)

#### &#x20;   *Compiling and Installing*

```
docker-compose build
docker-compose up -d
```

## Configuring KardiaChain Nodes

Configuration file will be stored in YAML file. Download the following config  [node1.yaml](https://github.com/kardiachain/go-kardia/blob/master/deployment/local/node1.yaml),   [node2.yaml](https://github.com/kardiachain/go-kardia/blob/master/deployment/local/node2.yaml),  [node3.yaml](https://github.com/kardiachain/go-kardia/blob/master/deployment/local/node3.yaml). Below is the example of the Config file.

```
Node:
  Name: node1 # Name of node
  DataDir: /root/.kardia # Location of data storage
  HTTPHost: 0.0.0.0
  HTTPPort: 8545 # RPC Port
  HTTPModules:
    - node
    - kai
    - tx
    - account
  HTTPVirtualHosts:
    - 0.0.0.0
    - localhost
    - "*"
  HTTPCors:
    - "*"
  P2P:
    PrivateKey: #Your private key
    ListenAddress: tcp://0.0.0.0:3000
    MaxPeers: 25
  LogLevel: info           # crit, error, warn, info, debug, trace
  Metrics: 1
MainChain:
  ServiceName: KARDIA
  ChainId: 1
  NetworkId: 10000
  AcceptTxs: 1       # accept tx sync process or not (1 is yes, 0 is no)
  Seeds:
    - # Seed node 1@<ip>:<port>
    - # Seed node 2@<ip>:<port>
    - # Seed node 3@<ip>:<port>
  Database:
    Dir: chaindata                           # directory stores leveldb
    Cache: 16                                # cache is used in leveldb
    Handles: 32                              # handles is used in leveldb
    Drop: 1                                  # Specify whether drop database or not (0 is no, 1 is yes)
Below is example config file to run Kardia network:

Mainnet (coming soon)
Testnet
Config file​

Local
Config file​

Previous
Deployment
Next
Local

Last updated 4 months ago
WAS THIS PAGE HELPFUL?
CONTENTS
Mainnet (coming soon)
Testnet

```

&#x20;***Notes:** Following the example above to modify information which match each Node function.*

## Run KardiaChain Network

### &#x20;  For Direct&#x20;

```
./cmd --network devnet --node <path/to/kai_config_devnet_node1.yaml>
./cmd --network devnet --node <path/to/kai_config_devnet_node2.yaml>
./cmd --network devnet --node <path/to/kai_config_devnet_node3.yaml>
```

### &#x20; &#x20;

### &#x20;   For Docker

```
docker-compose ps
```

```
docker logs -f --tail 10 node1
docker logs -f --tail 10 node2
docker logs -f --tail 10 node3
```

**Notes:** *logs showed the status of each node.*

## KardiaChain  Explorer Frontend

All files are available at <https://github.com/kardiachain/kardia-explorer-frontend>

### &#x20;   Development

#### &#x20;   *Prerequisites*

&#x20;   NodeJs v12.18.4

#### &#x20;   *Start Developing*

* Clone from the above project link
* Run `npm install`
* Run `npm start`

#### &#x20;   *Build*

&#x20;   Run `npm run build`

## KardiaChain Explorer Backend   &#x20;

All files are available at <https://github.com/kardiachain/kardia-explorer-backend>

### &#x20;   Setup

* Generate [*github\_private\_token*](https://github.com/settings/tokens) with `repo` permission and set as `GITHUB_TOKEN` variables in your system.
* Run `make all`
* Checkout `Makefile` for more command and use what you need

  &#x20;

### &#x20;   Project Structure

* \--- api: define API for FE&#x20;
* \--- cfg: define base configuration&#x20;
* \--- cmd: all entry point here
* \--- contracts: ERC20 and smc&#x20;
* \--- deployments: docker-compose and dockerfile for deploy/develop&#x20;
* \--- features: BDD |--- kardia: kardia client implement&#x20;
* \--- metrics: custom metrics for tracking/monitor&#x20;
* \--- scripts: scripting for execute&#x20;
* \--- server: logic/db server&#x20;
* \--- tools: tools for develop&#x20;
* \--- types&#x20;
* \--- utils: collections utilities function
