AlveyChain Documents
  • Alveychain Docs
  • Get-Started
    • Alveychain
    • Installation
    • Local Setup
    • Cloud Setup
    • Full Node
    • CLI Commands
    • JSON RPC Commands
    • Performance Reports
  • Configuration
    • Manage private keys
    • Set up Hashicorp Vault
    • Enable Prometheus metrics
  • Working-With-Node
    • Query JSON RPC endpoints
    • Query operator information
    • Backup/restore node instance
  • Consensus
    • Proof of Authority (PoA)
    • Proof of Stake
    • Set up and use Proof of Stake (PoS)
    • Migration from PoA to PoS
  • Additional Features
    • Alveycoin bridge
    • Network stress testing
    • Blockscout
  • Architecture
    • Architecture Overview
    • modules
      • Blockchain
      • Consensus
      • JSON RPC
      • Minimal
      • Networking
      • Other modules
      • Protocol
      • Sealer
      • State
      • Storage
      • TxPool
      • Types
  • Concepts
    • State in Ethereum
  • Community
    • Propose a new feature
    • Report an issue
  • Docs
    • Server Config File
    • how-tos
      • How to set up and use Proof of Stake (PoS)
Powered by GitBook
On this page
  • Overview
  • GRPC
  • 📜 Resources
  1. Architecture
  2. modules

Networking

PreviousMinimalNextOther modules

Last updated 2 years ago

Overview

A node has to communicate with other nodes on the network, in order to exchange useful information. To accomplish this task, the alveychain leverages the battle-tested libp2p framework.

The choice to go with libp2p is primarily focused on:

  • Speed - libp2p has a significant performance improvement over devp2p (used in GETH and other clients)

  • Extensibility - it serves as a great foundation for other features of the system

  • Modularity - libp2p is modular by nature, just like the alveychain. This gives greater flexibility, especially when parts of the alveychain need to be swappable

GRPC

On top of libp2p, the alveychain uses the GRPC protocol. Technically, the alveychain uses several GRPC protocols, which will be covered later on.

The GRPC layer helps abstract all the request/reply protocols and simplifies the streaming protocols needed for the alveychain to function.

GRPC relies on Protocol Buffers to define services and message structures. The services and structures are defined in .proto files, which are compiled and are language-agnostic.

Earlier, we mentioned that the alveychain leverages several GRPC protocols. This was done to boost the overall UX for the node operator, something which often lags with clients like GETH and Parity.

The node operator has a better overview of what is going on with the system by calling the GRPC service, instead of sifting through logs to find the information they're looking for.

GRPC for Node Operators

The following section might seem familiar because it was briefly covered in the section.

The GRPC service that is intended to be used by node operators is defined like so:

service System {
    // GetInfo returns info about the client
    rpc GetStatus(google.protobuf.Empty) returns (ServerStatus);

    // PeersAdd adds a new peer
    rpc PeersAdd(PeersAddRequest) returns (google.protobuf.Empty);

    // PeersList returns the list of peers
    rpc PeersList(google.protobuf.Empty) returns (PeersListResponse);

    // PeersInfo returns the info of a peer
    rpc PeersStatus(PeersStatusRequest) returns (Peer);

    // Subscribe subscribes to blockchain events
    rpc Subscribe(google.protobuf.Empty) returns (stream BlockchainEvent);
}

:::tip The CLI commands actually call the implementations of these service methods.

These methods are implemented in minimal/system_service.go. :::

GRPC for Other Nodes

📜 Resources

The alveychain also implements several service methods that are used by other nodes on the network. The mentioned service is described in the section.

CLI Commands
Protocol
Protocol Buffers
libp2p
gRPC