How to run?

Configuration

# chain
chain:
  esc: "https://api-testnet.elastos.io/esc"

# Validator.
validator:
  btcCreator: false
  listener: true
  verifier: true
  escStartHeight: 21971869
  btcStartHeight: 826758
  btcCrossChainAddress: "bc1pwrjaa2c8xux98ldunet93fkqqr7umz27sf20p0esp23rksn5un6skvcjnw"
  btcCrossChainPayAddress: "bc1pwrjaa2c8xux98ldunet93fkqqr7umz27sf20p0esp23rksn5un6skvcjnw"
  btcDeployOwnerAddress: "bc1pul7njkglracvzmrz7yx2ttv28jr5uxc0ne920e4397treueyqxls3alwkj"
  escCrossChainAddress: "0x7d9DE2642F874fbc91759DBae45e5A8Ed2F2cba8"
  deployBRC20Address: "0x0285b8b486cF99be65853D45269725e334c021BD"
  dataPath: "./app/validator/data/"
  keyFilePath: "./app/validator/data/keys/"
  parallelTxCount: 10

api:
  proxy: "" #"http://127.0.0.1:10902" 
  escIndexer: "" #http://43.137.35.215:8000/
  oklinkAPIKey: ""
  okxAPIKey: ""
  okxAPIKeySecret: ""
  okxAPIKeyPassphrase: ""
  okxAPIProjectID: ""
  bitcoinRPC: ""
  bitcoinRPCUser: ""
  bitcoinRPCPassword: ""

Validator Configuration Details

Steps to set the configuration

  1. Set role: The validator is comprised of three components: btcCreator, listener, and verifier. These can be individually enabled or disabled in the configuration file by setting boolean values. Currently, only one validator can have btcCreator enabled as it is responsible for creating single btc transactions.

  2. Set dataPath: Each of the three components, btcCreator, listener, and verifier, can be executed as separate validator processes. It effectively means that a single validator can be split into three processes using the configuration file. However, it's essential to ensure that all three processes of one validator share the same dataPath.

  3. Set API configuration: In the API configuration, the proxy is the only optional item, and is not required for servers located outside of the country; all other configuration items are mandatory.

  4. Set keyFilePath and prepare key file: Within the keyFilePath, it is mandatory to configure a key.json file. Additionally, if the btcCreator process is enabled, a btc_inscriptions_key.json and a btc_pay_key.json file also needs to be configured. The private key in the btc json file must be in the WIF format and can be exported from the unisat wallet. btc pay key will provide UTXOs to deploy or transfer inscriptions. The format is as follows:

    {
        "address": "***",
        "privKey": "***"
    }
  5. Set other configuration options

Ensure that these configurations are accurately set for proper functionality of the validator components. The number of validator instances to be started should be determined based on the information configured in the contract.

Run with configuration

Multiple instances of the validator can be started with different configurations by creating and using different config files.

Use the following command to start each instance:

./validator --gf.gcfg.file=config1.yaml

This will start the validator with the configuration defined in "config1.yaml". Similarly, you can start another instance with a different configuration using a different "config.yaml" file.

Example of two validators

In this example, we will configure two validator instances using the config.yaml file to enable btcCreator, listener, and verifier components. We will then start a total of six processes for the two validators.

Configuration Details

For each validator, the config.yaml file should be configured to enable the btcCreator, listener, and verifier components as follows:

Validator 1

config1.yaml:
  btcCreator: true
  listener: false
  verifier: false
  dataPath: /path/to/validator1/data
  # Add other configuration options as needed
  
config2.yaml:
  btcCreator: false
  listener: true
  verifier: false
  dataPath: /path/to/validator1/data
  # Add other configuration options as needed
  
config3.yaml:
  btcCreator: false
  listener: false
  verifier: true
  dataPath: /path/to/validator1/data
  # Add other configuration options as needed

Validator 2

config1.yaml:
  btcCreator: false
  listener: true
  verifier: false
  dataPath: /path/to/validator2/data
  # Add other configuration options as needed

config2.yaml:
  btcCreator: false
  listener: false
  verifier: true
  dataPath: /path/to/validator2/data
  # Add other configuration options as needed

Process Execution

To start the two validators and a total of six processes, use the following shell commands:

Validator 1

# Start btcCreator process for validator 1
./validator --gf.gcfg.file=config1.yaml

# Start listener process for validator 1
../validator --gf.gcfg.file=config2.yaml

# Start verifier process for validator 1
./validator --gf.gcfg.file=config3.yaml

Validator 2

# Start listener process for validator 2
./validator --gf.gcfg.file=config1.yaml

# Start verifier process for validator 2
./validator --gf.gcfg.file=config2.yaml

By following this configuration and process execution, you will have a total of two validators running with btcCreator, listener, and verifier components enabled, resulting in a total of six processes.

Last updated