HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
Guides

Main Net Database Snapshots

TRON officially offers database snapshots regularly for quick node deployment. A data snapshot is a compressed file of the database backup of a TRON network node at a certain time. Developers can download and use the data snapshot to speed up the node synchronization process.

Download the Data Snapshot

Fullnode data snapshot

The following table shows the download address of Fullnode data snapshots. Please select a suitable data snapshot according to the location and node database type, and whether you need to query historical internal transactions.

Fullnode Data SourceDownload siteDescription
Official data source (Asia: Singapore)http://34.143.247.77LevelDB, exclude internal transactions (About 1706G on May 16, 2024)
Official data source (America)http://34.86.86.229LevelDB, exclude internal transactions (About 1702G on May 14, 2024)
Official data source (America)http://35.197.17.205RocksDB,exclude internal transactions (About 1686G on May 16, 2024)
Official data source (Singapore)http://35.247.128.170LevelDB, include internal transactions (About 1884G on May 16, 2024)
Official data source with accountbalancehttp://34.48.6.163LevelDB,exclude internal transactions,but include address history TRX balance(About 2143G on May 16, 2024)

Note:The data of LevelDB and RocksDB are not allowed to be mixed. The database can be specified in the config file of the full node, set db.engine to LEVELDB or ROCKSDB.

Lite Fullnode data snapshot

The Tron Public Chain has supported the type of the Lite Fullnode since the version of GreatVoyage-v4.1.0 release. All the data required by the Lite Fullnode for running is whole of the status data and a little essential block data, so, it is much more lightweight (smaller database and faster startup) than the normal Fullnode. TRON officially offers database snapshots of the Lite Fullnode.

Lite Fullnode Data SourceDownload siteDescription
Official data source (Singapore)http://34.143.247.77/LevelDB

Tips: You can split the data from the whole data with the help of the Lite Fullnode Data Pruning Tool.

Use the data snapshot

The steps for using data snapshots are as follows:

  1. Download the corresponding compressed backup database according to your needs.
  2. Decompress the compressed file of the backup database to the output-directory directory or to the corresponding directory according to your needs.
  3. Startup the node. The node reads the output-directory directory by default. If you need to specify another directory,please add the -d directory parameter when the node starts.

Others

Lite Fullnode Data Pruning Tool

The toolkit provides a series of java-tron tools, one of which is the Lite Fullnode data pruning tool. It is mainly used for generating or pruning Lite Fullnode data, for example, it can be used to split the database of a Fullnode into a Snapshot dataset and a History dataset. The snapshot dataset is used to start the Lite Fullnode (That is the Lite fullnode database), and the historical dataset is used for historical data query.

  • Snapshot dataset: the minimum dataset for quick startup of the Lite Fullnode.
  • History dataset: the archive dataset that used for historical data queries.

Before using this tool for any operation, you need to stop the currently running Fullnode process first. This tool provides the function of splitting the complete data into two datasets according to the current latest block height (latest_block_number). Lite Fullnode launched from snapshot datasets do not support querying historical data prior to this block height. The tool also provides the ability to merge historical datasets with snapshot datasets.


The usage scenarios are as follows:

  • Convert FullNode data into Lite Fullnode data

    The Lite Fullnode starts only based on the snapshot data set, use the data pruning tool to convert the full node data into the snapshot data set, and that will get the Lite Fullnode data

  • Prune Lite Fullnode data regularly
    Since the Lite Fullnode saves the same data as the FullNode after startup, although the data volume of the Lite Fullnode is very small at startup, the data expansion rate in the later period is the same as that of the FullNode, so it may be necessary to periodically prune the data. Clipping the Lite Fullnode data is also to use this tool to cut the Lite Fullnode data into snapshot data set, that is, to obtain the Pruned Lite Fullnode data

  • Convert Lite Fullnode data back to FullNode data

    Since Lite Fullnode does not support historical data query, if you want to support it, you need to change Lite Fullnode data into FullNode data, then the node will change from Lite Fullnode to FullNode. You can directly download the snapshot of the FullNode database, or you can use the data pruning tool: first, convert the FullNode data into historical data set, and then merge the historical data set and the snapshot data set of the Lite Fullnode to obtain the FullNode data.

Note: Before using this tool for any operation, you need to stop the currently running node first.


Obtain Toolkit

Toolkit.jar can be obtained by compiling the java-tron source code, the steps are as follows:

  1. Obtain java-tron source code

    $ git clone https://github.com/tronprotocol/java-tron.git
    $ git checkout -t origin/master
    
  2. Compile

    $ cd java-tron
    $ ./gradlew clean build -x test
    

    After compiling, Toolkit.jar will be generated in the java-tron/build/libs/ directory.

Command and parameters

To use the data pruning tool provided by Toolkit through the db lite command:

# full command
  java -jar Toolkit.jar db lite [-h] -ds=<datasetPath> -fn=<fnDataPath> [-o=<operate>] [-t=<type>]
# examples
  #split and get a snapshot dataset
  java -jar Toolkit.jar db lite -o split -t snapshot --fn-data-path output-directory/database --dataset-path /tmp
  #split and get a history dataset
  java -jar Toolkit.jar db lite -o split -t history --fn-data-path output-directory/database --dataset-path /tmp
  #merge history dataset and snapshot dataset
  java -jar Toolkit.jar db lite -o merge --fn-data-path /tmp/snapshot --dataset-path /tmp/history

Optional command parameters are as follows:

  • --operation | -o: [ split | merge ], this parameter specifies the operation as either to split or to merge, default is split.
  • --type | -t: [ snapshot | history ], this parameter is used only when the operation is split. snapshot means clip to Snapshot Dataset and history means clip to History Dataset. Default is snapshot.
  • --fn-data-path | -fn: The database path to be split or merged. When the operation type is split, fn-data-path is used to indicate the directory of the data to be pruned; when the operation type is merge, fn-data-path indicates the database directory of the Lite Fullnode or the directory of the snapshot dataset.
  • --dataset-path | -ds: When operation is split, dataset-path is the path that store the snapshot or history, when operation is merge, dataset-path is the history data path.

Usage Instructions

The node database is stored in the output-directory/database directory by default. The examples in this chapter will be explained with the default database directory.

The following three examples illustrate how to use the data pruning tool:

  • Split and get a Snapshot Dataset

    This function can split FullNode data into Lite Fullnode data, and can also be used to regularly trim Lite Fullnode data. The steps are as follows:

    First, stop the FullNode and execute:

    # just for simplify, save the snapshot into /tmp directory
    java -jar Toolkit.jar db lite -o split -t snapshot --fn-data-path output-directory/database --dataset-path /tmp
    
    • --fn-data-path: The data directory to be trimmed, that is, the node data directory

    • --dataset-path: The directory where the output snapshot dataset is stored

      After the command is executed, a snapshot directory will be generated in /tmp, the data in this directory is the Lite Fullnode data, then rename the directory from snapshot to database (the default value of the storage.db.directory is database, make sure rename the snapshot directory to the specified value) and copy the database directory to the Lite Fullnode database directory to finish the splitting. Finally start the Lite Fullnode.

  • Split and get a History Dataset

    The command to split the historical data set is as follows:

    # just for simplify, save the history into `/tmp` directory,
    java -jar Toolkit.jar db lite -o split -t history --fn-data-path output-directory/database --dataset-path /tmp
    
    • --fn-data-path: FullNode data directory

    • --dataset-path: The directory where the output historical dataset is stored

      After the command is executed, the history directory will be generated under the /tmp directory, and the data in it is the historical dataset.

  • Merge History Dataset and Snapshot Dataset

    Both History Dataset and Snapshot Dataset have an info.properties file to identify the block height when they are split. Make sure that the split_block_num in History Dataset is not less than the corresponding value in the Snapshot Dataset. After the historical dataset is merged with the snapshot dataset through the merge operation, the Lite Fullnode will become a real FullNode.

    The command to merge the historical dataset and the snapshot dataset is as follows:

    # just for simplify, assume `History dataset` is locate in /tmp
    java -jar Toolkit.jar db lite -o merge --fn-data-path /tmp/snapshot --dataset-path /tmp/history
    
    • --fn-data-path: snapshot dataset directory

    • --dataset-path: history dataset directory

      After the command is executed, the merged data will overwrite the directory where the snapshot data set is located, that is, the directory specified by --fn-data-path, copy the merged data to the node database directory, and the Lite Fullnode becomes a FullNode.