Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Multi Node P2P and POA #1332

Open
piux2 opened this issue Nov 4, 2023 · 0 comments
Open

Feature: Multi Node P2P and POA #1332

piux2 opened this issue Nov 4, 2023 · 0 comments
Assignees

Comments

@piux2
Copy link
Contributor

piux2 commented Nov 4, 2023

Problem Definition

Running multi-node p2p sync and POA (Proof of Authority) is critical for gno.land to operate as a blockchain node in a network.

Currently, gno.land is an in-process Cosmos application with a Tendermint node operating as the consensus engine. By default, it cannot sync with other nodes. For other nodes to sync their state with another node, we rely on the txsync cmd to export and import transactions from other nodes through RPC calls.

Current setup works well when running it as a development and testing node. Moving forward, we need simple tools and instructions for running nodes in p2p mode with POA (proof of authority) enabled when connecting to a production blockchain network.

We want to overcome several limitations to set up a multi-node network in POA.

  • The default node runs a customized state pruning strategy, retaining only the last 100 blocks and the state of every 1000th block.
  • There are no seed nodes or persistent nodes published, preventing the establishment of secure p2p connections.
  • There's a lack of commands to maintain configuration consistency during the refresh syncing process.
  • Ideally, every archive node should be able to index transactions without requiring external tools for syncing with other nodes.
  • Clear instructions for setting up a proof of authority (POA) network are missing.

Solution

To address these issues, we added the following commands and documentation: It allows us to run a multi-node network, synchronized through p2p, with POA established from the genesis state.

  • Added an option to start as a archive node.
  • Initiate, generate configs, stores, private keys before starting the chain.
  • Allow to overwrite the default PruneStrategy to nothing, keeping all historical blocks and states in the archive nodes. The current default value is a customized sync, retaining only the last 100 blocks and every 1000th block.
  • Command to retrieve Node ID. Set up a persistent peer node in the configuration. Configure a persistent peer node.
  • Command to retrieve the validator info, which can be included in genesis file to exstable the POA from genesis state.
  • Implemented soft sync: remove the state, and a validator node tries to resync the node. This approach reduced the risk of double-signing and chain fork when it syncs back the block that it signed before.
  • Documentation on starting a network and resetting a network. gno.land/cmd/gnoland/README.md

Running POA

  • Achieving POA through fixed POS voting power.
  • Added a Validator Structure in the genesis, with voting power > 0.
  • Shared the Genesis file among pre-approved validators.

With these configurations, we should be able to run multiple nodes with p2p sync enabled, along with a preliminary static POA setup.

Future Work

For further enhancement of the main test network, we might need to:

  1. Export genesis states based on height so that we can rollback to a specific height during upgrades or rollbacks.
  2. Manage government and system contracts from genesis with multisig.
  3. Sign and verify genesis signatures.
  4. Implement dynamic POA by adding validators from the chain gov contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant