# Integrate on Mainnet

{% hint style="warning" %}
Make sure you completed the [Installation](../validators/set-up-node/from-source) step before following this session. You will also need knowledge about linux service file (systemd).
{% endhint %}

* Current Version: v3.0.0
* Chain ID: titan\_18888-1
* Denom: atkx, tkx (1e18 atkx)
* Endpoint: [mainnet](../validators/become-a-mainnet-validator/mainnet "mention")
* Explorer: [https://tkxscan.io](https://tkxscan.io/)

## Information

The Titan mainnet is currently running **titand** `v3.0.0`. Visit the [explorer](https://tkxscan.io/Titan) to view real-time on-chain activity

We recommend running public mainnet nodes on a machine with at least two cores, 8GB of RAM, and 100GB of disk space SSD.

## Installation & Configuration

### Init config file and data

```sh
titand init <custom_moniker>
```

Now, a folder will be created by default in your HOME directory as `$HOME/.titan`. This folder will store all the configuration and data files of the node during operation.

### Retrieve the genesis file of the Titan Chain and store it in the config directory.

```sh
cd $HOME
curl -LO https://github.com/titantkx/titan-mainnet/raw/main/public/genesis.json.gz
gzip -d genesis.json.gz
mv genesis.json $HOME/.titand/config/genesis.json
```

### Config your node.

#### Set peers

<pre class="language-sh"><code class="lang-sh">cd $HOME/.titand/config
<strong>sed -i 's/seeds =.*/seeds = "bee5ef5680cf90fe40d6cde872cdc52e53c8338d@titan-p2p-seed-1.titanlab.io:26656,a7e03c50f9b85ac2c9488d20913a37c2d1a9361c@titan-p2p-seed-1-seoul.titanlab.io:26656"/' config.toml
</strong></code></pre>

#### Config external address

You will need to config `external_address` in file `config.toml` is external address of your node. Correct this config will allow other node in P2P network connect to your node.

#### Index:

{% hint style="info" %}
By default, we disable all indexes and only keep 100 recent blocks to optimize the diskspace used by node.
{% endhint %}

If you want to enable index, you need to change the config in file `app.toml` and `config.toml`

* Ethereum transaction  (in `app.toml`)

```toml
[json-rpc]

# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions).
enable-indexer = true
```

* TX index, for query tx (in `config.toml`)

```toml
[tx_index]

# What indexer to use for transactions
#
# The application will set which txs to index. In some cases a node operator will be able
# to decide which txs to index based on configuration set in the application.
#
# Options:
#   1) "null"
#   2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
# 		- When "kv" is chosen "tx.height" and "tx.hash" will always be indexed.
#   3) "psql" - the indexer services backed by PostgreSQL.
# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed.
indexer = "kv"
```

### Config state sync

{% hint style="warning" %}
If you use the latest binary version, this is required to sync data from blockchain. If you want to sync data from the genesis block, you must start syncing from genesis binary and follow [every upgrade in history](broken-reference).
{% endhint %}

Without this, your node will have to synchronize data from the genesis, which could take a considerable amount of time. Instead, we will search for snapshots from trusted peers at a specific height and then verify a minimal set of snapshot chunks against the network.

Get the block height and block hash. First, you need to access the [explorer website](https://tkxscan.io/) to obtain the nearest block height and its corresponding hash. We configure a node to take a snapshot every 1000 blocks and keep the 10 most recent snapshots. Therefore, the snapshot corresponding to the nearest block height will have the highest thousand value. For example, at the time of writing this guide testnet block height is `37026` so the nearest block height will be `37000`. Enter the block height in the search bar at the top of the website to retrieve its hash. The hash of Block `37000` is:  `7240576BE8C737A4DA3849C2739143944F2D87C7E2A449A0949D03D1B72E878C`

After having block height and block hash run the following command in order (replace `<BLOCK_HEIGHT>` and  `<BLOCK_HASH>` by the value you found in the above step)

{% hint style="info" %}
`rpc_servers` need at least 2 servers.
{% endhint %}

```sh
cd $HOME/.titand/config
sed -i 's/enable =.*/enable = true/' config.toml
sed -i 's/trust_height =.*/trust_height = <BLOCK_HEIGHT>/' config.toml
sed -i 's/trust_hash =.*/trust_hash = "<BLOCK_HASH>"/' config.toml
sed -i 's/rpc_servers =.*/rpc_servers = "https:\/\/titan-rpc-1.titanlab.io:443,https:\/\/titan-rpc-2.titanlab.io:443"/' config.toml
```

### Create Service File

{% hint style="warning" %}
To make the upgrade process as convenient as possible, instead of using `titand` binary directly we recommend you follow [this guide](../validators/automatic-upgrades) to use [`cosmovisor`](https://docs.cosmos.network/main/build/tooling/cosmovisor)
{% endhint %}

Get your absolute path of `titand`  binary and your HOME directory that contains `.titan` folder

```sh
which titand
echo $HOME
```

Create a service file at `/etc/systemd/system/titand.service`. Replace `<titand_absolute_path>` and `<home_directory>` to your.

{% hint style="info" %}
To find out your `<titand_absolute_path>` you can use command `which titand`. And your `<home_directory>` by command `echo $HOME`
{% endhint %}

```
[Unit]
Description=Titan service
After=network-online.target

[Service]
User=root
ExecStart=<titand_absolute_path> start --x-crisis-skip-assert-invariants --home <home_directory>/.titand
Restart=always
RestartSec=6
LimitNOFILE=4096

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

### Start the Service

<pre class="language-sh"><code class="lang-sh">systemctl daemon-reload
<strong>systemctl restart systemd-journald
</strong>systemctl enable titand.service
systemctl start titand.service
</code></pre>

Now that your node has started up and the synchronization process has begun, you can check the sync status of the node using the following command. If the node is syncing, it will show `true`. Please wait until it show `false`, which means your node has caught up with the network and is ready for querying.

```sh
titand status | grep -o '"catching_up":[^,}]*'
```

If have any issue, you can check error log by

```sh
journalctl -fu titand
```
