Search
Close this search box.
Search
Close this search box.
Explore Casper Network Design

Dive into the intricate design of Casper Network! Explore Casper’s account-based PoS model, WebAssembly smart contracts, and tokenomics. Understand how Casper empowers developers with a secure and scalable platform for decentralized applications.

Learn more about: What is Casper Network?

Introduction Casper Network design

Casper is a Proof-of-Stake (PoS) blockchain platform that employs an account-based model, executing operations after reaching consensus. The Casper Network stores data within a structure called the Global State. Users interact with this state through session code sent in a Deploy. These deployments contain WebAssembly (Wasm) code executed by the network, allowing developers to use their preferred programming languages. A deployment executes within the context of the user’s account but can call stored Wasm that will execute in its context. User-related information, aside from the account, is stored in the global state as an Unforgeable Reference or URef. Once a node validates a deployment, it places the deployment in a proposed block and propagates it among nodes until the network reaches consensus. The network then executes the Wasm included in the deployment.

Execution Semantics

The Casper Network is a decentralized computation platform. This section outlines key aspects of Casper’s computational model.

Measuring Computational Work

Computation on Casper is performed in a Wasm interpreter, enabling any programming language that compiles to Wasm to function as a smart contract language. Similar to Ethereum, Casper uses Gas to measure computational work, ensuring consistency across nodes. Each Wasm opcode has an assigned Gas cost, tracked by the runtime as each opcode is executed. All executions are finite due to a gas limit that specifies the maximum amount of Gas available before the runtime terminates the computation. The gas limit is set by executing the payment code specified within the deployment. Though the network measures costs in Gas, payment for computation is made in motes, with a conversion rate between Gas and motes.

The Casper Network Runtime

A Wasm module cannot inherently create effects outside of its own linear memory. To enable desired effects like reading or writing to the global state, Wasm modules import functions from the host environment they run in.

All these features are accessible via functions in the Casper External FFI.

Accounts

Casper employs an on-chain account-based model, uniquely identified by an AccountHash derived from a specific PublicKey. The global state trie store requires uniform key lengths, so the AccountHash is a 32-byte derivative used to abstract any supported public key variants. Casper supports two types of keys for creating accounts and signing transactions:

  • Ed25519 keys: Using the Edwards-curve Digital Signature Algorithm (EdDSA), these keys are 66 bytes long.
  • Secp256k1 keys: Commonly known as Ethereum keys, these are 68 bytes long.

By default, interactions with the blockchain take the form of a Deploy cryptographically signed by the key pair corresponding to the PublicKey used to create the account. All user activities on the Casper blockchain (i.e., “deploys”) must originate from an account. Each account has its context for locally storing information, such as references to useful contracts, metrics, and aggregated data. Each account also has a “main purse” for holding Casper tokens.

Creating an account

Account creation occurs automatically when tokens are transferred to a new PublicKey. Upon creation, the main purse balance equals the number of tokens transferred, with action thresholds set to 1 and one associated key—the PublicKey used to create the account. An account is essentially a context object encapsulating the main purse, used to pay for transactions, though additional purses beyond the main purse are possible.

Tokens

Casper is a decentralized PoS blockchain platform using a consensus algorithm called Highway. A unit of value is necessary for users to pay for computation and validators to stake for bonding. In Casper, this unit of value is a token.

Token Generation and Distribution

A blockchain system requires a supply of tokens to pay for computation and reward validators. At Mainnet launch, the initial supply was 10 billion CSPR.

The system has a low inflation rate, with the results paid out to validators as seigniorage. The number of tokens used to calculate seigniorage is the initial supply at Genesis.

Divisibility of Tokens

Tokens are divisible into smaller units. For CSPR, these units are called motes, with each CSPR divisible into 10^9 motes. To avoid rounding errors, token balances are always represented in motes. Unlike the human-readable concept of CSPR, transactions within the Casper network deal solely with motes.

Conclusion

The Casper Network design showcases a sophisticated framework for decentralized computation, smart contract execution, and token governance. Leveraging PoS consensus and WebAssembly, Casper ensures efficient transactions and robust security within a permissionless environment. With its execution semantics, runtime environment, and tokenomics, Casper stands as a beacon of innovation in the blockchain space, offering scalability and security for decentralized applications.

About OriginStake

Originstake is your professional and trusted validator that assists you in your staking activities. We provide full support services, a reward management dashboard, rewards sharing, and much more!

With Originstake, staking is safe, profitable, and extremely cost-effective!

Share the Post:

Subscribe for our insight