The Blockchain Chief Blog

Get started with Casper: An In-Depth Overview of Casper Network Architecture

February 11, 2024 | by Mohit Bhat

Casper Blockchain

A guide about Casper Blockchain Architecture and its comparison to Ethereum! To help you make better dapps

Introduction

Hey Everyone, Welcome to another blog where we will be discussing about casper blockchain. Casper was launched in March 2021 and from that day it has been in the news.
As we know that Ethereum being the biggest player in blockchain market is suffering from multiple issues related to gas fees, computation, etc. Today we will discuss about how casper is different from others and how you can benefit from it.

Casper is a layer 1 public blockchain, meaning its a new blockchain and not a sidechain. The Casper Network is the first live proof-of-stake blockchain built off the Casper CBC specification. Casper is designed to accelerate enterprise and developer adoption of blockchain technology today and evolve to meet user needs in the future. The network is specifically optimised for high throughput, security and decentralisation.

It is also represented as CSPR, same as ethereum is represented as ETH.

Native Token of Casper Blockchain

The native token of casper is known as CSPR. Same as ETH is native token for Ethereum.

The use of CSPR is to reward validators that participate in the pos consensus mechanism which secures the network.

CSPR is also used to pay network fees for on-chain actions.

The smaller unit of casper is called motes, the unit in which gas is paid on casper, Its same like Ethereum has GWei for gas payments.

In short the use of CSPR is same as ETH which is for securing and doing transactions(gas fee) for blockchain

Consensus algorithm of Casper

Casper uses a type of Proof of stake consensus protocol called Casper CBC(Casper Correct by Construction (CBC)) with many improvements. This improved consensus protocol of casper is named as Highway Protocol. Casper CBC was an idea of Vlad Zamfir, who helped to create Ethereum. Ethereum2.0 is going to use CFFG(Casper Friendly Finality Gadget (CFFG)) protocol and the Ethereum 3.0 is going to use Casper CBC. Because of this casper calls itself the “final evolution” of Ethereum.

How Highway protocol is better

  • The highway allows networks to reach higher thresholds of finality, meaning that more blocks are finalized, and validators agree to add them to the blockchain.
  • The protocol achieves flexibility by expressing block finality in ways not possible in BFT models
  • Unlike Proof-of-Work networks, which need to centralize validators for economies of scale, Casper allows for the geographical decentralization of validators

The virtual Machine of Casper

Casper is turning-complete chain which means it supports smart contracts.
Casper doesn’t have an EVM like Ethereum, Instead, it has a WASM interpreter(We can say it’s a kind of Virtual Machine) which is used for all computation work to be performed. This makes Casper useful as any language that can compile code to WASM can be used to write smart contracts on Casper.

Smart Contracts in Casper

Casper blockchain supports smart contracts. You can write your smart contracts in any language that compiles down to wasm(Web Assembly).
The primary language used to write smart contracts in Casper is Rust. CaperLabs has also created a code transpiler called caspiler that converts solidity code to Rust. This makes solidity another language supported in Casper.

There is Javascript SDK which is used to connect to Casper and perform calls on the smart contracts that are deployed.

The Model of Casper: Account-Based Model

Similar to Ethereum Casper has account based model. It has an account hash, public key, and private key.
There is a global state in Casper where all data is stored in a Key-value manner. Each block causes a change in the global state. The key-value store is implemented using a Merkle trie. Casper’s implementation of the trie has a radix of 256, meaning each branch node can have up to 256 children. A path through the tree can be an array of bytes, and serialization directly links a key with a path through the tree as its associated value.

A trie node is actually one of the following:

  • A leaf: which includes a key and a value
  • A branch: which has up to 256 blake2b256 hashes, pointing to up to 256 other nodes in the trie (recall each node is labeled by its hash)
  • An extension node: which includes a byte array (called the affix) and a blake2b256 hash pointing to another node in the trie

Features of Casper as compared to Ethereum(Why to choose Casper)

Casper is built to solve the problems that existing enterprises are facing with the adoption of blockchain. Casper aims to support global enterprise adoption of web3. Existing enterprise blockchains lack a lot of features which Casper has tried to solve.

Eth-casper comparison

Let’s have a look at some of the great features Casper provides:-

  • Upgradable Smart Contracts: Yes, You have heard it right, Casper supports the easy upgrade of deployed smart contracts without any complex processes as it is present in Ethereum where you have to deal with proxy contracts with a lot of mess. Casper smart contracts use a package management model, which allows the direct upgrading of on-chain smart contracts, eliminating the need for complex migration processes. This allows quick patching of smart contracts vulnerabilities, easy logic upgrades with time, etc.

When installing a contract, it’s possible to designate a contract as ‘not upgradeable’, which is suitable for DeFi contracts

  • Inbuilt Easy and Secure Weighted Keys Management: As you know many blockchains only allow binary (on or off) smart contract access permissions for users, which restricts larger teams from effectively working together on blockchain, and managing complex applications becomes very difficult. The Casper Network offers powerful accounts that are not just public keys. Accounts on Casper offer weights for separate key management and transaction signing rights, and the ability to run session code (wasm) in the account context. By running the session code in the account, it’s possible to delegate transaction signing to multiple keys, revoke lost keys to recover accounts, and store data within the account itself. It is also possible to securely share state between accounts and contracts (without expensive cryptographic checks)
  • Lower and Predictable Gas Cost: The casper PoS consensus mechanism allows less network congestion and high throughput when compared to Ethereum and other blockchains. The network is designed in such a way that it improves price stability during changes in order size or at times of high transaction volume. Casperlabs is also working on predictive gas futures market which would allow us to reserve gas ahead of time at predetermined prices.
  • CasperLabs- A Non-Profit for casper improvements: The casperLab is a Non Profit org which works on improving the casper blockchain as per the user needs and demand. This makes casper a great choice for enterprises as casper is designed to continually upgrade itself with time which makes the blockchain feature rich with growing demand and needs of business’s.
  • Future Proof : The design of casper is so great that all components in it are pluggable(Network Engine, Execution Engine, Consensys Layer). This makes it easy to upgrade casper in future.

This was all about Casper Blockchain. I hope you understood what Casper is and how it is different from others.


Leave a Reply

Your email address will not be published. Required fields are marked *

RELATED POSTS

View all

view all