Nyzo techRelease notesNyzo 523: Nyzo client

Nyzo 523: Nyzo client

Nyzo version 523 (commit on GitHub) introduces the Nyzo client.

This version affects the client, verifier, and sentinel. The changes to the verifier and the sentinel are inconsequential side effects of changes made in the implementation of the client.

Please realize that this is a minimal version of the client. It does not yet allow sending of transactions. Its tracking of the blockchain is limited and does not yet include any attempt to establish a full history of the blockchain. These limitations will be addressed in future versions.

In ChainInitializationManager, the bootstrapResponses map has been changed to the concurrent version.

RN_523 code 0

Three of the methods used on the initialization process have been narrowed in visibility from public to private. Synchronization has also been removed from one of them; it is no longer necessary due to use of the concurrent hash map. The initialization process that was previously in the Verifier has been encapsulated in the initializeFrozenEdge() method. This was done to allow both the client and verifier to access this code, and it is what allowed narrowing of the visibility of the other methods.

RN_523 code 1

In Message, the fetchFromRandomNode() method has been refactored to allow different behavior in the sentinel and client. This is useful because they each use their own method of tracking which nodes are in the mesh.

RN_523 code 2

In MessageQueue, the log statement has been changed to use the new LogUtil class.

RN_523 code 3

The RunMode enumeration tracks whether the code is running as verifier, sentinel, or client. This is currently used only in the LogUtil class and in the Message.fetchFromRandomNode() method, but it will likely be useful in other places in future versions.

RN_523 code 4

In Verifier, the run mode is set just before the start() method is called. The main() method of the Verifier class is the default entry point of the jar file. This is why the run mode is not set at the top of the main() method as it is in the sentinel and client.

RN_523 code 5

The frozen-edge initialization code that was moved to the ChainInitializationManager class is now accessed through the appropriate method call.

RN_523 code 6

Visibility of the getTrustedEntryPoints() method has been changed to allow access from ClientDataManager.

RN_523 code 7

The client is a simple interactive console application. The program loop asks for which command to run and then collects the necessary arguments and dispatches them to the appropriate command handler. As more functionality is added to the client, it will be encapsulated in separate command handlers for each task.

RN_523 code 8

The ClientDataManager tracks the mesh and blockchain for the client. Use of a democratic process for the Genesis block in addition to the frozen edge means that the client should be able to connect, without modifications, to any Nyzo-based blockchain.

RN_523 code 9

The ClientNodeManager manages mesh information for the client. The verifier, sentinel, and client all need different node managers because they all have different relationships with the mesh. The verifier is an active participant in the mesh. Neither the sentinel nor the client are participants in the mesh, so they must rely on verifiers for mesh information. The sentinel has a fully-trusted relationship with all the verifiers it queries for mesh information, but the client does not.

RN_523 code 10

The Command enumeration is a wrapper for the command handlers. Currently, only four commands are included, and three of those are system commands (i.e., not actual tasks). The only useful command in this version is balance. In the lines commented out, you can see some of the other commands currently in development.

RN_523 code 11

The ConsoleColor enumeration provides simple ANSI console coloring. This is disabled by default, as non-ANSI consoles display erroneous characters for ANSI color commands. To enable this functionality, place the line enable_console_color=1 in /var/lib/nyzo/production/preferences.

RN_523 code 12

The ConsoleUtil class provides a simple mechanism for printing tables of data.

RN_523 code 13

The BalanceDisplayCommandHandler displays the balances of accounts with a specified prefix at the current local frozen edge. This is the only command handler of utility in this version of the client.

RN_523 code 14

The CommandHandler interface will be used for all the commands in the client. Separation of the argument names from execution of the handler will allow different interfaces, including a web interface, to share the same command handler.

RN_523 code 15

The EmptyCommandHandler prints the available commands if no command is provided.

RN_523 code 16

The ExitCommandHandler terminates the client.

RN_523 code 17

The InvalidCommandHandler is similar to the EmptyCommandHandler, but it also provides feedback that an invalid command was provided.

RN_523 code 18

The sentinel, like the client, sets the run mode at the top of the main() method.

RN_523 code 19

The sentinel block-with-votes fallback now uses the run-mode-aware Message.fetchFromRandomNode() method.

RN_523 code 20

The randomNode() method has been changed to public visibility to allow access from the Message class.

RN_523 code 21

The LogUtil class suppresses console output for messages in the client run mode. Like some other classes introduced in this version, this class is little more than a placeholder for planned future functionality.

RN_523 code 22

PreferencesUtil has a new getBoolean() method. This method is used by ConsoleColor to activate the color codes.

RN_523 code 23

To use the client, follow the installation instructions for the verifier. Then, run the following command from the nyzoVerifier directory:

sudo java -jar build/libs/nyzoVerifier-1.0.jar co.nyzo.verifier.client.Client