GithubHelp home page GithubHelp logo

sig-0 / go-ibft Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 751 KB

A minimal and compact IBFT 2.0 engine implementation, written in Go. Maintained by the original authors

Home Page: https://docs.madz-lab.com/go-ibft

License: Apache License 2.0

Makefile 0.21% Go 99.79%
consensus distributed go ibft ibft2 protocol

go-ibft's Introduction

Overview

go-ibft is a simple, straightforward, IBFT state machine implementation.

It doesn't contain fancy synchronization logic, or any kind of transaction execution layer. Instead, go-ibft is designed from the ground up to respect and adhere to the IBFT 2.0 specification document.

Inside this package, you’ll find that it solves the underlying liveness and persistence issues of the original IBFT specification, as well as that it contains a plethora of optimizations that make it faster and more lightweight. For a complete specification overview on the package, you can check out the official documentation.

As mentioned before, go-ibft implements basic IBFT 2.0 state machine logic, meaning it doesn’t have any kind of transaction execution or block building mechanics. That responsibility is left to the Backend implementation.

Installation

To get up and running with the go-ibft package, you can pull it into your project using:

go get github.com/sig-0/go-ibft

Currently, the minimum required go version is go 1.19.

Usage Examples

package main

import "github.com/sig-0/go-ibft"

// IBFTBackend is the structure that implements all required
// go-ibft Backend interfaces
type IBFTBackend struct {
	// ...
}

// IBFTLogger is the structure that implements all required
// go-ibft Logger interface
type IBFTLogger struct {
	// ...
}

// IBFTTransport is the structure that implements all required
// go-ibft Transport interface
type IBFTTransport struct {
	// ...
}

// ...

func main() {
	backend := NewIBFTBackned(...)
	logger := NewIBFTLogger(...)
	transport := NewIBFTTransport(...)

	ibft := NewIBFT(logger, backend, transport)

	blockHeight := uint64(1)
	ctx, cancelFn := context.WithCancel(context.Background())

	go func() {
		// Run the consensus sequence for the block height.
		// When the method returns, that means that
		// consensus was reached
		i := RunSequence(ctx, blockHeight)
	}

	// ...

	// Stop the sequence by cancelling the context
	cancelFn()
}

go-ibft's People

Contributors

zivkovicmilos avatar dependabot[bot] avatar dbrajovic avatar zeljkobenovic avatar kourin1996 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.