# Mainnet

This document introduces how to join the mainnet of smartBCH as a normal node (non-validator node).

Before you start, you must have a trusted server running bitcoincashnode's client with RPC enabled. The executable `smartbchd` will connect to it for querying staking information.

First, build the latest binary by running the steps of [this document](https://github.com/smartbch/docs/blob/master/developers-guide/build-smartbchd.md).

Second, prepare the working directory:

```bash
cp ~/smart_bch/smartbch/smartbchd ~/build/smartbchd
cd ~
rm -rf .smartbchd
~/build/smartbchd init mynode --chain-id 0x2710
wget https://github.com/smartbch/artifacts/releases/download/v0.0.6/dot.smartbchd.tgz
tar zxvf dot.smartbchd.tgz
cp -rf dot.smartbchd/* .smartbchd/
```

Third, open the `~/.smartbchd/config/app.toml` file to modify the information of the bitcoincashnode's client with RPC enabled.

```
# BCH mainnet rpc url (Only BCHN & BCHD are well tested)
mainnet-rpc-url = "http://ip-address:8332"

# BCH mainnet rpc username
mainnet-rpc-username = "<my user name>"

# BCH mainnet rpc password
mainnet-rpc-password = "<my password>"
```

Last, start smartbchd.

```bash
cd ~/build
./smartbchd start --mainnet-genesis-height=698502
```

## Docker

You can also run your smartBCH node using Docker. First, clone smartBCH and build Docker image for mainnet (or [pull prebuilt images from DockerHub](https://hub.docker.com/r/smartbch/smartbchd/tags)):

```bash
git clone https://github.com/smartbch/smartbch.git
cd smartbch
docker image build -f Dockerfile.optimized -t smartbchd:latest .
```

Second, prepare smartBCH mainnet home directory:

```bash
cd somewhere
mkdir smartbchd_home
docker run \
  -v path/to/smartbchd_home:/root/.smartbchd \
  smartbchd:latest init mynode --chain-id 0x2710

wget https://github.com/smartbch/artifacts/releases/download/v0.0.6/dot.smartbchd.tgz
tar xvf dot.smartbchd.tgz
cp -rfv dot.smartbchd/* smartbchd_home/
```

Third, edit smartbchd\_home/config/app.toml, modify the information of the bitcoincashnode's client:

```toml
...
mainnet-rpc-url = "http://ip-address:8332" # BCH mainnet rpc url
mainnet-rpc-username = "<my user name>"    # BCH mainnet rpc username
mainnet-rpc-password = "<my password>"     # BCH mainnet rpc password
...
```

Last, start smartbchd using Docker like this:

```bash
docker run \
  -v path/to/smartbchd_home:/root/.smartbchd \
  -p 0.0.0.0:8545:8545 \
  -p 0.0.0.0:8546:8546 \
  -p 0.0.0.0:26656:26656 \
  --ulimit nofile=65535:65535 \
  --log-opt max-size=200m \
  -d smartbchd:latest start --mainnet-genesis-height=698502
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smartbch.org/smartbch/mainnet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
