> For the complete documentation index, see [llms.txt](https://docs.bloxroute.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bloxroute.com/bsc/gateway/configuration-and-startup/startup-script.md).

# Startup Script

Use the startup script below to bypass manual configuration when starting your Gateway.

Follow the steps below to modify the script to suit your specific configuration and needs. Once initiated, the script will create a Docker container named bxgateway-go that will running in the background, setting up your Local Gateway.

1. Modify the startup command below to include your gateway's `enode` and `multiaddr`

```bash
./run_gateway.sh /home/ubuntu/gw/ssl \
                 /home/ubuntu/gw/logs \
                 /home/ubuntu/gw/datadir \
                 Mainnet \
                 enode://123..abc@127.0.0.1:30303 \
                 multiaddr:/ip4/<IP_address>/tcp/<port>/p2p/<Peer_ID>
```

2. Specify input arguments at the beginning of the script below
   * **`CERT_PATH`**`: Your SSL certificates from the portal. This should be a path to the parent directory of the external_gateway folder. The external_gateway folder should contain a registration_only folder with certs inside.`
   * **`LOGS_PATH`**`: Where you want a logs folder to be created with a gateway.log file inside`
   * **`DATADIR_PATH`**`: The directory for storing various persistent files such as gateway private key file`
   * **`BLOCKCHAIN_NETWORK`**`:BSC-Mainnet`
   * **`ENODES`**`: Local blockchain node (Enterprise clients must start the gateway with local node connection.)`
   * **`MULTIADDR`**`: multiaddr has replaced enr as the argument to indicate the node address because it is human-readable. It has the following format:`\
     `/ip4/<IPv4_NETWORK_ADDRESS>/tcp/<LISTENING_PORT>/p2p/<NODE_ID>`
3. Copy the script to an executable file (example below)
4. Run the `run_gateway.sh` command from step 1

```bash
#usr/bin/env bash

CERT_PATH=${1:-/home/ec2-user/ssl}
LOGS_PATH=${2:-/home/ec2-user/logs}
DATADIR_PATH=${3:-/home/ec2-user/datadir}
BLOCKCHAIN_NETWORK=${4:-"Mainnet"}  
ENODES=${5:-""}
MULTIADDR=${6:-""}

LOG_LEVEL="info"
LOG_FILE_LEVEL="debug"
IMAGE_TAG="latest"
EXTERNAL_IP=""

CA_CERT_URL="https://s3.amazonaws.com/credentials.blxrbdn.com/ca/ca_cert.pem"
mkdir -p "$CERT_PATH"/external_gateway/ca
curl $CA_CERT_URL -o "$CERT_PATH"/external_gateway/ca/ca_cert.pem

ARGS="--ws --port 1801"
if [[ "${EXTERNAL_IP}" != "" ]]; then
  ARGS="${ARGS} --external-ip ${EXTERNAL_IP}"
fi

if [[ "${LOG_LEVEL}" != "" ]]; then
  ARGS="${ARGS} --log-level ${LOG_LEVEL}"
fi

if [[ "${LOG_FILE_LEVEL}" != "" ]]; then
   ARGS="${ARGS} --log-file-level ${LOG_FILE_LEVEL}"
fi

if [[ "${ENODES}" != "" ]]; then
  ARGS="${ARGS} --enodes ${ENODES}"
fi

if [[ ${MULTIADDR} != "" ]]; then
  ARGS="${ARGS} --multiaddr ${MULTIADDR}"
fi

if [[ ${BLOCKCHAIN_NETWORK} == "Mainnet" && "${MULTIADDR}" != "" ]]; then
  ARGS="${ARGS} --multiaddr ${MULTIADDR}"
fi


ARGS="${ARGS} --blockchain-network ${BLOCKCHAIN_NETWORK}"

docker pull bloxroute/bloxroute-gateway-go:$IMAGE_TAG
docker rm -f bxgateway-go
docker run --name bxgateway-go --restart=on-failure -d -v "$LOGS_PATH":/app/bloxroute/logs \
  -v "$CERT_PATH":/app/bloxroute/ssl -v "$DATADIR_PATH":/app/bloxroute/datadir \
  -p 1801:1801 -p 127.0.0.1:6060:6060 \
  -blockchain-network BSC-Mainnet \
  -p 28333:28333 bloxroute/bloxroute-gateway-go:$IMAGE_TAG "$ARGS"
```

{% hint style="info" %}
Note that WebSockets are accessible at ws\://localhost:28333/ws. To test it, you can use wscat -c ws\://localhost:28333/ws -H "Authorization:\<your auth header here>"
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bloxroute.com/bsc/gateway/configuration-and-startup/startup-script.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
