import useBaseUrl from '@docusaurus/useBaseUrl';
Accounts and Cryptographic Keys
The Casper blockchain uses an on-chain account-based model, uniquely identified by an AccountHash
derived from a specific PublicKey
. The AccountHash
is a 32-byte hash derived from any of the supported PublicKey
variants below to standardize keys that can vary in length.
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.
The Casper platform supports two types of keys for creating accounts and signing transactions:
- Ed25519 keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 bytes long
- Secp256k1 keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 bytes long and are also found on the Ethereum blockchain
You can generate keys using both formats, and it is also possible to work with existing Ethereum keys.
You can also generate an account hash from a public key with the Casper command-line client.
Creating Accounts and Keys
When you create an account on the Casper blockchain, a cryptographic key-pair will be created when using either the Casper command-line client or a block explorer. Developers must use the Casper command-line client as described below. Otherwise, they won't have access to the secret key file needed during development.
SAVE your keys to a safe place, preferably offline.
Option 1: Generating keys using the Casper Client
This option describes how you can use the Casper command-line client to set up an account using either key type.
EdDSA Keys
The command-line client generates EdDSA keys by default. Use the command below to create the account.
mkdir ed25519-keys
casper-client keygen ed25519-keys/
tree ed25519-keys/
Sample output of the tree
command shows the contents of the ed25519-keys folder:
ed25519-keys/
├── public_key.pem
├── public_key_hex
└── secret_key.pem
0 directories, 3 files
Here are some details about the files generated:
public_key.pem
is a PEM-encoded public keypublic_key_hex
is a hexadecimal-encoded string of the public keysecret_key.pem
is the PEM-encoded secret key
The public-key-hex for Ed25519
keys starts with 01 and is 66 bytes long:
cat ed25519-keys/public_key_hex
011724c5c8e2404ca01c872e1bbd9202a0114e5d143760f685086a5cffe261dabd
ECDSA Keys
To create Secp256k1
keys, which use the ECDSA algorithm with the P-256 curve, follow these steps:
mkdir secp256k1-keys
casper-client keygen -a secp256k1 secp256k1-keys/
tree secp256k1-keys/
Sample output of the tree
command shows the contents of the secp256k1-keys folder:
secp256k1-keys/
├── public_key.pem
├── public_key_hex
└── secret_key.pem
0 directories, 3 files
The public-key-hex for Secp256k1
keys starts with 02 and is 68 bytes long:
cat secp256k1-keys/public_key_hex
020287e1a79d0d9f3196391808a8b3e5007895f43cde679e4c960e7e9b92841bb98d
After generating keys for the account, you may add funds to the account's purse to finish the account creation process.