Module agora.api.Validator

Definitions of the validator API

Two kinds of nodes exist: full nodes, and validators. A full node follows the network as a passive actor, but does validation on the data it receives, and can forward that data to other nodes. A validator is a full node which participates in consensus.

An API is used as an interface to communicate with a node. As such, a class that implements API exists (in agora.node.Node), and in order to communicate with other nodes, it holds an API for each of those nodes.

Note that both full node and validator interfaces are named API, as users are expected to use only one of them, not both in combination. A client either deal with a validator because it needs the validator API (only other validators so far), or needs the full node API and don't care about the validators functions, and should not know about them as they also include many more dependencies.

APIs are defined as D interfaces, following what is done in Vibe.d. Those interfaces can be read by a generator to build a client or a server. One such generator is Vibe.d's vibe.web.rest. RestInterfaceClient allows to query a REST API, while registerRestInterface will route queries and deserialize parameters according to the interface's definition.

Another generator which we use for unittests is "LocalRest". It allows to start a node per thread, and uses std.concurrency to do message passing between nodes.

Lastly, we plan to implement a generator which works directly on TCP/IP.

Interfaces

NameDescription
API Define the API a validator exposes to other validators