Skip to main content

Development Prerequisites

This page covers the necessary software for your Casper development environment. To develop comfortably, you should use Linux Ubuntu 20.04. Casper does not officially support macOS, but the commands are included for your convenience. If you encounter any problems, reach out to the community on Telegram or Discord. Developing on Windows is not advised.

Preparing your Development Environment

Installing curl

sudo apt install curl

Installing essential Linux packages

sudo apt install build-essential

Installing packages required for Casper tools

sudo apt-get install pkg-config
sudo apt-get install openssl
sudo apt-get install libssl-dev

Installing cargo on Linux

sudo apt install cargo

Installing Rust

Install the Rust programming language if you don't already have it on your computer.

The official Rust guide recommends installing Rust by using curl:

curl --proto '=https' --tlsv1.2 -sSf | sh

After your next login, the installation script automatically adds Rust to your system PATH. To start using Rust immediately, run the following command in your shell instead of restarting your terminal. The command will add Rust to your system PATH.

source $HOME/.cargo/env

Verify the installation:

rustup --version

Note: You can also use brew on MacOS or apt on Linux to install Rust.

Installing the Casper Crates

The best and fastest way to set up a Casper Rust project is to use cargo casper, which is the command line tool for creating a Wasm smart contract and tests for use on a Casper network. This tool will create a simple contract, a runtime environment, and a testing framework with a simple test. Cargo is a build system and package manager for Rust (much like pip if you are familiar with Python, or npm and yarn for those familiar with Javascript). It is also possible to use this configuration in your CI/CD pipeline.

cargo install cargo-casper

If you run into any issues with this command and you have not recently installed Rust from scratch, please make sure to update your Rust version with this command:

rustup update

Verify the installation:

cargo-casper --version

Familiarize yourself with the essential Casper crates described here.

Installing the Casper Client

The default Casper client is on This client can transmit your deploys to a Casper network.

cargo install casper-client

Verify the installation:

casper-client --version

The Casper client can print out help information, which provides an up-to-date list of supported commands. To do so, use the following command:

casper-client --help

You can use help for each command to get the most up-to-date arguments and descriptions.

casper-client <command> --help

Accessing the Casper client source code

You can access the Casper client source code here. The lib directory contains the source for the client library, which may be called directly rather than through the CLI binary. The CLI app casper-client uses this library to implement its functionality.

If you wish to compile it, you will need to first install the nightly Rust toolchain with this command:

rustup toolchain install nightly

Then, compile the source code:

cargo build --release

You will find the casper-client executable in the target/release directory.

Installing CMake

If you plan to compile contracts from the source code, including those provided in the casper-node repository, install CMake with the commands below.

CMake is a popular build tool that we will use, and you may have it installed. If you do, make sure that you have the latest version. If you need to install or upgrade it, follow the steps below or on the CMake website. Once installed, check your version as shown below.

sudo apt-get -y install cmake

Check your version:

cmake --version

Sample output:

cmake version 3.20.0 (or above)

CMake suite maintained and supported by Kitware (

Installing an IDE

We advise using an integrated development environment such as Visual Studio Code (VSC) for development. There are many IDEs available for Rust development. The most popular IDEs for Rust are the following:

You can use any IDE you wish. Most of our documentation and examples use Visual Studio Code (VSC), a popular IDE with many extensions that might be helpful during development.

If you are using VSC, you might find the following extensions useful:

  • CodeLLDB – An important extension for debugging Rust code
  • rust-analyzer – The official Rust language extension
  • Better TOML – Support for formatting TOML files
  • crates – An extension to help manage crates
  • Error Lens – Enhances the programming experience by highlighting syntax errors

Setting up a Casper Account

The Account creation process consists of two steps:

  1. Creating an Account
  2. Funding the Account

The following video complements the instructions below, showing you the expected output.

Creating an account

The Casper blockchain uses an on-chain account-based model, uniquely identified by an AccountHash derived from a specific PublicKey.

By default, a transactional interaction with the blockchain takes the form of a Deploy cryptographically signed by the key-pair corresponding to the PublicKey used to create the account.

Developers must create accounts using the Casper command-line client to access the secret_key.pem file needed during development.

Some Casper networks, such as the official Testnet and Mainnet, provide wallets that allow account creation as outlined here. However, these wallets do not give developers access to the secret key file.

Generating the account hash

As a developer, you will often use an account hash, which is a 32-byte hash of the public key. This is because responses from the node contain AccountHashes instead of the direct hexadecimal-encoded public key. To view the account hash for a public key, use the account-address option of the Casper CLI client:

casper-client account-address --public-key <path-to-public_key.pem/public-key-hex>

Funding an Account

After generating the cryptographic key-pair for an Account, you must fund the account's main purse to create it on-chain.

On Testnet, you can fund an account by requesting test tokens according to this guide. You can request test tokens only once for each account.

On Mainnet, a pre-existing account must transfer CSPR tokens to the newly created account's main purse to finalize the setup. The source account needs to transfer CSPR tokens to the hexadecimal-encoded public key of the target account. This transfer will automatically create the target account if it does not exist. Currently, this is the only way to create an account on Mainnet.

Acquiring a Node Address from the Network

Clients can interact with a node on the blockchain via requests sent to that node's JSON-RPC endpoint, http://<node-ip-address>:7777 by default.

The node address is the IP of a peer node.

Both the official Testnet and Mainnet provide block explorers that list the IP addresses of nodes on their respective networks.

You can get the node-ip-address of a node on the network by visiting the following block explorers:

You will see a list of peers, and you can select the IP of any peer on the list.

Note: If the selected peer is unresponsive, pick a different peer and try again.