Skip to main content

Prerequisites

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

This section covers:

  1. Installing the official Casper command-line client
  2. Setting up an account on a Casper Network
  3. Acquiring the IP address of a peer on the official Testnet or Mainnet

Casper Command-line Client

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

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 https://repo.casperlabs.io/ 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

Instructions

Setting up an Account

The Account creation process consists of two steps:

  1. Creating the account
  2. Funding the account

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 to create an account on the blockchain will also create a cryptographic key-pair. This process generates three files for each account:

  • A PEM encoded secret key
  • A PEM encoded public key
  • A hexadecimal-encoded string representation of the public key

We recommend saving these files securely.

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 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 CSPR.live 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.

Fund your Account

After generating the cryptographic key-pair for the account, you must then fund the account to create it on chain.

In Testnet, you can fund the account by using the Request tokens button on the Faucet Page to receive tokens.

In Mainnet, a pre-existing account will have to transfer CSPR tokens to finalize the process of setting up an account. 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.