# Tron Node / DONE

### Tron Node reconfiguring:

{% hint style="warning" %}
The documentation is described for installation on a pure VDS without any third-party software or other programmes, please take this into account when installing.
{% endhint %}

1. Install the necessary packages:

   ```shell
   apt update && apt install -y git wget curl nano
   ```
2. Install Docker according to the official documentation<https://docs.docker.com/engine/install/#server>
3. Clone the repository with the docker image:

   ```bash
   git clone https://github.com/boxexchanger/docker-java-tron.git
   ```
4. Go to the directory with the project

   ```
   cd docker-java-tron/
   ```
5. Create a configuration file and set the required contract addresses and event tops: (not obligatory, but recommended so as not to process unnecessary transactions).

   ```bash
   nano ~/docker-java-tron/tron.conf
   ```

   configuration example for processing only USDT events

   ```
   EVENT_PLUGIN_ADDRESS_FILTER=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
   ```
6. Create a folder for this node

   ```bash
   mkdir -p ~/docker-java-tron/data/node
   ```
7. Download Lite version of node data from open source[(http://34.143.247.77/](http://34.143.247.77/)) ([documentation](https://developers.tron.network/docs/main-net-database-snapshots#lite-fullnode-data-snapshot))

   ```bash
   wget http://34.143.247.77/backup20240809/LiteFullNode_output-directory.tgz -O ~/LiteFullNode_output-directory.tgz
   ```
8. Unzip the archive (folder`output-directory)` в `~/docker-java-tron/data/node/`

   ```bash
   tar xvf ~/LiteFullNode_output-directory.tgz -C ~/docker-java-tron/data/node/ --strip-components=1
   ```
9. Delete the archive with the Lite data

   ```
   rm ~/LiteFullNode_output-directory.tgz
   ```

   Now our Tron node is ready to go live

### Launch Node

1. Go to the project directory:

   ```bash
   cd ~/docker-java-tron/
   ```
2. Launch Tron node

   ```
   ./start.sh
   ```

### How to add another contract address

1. You have to go into the configuration:

   ```
   nano ~/docker-java-tron/tron.conf
   ```
2. Add another address to the `EVENT_PLUGIN_ADDRESS_FILTER` block by separating the contract addresses with a comma character **, and** do not use line breaks or spaces between addresses.\
   \
   USDT + USDC Example:

   ```
   EVENT_PLUGIN_ADDRESS_FILTER=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t,TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8
   ```

### Clearing node data:

By default we have set 5 days of data storage which you can synchronise

If you want to change this parameter you need to add a different number of days to your configuration

1. You have to go into the configuration

   ```bash
   nano ~/docker-java-tron/tron.conf
   ```
2. Add a line with your value:

   ```
   MONGO_RETENTION_DAYS=5
   ```

### How to get logs from node:

```
docker exec -it tron-node tail -f logs/tron.log
```

### Opening an access port:

Create proxy from ports&#x20;

\- localhost:8080 to port **2080** for EventServer&#x20;

\- localhost:18090 to port **2090** for fullNode&#x20;

\- localhost:18091 to port **2091** for solidityNode

<details>

<summary>Setting up a proxy on caddy</summary>

Installing caddy <https://caddyserver.com/docs/install>&#x20;

Documentation prepared for **Debian 11 and 12**.

```shell
apt install -y debian-keyring debian-archive-keyring apt-transport-https
```

```shell
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
```

```shell
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' |  tee /etc/apt/sources.list.d/caddy-stable.list
```

```shell
apt update
```

```shell
apt install caddy
```

configuring caddy for proxy&#x20;

8080,18090,18091 to ports 2080,2090,2091 for the external network

**Caddyfile will be overwritten completely!**

```
echo -e ':2080 {\n reverse_proxy :8080\n}\n:2090 {\n reverse_proxy :18090\n}\n:2091 {\n reverse_proxy :18091\n}' > /etc/caddy/Caddyfile 
```

launch caddy

```bash
systemctl enable --now caddy
```

or restart if necessary`systemctl restart caddy`

</details>

### Accesses

**EventServer:** `http://ip.host:2080`\
**Node:** `http://ip.host:2090`\
**Solidity:** `http://ip.host:2091`

### How to update a tron-node container.

Update the version in the .env file <https://github.com/tronprotocol/java-tron/releases>

{% code title=".env" %}

```bash
JAVA_TRON_VERSION="GreatVoyage-v4.7.5"
```

{% endcode %}

Rebuild docker and restart the node:

```bash
docker compose build
./start.sh
```


---

# 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://manual-en.boxexchanger.net/for-developers-done/ustanovka-node/tron-node.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.
