Tron Node Config

Updated on 14.02.2019
The Tron config file has been updated. The new entries are listed below.

Java Tron Config File
The config.conf file has a lot of options for customization. We are going explain the important ones here that are relevant for the Tron Witness Nodes (TWN) or the Tron Full Node (TFN)

Choose on what network you want to be. You have the choice between mainnet and testnet. Well as the name does suggest, mainnet is live and testnet is just for testing purposes.

net {
  type = mainnet
  # type = testnet
}

Starting with Odyssey-v3.2.2 a new DB version as well indexing options were introduced. If the version is set to 2, it enables the RPC and HTTP interface services of the SolidityNode on the FullNode.

storage {
  # Directory for storing persistent data
  db.version = 2,
  db.directory = "database",
index.directory = "index",

The index only applies to the SolidityNode. Turning off the index will significantly improve the performance of the SolidityNode sync block. You can turn off the index if you don’t use the two interfaces getTransactionsToThis and getTransactionsFromThis.

index.switch = "off"

This configuration item is used to database write strategy. Asynchronous writing significantly improves the performance of the FullNode sync block. Synchronous writing is “true”, else Asynchronous writing is “false”. Asynchronous writing significantly improves the performance of the FullNode sync block, however the write will be flushed from the operating system buffer cache.

Why it’s important: If the machine crashes, some recent writes may be lost. Note that if it is just the process that crashes (i.e., the machine does not reboot), no writes will be lost.

db.sync = false

This configuration item controls the transaction result be put into transactionHistory database. Turning off the switch, transaction result will not be put into transactionHistory database. You can turn off the switch if you don’t use the interface getransactioninfobyid.

transHistory.switch = "on"

You can customize these 14 databases’ configs for account, account-index, asset-issue, block, block-index, block_KDB, peers, properties, recent-block, trans, utxo, votes, witness, witness_schedule. Otherwise, db configs will remain defualt and data will be stored in the path of “output-directory” or which is set by “-d” (“–output-directory”). this section is default and commented out. if you have no reason to change it, leave it as is.

  properties = [
//    {
//      name = "account",
//      path = "storage_directory_test",
//      createIfMissing = true,
//      paranoidChecks = true,
//      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
//    {
//      name = "account-index",
//      path = "storage_directory_test",
//      createIfMissing = true,
//      paranoidChecks = true,
//      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
]

One of the blocks you may need to edit is the node.discovery block. You need to edit it, if you are behind a proxy and having trouble allowing incoming connections. Set here your external and internal IP addresses.

node.discovery = {
  enable = true
  persist = true
  bind.ip = "10.10.10.10"
  external.ip = "89.34.227.1"
}

The node.backup block will allow you to run two witness nodes at the same time, with an automatic fail over.

Example:
Two node setup with Host A and Host B working in a failover scenario, when one host fails, the second takes over. Your primary witness will be the one with the higher priority status, or the one which is started first if they have the same priority. You can list as many backups as you like in this block, but normally each SR has a limited number of TWN or TFN. You should definitely not forget to open the backup port on your firewall.

To set this up, simply alter the config file on Host A to include the backup IP Address of Host B. And analog on Host B include the IP Address of Host A.

node.backup {
  port = 10001
  priority = 8
  members = [10.10.10.11]
}

Next there is the node block that has a lot of options.

Trustnode
If you are running a Solidity node, you need to point it to a trusted full node. The trusted node can be running on the same machine under a different set of ports. Starting with Odyssey-v3.2.2 where DB version 2 was introduced and where the FullNode does provide the RPC and HTTP interface services of the SolidityNode on the FullNode

node {
  # trust node for solidity node
  # trustNode = "ip:port"
  trustNode = "127.0.0.1:50051"

Wallet API
Enable Wallet API exposure to public.

# expose extension api to public or not
walletExtensionApi = true

listen.port
This is what we refer to as the “communication port.” Default this is set to 18888 but you can change it for example if you are running two nodes on one machine. You must change this port for one of those nodes. It is also a good security practice to use a nonstandard port because of scanning of well known ports.

listen.port = 18888

TRON HTTP Gateway interface.
The default http port on FullNode is 8090. The default http port on solidityNode is 8091.

http {
    fullNodePort = 8090
    solidityPort = 8091
  }

rpc
The rpc (grpc) port listens for API instructions to execute. If you are running multiple nodes on one machine you must change this port for all but one of those nodes. It is also a good security practice to use a nonstandard port because of scanning of well known ports. Below are also performance tuning settings that one can tune depending on the available resources.

  rpc {
    port = 50051
    solidityPort = 50061
    # Number of gRPC thread, default availableProcessors / 2
    # thread = 16

    # The maximum number of concurrent calls permitted for each incoming connection
    # maxConcurrentCallsPerConnection =

    # The HTTP/2 flow control window, default 1MB
    # flowControlWindow =

    # Connection being idle for longer than which will be gracefully terminated
    maxConnectionIdleInMillis = 60000

    # Connection lasting longer than which will be gracefully terminated
    # maxConnectionAgeInMillis =

    # The maximum message size allowed to be received on the server, default 4MB
    # maxMessageSize =

    # The maximum size of header list allowed to be received, default 8192
    # maxHeaderListSize =
}

Seed Node
New nodes will look to connect to this list of seed nodes to make an initial network connection. There is no need to alter this block if you start fresh. If you already have another server with the full chain, you can enter it here and sync from it.

seed.node = {
  # List of the seed nodes
  # Seed nodes are stable full nodes
  # example:
  # ip.list = [
  #   "ip:port",
  #   "ip:port"
  # ]
  ip.list = [
    "54.236.37.243:18888",
    "52.53.189.99:18888",
    "18.196.99.16:18888",
    "34.253.187.192:18888",
    "52.56.56.149:18888",
    "35.180.51.163:18888",
    "54.252.224.209:18888",
    "18.228.15.36:18888",
    "52.15.93.92:18888",
    "34.220.77.106:18888",
    "13.127.47.162:18888",
    "13.124.62.58:18888",
    "13.229.128.108:18888",
    "35.182.37.246:18888",
    "34.200.228.125:18888",
    "18.220.232.201:18888",
    "13.57.30.186:18888",
    "35.165.103.105:18888",
    "18.184.238.21:18888",
    "34.250.140.143:18888",
    "35.176.192.130:18888",
    "52.47.197.188:18888",
    "52.62.210.100:18888",
    "13.231.4.243:18888",
    "18.231.76.29:18888",
    "35.154.90.144:18888",
    "13.125.210.234:18888",
    "13.250.40.82:18888",
    "35.183.101.48:18888"
  ]

Active nodes

  active.node = [
      # Active establish connection in any case
      # Sample entries:
      # "ip:port",
      # "ip:port"
  ]

Trusted Nodes

  trust.node = [
      # Passive accept connection in any case
      # Sample entries:
      # "ip:port",
      # "ip:port"
  ]

localwitness
Here you can put your private key for a witness node. It is the less secure version of adding the key to the config.

localwitness = [650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812]

localwitnesskeystore
This is a .json file that holds the encrypted private key. You must put this file in the same directory as the application (~/java-tron/). When you launch the application this way, it will ask you for a password.

localwitnesskeystore = [
  "localwitnesskeystore.json"
]

This entry needs to be set in a multi node environment. It’s false for the first node because it does generate blocks and true for all others who will sync from this one. This is set in test net of you deploy a private testnet. In mainnet we will always sync from other nodes and will need to check.

block = {
  needSyncCheck = true
  maintenanceTimeInterval = 21600000
  proposalExpireTime = 259200000 // 3 day: 259200000(ms)
}

TVM related entries
These fields are related to smart contracts and how the TVM is executing them. Since in the wave field network protocol, both the deployment and the calling contract need to consume the corresponding resources (memory, CPU, storage, etc.), it is recommended that developers build their own private network for debugging and testing the smart contract, after confirming that the contract is available. Then deploy the contract on the test network or the main network.

As a developer, if you want to support the constant request, you need to fill in the configuration file config.conf: supportConstant = true, the default is false.

The other two, minTimeRatio is the timeout period set when the contract is verified when the smart contract transaction is timed out; maxTimeRatio is the timeout period set when the contract is verified when the smart contract transaction that has not timed out is accepted.

vm = {
  supportConstant = false
  minTimeRatio = 0.0
  maxTimeRatio = 5.0
}

This is the entry related to the TVM activation that is voted by the SR Tron comitee.

committee = {
  allowCreationOfContracts = 0  //mainnet:0 (reset by committee),test:1
}

You can now change the logging level and choose between TRACE, DEBU, INFO, WARN and ERROR

log.level = {
   root = "INFO" // TRACE;DEBUG;INFO;WARN;ERROR
}