Skip to main content

Loopchain Fault Tolerance

Project description

LFT2

Unittest IntegrationTest

LFT2 is a new consensus algorithm inspired by PBFT. It improves TPS with reducing a pair of votes compared to PBFT when nodes make a consensus. A concept, 'Candidate' has been introduced for keeping safety.

This is implemented as a library. So not only blockchain but also any application which requires a byzantine fault tolerance consensus algorithm can integrate it.

This contains an example application for easy understanding. You can run it without integration. Also it composes multiple nodes in this single app. You can simulate byzantine node actions and observe how it tolerates the actions.

The paper of LFT2 will be released soon.

Example Application

You can run example app using this command.

$ lft

This command runs 4 nodes. They make data as results of consensus. If you want to run it with 10 nodes then run this command below.

$ lft -n 10

You can see a lot of event logs.

16:18:34,085 0xd32b RoundEndEvent(is_success=True,epoch_num=1,round_num=1,candidate_id=0xd4ad,commit_id=0x6765)

Event log consists of time, node id and event. This log means round 1 ends successfully with deciding a new candidate. Each round makes a consensus to determine one candidate. A candidate is committed after when next new candidate connected to the candidate is decided. In this case 0xd4ad is connected to 0x6765. 0x6765 has already been decided in previous round.

Replay

$ lft record

It records event logs for replaying. The log path is ./data. It contains all nodes' events.

$ lft replay -t 1abde1d6c2eb942df4686116d64f889d

The argument 1abde1d6c2eb942df4686116d64f889d is one of nodes' id located in log path after running with recording command.

Integration

Some components are provided for integration. Applications which want to use LFT have to customize abstract classes.

Data(Block), DataFactory(BlockFactory), Vote, VoteFactory, Epoch

The applications have to post the event.

RoundStart

The applications must listen the events.

RoundEnd, BroadcastData, BroadcastVote, ReceiveData, ReceiveVote

Note that LFT2 is not responsible for node communication, storing blocks and executing transactions. So the applications must implement them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

LFT-0.1.0.tar.gz (22.6 kB view hashes)

Uploaded Source

Built Distribution

LFT-0.1.0-py3-none-any.whl (40.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page