CasperLabs Releases Node 0.3

Medha Parlikar
CasperLabs
Published in
4 min readMay 14, 2019
Message Propagation among peers

CasperLabs is pleased to announce the release of Node 0.3. This release introduces on disk storage of the global state and a new communications module that uses efficient block gossiping. The CasperLabs node runs smart contracts that compile to WASM. Presently, compilation targets for Rust are supported. The CasperLabs system supports the upgrading of contracts through Capability Security Model.

About This Release

The previous version of the Node used a naive block gossiping algorithm, where blocks were gossiped to all peers in the Kademlia table. This release introduces an algorithm that gossips blocks based on ‘network’ proximity, rather than all nodes, resulting in more efficient block propagation. This release also introduces the on-disk storage for the global state and blockchain, enabling nodes to use resources more effectively. Calling contracts stored on the blockchain are now easier, thanks to improved API’s.

Technical Details about the Release

New and Improved Communications Subsystem

Block Gossiping is the method by which blocks are distributed to all nodes in the network. An intra-node GossipService has been implemented based on a gRPC service definition. Gossiping is more focused and efficient now in that it:

  1. Requests only the blocks they determine they need for syncing with another nodes DAG;
  2. Streams only block summary (not the entire block) information needed to determine a block’s existence in a node’s DAG and identify the parent blocks;
  3. A Download Manager schedules the streamed block summary so the entire block can be download at an efficient time;
  4. The Download Manager also polls other nodes for the block so that parallel downloads can be used if desired;
  5. The Download Manager is configurable so Node operators can effectively manage their resources;
  6. Uses iterative streaming, starting at the DAG tips and continuing until it reaches the Genesis Block (entire DAG) or a common ancestor (partial DAG);
  7. The network makes use of Kademlia’s standard protocols to “gossip” a given block to the smallest number of nodes necessary and yet ensure every node will eventually receive every block.

This new paradigm uses fewer resources by not flooding the network with gossiped blocks, not choking a node with block downloads and iteratively streaming only the block information nodes need to keep their DAGs in sync.

State storage on disk

Blockchain nodes must run reliably and consume physical resources efficiently. Part of the node architecture must involve the storage of data on disk. This release introduces storage of the global state and the blockchain data on disk.

The BlockStore and BlockDAG storage work in conjunction and are updated in an atomic way. They function virtually as one storage mechanism to represent the state of the DAG.

  • Blockdag storage — BlockDagFileStorage stores the DAG structure on disk. When a node re-starts, the in memory DAG is rebuilt from these files.
  • BlockStore storage- FileLMDBIndexBlockStore- This stores the raw block data. LMDB key-value storage of blockHash, blockMessage, where blockMessage is stored in a file and blockHash is the location of the file.

Global State storage

This is a Merkle trie stored back by LMDB. When a contract is executed, the pre-state context is retrieved from the global state store using the contracts pre-state key (including the local state cache). The contract executes, the effects to the global state are recorded, and the new post-state context is stored with its key. Any local context created during contract execution is returned; only the effects to the global state is saved.

Improved Interfaces for DApp Developers

The CasperLabs blockchain accepts WASM. As such, dApp developers should be able to develop their contracts to accept parameters. Then call the contracts and pass parameters into their contracts. Contract calls operate the same as traditional function calls.

The Rust API to call contracts has also been updated to take arguments in their original form rather than an array of byte arrays. This makes calling contracts more intuitive. Specifically, API method call_contract has been simplified. Instead of requiring arguments passed in the binary form it now accepts tuples up to 16 elements. It is required that for every type in the tuple there exists an instance of ToBytes trait. The byte representation for each tuple argument must be ABI compliant.

Packaging:

This release comes in:

  • Docker images available via DockerHub
  • Debian package
  • RPM package

Getting started with Node 0.3

At release, links to installation packages and relevant documentation is available on GitHub.

If you find an issue…

Report a bug on GitHub

Have Questions?

Visit https://forums.casperlabs.io with questions, members of the core development team will respond.

--

--