Skip to main content

Development Prerequisites

This section explains how to fulfill the prerequisites needed to interact with a Casper network.

This section covers:

  1. Setting up a Rust development environment
  2. Installing the official Casper command-line client
  3. Setting up an Account on a Casper network
  4. Acquiring the IP address of a peer on the official Testnet or Mainnet

Installing Rust

On the Casper platform, developers may write smart contracts in any language that compiles to Wasm. These How To guides focus on code examples that use Rust and a Rust client to interact with a Casper network. While following these guides, we recommend setting up Rust and installing all dependencies. For step-by-step instructions, visit Getting Started with Rust.

Casper Command-line Client

You can find the default Casper client on This client communicates with the network to transmit your deploys.

Run the commands below to install the Casper client on most flavors of Linux and macOS. You should have Rust installed, otherwise check the alternative installation methods below.

cargo install casper-client

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

Important: For each command, you can use help to get the most up-to-date arguments and descriptions.

casper-client <command> --help

Alternative Installation Methods

Debian / Ubuntu

Navigate to and follow the instructions compatible with your distribution.

Red Hat / CentOS

Head to GitHub and download the .rpm file for the latest client release.

Run the following command by replacing the file's name with the one you downloaded.

sudo yum install casper-client-x-x-x*.rpm

In RHEL 5 and previous versions, you need to use the following command:

sudo yum localinstall casper-client-x-x-x*.rpm

On Fedora, RedHat 8, and other more recent RPM-based distributions, you can also use dnf to install packages:

sudo dnf install casper-client-x-x-x*.rpm

Building the Client from Source


Setting up an Account

The Account creation process consists of two steps:

  1. Creating the 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.

Users can create an account through the Casper command-line client. Alternatively, some Casper networks such as the official Testnet and Mainnet provide a browser-based block explorer that allows account creation. Using the Casper command-line client or a block explorer will also create a cryptographic key-pair.

Option 1: Key generation using the Casper client

This option describes how you can use the Casper command-line client to set up your accounts. For more information about cryptographic keys, see Working with Cryptographic Keys.

Execute the following command to generate your keys:

casper-client keygen .

The above command will create three files in the current working directory:

  1. secret_key.pem - PEM encoded secret key
  2. public_key.pem - PEM encoded public key
  3. public_key_hex - Hexadecimal-encoded string of the public key

Note: Save your keys to a safe place, preferably offline.

After generating keys for the account, you may add funds to the account's purse to finish the account creation process.

Note: 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 client:

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

Option 2: Key generation using a Block Explorer

This option is available on networks that have a block explorer.

For instance, on the official Testnet network, the block explorer is available, and the following instructions assume you are using it.

Start by creating an Account using the Casper Signer. The Signer will prompt you to download the secret key of your new account by clicking on the Download option. The Signer will download the secret key in a file ending in secret_key.cer. We recommend securely storing this file. Note that the account is not stored on chain.

Signer Secret Key Download Prompt

The Signer does not allow you to download the corresponding public key and hexadecimal representation of the public key. But, you can view them if you click the account details.

Signer Account Details

For ed25519 keys, you can generate the public_key.pem and public_key_hex using these commands.

Funding Accounts

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 will have to 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.