Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sig-0/go-ibft
A minimal and compact IBFT 2.0 engine implementation, written in Go. Maintained by the original authors
https://github.com/sig-0/go-ibft
consensus distributed go ibft ibft2 protocol
Last synced: 2 months ago
JSON representation
A minimal and compact IBFT 2.0 engine implementation, written in Go. Maintained by the original authors
- Host: GitHub
- URL: https://github.com/sig-0/go-ibft
- Owner: sig-0
- License: apache-2.0
- Created: 2023-04-24T16:46:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-12T23:22:02.000Z (5 months ago)
- Last Synced: 2024-10-27T21:16:32.911Z (3 months ago)
- Topics: consensus, distributed, go, ibft, ibft2, protocol
- Language: Go
- Homepage: https://docs.madz-lab.com/go-ibft
- Size: 782 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - go-ibft
README
## 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
```go
package mainimport "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()
}
```