Git Product home page Git Product logo

skalenetwork / skale-consensus Goto Github PK

View Code? Open in Web Editor NEW
78.0 12.0 31.0 29.06 MB

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. Easy and flexible enough to implement your own blockchain or smart contract platform. BLS signatures and Binary Asynchronous Consensus are main building blocks.

Home Page: https://docs.skale.network/technology/consensus-spec

License: GNU Affero General Public License v3.0

C++ 58.11% CMake 13.99% Makefile 6.70% C 20.58% Python 0.25% Dockerfile 0.05% Shell 0.08% Solidity 0.19% JavaScript 0.06%
bft consensus cryptography asynchronous cpp distributed-systems consistency skale-network

skale-consensus's Introduction

SKALE Consensus: a BFT Consensus engine in C++

Discord Build and test skale-consensus

Skale-consensus is an implementation of SKALE provable consensus spec as described here https://docs.skale.network/technology/consensus-spec

Key features of of SKALE consensus

  • provably secure
  • forkless
  • single block finality - blocks become immediately finalized once committed.
  • survives under arbitrarily long network distruptions and delays by implementing asynchronous network model
  • multiple block proposers per block provide protocol stability even if some block proposers are down

Read the spec for more exciting features.

The consensus is under active improvement and research.

Installation Requirements

SKALE consensus has been built and tested on Ubuntu 18.04 and later.

The preferred build and execution environment is currenty Ubuntu 22.04.

Ensure that the required packages are installed by executing:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -yq libprocps-dev gcc-9 g++-9 valgrind gawk sed libffi-dev ccache \
    libgoogle-perftools-dev flex bison 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

Building from source on Ubuntu (Development)

Steps to build from source:

# clone repo
git clone --recurse-submodules https://github.com/skalenetwork/skale-consensus.git
# build dependencies
cd scripts && ./build_deps.sh 
 # Configure the Cmake build.
cd .. && cmake . -Bbuild
# now run hunter bug workaround
mkdir -p "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/ && wget -O "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/hunter-1.0.5.tar.gz https://github.com/hunter-packages/crc32c/archive/refs/tags/hunter-1.0.5.tar.gz
#  now build all targets using all available CPU cores
cmake --build build -- -j$(nproc) 

Running tests

Navigate to the testing directories and run ./consensusd .

Libraries

An important note about production readiness:

The SKALE consensus is still in active development and contains bugs. This software should be regarded as alpha software. Development is still subject to competing the specification, security hardening, further testing, and breaking changes. This consensus engine has not yet been reviewed or audited for security. Please see SECURITY.md for reporting policies.

Contributing

If you have any questions please ask our development community on Discord.

Discord

License

License

Copyright (C) 2018-present SKALE Labs

skale-consensus's People

Contributors

cstrangedk avatar dimalit avatar dimastebaev avatar dmytronazarenko avatar gannakulikova avatar kladkogex avatar olehnikolaiev avatar sergiy-skalelabs avatar skale-jace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skale-consensus's Issues

[SKALE-161] Stabilize consensus

1. Fix memory leaks
2. Run in Valgrind to fix memory corruptions.
3. Remove all unsafe memory accessesl
4. Fix all major compiler warnings

[SKALE-115] Implement key-value reduce extensions to EVM

The reduce chain should perform key-value reduce operation similar to Hadoop/Spark

https://www.safaribooksonline.com/library/view/learning-spark/9781449359034/ch04.html

Key-value reduce is needed to perform aggregation of payments or other operations performed in different Map chains in Map-Reduce atchitecture. Normally key is the payee and value is the amound paid

The result of map reduce performed for a particular reduce block shall be available as input to Map smart contracts for the next block

Example:

Each user maintains a payee account with a key on each Map subchain, and a payor account with the same key on a particular subchain.

Payee accounts are used to acumulate accepted payments, and payor accounts are used to pay.

After the Map phase a smart contract on each subchain produces a set of payee - amount key/value pairs that it wants to aggregated. The pairs are passed to the reduce phase and aggregated by key. This means that payments made to the same user on different subchains are aggregated. After that the aggregated payment message is send to the subchain where the corresponding user payor account is maintained, and the payor account is credited.

In this way payments can be scaled to millions of users.

To implement this we need key/value aggregation \(adding up values by key\) performed during the reduce phase and then
message send operation that sends aggregated value to the subchain where the corresponding payor account is stored.

[SKALE-808] Make it possible to create several instances of ConsensusEngine

It is not possible to create several instances of ConsensusEngine because all of them use the same global variables. It makes difficulties for testing and is the cause of ConsensusTests unit test suite does not work.
We want to make it possible to run several instances to test their communication in scope of one process.

[SKALE-746] s-chain failure: ...[config] [info] Char*, ErrorHandler&&) ...

Just checked this server that D1 spun up just 12 hrs ago, and noticed that it crashed. see comments for log files. Note this new error:

\[2019-02-04 04:54:57.595\] \[config\] \[info\] Char\*, ErrorHandler&&\) \[with Char = char; ErrorHandler = fmt::v5::internal::id*adapter<fmt::v5::format*handler<fmt::v5::arg*formatter<fmt::v5::back*insert*range<fmt::v5::internal::basic*buffer<char> > >, char,
                fmt::v5::basic*format*context<std::back*insert*iterator<fmt::v5::internal::basic\_buffer<char> >, char> >&, char>&\]

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.