Skip to content

USC node Config file

Teh Sunn Liu (AlexLiu) edited this page Mar 28, 2019 · 5 revisions

This article describes all the fields available in the configuration file. A sample configuration file can be found here.

By default USC uses default config files. However, you can create your config file and replace the default config file follow the steps here to start USC with your config file

Index

peer

  • peer.discovery.enabled = [true/false] enables the possibility of being discovered by new peers.
  • peer.discovery.ip.list = ["<ip address>", <ip address>] a list of peers to discover. Peers must have their discovery.enabled option set to true.
Network Ip Address USC Ip Address USC-2
TestNet testnet.usc.ulord.one:58858 114.67.37.198:12389, 114.67.37.198:12389
MainNet
  • peer.active = [] (can be empty), this field is used to connect to specific nodes.
  • peer.trusted = [] (can be empty), a list of peers whose incoming connections are always accepted from.
  • peer.port the port used by the peer to listen to incoming connections. Default port for USC network:
Network peer.port USC peer.port USC-2
RegTest 30305 60300
TestNet 58585 60200
MainNet 5858 60100
  • peer.connection.timeout = number (seconds) defines in seconds the timeout for trying to connect to a peer. Suggested value: 2

  • channel.read.timeout = number (seconds) specifies how much time you will wait for a message to come before closing the channel. Suggested value: 30. peer.privateKey = hash a securely generated private key unique for your node that must be set. peer.networkId = int is the number of the network to connect to. It's important to maintain these numbers. It identifies the network you are going to connect to. For a regtest private network, you should use always the same (not necessary 34567). USC networks Ids:

Network peer.networkId USC peer.networkId USC-2
Regtest 34567 3456789
TestNet 779 955
MainNet 775 855
  • peer.maxActivePeers = int is the max number of active peers that your node will maintain. Suggested value: 30.

  • peer.p2p.eip8 = bool forces peer to send handshake message in the format defined by EIP-8.

database

Describes where the blockchain database is stored.

  • database.dir = path path where the database is stored, eg: "/root/usc/database".
  • database.reset = [true/false] resets de database when application starts if it is set to true.

vm

Enabling vm.structured will log all the calls to the VM in the local database, this means, all the contract executions (opcodes). When testing, using this module is the only way to see Exceptions.

  • trace = [true/false] enables the vm.structured.
  • dir = foldername the directory where calls are saved.
  • compressed = [true/false] compress data when enabled. initStorageLimit = int the storage limit. An example:
vm.structured {
    trace = false
    dir = vmtrace
    compressed = true
    initStorageLimit = 10000
}

sync

Options related to syncing the blockchain:

  • sync.enabled = [true/false] enables the blockchain synchronization. Should be set to true to keep the node updated.
  • sync.max.hashes.ask = int determines the max amount of blocks to sync in a same batch. The synchronization is done in batches of blocks. Suggested value: 10000.
  • sync.peer.count = int minimum peers count used in syncing. Sync may use more peers than this value but always trying to get at least this number from discovery. However, it will continue syncing if it's not reached.
  • sync.timeoutWaitingPeers = int (seconds) timeout to start to wait for syncing requests.
  • sync.timeoutWaitingRequests = int (seconds) expiration time in minutes for peer status.
  • sync.maxSkeletonChunks = int maximum amount of chunks included in a skeleton message.
  • sync.shunkSize = int amount of blocks contained in a chunk, must be 192 or a divisor of 192.

An example:

sync {
    enabled = true
    max.hashes.ask = 10000
    peer.count = 10
    expectedPeers = 5
    timeoutWaitingPeers = 1
    timeoutWaitingRequest = 30
    expirationTimePeerStatus = 10
    maxSkeletonChunks = 20
    chunkSize = 192
}

rpc

Describes the configuration for the RPC protocol.

  • rpc.providers = [] lists the different providers (up to this moment, just web). rpc.providers.web has a global setting for every web provider, cors.
    • rpc.providers.web.cors = domain restricts the RPC calls from other domains. Default value is localhost.
  • rpc.providers.web options:
    • rpc.providers.web.http defines http configuration:
      • rpc.providers.web.http.enabled = [true/false] enables this web provider. Default value is true.
      • rpc.providers.web.http.port = port is the HTTP-RPC server listening port. By default USC uses 58858.
      • rpc.providers.web.http.bind_address = address is the HTTP-RPC server listening interface. By default USC uses localhost.
      • rpc.providers.web.http.hosts = [] is the list of node's domain names or IPs.
    • rpc.providers.web.ws defines web sockets configuration:
      • rpc.providers.web.ws.enabled = [true/false] enables this web provider. Default value is true.
      • rpc.providers.web.ws.port = port is the WS-RPC server listening port. By default USC uses 58859.
      • rpc.providers.web.ws.bind_address = address is the WS-RPC server listening interface. By default USC uses localhost.
  • rpc.modules lists of different RPC modules. If a module is not in the list and enabled, its RPC calls are discard. Examples:
modules = [
    { name: "eth", version: "1.0", enabled: "true" },
    { name: "net", version: "1.0", enabled: "true" },
    { name: "rpc", version: "1.0", enabled: "true" },
    { name: "web3", version: "1.0", enabled: "true" },
    { name: "evm", version: "1.0", enabled: "true" },
    { name: "sco", version: "1.0", enabled: "true" },
    { name: "txpool", version: "1.0", enabled: "true" },
    { name: "personal", version: "1.0", enabled: "true" }
]

It is possible to enable/disable particular methods in a module.

{
    name: "evm",
    version: "1.0",
    enabled: "true",
    methods: {
        enabled: ["evm_snapshot", "evm_revert"],
        disabled: [ "evm_reset", "evm_increaseTime"]
    }
}

USC has implemented an RPC miner module. To use it, you have to include:

{ name: "mnr", version: "1.0", enabled: "true" }

wallet

You can store your accounts on the node to use them to sign transactions. However, it is not secure to use a wallet in a public node.

wallet {
    enabled = true
    accounts = [
        {
            "publicKey" : "<PUBLIC_KEY>"
            "privateKey" : "<PRIVATE_KEY>"
        }
    ]
}

scoring

coring is the way the node 'punishes' other nodes when bad responses are sent. Punishment can be done by node id or address.

  • scoring.nodes.number = int number of nodes to keep scoring.
  • scoring.nodes.duration and scoring.addresses.duration initial punishment duration (in minutes). Default is 10.
  • scoring.nodes.increment and scoring.addresses.increment punishment duration increment (in percentage). Default is 10.
  • scoring.nodes.maximum maximum punishment duration (in minutes). Default is 0.
  • scoring.addresses.maximum maximum punishment duration (in minutes). Default is 1 week. An example:
scoring {
    nodes {
        number: 100
        duration: 12
        increment: 10
        maximum: 0
    }
    addresses {
        duration: 12
        increment: 10
        maximum: 6000
    }
}

miner

If you want to convert your node into a mining node, you have to add the following methods to your config file.

Enable RPC mining methods

Add 'mnr' module inside rpc.modules section:

modules = [
        {
            name: "mnr",
            version: "1.0",
            enabled: "true"
         },
         #Other enabled modules
         ...
    ]

Add the miner section

Current Testnet minGasPrice value = 0 Current MainNet minGasPrice value = 183000000

# miner options
miner {
    server.enabled = true
    client.enabled = false
    minGasPrice = 183000000

    # this is a hex-encoded, 20-bytes length address where the miner gets the reward
    reward.address = <ENCODED_ADDRESS>
}
  • Your <ENCODED_ADDRESS> should be a 20-bytes value, for example:
reward.address = "83e5356c8Bb19109f5dg19900EC6c130049F8034"

Miner with coinbase secret (alternative to setting a reward address)

❗ This is not recommended to be used in MainNet.

This configuration is usually used for testing, along with a local wallet hosted in the node.

# miner options
miner {
    server.enabled = true
    client.enabled = false
    minGasPrice = 183000000

    # this is a secret passphrase that is used to derive the address where the miner gets the reward.
    # please note this is stored in a local wallet and not recommended for production.
    coinbase.secret = <COINBASE_SECRET>
}

Set client.enabled = false if you want to do merged mining and client.enabled = true if you want to do local mining

blockchain.config.name

It is a string that describe the name of the configuration. We use:

Network blockchain.config.name
Regtest regtest
TestNet testnet
MainNet main

bind_address

It's the network interface with wire protocol and peer discovery.

It is the last resort for public IP when it cannot be obtained by other ways.

public.ip

It is the node's public IP. If it's not configured, default is the IPv4 returned by http://checkip.amazonaws.com.

genesis

It is the path to the genesis file (in resources/genesis). The folder resources/genesis contains several versions of genesis configuration according to the network the peer will run on.

| Network genesis | | --- | --- | | Regtest | usc-dev.json | | TestNet | ulord-testnet.json | | MainNet | usc-mainnet.json |

transaction.outdated

It defines when a transaction is outdated:

  • transaction.outdated.threshold = int is the number of blocks that should pass before pending transaction is removed. Suggested value: 10.
  • transaction.outdated.timeout = int is the number of seconds that should pass before pending transaction is removed. Suggested value: 400.

play.vm

It is a boolean that invokes vm program on message received, if the vm is not invoked the balance transfer occurs anyway. Suggested value: true.

hello.phrase

A string that will be included in the hello message of the peer.

details.inmemory.storage.limit

Specifies when exactly to switch managing storage of the account on autonomous db. Suggested value: 1. If the inmemory storage of the contract exceded the limit, just deltas are saved.

solc.path

It is the path to the Solidity compiler. It's set because you may want to use the node to compile your smart contracts. If you don't have Solidity installed, you can use /bin/false as value.

prune

The prune service is a process that runs over the node storage to lighten the space it needs to be synchronized. This process removes useless data over a determined amount of blocks processed.

To enable prune service in your node you can override your configuration with the recommended parameters:

prune {
    # prune service could be enabled or not
    # values: [true/false]
    # default: false
    enabled = true

    # Number of blocks to process
    blocks {
        # Number of blocks to copy in each prune run
        # default: 5000
        toCopy = 5000

        # Number of blocks to wait to run prune again
        # default: 10000
        toWait = 10000

        # Number of blocks to suspend blockchain process
        # in order to avoid forks
        # default: 100
        toAvoidForks = 100
    }
}