Smilo Update: Tendermint Consensus

Smilo Cooperative
8 min readMay 5, 2020

What is Tendermint Consensus ?

Tendermint is Consensus created to secure and replicate an application on many machines. Tendermint works even if up to 1/3 of machines fail in arbitrary ways.

The main idea behind adapting this consensus to Smilo is because Tendermint is designed to be easy-to-use, simple-to-understand, it provides high performance, proof of stake, and useful for a wide variety of distributed applications.

Using Tendermint, All non-faulty nodes will effectively seeing the same transaction log and computes the same state.

We are super proud to present our latest release of the Smilo Blockchain Platform: Smilodon Populator — Tendermint Stable v1.9.2.4 (GETH 1.9.2).

This release is shipping with a Stable version of Tendermint Consensus and:

  • Improved test coverage with Integration tests and added some of them to CI as required and some others as not required as they seem to take up to 60 mins to complete and Travis halts on 10m if no output.

Tendermint Unit tests passing

301 Tests for Tendermint packages: crypto, validator, core, backend, config, events

New Tendermint Integration Tests required by CI:

TestTendermintSuccess [pass]
TestTendermintOneMalicious [pass]
TestTendermintSlowConnections [pass]
TestTendermintLongRun [pass]
TestTendermintStopUpToFNodes [pass]

New Tendermint Integration Tests added to CI but unstable and not required by CI:

TestCheckFeeRedirectionAndRedistribution [pass]
TestCheckBlockWithSmallFee [pass]
TestTendermintStartStopSingleNode [pass]
TestTendermintStartStopFNodes [pass] * unstable (Takes up to 20m to complete)
TestTendermintStartStopFPlusOneNodes [pass] * unstable (Takes up to 20m to complete)
TestTendermintStartStopFPlusTwoNodes [pass] * unstable (Takes up to 20m to complete)

  • Fixed MacOS 386 build
  • Added support for Ubuntu focal
  • Updated OSX build on Travis to latest
  • Fixed miner and node start/stop issues
  • Stabilized Tendermint Implementation
  • Fixed issues related to Tendermint Unit tests breaking like: (fix handler.go to avoid closing backend on stop) that was causing Tendermint backlog messages to not be processed when engine is stopped.

As always, Ubuntu users can install it using apt-get via LaunchPad https://launchpad.net/~smilo/+archive/ubuntu/smilo

Installing Smilo mainnet node on Ubuntu Linux

For a brief explanation of Smilo Wallet see Understand the main characteristics of Smilo Wallet in 5 minutes

For a brief explanation of Smilo blockchain see Understand the main characteristics of the Smilo blockchain in 5 minutes

To deploy Smilo with Kubernetes see How to deploy a Blockchain with 7 nodes using Smilo network on Kubernetes in 5 minutes

The Smilo Tendermint consists of two main components:

1 — Consensus engine — aka Core

The Core ensures that the same transactions are recorded on every machine in the same order.

A consensus algorithm is a computer process which helps machines to achieve agreement among systems or distributed processes.
The purpose of a consensus is to aid in achieving reliability and security in a network that has multiple unreliable nodes.

The Tendermint is somewhat easy to understand, it is a mostly asynchronous, BFT consensus protocol. Everything works in Round. A round is a sequence of operations that should happen in sequence. A round change can happen if there is a timeout, if the proposal is said to be invalid by majority of the Validators, or if the block insertion fails. Upon these events, the Validators will enter on the New Round state.

The Tendermint protocol follows a simple state machine; so we created a simple diagram to explain it:

Tendermint Consensus Protocol

The Nodes that are able to create blocks are called Validators.

They take turns proposing blocks of that should contain transactions (On Smilo, Nodes do not create empty blocks) and start voting on them.

The blocks are then committed in a the Blockchain, with one block at each height (eg: Block #1234).

If a block fail to be committed, the protocol will then move to the next round. A new Validator will be selected to propose a block for that height.

In this simple consensus, only Two stages of voting are required to successfully commit a block;

  • Prevote

Prevote is the step where the validators accept or not a new proposed block.

  • Precommit

Precommit is the step where validators collect Precommit messages until it reaches +2/3 of required Precommit messages.

A block is committed when more than 2/3 of validators pre-commit for the same block in the same round.

The following diagram is Tendermint in a (technical) nutshell extracted from Tendermint.com article.

Tendermint in a Nutshel. By tendermint.com

2 — Consensus Smart contracts — POS

Tendermint Smart contracts allow for managing the validator set and also controls who have access to the network. This results in a on-chain governance that enables the consortium responsible for the maintenance of the Blockchain to fully customize the governance mechanism of the network.

This modular architecture, composed by the smart contracts, allows enterprise Blockchain users and consortium of companies to decide and precisely define the governance mechanism through which the validator set is maintained.

The consortium can setup a Governance mechanism, this should then be configured with a number of smart contract interfaces that will consequently allow the consensus mechanism to access the validator set when creating new blocks and validate that each user is doing the right thing in a distributed, transparent and decentralized way. To explain this better, we have divided it in 3 sections:

1. Governance of the network set

The set of validators who create and validate blocks are stored in a smart contract. Validators are identified via their public address.

Addresses not contained in the list should be prevented from creating blocks but should be able to view and submit transactions on the network.

The initial configuration of the list is defined at the genesis file. It should be noted that this list must be non-empty, as only members in the network can vote to add new validators. The size of the list is dynamic. However, the details of the governance processes (e.g. the maximum size of the list) is defined in the smart contract.

2. Modular Governance.

The logic in the smart contract sets the rules to add and remove validators from the white-list. Thus, the user can customize the governance of the member set writing the contract functions which satisfy a defined interface. Examples of variables that can be defined at the contract level are:

  1. The minimum quorum and threshold required to add/remove nodes.
  2. The minimum and maximum size of the white-list.
  3. The voting mechanics to add/remove nodes.

We are currently working on a small demo that will explain it in more detail, stay tuned.

3. POS — Reward Distribution

In Tendermint, not all validators will have the same “voting power”.

The voting power of the network is not measured in numbers, one-third or two-thirds of the validators, but in those proportions of the total voting power. This could be not be uniformly distributed across individual validators, who gets what depends on the Stakeholders and how much tokens they assign for a validator. Whoever is doing a good job, will eventually get more stake, thus more voting power in the network.

The Reward distribution works with a Smart contract called Autonity.sol . This smart contract contains several functions that are important for the POS system of Tendermint. Today I will explain the surface, more details will come in another article.

Add Validator

Add validator to validators list. This function is called when a Validator wants to vote in another Validator, that will be able to participate into the consensus together with the others.

Add Stakeholder

Add a stakeholder address to the stakeholder contract list. This function is used to add a StakeHolder (someone with coins that wants to participate in the consensus)

Add Participant

Add a participant to the participants list

Remove User

Used to remove (Validator, StakeHolder) from the Stakeholder list and Validators list. This is used to remove a Validator or a StakeHolder.

Set Minimum Gas Price

The Autonity Contract implements the setMinimumGasPrice function that is restricted to the Governance Operator account. This will set the minimum Gas price that the network will accept as for means of payment for transactions.

Set Committee Size

Set the maximum size of the commitee, restricted to the Governance Operator account.

Mint Stake

Function capable of creating new stake token and adding it to the recipient balance

Set Commission Rate

Function capable of fixing the caller commission rate for the next bonding period.

Redeem Stake

Decrease unbonded stake

Perform Redistribution

Function used to distribute the balance of the smart contract with the stake holders. There should be at least 1 stakeholder for this to be executed. The reward is distributed as:

uint256 reward = _user.stake.mul(_amount).div(stakeSupply);

Acknowledgements / gr33tz

This amazing work, was a result of many months of unpaid research.
Launched on March 8th, 2019, Smilo is a cryptocurrency focused on making permissioned ledgers obsolete.

We believe that everything that can be done in a permissioned blockchain, should be possible also in a public blockchain.

The Smilo developers want Smilo to be (Open, Public, Border-less, Censorship Resistant and Neutral). Smilo was launched without a premine, ICO, or founders rewards and relies on donations to support the long-term development of the project.

Our unpaid development team have been working hours around the clock to understand, merge, refactor and test existing codebase created and maintained by the Autonity developers. We would like to thank all their developers and team for the hard work and excellent code base, full of tests and that is under active development, we love what you are doing s2.

The official list of go-ethereum Authors, without your individual contributions this would never be possible.

Vitalik Buterin, Thank you for your pure approach to Blockchain. Thank you for truly caring and calling out the greed and the scams. Keep up the good work!

Vitalik does not vouch for Smilo. The picture below is not a endorsement in any ways. I am just a big fan of him, so I placed this picture here to show my enormous gratitude for his efforts in creating Ethereum and this amazing ecosystem.

Photo taken at ETCC 2020 — Paris

Smilo’s development is not motivated by profit for either its developers or early adopters. In order to finance the project and guarantee its future, we invite everyone who sees potential to consider donating/investing/contributing to the project, and we hope that the vibrant cryptocurrency community will help Smilo to achieve its goal of making permissioned ledgers obsolete.

#NO-ICO #ICO-FREE #NOT-AN-ICO

Be part of the Smilo hybrid blockchain movement!

go-ethereum <3

--

--

Smilo Cooperative

The latest generation hybrid blockchain platform DAO Cooperative