|
1 | 1 | # TRON Docker |
2 | 2 |
|
3 | | -This repository provides guidance and tools for the community to quickly get started with TRON network and development. |
| 3 | +This repository provides tools and guidance to help the community quickly get started with the TRON network and development. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -### Quick start for single FullNode |
| 7 | +### 🚀 Quick start for single FullNode |
| 8 | +Easily deploy a single TRON FullNode connected to **Mainnet** or **Nile testnet** using Docker. Follow the instructions to get your node up and running in minutes. |
8 | 9 |
|
9 | | -This repository includes Docker configurations to quickly start a single TRON FullNode connected to the Mainnet or NileNet. Simply follow the instructions to get your node up and running in no time. |
| 10 | +### 🔗 Private chain setup |
| 11 | +Set up your own private TRON blockchain network for development and testing. The provided configurations simplify deployment and management, making it ideal for custom use cases. |
10 | 12 |
|
11 | | -### Private chain setup |
12 | | - |
13 | | -You can also use this repository to set up a private TRON blockchain network. This is useful for development and testing purposes. The provided configurations make it straightforward to deploy and manage your own private chain. |
14 | | - |
15 | | -### Node monitoring with Prometheus and Grafana |
16 | | - |
17 | | -Monitoring the health and performance of your TRON nodes is made easy with integrated Prometheus and Grafana services. The repository includes configurations to set up these monitoring tools, allowing you to visualize and track various metrics in real time. |
18 | | - |
19 | | -### Tools |
| 13 | +### 📊 Node monitoring with Prometheus and Grafana |
| 14 | +Monitor the health and performance of your TRON nodes with integrated **Prometheus** and **Grafana** services. Real-time metrics and visualizations are just a few steps away. |
20 | 15 |
|
| 16 | +### 🛠️ Tools |
21 | 17 | We also provide tools to facilitate the CI and testing process: |
22 | | -- Gradle Docker: Using Gradle to automate the build and test processes for java-tron image. |
23 | | -- DB Fork: This tool helps launch a private Java-Tron network based on the state of the Mainnet database to support shadow fork testing. |
24 | | - |
25 | | -## Getting Started |
26 | | - |
27 | | -### Prerequisites |
28 | | - |
29 | | -- Docker |
30 | | -- Docker Compose |
31 | | - |
32 | | -### Installation |
33 | | - |
34 | | -1. **Clone the repository:** |
35 | | - ```sh |
36 | | - git clone https://github.com/tronprotocol/tron-docker.git |
37 | | - cd tron-docker |
38 | | - ``` |
39 | | - |
40 | | -2. **Start the services:** |
41 | | - Navigate to the corresponding directory and follow the instructions in the respective README. Then you can easily start the services. |
42 | | - - To start a single FullNode, use the folder [single_node](./single_node). |
43 | | - - To set up a private TRON network, use the folder [private_net](./private_net). |
44 | | - - To monitor the TRON node, use the folder [metric_monitor](./metric_monitor). |
45 | | - - To use Gradle with Docker, check [gradle docker](./tools/docker/README.md). |
46 | | - - To do shadow fork testing, check [db fork guidance](./tools/dbfork/README.md). |
| 18 | +- **Gradle Docker**: Automate the build and testing of the `java-tron` Docker image using Gradle. |
| 19 | +- **Toolkit**: This package contains a set of database tools for TRON: |
| 20 | + - `mv, move`: Move db to pre-set new path. For example HDD,reduce storage |
| 21 | + expenses. |
| 22 | + - `archive`: A helper to rewrite leveldb manifest. |
| 23 | + - `convert`: Covert leveldb to rocksdb. |
| 24 | + - `lite`: Split lite data for java-tron. |
| 25 | + - `cp, copy`: Quick copy leveldb or rocksdb data. |
| 26 | + - `root`: compute merkle root for tiny db. NOTE: large db may GC overhead |
| 27 | + limit exceeded. |
| 28 | + - `fork`: Modify the database of java-tron for shadow fork testing. |
| 29 | + - `query`: Query the latest vote and reward information from the database. |
| 30 | +- **Stress Test**: Execute the stress test and evaluate the performance of the `java-tron` fullnode. |
| 31 | + |
| 32 | + |
| 33 | +## Prerequisites |
| 34 | +Please ensure you have the latest versions of Docker and Docker Compose installed by downloading them from the official websites: |
| 35 | + |
| 36 | +- **For Mac:** |
| 37 | + Download Docker from [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/). |
| 38 | + Docker Compose is included in the Docker installation package for Mac. |
| 39 | + - After installation, open Docker application, navigate to Settings \-> Resources \-> Network, and check the option \`Use kernel networking for UDP\`. Then restart Docker to apply. |
| 40 | + |
| 41 | +- **For Linux:** |
| 42 | + Download and install both Docker and Docker Compose plugin from the official websites: |
| 43 | + - Docker: [Install Docker on Linux](https://docs.docker.com/desktop/setup/install/linux/) |
| 44 | + - Docker Compose standalone: [Install Docker Compose on Linux](https://docs.docker.com/compose/install/standalone/) |
| 45 | + |
| 46 | +## Official Docker image |
| 47 | +There are two official Docker images for java-tron: |
| 48 | + |
| 49 | +- `tronprotocol/java-tron`: This image is based on the official [java-tron](https://github.com/tronprotocol/java-tron) repository, used for the Mainnet, and mostly can be used for the Nile testnet too. (**All the demo in this repository are based on this image**) |
| 50 | +- `tronnile/java-tron`: This image is based on the [nile-testnet](https://github.com/tron-nile-testnet/nile-testnet) repository which is forked from [java-tron](https://github.com/tronprotocol/java-tron). You need to use this image for the Nile testnet when there is new test release from java-tron and before it was released, especially for the hard fork test on Nile. Information about code release of the Nile testnet, please refer to this [website](https://nileex.io/). |
| 51 | + |
| 52 | +## Quick Start |
| 53 | +To quickly start a java-tron node that connects to the Mainnet, simply use the following Docker command: |
| 54 | + |
| 55 | +```sh |
| 56 | +docker run -it --name tron-node -d --memory="16g" -p 8090:8090 -p 50051:50051 tronprotocol/java-tron |
| 57 | +``` |
| 58 | + |
| 59 | +Alternatively, you can download and run the [docker-compose](single_node/docker-compose-quick-start.yml) file using the command: |
| 60 | + |
| 61 | +```sh |
| 62 | +docker-compose -f docker-compose-quick-start.yml up |
| 63 | +``` |
| 64 | + |
| 65 | +Once the FullNode starts, it will begin to sync blocks with Mainnet from the genesis block. You can use the following API request to check the current synced blocks: |
| 66 | +``` |
| 67 | +Request: |
| 68 | +curl --location --request POST 'http://127.0.0.1:8090/wallet/getnowblock' |
| 69 | +
|
| 70 | +Response example: |
| 71 | +{ |
| 72 | + "blockID": "00000000002ceed0bf4668aae518d143dfe1b74eea037a1caed98e0d4ea00de4", |
| 73 | + "block_header": { |
| 74 | + "raw_data": { |
| 75 | + "number": 2944720, |
| 76 | + "txTrieRoot": "d9c4fbe7c210ada548ac54460d717a5fce70d621b1e3da1db425672cbf477ca5", |
| 77 | + "witness_address": "41f29f57614a6b201729473c837e1d2879e9f90b8e", |
| 78 | + "parentHash": "00000000002ceecf692df37b4300746b9c68f7bdfad6d15a74859ceaff852f90", |
| 79 | + "version": 1, |
| 80 | + "timestamp": 1538758257000 |
| 81 | + }, |
| 82 | + "witness_signature": "445ad3d0585e24b60a9bceec0d97ac70b1558f42b44d24ef62f400a7c2646a271f01b83de985c5796485f74fd69d7b11c50b9ce44ad193fa35e26b317d3e339401" |
| 83 | + }, |
| 84 | + "transactions": [ |
| 85 | + { |
| 86 | + "signature": [ |
| 87 | + "948c3cbe1b48a20661878e591cf4c7fea7d1c63836b1523f5b0b003a290629714bfa4f4e6e6398a8edbca076b9c263c36b226b0f5a046ca3d54098b9e95d1c8e00" |
| 88 | + ], |
| 89 | + "txID": "25e0b74bcd0e7b2691945cce61ccafdf0be879c21fc729e6c25646350b611ad6", |
| 90 | + "raw_data": { |
| 91 | + "contract": [ |
| 92 | + { |
| 93 | + "parameter": { |
| 94 | + "value": { |
| 95 | + "amount": 1, |
| 96 | + "asset_name": "49504653", |
| 97 | + "owner_address": "41d13433f53fdf88820c2e530da7828ce15d6585cb", |
| 98 | + "to_address": "414f93486fa5d2685c70a3dd7e0815769a9fd3f02b" |
| 99 | + }, |
| 100 | + "type_url": "type.googleapis.com/protocol.TransferAssetContract" |
| 101 | + }, |
| 102 | + "type": "TransferAssetContract" |
| 103 | + } |
| 104 | + ], |
| 105 | + "ref_block_bytes": "eece", |
| 106 | + "ref_block_hash": "36ef820a1c8df903", |
| 107 | + "expiration": 1538758311000, |
| 108 | + "timestamp": 1538758251854 |
| 109 | + }, |
| 110 | + "raw_data_hex": "0a02eece220836ef820a1c8df90340d8f891a9e42c5a700802126c0a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e736665724173736574436f6e747261637412360a0449504653121541d13433f53fdf88820c2e530da7828ce15d6585cb1a15414f93486fa5d2685c70a3dd7e0815769a9fd3f02b200170ceaa8ea9e42c" |
| 111 | + }, |
| 112 | + ... |
| 113 | + ] |
| 114 | +} |
| 115 | +
|
| 116 | +``` |
| 117 | +You can also use `docker exec tron-node tail -f ./logs/tron.log` to check the node and syncing status. |
| 118 | + |
| 119 | +For more details on using database snapshort or customized configurations, please refer to the [single_node](single_node/README.md) section. |
| 120 | + |
| 121 | +## Start all features |
| 122 | +First, clone the repository: |
| 123 | + |
| 124 | +```sh |
| 125 | +git clone https://github.com/tronprotocol/tron-docker.git |
| 126 | +cd tron-docker |
| 127 | +``` |
| 128 | + |
| 129 | +### Start feature by trond tool |
| 130 | +We offer a `trond` command-line tool that allows developers to easily initiate features with a single command, enabling the community to quickly engage in TRON network development and interaction. |
| 131 | + |
| 132 | +To build the `trond` command-line tool, simply run `build_trond.sh`. |
| 133 | +```sh |
| 134 | +# this will generate trond in current directory |
| 135 | +./build_trond.sh |
| 136 | +``` |
| 137 | +After that, you can explore all the commands it supports. |
| 138 | +``` |
| 139 | +./trond -h |
| 140 | +Usage: |
| 141 | + trond [command] |
| 142 | +
|
| 143 | +Examples: |
| 144 | +# Help information for java-tron Docker image build and testing commands |
| 145 | +$ ./trond docker |
| 146 | +
|
| 147 | +# Help information for database snapshot download-related commands |
| 148 | +$ ./trond snapshot |
| 149 | +
|
| 150 | +# Help information for java-tron node deployment commands |
| 151 | +$ ./trond node |
| 152 | +
|
| 153 | +Available Commands: |
| 154 | + docker Commands for operating the java-tron Docker image. |
| 155 | + help Help about any command |
| 156 | + node Commands for operating the java-tron Docker node. |
| 157 | + snapshot Commands for obtaining java-tron node snapshots. |
| 158 | +``` |
| 159 | +Check the output of `./trond -h`, which now supports the following features: |
| 160 | +- Download database snapshots. It is used to save time by avoiding the need to sync from the genesis block. |
| 161 | +- Build and test the java-tron Docker image locally. Note that it is not mandatory for deploying a node, as you can use the Docker image available on the official Docker Hub. |
| 162 | +- Deploy a single FullNode for various networks. |
| 163 | + |
| 164 | +For more details on the `trond` command-line tools and how they work, please refer to the [README](./tools/trond/README.md). |
| 165 | + |
| 166 | +### Start the feature individually |
| 167 | +To start all available features, or you want more customized operations, navigate to the respective directory and follow the instructions in the corresponding README to start the services: |
| 168 | +- **TRON network deployment related:** |
| 169 | + - **Single FullNode**: Use the [single_node](./single_node) folder. |
| 170 | + - **Private TRON network**: Use the [private_net](./private_net) folder. |
| 171 | + - **Node monitoring**: Use the [metric_monitor](./metric_monitor) folder. We provide two solutions: one with enhanced security considerations and another with a simpler setup. |
| 172 | + |
| 173 | +- **Tools**: |
| 174 | + - **Gradle Docker**: Automate Docker image builds and testing. Check the [gradle docker](./tools/docker/README.md) documentation. |
| 175 | + - **Toolkit**: Perform a set of database related operations. Follow the [Toolkit guidance](./tools/toolkit/README.md). |
| 176 | + - **Stress Test**: Execute the stress test. Follow the [stress test guidance](./tools/stress_test/README.md). |
47 | 177 |
|
48 | 178 | ## Troubleshooting |
49 | 179 | If you encounter any difficulties, please refer to the [Issue Work Flow](https://tronprotocol.github.io/documentation-en/developers/issue-workflow/#issue-work-flow), then raise an issue on [GitHub](https://github.com/tronprotocol/tron-docker/issues). For general questions, please use [Discord](https://discord.gg/cGKSsRVCGm) or [Telegram](https://t.me/TronOfficialDevelopersGroupEn). |
50 | 180 |
|
51 | | -# Contributing |
| 181 | +## Contributing |
52 | 182 |
|
53 | 183 | All contributions are welcome. Check [contribution](CONTRIBUTING.md) for more details. |
54 | 184 |
|
55 | | -# License |
| 185 | +## License |
56 | 186 |
|
57 | 187 | This repository is released under the [LGPLv3 license](https://github.com/tronprotocol/tron-docker/blob/main/LICENSE). |
0 commit comments