# Welcome

Lum Network introduces the first decentralized protocol for businesses to build authentic trust with their customers.

The Lum Network is a suite of tools built using the [Tendermint](https://docs.tendermint.com/master/) & [Cosmos SDK](https://docs.cosmos.network/). One of the world’s most popular framework for building application-specific blockchains.

This documentation is focused on the core blockchain aspect of the Lum Network, if you are looking to build applications using the Lum Network you should definitely check out our [Javascript SDK](https://github.com/lum-network/sdk-javascript).

Contributions on all open source repositories are welcome and much appreciated!\
Do not hesitate to contribute here: <https://github.com/lum-network>

#### **If you do not find the information you are looking for**

1. Checkout our [Github repositories](https://github.com/lum-network)
2. Browse the [Cosmos SDK documentation](https://docs.cosmos.network/)
3. Join our [Discord channel](https://discord.gg/KwyVvnBcXF) to get in touch with the team
4. As a last resort, shoot us an email at <contact@lum.network>


# Installation

You **need** to have GO (version >= 1.18) installed and configured on your machine before attempting to compile the project.

Start by cloning the repository in your GOPATH

```
$ git clone https://github.com/lum-network/chain.git
$ cd chain && git checkout v1.6.3
```

Make sure your Go configuration looks like that one (especially the GO111Module):

```
export GOPATH=$HOME/dev/go
export GOBIN=$GOPATH/bin
export GO111MODULE=on
export PATH=$PATH:$GOBIN
```

Then compile (this will take care of installing the binaries in the PATH once compiled)

```
$ make install
```

You should always use the latest version

```
$ lumd version --long
name: lum
server_name: lumd
version: 1.6.3
commit: 4f4349bef967279608cd0cc88e4caadbd12e785c
```


# Running a main network node

**1/ Initialize your node**

Replace `<moniker>` by the node name of your choice

```
$ lumd init <moniker> --chain-id lum-network-1
```

**2/ Edit the config files**

```
$ nano ~/.lumd/config/config.toml
```

Search for "seed\_peers" and replace the value as following:

```
seeds = "19ad16527c98b782ee35df56b65a3a251bd99971@peer-1.mainnet.lum.network:26656"
```

Once opened, search for "persistent\_peers" and replace the value as following:

```
persistent_peers = "b47626b9d78ed7ed3c413304387026f907c70cbe@peer-0.mainnet.lum.network:26656,5ea36d78ae774c9086c2d3fc8b91f12aa4bf3029@46.101.251.76:26656,a7f8832cb8842f9fb118122354fff22d3051fb83@3.36.179.104:26656,9afac13ba62fbfaf8d06867c30007162511093c0@54.214.134.223:26656,433c60a5bc0a693484b7af26208922b84773117e@34.209.132.0:26656,8fafab32895a31a0d7f17de58eddb492c6ced6d1@185.194.219.83:36656,c06eae3d9ea779710bca44e03f57e961b59d63f1@82.65.223.126:46656,4166de0e7721b6eec9c776abf2c38c40e7f820c5@202.61.239.130:26656,5a29947212a2615e43dac54deb55356a162e173a@35.181.76.160:26656,2cda4d97de0449878da10e456b176dd0720fbcec@62.171.129.174:26656"
```

Get the genesis file and put it in \~/.lumd/config/genesis.json (you can replace it if one was generated automatically) and double check the sha256sum.

```
$ curl -s  https://raw.githubusercontent.com/lum-network/mainnet/master/genesis.json > ~/.lumd/config/genesis.json

$ sha256sum ~/.lumd/config/genesis.json
3bbbd7aff6c545126d869fc683f6344e65ae71b048b25540826cd2f3be91a24c
```

**2-bis/ Synchronize from latest up-to-date state machine**

You are offered a possibility to avoid syncing every single code / state machine upgrade by using ChainLayer's QuickSync service.

You can find relevant URLs and hashes here: <https://quicksync.io/networks/lum.html>

Different versions are available:

* Pruned: lightweight version of the state machine, only contains recent blocks / transactions in full
* Default: standard version of the state machine

When using the commands provided by QuickSync, please make sure that you edit the relevant paths and other configuration according to your setup.

**3/ Start your node**

```
$ lumd start
```

You will now notice that the node starts to sync the blockchain history.

**But,** as soon as you quit the SSH screen or close the window, you will kill it. To avoid doing this launch it in a daemon process:

```
$ sudo nano /etc/systemd/system/lumd.service
```

Copy and paste the following and update `<YOUR_HOME_PATH>`:

```
[Unit]
Description=Lum Network daemon
After=network-online.target

[Service]
User=lum
ExecStart=/<YOUR_HOME_PATH>/go/bin/lumd start --p2p.laddr tcp://0.0.0.0:26656 --home /<YOUR_HOME_PATH>/.lumd
Restart=on-failure
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
```

Enable and start the new service:

```
$ sudo systemctl enable lumd
$ sudo systemctl start lumd
```

Check your node status:

```
$ lumd status
```

Check your node logs:

```
$ journalctl -u lumd -f
```


# Generate a new account

You can generate a new local key using the following:

```bash
$ lumd keys add <name>
```

It will ask for a passphrase, two times. Once generated it will echo a few informations:

```bash
$ lumd keys add test
Enter a passphrase to encrypt your key to disk:
Repeat the passphrase:

- name: test
  type: local
  address: lum14hjqg48twngvujs2xhkac8mhzncjqg8wq0easj
  pubkey: AxdPTMtvjPdu40WJSo4gmSCU0x4+y6SPUvdELZq+kvgC
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

portion scorpion engage salon milk mother brain mention drama diet motion bread seek one scissors diet opera refuse panda fiscal wage tragic moment exhaust
```

The key will be automatically saved in your local disk. However we **recommend** you to save the mnemonic on a safer place.


# Transfer coins

First, you can check how much you have on your local account (replace test by key name):

```bash
$ lumd query auth account $(lumd keys show <test> -a)
```

And it should return a complete payload with some useful information about your account:

```
{
  "type": "cosmos-sdk/Account",
  "value": {
    "address": "lum14hjqg48twngvujs2xhkac8mhzncjqg8wq0easj",
    "coins": [
      {
        "denom": "ulum",
        "amount": "19987728"
      }
    ],
    "public_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AxdPTMtvjPdu40WJSo4gmSCU0x4+y6SPUvdELZq+kvgC"
    },
    "account_number": "0",
    "sequence": "25"
  }
}
```

Finally you can emit a new transfer by doing this (replace \<test> by key name, \<destination> by address, amount by the amount + asset like "10sbc"):

```bash
$ lumd tx bank send $(lumd keys show <test> -a) <destination> <amount> --from <test>
```

Once confirmed and signed with passphrase, it should echo this:

```
{
  "height": "0",
  "txhash": "ACC5DD0281AE618838FA342B891F9F83CB8110030B53A10BB50A2D5E4C9E523D",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\"}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": ""
    }
  ]
}
```


# Introduction

#### What is a validator? <a href="#what-is-a-validator" id="what-is-a-validator"></a>

The Lum Network is built using the [Tendermint](https://docs.tendermint.com/master/) & [Cosmos SDK](https://docs.cosmos.network/), which relies on a set of validators to secure the network.&#x20;

The role of validators is to run a full-node and participate in consensus by broadcasting votes which contain cryptographic signatures signed by their private key.&#x20;

Validators commit new blocks in the blockchain and receive revenue in exchange for their work. They must also participate in governance by voting on proposals. Validators are weighted according to their total stake.

#### What is staking? <a href="#what-is-staking" id="what-is-staking"></a>

The Lum Network is a public Delegated Proof-Of-Stake (DPoS) blockchain network, meaning that the weight of validators is determined by the amount of LUM tokens bonded as collateral. These LUM tokens can be self-delegated directly by the validator or delegated to them by other LUM holders.

Any user in the system can declare their intention to become a validator by sending a `create-validator` transaction. From there, they become validator candidates.

The weight (i.e. voting power) of a validator determines whether or not they are an active validator. Initially, only the top 100 validators with the most voting power will be active validators.


# Becoming a validator

Any participant in the network can signal their intention to become a validator by sending a `create-validator` transaction, where they must fill out the following parameters:

* **Validator's `PubKey`:** The private key associated with this Tendermint `PubKey` is used to sign *prevotes* and *precommits*.
* **Validator's Address:** Application level address. This is the address used to identify your validator publicly. The private key associated with this address is used to delegate, unbond, claim rewards, and participate in governance.
* **Validator's name (moniker)**
* **Validator's website (Optional)**
* **Validator's description (Optional)**
* **Initial commission rate**: The commission rate on block rewards and fees charged to delegators.
* **Maximum commission:** The maximum commission rate which this validator can charge. This parameter cannot be changed after `create-validator` is processed.
* **Commission max change rate:** The maximum daily increase of the validator commission. This parameter cannot be changed after `create-validator` is processed.
* **Minimum self-delegation:** Minimum amount of LUM tokens the validator needs to have bonded at all time. If the validator's self-delegated stake falls below this limit, their entire staking pool will unbond.

Once a validator is created, LUM holders can delegate LUM tokens to them, effectively adding stake to their pool. The total stake of an address is the combination of the LUM tokens bonded by delegators and LUM tokens self-bonded by the entity which designated themselves.

So finally, once you have installed all daemons & CLIs, you can just run a simple **create-validator** command.&#x20;

**1/ Minimum hardware requirements**

* 4 CPU ores
* 16 GB RAM
* 200 GB of disk space
* 100 mbps bandwidth

**2/ Configure minimum gas price**

Configure the minimum gas price to `minimum-gas-prices = "0.001ulum"`

```
$ nano ~/.lumd/config/app.toml
```

**3/ Create a validator**

**Important:** Do not forget to verify and change the parameters in the following command:

```bash
$ lumd tx staking create-validator \
  --amount=1000000ulum \
  --pubkey=$(lumd tendermint show-validator) \
  --moniker="my super new validator" \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --chain-id=lum-network-1
```

You can also edit a running validator using the **edit-validator** command:

```bash
lumd tx staking edit-validator \
   --website="https://lum.network" \
   --details="So luminous" \
   --chain-id=lum-network-1
```

**4/ Validator logo**

If you want your validator to have a logo displayed on [Mintscan](https://www.mintscan.io/lum/validators), you must follow the procedure detailed here: <https://github.com/cosmostation/cosmostation_token_resource>

**5/ Join Discord**

Once your validator is up and running you can join the private validator channel on Discord.\
This is the main communication channel with validators.

* Join the [Lum Network Discord server](https://discord.gg/KwyVvnBcXF)
* Ping the `infra-support` channel to get the Validator Role and access the validator channels


