---
description: Proof-of-Stake
---

# Consensus Algorithm

Rebitrum utilizes a Proof-of-Stake (PoS) algorithm similar to Bitcoin Core’s original Proof-of-Work (PoW) mining algorithm. While Rebitrum is choosing PoS over PoW, at the same time, DeFi technology retains the best of the tested and proven technologies that were developed in the Bitcoin Core blockchain.



Masternodes for Staking

To run a masternode (staking node), stakers must hold a fixed amount of 20,000 DFI. Masternodes on Rebitrum participate in active transaction validations and block creations. The staking amount is intended to be lowered with the stability and maturity of blockchain to encourage further decentralization. Each staking node can perform only 1 hash per second, with the nonce from Bitcoin Core PoW algorithm replaced by a staker’s masternode ID. A new block is mined if it satisfies the following condition:

`SHA256({staker’s UTXO}, {current timestamp, in seconds}, {stake modifier}) < {target}`

The stakers check this requirement each second. If the block condition is less than the current target, then the stakers assemble and sign a new block. Staker’s UTXO require 20 confirmations before it can be accepted as a stake.



Stake Modifier

A stake modifier is a collective source of random entropy. Without a stake modifier, the future PoS kernel would be completely predictable. A good stake modifier needs to be neither predictable nor influance-able by stakers. DeFiChain’s staker modifier is set to be

`SHA256({previous stake modifier}, {masternode ID})`.



Validation of Future and Past Headers

Unlike PoW, block header validation requires a stakes table. Headers get verified in batches before full blocks are downloaded, so the stakes table is used to verify future stakes. To be able to verify future headers, the blockchain needs to apply an additional rule, so any change of the stakes database gets written right away, but takes effect only after 300 blocks. As a result, any node will be able to verify any block header against its current stake, if a block header isn’t further in the future (or in the past) than 300 blocks.



Nothing at Stake Protection

For PoS blockchains, there’s no limit to how many conflicting blocks a staker may sign. As a result, stakers may stake for every possible fork or branch, which weakens the finality of a PoS blockchain. This problem is known as a double-sign and is not possible in PoW blockchains, where a miner cannot mine all the possible branches without splitting mining capability. In PoW, this represents an intrinsic economic penalty. However, PoS blockchains cannot apply an inherent economic penalty for signing conflicting blocks on different branches. Therefore, in order to enhance the finality of Rebitrum, in PoS, it’s necessary to detect double-signs and penalize them through an explicit mechanism.



Detection of Double-sign

Each block header has a sequence number as a number of blocks that a particular staker has mined before a particular block. If two blocks are mined with the same sequence number, it means that a staker has double-signed, even if the blocks have different ancestors, i.e. across branches. During a block’s generation, a staker has the right to include the double-sign proofs into his block header in exchange for only half of the penalty.



Double-sign Penalty

To be able to apply a penalty to stakers who double-sign, Rebitrum has to disallow immediate withdrawing of stake. Thus, when a deactivation transaction is confirmed, Rebitrum requires 3000 blocks to pass. At a block time of 30 seconds, 3000 blocks is equivalent to 25 hours. The double-sign penalty is 10 times the block rewards, deducted from the collateral. This also disqualifies the stakers from further staking immediately. The staker who wants to get back to staking has to deposit a fresh stake UTXO of 20,000 DFI. Running the official Rebitrum node does not cause any unintentional or accidental double-sign. Double-sign happens only in cases of malicious intent.
