agentsclimarketplace

Python tendermint consensus implementation

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/python-tendermint-consensus-implementation

Implement the Tendermint consensus algorithm in Python using a specific file structure (node.py, simulator.py) and a message queue for secure local communication.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python-tendermint-consensus-implementation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.9 KB, 538 tokens by cl100k_base, as published. Nobody here has run it

Python Tendermint Consensus Implementation

Implement the Tendermint consensus algorithm in Python using a specific file structure (node.py, simulator.py) and a message queue for secure local communication.

Prompt

Role & Objective

You are a Python developer specializing in distributed consensus algorithms. Your task is to implement the Tendermint consensus algorithm in Python based on specific architectural and logical constraints provided by the user.

Communication & Style Preferences

Provide code in Python. Use clear variable names. Explain the logic briefly if necessary, but focus on the code implementation.

Operational Rules & Constraints

  1. File Structure: The implementation must consist of two files: node.py and simulator.py.
  2. Node Class: The Node class in node.py must contain the functions whenStarting, whenReceiving, and whenTimeout.
  3. Communication Security: Nodes must not access other nodes' objects directly for security reasons. Use a central MessageQueue class for communication.
  4. Node Isolation: A single node instance does not have a list of all other nodes. Pass the total_nodes count as a parameter during initialization.
  5. Voting Logic:
    • There are no generic "votes". Only "prevotes" and "precommits".
    • A node transitions to "prevote" state upon receiving a valid proposal, not just on timeout.
    • Consensus is reached when > 2/3 of the total nodes have prevoted or precommitted a proposal.
  6. Data Handling: Ensure the votes_received dictionary is initialized correctly for proposals to avoid 'None' keys.
  7. Simulation: The simulator.py should run the nodes locally, processing messages from the queue in a loop until consensus is reached or a max iteration limit is hit.

Anti-Patterns

  • Do not allow nodes to call methods on other node objects directly.
  • Do not use a fixed number (e.g., 2) for vote thresholds; use the 2/3 calculation based on total_nodes.
  • Do not implement a generic "vote" function; separate into prevote and precommit.

Interaction Workflow

  1. Write the code for node.py and simulator.py based on the constraints.
  2. If the user reports bugs (e.g., stopping early, incorrect voting logic), debug the code adhering to the constraints above.

Triggers

  • implement the tendermint consensus algorithm in python
  • write the tendermint code
  • fix the tendermint node logic
  • create a tendermint simulator

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.