Download and Build

1.  Download the source codes using the following command. dsc-guard will appear in the current folder

`git clone [email protected]:decimalteam/dsc-guard.git

2.    Alternately go to dc-guard/cmd/desc-guard and dsc-guard/cmd/gentx and assemble the guard and the transaction generator with the `go build` command.


Configuring the Transaction Generator

To generate set-offline transaction, next to the gentx place the file binary .env file with the following content:


DECIMAL_GATEWAY is necessary to generate the correct transaction, MNEMONIC is the mnemonic of the account that created the node.


For testnet:



The `./gentx` command will output the prepared transaction in hexadecimal.


Configuring the guard

Next to the dsc-guard binary file, you need to place the .env file with the following content:

``` NODES_ENDPOINTS=tcp://localhost:26657,tcp://abcd:26657 MISSED_BLOCKS_LIMIT=8 MISSED_BLOCKS_WINDOW=24 FALLBACK_PAUSE=2 NEW_BLOCK_TIMEOUT=10 VALIDATOR_ADDRESS=FBAFF7A1BB2C4E72DF924FAF5F23F11DEFF5C70B HTTP_LISTENER=localhost:11111 SET_OFFLINE_TX=0a5b0a590a232f646563696d616c2e76616c696461746f722e76312e4d73675365744f66666c696e6512320a30647876616c6f70657231787036617161643439746537767366676136737472386872646568323472396a30356d736363125d0a590a4f0a282f65746865726d696e742e63727970746f2e76312e657468736563703235366b312e5075624b657912230a2103448e6b3d50d6a39cab3babaa4aa2b0885f556fe05d7149885a05a0e7940a7e4f12040a020801180d12001a4122264e07b59dd0739a289587ae8b7bf4103dec6ddb7a87e5bf51f98e3e6415937f594bf66cbf5ab8b0284d0d1d5cf99810ff5ca01484237e7e491c43361b886200 ```

NODES_ENDPOINTS - comma-separated list of nodes in the DSC blockchain with open tendermint ports (26657)

MISSED_BLOCKS_LIM IT and MISSED_BLOCKS_WINDOW - upon reaching how many missed blocks MISSED_BLOCKS_LIMIT in a window of size MISSED_BLOCKS_WINDOW, a set-offline transaction should be sent

FALLBACK_PAUSE - time to reconnect to nodes in seconds

NEW_BLOCK_TIMEOUT - time to wait for a new block in seconds

VALIDATOR_ADDRESS - tendermint address of the validator, taken from priv_validator_key.json, field "address "

SET_OFFLINE_TX - hex representation of the set-offline transaction, should be the result of running `gentx`

HTTP_LISTENER - optional. If set as host:port, then JSON is issued at this address according to the status of the guard




The guard connects to the nodes, monitors the signatures of the specified validator, and counts the missed blocks.

Every 5 blocks, the guard checks the transaction for validity through nodes known to him. If the transaction is incorrect - generated for a different chain id, with an old nonce, then the guard will report an error.