This section explains how to fulfill the prerequisites needed to interact with a Casper Network.
This section covers:
Installing the official Casper command-line client
Setting up an account on a Casper Network
Acquiring the IP address of a peer on the official Testnet or Mainnet
You can find the client on crates.io.
Run the commands below to install the Casper client on most flavors of Linux and macOS. You will need the nightly version of the compiler.
rustup toolchain install nightly
cargo +nightly install casper-client
The Casper client can print out help information, which provides an up-to-date list of supported commands.
Important: For each command, you can use help to get the up-to-date arguments and descriptions:
casper-client <command> --help
The process of creating an Account can be divided into two steps:
Cryptographic key generation for the account
Funding the 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.
Accounts can be created using 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.
A cryptographic key-pair will be created when using either the Casper command-line client or a block explorer to create an account on the blockchain. 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.
The command-line client provides a command that will give you the account hash for a given public key.
casper-client account-address --public-key <path-to-public-key-hex>/public_key_hex
This option describes how you can use the Casper command-line client to set up your accounts.
Execute the following command to generate your keys:
casper-client keygen .
The above command will create three files in the current working directory:
secret_key.pem - PEM encoded secret key
public_key.pem - PEM encoded public key
public_key_hex - Hexadecimal-encoded string of the public key
Note: SAVE your keys to a safe place, preferably offline.
Once the keys for the account have been generated, the accounts can be funded to finish the process of creating an account.
Note: Responses from the node contain AccountHashes instead of the direct hexadecimal-encoded public key. For traceability, it is important to generate the account hash and store this value locally. The account hash is a Blake2B hash of the public hexadecimal-encoded string.
This option is also 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 Create Account link. You will be asked to provide a unique name for your account; this is for your convenience and is not stored on chain.
You will be prompted to save three files for your new account; carefully choose where you store them. We recommend storing your keys in a secure manner.
<Account-Name>_secret_key.pem - PEM encoded secret key
<Account-Name>_public_key.pem - PEM encoded public key
<Account-Name>_public_key_hex - Hexadecimal-encoded string of the public key
Once the cryptographic key-pair for the account has been generated, the account must be funded so it can be created 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 an account can be created on Mainnet.
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 provide a list of 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:
Peers on Testnet
Peers on Mainnet
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.