An open API service indexing awesome lists of open source software.

https://github.com/skalenetwork/skale-consensus

If you like this project, please ⭐ it on GitHub!!Running the very core of SKL network, SKALE BFT consensus is universal, modern, modular, high-performance, asynchronous, provably-secure, agent-based Proof-of-Stake blockchain consensus engine in C++ 17. Includes provably secure embedded Oracle. Used by SKALE elastic blockchains.
https://github.com/skalenetwork/skale-consensus

asynchronous bft consensus consistency cpp cryptography distributed-systems skale-network

Last synced: 5 months ago
JSON representation

If you like this project, please ⭐ it on GitHub!!Running the very core of SKL network, SKALE BFT consensus is universal, modern, modular, high-performance, asynchronous, provably-secure, agent-based Proof-of-Stake blockchain consensus engine in C++ 17. Includes provably secure embedded Oracle. Used by SKALE elastic blockchains.

Awesome Lists containing this project

README

          

# SKALE Consensus: a Blockchain Consensus engine in C++

[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)
![Build and test skale-consensus](https://github.com/skalenetwork/skale-consensus/workflows/Build%20and%20test%20skale-consensus/badge.svg)

**SKALE Consensus** is an ultra-high-performance blockchain consensus engine written in C++.

## Key Features of SKALE Consensus

- **Over 10,000 TPS**
- **Byzantine fault tolerant** — no block gaps, and stable performance even with up to 1/3 of nodes offline
- **Provably secure**
- **Forkless**
- **Single-block finality** — blocks are immediately finalized upon commitment
- **Resilient to arbitrarily long network disruptions and delays** through an asynchronous network model
- **Multiple block proposers per block** — ensures protocol stability even when some proposers are offline
- **Secure against MEV and front-running** — provably resistant to manipulation

Read the spec for more exciting features [https://docs.skale.network/technology/consensus-spec ](https://github.com/skalenetwork/skale-consensus/blob/develop/docs/consensus-spec.md)

See visualization of live conseneus https://www.youtube.com/watch?v=0NGCSRjjPkk

## Building from Source

The preferred build and execution environment is **Ubuntu 22.04**.

Later versions of Ubuntu may work, but they are not officially tested.

### 1. Install packages

```bash
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -yq libprocps-dev gcc-11 g++-11 valgrind gawk sed libffi-dev ccache \
libgoogle-perftools-dev yasm texinfo autotools-dev automake \
python3 python3-pip cmake libtool build-essential pkg-config autoconf wget \
git libargtable2-dev libmicrohttpd-dev libhiredis-dev redis-server openssl \
libssl-dev doxygen libgcrypt20-dev
```

### 2. Clone the repo

```bash
git clone --recurse-submodules https://github.com/skalenetwork/skale-consensus.git
```

### 3. Build dependencies in debug mode
```bash
cd skale-consensus/deps && ./build.sh DEBUG=1
```

### 4. Configure the CMake build in Debug M ode.

```
cd .. && cmake . -Bbuild -DCMAKE_BUILD_TYPE=Debug
```

### 5. Build All Targets Using All Available CPU Code

```
cmake --build build -- -j$(nproc)
```

---

## Testing

SKALE Consensus includes comprehensive test suites covering unit tests, integration tests, and end-to-end scenarios.

### Quick Test Run

After building, you can run a basic test:

```bash
cd test/onenode
sudo NO_ULIMIT_CHECK=1 TEST_TIME_S=60 TEST_TRANSACTIONS_PER_BLOCK=10 ../../build/consensust [consensus-basic]
```

### Running Specific Tests

Tests are organized with a multi-dimensional tagging system:

```bash
# Run RLP unit tests that only test correctness (ignores safety and performance tests)
./build/consensust [rlp][unit][correctness]

# Run all crypto tests
./build/consensust [crypto]

# Run performance tests
./build/consensust [performance]
```

### Multi-Node Testing

For more detailed testing scenarios, including 4-node and 16-node tests with SGX simulation, see our comprehensive **[Testing Guide](TESTING.md)**.

The testing guide covers:
- Detailed test organization and tagging
- SGX simulation setup with Docker
- Performance testing procedures

## Contributing

**If you have any questions please ask our development community on [Discord](https://discord.gg/vvUtWJB).**

[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)

## License

[![License](https://img.shields.io/github/license/skalenetwork/skale-consensus.svg)](LICENSE)

Copyright (C) 2018-present SKALE Labs