This deployer is capable is starting an entire blockchain. To do so you must specify the network's topology and nodes' role in a file. Please pay attension to the Remarks at the end of next section.
The best way to define the topology and the roles is to duplicate the parentDir/CudosBuilders/tools-nodejs/deployer-network/config/topology.json.example
and rename it to topology.json
.
topology.json
is a json file has the following structure:
{
"computers": Computer[], // Defines each computer where a node will be deployed.
"nodes": Node[], // Defines the topology of the network.
"params": Params, // Global params used by nodes.
}
Computer object:
Each computer defined in the topology.json
is accessed by a username. This user should be able to execute sudo commands without asking for a password, e.g. it should be in sudoer group. More information can be found here
{
"id": string, // The id of the computer. It is used as a unique identifier of the machine.
"ip": string, // The IP of the computer or "auto". If set to "auto" then a local docker instance will be created.
"port": number, // The SSH service port. Usually it is 22.
"user": string, // The SSH service user. It is optional if "ip" is "auto".
"sshKey": string, // Optional - Absolute path of the sshKey if available
"pass": string // The password of the sshKey or user. It can be empty string.
}
Node object:
{
"rootValidator": Validator, // Defines the root validator, e.g. the one that starts the network.
"validators": Validator[], // Defines the validatora other than the root one.
"seeds": Seed[], // Defines the seed nodes and how they are attached to validators.
"sentries": Sentry[], // Defines the sentry nodes and how they are attached to validators.
}
Validator object:
{
"computerId": string, // The id of the computer where this node will run.
"validatorId": string, // The id of the current validator. It is used as a unique identifier of the validator.
"orchEthAddress": string, // The address of a ethereum wallet starting with 0x. (1)
"ethPrivKey": string // The private key of the "orchEthAddress". (1)
}
Seed object:
{
"computerId": string, // The id of the computer where this node will run.
"validatorId": string, // The id of the current validator where this seed will be attached to.
}
Sentry object:
{
"computerId": string, // The id of the computer where this node will run.
"validatorId": string, // The id of the current validator where this sentry will be attached to.
}
Params object:
{
"gravity": ParamsGravity // Defines gravity parameters
}
ParamsGravity object:
{
"ethrpc": string, // Ethereum full node endpoint. (1)
"contractDeploerEthPrivKey": string // Hex-formated private key of a ethereum wallet. It will be used for the gravity contract deployment. (1)
"etherscanApiKey": string // Etherscan API Key
}
(1) It can be empty if the chain is started without gravity module or if this validator is not the root-validator.
Remarks:
- Each computer instance can be used only by a single node.
- The network should have at least rootValidator.
- Each validator must have at least one seed and one sentry.
- You must either use only local docker instances (with "ip": "auto") or only remote machines (with "ip": "")
network
- starts the network using the topology defined in parentDir/CudosBuilders/tools-nodejs/deployer-network/config/topology.json
. It has 4 parameters:
- topology: A relative path to topology.json based on tools folder.
- gravity: 0 (disables the module) or 1 (enabled the module)
- docker-source: remote (downloads the source code from the github) or local (uses local version of the source code)
The parameters are passed in the following way:
npm run network -- --topology ./deployer-network/config/topology.json --gravity 1 --docker-source local