With a four-billion-dollar ICO and everyone in the blockchain community raving about it, EOS took the blockchain sphere by storm in 2018. The credit clearly goes to its father, Dan Larimer – the mastermind behind various other mainstream blockchain projects such as Bitshares and Steemit. However, due to the success of these well-marketed ones, one of Dan’s projects has always been ignored: Graphene blockchain. The blockchain community is privy to the fact that EOS, Bitshares, and Steemit would have never seen the light of day if Dan hadn’t come up with Graphene, one of the most scalable blockchains.
But because of a lack of documentation, the potential of this underrated gem is still isn’t realized in the circle.
So, here’s a handy guide for those who wish to understand and learn about Graphene blockchain. Keep in mind that this article is the first in the
Consensus in Graphene Blockchain
As most of us know, Bitcoin and Ethereum are based on POW consensus mechanism, where all the nodes can participate in the competition of adding blocks to the blockchain. The POW mechanism seems completely decentralized on paper, but in reality, with increasing load on the system – outgrows the computational power needed to mine these blocks. At a certain point, it becomes nearly impossible for a person with a desktop computer to add any value to the system. In such scenarios, only huge mining rigs and pools are able to mine and add blocks.
POW based blockchains are facing a major backlash. This is due to the amount of power being used in the mining process. As reported by CBS, the Bitcoin network alone consumes more electricity than 159 individual countries, including Ireland.
With these drawbacks, there was always a growing need for a less power hungry and more decentralized consensus mechanism. This is where DPOS stepped up.
The Delegated Proof of Stake Consensus (DPOS)
Graphene blockchain is based on the DPOS consensus mechanism, where ‘N’ number of witnesses are selected via continuous voting by stakeholders to produce blocks. This ‘N’ is an odd number. Only these witnesses produce the blocks in their respective time slots until the next maintenance interval. After the maintenance interval, the algorithm chooses the next set of witnesses based on the voting results. It is important to understand here that:
- Only stakeholders can participate in the voting process
- One stakeholder can only vote one witness.
Apart from witnesses, the stakeholders also elect delegates who have the privilege of proposing changes to the network parameters. These changes range from something as simple as transaction fees – to the number of elected witnesses. A particular majority of delegates approve the proposed changes. Post this, a two week period is given to the stakeholders. During this, they may vote out the delegates and veto the proposed changes (note that these network changes aren’t very likely to be proposed).
Thus, under DPOS it is safe to assume that the administrative authority rests in the hands of the users, just like a democracy. But unlike witnesses, the delegates are not compensated for retaining their positions.
Let us kick this off by running a
Clone this repo: https://github.com/cryptonomex/graphene.git. After that, clone the sub-modules by this command:
git submodule update –init –recursive
Make the build by the following steps:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=”-fpermissive” .
Once the build is successful, create the genesis file
mkdir -p genesis
programs/witness_node/witness_node –create-genesis-JSON genesis/my-genesis.json
Edit the genesis.json file accordingly. For instance, you could specify how much accounts should be there initially, maintenance interval time, ’N’ – the number of witnesses, initial balances in accounts etc.
Then, start the witness-node with the following command depending on the number of witnesses you have initialized in my-genesis.json
./witness_node –RPC-endpoint “127.0.0.1:8090″ –enable-stale-production –genesis-JSON genesis/my-genesis.json -w \””1.6.0″\” \””1.6.1″\” \””1.6.2″\” \””1.6.3″\” \””1.6.4″\”
Boom! You now have Graphene blockchain’s testnet running on your system.
You now have a basic understanding of Graphene blockchain’s DPOS consensus. Please click here to navigate to the next article in the series, where we will discuss about more concepts like multi-node setup and smart contracts on Graphene.
If you have any query regarding this blog, please email the author at email@example.com. Drop your email here if you want to build a project on Graphene blockchain.
Code reference: https://www.monetha.io