Deep Dive into the Lition Protocol

The Lition whitepaper has already outlined our PoS protocol but now it’s time to explain and describe in greater detail how the protocol between the Ethereum public chain and Lition sidechains works.

Important to note upfront is that Lition sidechains and the Ethereum public chain share the same private/public keys and addressing schemes since Lition is a layer 2 scaling solution on top of Ethereum. This way, one can use the same identity (account name) and private keys on both chains. This is quite advantageous for us as it allows for:

  • Straight-forward mapping of sidechain and public chain accounts
  • Simplified wallets and client’s logic
  • Simplified dApp design and cross-chain dApp functionality

Sidechain Registration

Sidechain registrations is managed by a smart contract on the Ethereum public chain. The registration data of a new side chain includes, amongst other data, the seed nodes addresses and initial mining accounts. By doing so, we enable potential users to easily find and join the side chain networks.

The sidechain creator can also select a specific whitelist/blacklist and/or other criteria that miners will have to fulfill, which allows for a customized creation of fully private, semi-private or fully public sidechains. In order to do so, the sidechain creator must vest a deposit for initial miners and pay the fee.

Miner Registration

Every miner interested in validating one specific sidechain has to vest a deposit in LIT tokens into the notary contract onto the Ethereum public chain. To avoid manipulation, the right to mine will be granted only at the beginning of the following notary window and after the vesting transaction has been confirmed in the public chain. The rights will be valid for the entire duration of the notary window. During the registration the eligibility criteria specified for the “Sidechain Registration” are checked.

Each vesting is associated only with one sidechain. In order to mine multiple sidechains, one has to stake for each of them.

The vested deposits can be released by calling the Ethereum public chain smart contract and they will be freed 168 hours (one week) after the end of the current notary window. As a result, the identities of the miners, together with their stakes, will be publicly known.

User Registration

In order to make transactions on the Lition sidechain, the user has to deposit a number of LIT tokens in the Ethereum public chain in order to cover the gas costs that are associated with the sidechain usage. The LIT tokens are discounted from the deposit when mining reward is being distributed — see below.

Pluggable Sidechain Consensus

Miners are required to use the same addresses and private keys as those they have for the Ethereum public chain, since all the nodes participating in the sidechain will have to check the validity of miners based on the list of miners present in the smart contract on the Ethereum public chain. The result is a Proof-of Authority-like sidechain, in which the authorized nodes are the ones properly registered.

The actual consensus is pluggable, and the algorithms considered are BFT, RAFT, POS and LitionPOA or weighted LPOA. LPOA for example splits the blocks to be mined into mining windows of length m, then it shuffles the list of miners using pseudo-random algorithm and returns to each miner one individual slot based on the generated order (i.e. the first miner in the shuffled list will mine the first block in the window, the second miner the second block etc.). The blocks are then generated in fixed time slots, e.g. every 3 seconds.

Weighted LPOA, on the other hand, adds stake into the pseudo-random equation, making it more probable for miners with higher stake to get a slot. Every consensus protocol has its pros and cons, e.g. BFT-like mechanism is more suitable for private nets. The sidechain creator has to carefully select the right one for the given use case.

Notary Window

After every n block, where n is configurable at sidechain creation, the sidechain status and statistics are recorded into Ethereum public net smart contract. This can be done by writing a report of the registered miner whose block time matches the end of the notary window. The report shall contain also previous blocks information in order to make sure that the block composing the chain has been signed by miners holding together at least 66% of the total stake.

For example, 7 miners are registered with the following stakes: 100, 80, 150, 200, 200, 170 and 100 LIT tokens for a total of 1000 LIT. In this case, the supermajority amounts to 660 LIT tokens. Now, if the recent block history were to be: M1 -> M2 -> M3 -> M4 -> M5 -> M6 -> M7, then the last 4 block headers will need to be included (as their collective stake amounts represent the supermajority).

If the condition of supermajority cannot be achieved, the sidechain struggles to get consensus among miners and therefore cannot be considered final. Should this be the case, the selected miner will just report “supermajority not achieved”.

In case supermajority is achieved, the next report shall then contain both (or more) notary windows. The statics reported have to include the activity of all miners and the gas usage of all users. In case a miner failed to transfer the report to the Ethereum public chain, it will be included in the following report, however, the miner who had such oversight will not receive the mining reward. If a miner provided incorrect information in the statistics, the other miners can express their complaints through smart contracts. If the majority of miners report this mistake, the miner will lose part of his stake as a fine.

Combination of pluggable consensus inside the sidechain and notary contract in the Ethereum public chain form a Lition Proof of Stake consensus algorithm.

Mining Rewards

The gas consumed by the users in the given notary window, as per reported statistics, is distributed to the miners proportionally to the weight given by the following formula:

Wi = Si * max(0, Ei*0.7 — Ai)

where Wi is the weight of miner i, Si is the stake of miner i, Ei is the expected activity (number of blocks to be confirmed) by miner i and Ai is the actual activity by miner i. This ensures that the reward is granted only to the miners that are actively supporting the Lition sidechain. Also, using Ei and Ai variables keeps the mechanism independent from the actual consensus mechanism in the Lition sidechain.

The gas consumed is calculated based on the amount of transactions processed and the LIT price information (from oraculum), so that cost of one transaction does not exceed 0.01 USD. For example, if the statistics report that 100.000.000 gas was consumed, the highest transaction cost was 200.000 and current LIT price is 0.1 USD/LIT, then the total gas cost is determined as:

(100.000.000 / 200.000) * (0.01 USD / 0.1 USD/LIT) = 50 LIT

The per user gas cost is then calculated proportionally.