Skip to content

Self Identification Steps for the Casper Mainnet Accounts

Muhammet Kara edited this page Apr 8, 2024 · 8 revisions

Casper Account Info Contract allows account owners to provide information about themselves to the public by specifying a URL to a Casper Account Info Standard file.

Follow the steps below to identify the details of your account on the Casper Mainnet. The commands are meant to be run on Ubuntu 20.04 LTS.

Prepare your Casper Account Info Standard file

  • Right click here and select Save Link As... (or the proper option for your Browser) to download the sample Casper Account Info Standard file.

  • Adapt the file to match your details, and validate it against the standard schema by pasting it into the lower box here: https://www.jsonschemavalidator.net/s/ltMuxIEq

    • You should see the No errors found. JSON validates against the schema message at the bottom of the page.
  • Also make sure it passes the JSON validity checks here: https://jsonlint.com/

Important: The checks above are extremely important. If you publish an invalid JSON file, it will not be displayed correctly.

  • Then publish it at https://YOURDOMAIN/.well-known/casper/account-info.casper.json
    • (If your website is at https://mysupercaspervalidator.com, then your account info file should be reachable at https://mysupercaspervalidator.com/.well-known/casper/account-info.casper.json)

Install the prerequisites

To run the commands in the instructions, you need to have a recent version of casper-client and jq installed. Run the commands below to make sure you have them on your node.

Update package repositories

sudo apt update

Install helpers

sudo apt install jq -y

We will use jq to process JSON responses from API later in the process.

Add Casper repository

Execute the following in order to add the Casper repository to apt in Ubuntu.

echo "deb https://repo.casperlabs.io/releases" focal main | sudo tee -a /etc/apt/sources.list.d/casper.list
curl -O https://repo.casperlabs.io/casper-repo-pubkey.asc
sudo apt-key add casper-repo-pubkey.asc
sudo apt update

Install casper-client

sudo apt install casper-client -y

Set the environment variables

Please set the following environment variables, which are reused across the instructions.

Set the node address

You need to send the commands/queries to healthy Mainnet node. If you don't have a node of your own, you can pick one from here: https://cspr.live/tools/peers

Replace the THE-IP-ADDRESS-OF-A-MAINNET-NODE part with an actual IP address, and run the command below:

NODE_ADDRESS=THE-IP-ADDRESS-OF-A-MAINNET-NODE

Set the chain name

For the Casper Network Mainnet, the chain name should be set as casper with the following command:

CHAIN_NAME=casper

Path to your secret key

Place your secret_key.pem file inside a folder under your home directory, and give its path to an environment variable with the following command:

ACCOUNT_KEYS_PATH=/home/YOURUSERNAME/THE-DIRECTORY-WHICH-CONTAINS-YOUR-KEYS

Set the Account Info Contract hash

Set the hash of the Account Info Contract on the Casper Network Mainnet with the following command:

ACCOUNT_INFO_CONTRACT_HASH=fb8e0215c040691e9bbe945dd22a00989b532b9c2521582538edb95b61156698

Set URL for your account

Payment: The set_url entry point call payment should be 15 CSPR. The deploy may fail with an "Out of gas" error if a smaller amount provided. For the consecutive set_url calls the advised payment amount is 0.5 CSPR

The command below sets the top level domain URL for an account information file hosted at https://MYSUPERCASPERVALIDATOR.COM/.well-known/casper/account-info.casper.json. (Please note that the url you provide here will be prominently displayed on the block explorers as your official website, and your account's public key must exist in the JSON data either in the nodes or affiliated accounts section for it to be successfully verified by CSPR.live and other dApps in the Casper ecosystem.)

sudo -u casper casper-client put-deploy \
    --chain-name "$CHAIN_NAME" \
    --node-address "http://$NODE_ADDRESS:7777/" \
    --secret-key "$ACCOUNT_KEYS_PATH/secret_key.pem" \
    --session-hash "$ACCOUNT_INFO_CONTRACT_HASH" \
    --session-entry-point "set_url" \
    --payment-amount 15000000000 \
    --session-arg=url:"string='https://MYSUPERCASPERVALIDATOR.COM'"

Take note of the deploy hash returned from the command above, wait for a few minutes and confirm that your deploy succeeded by searching for it on https://cspr.live/.

Verify the account info

Clone the Casper Account Info Contract repo:

cd ~
git clone https://github.com/make-software/casper-account-info-contract.git

Then get the account information file content:

PUBLIC_KEY=<put here your public key>

cd ~/casper-account-info-contract/tools
./get-account-info.sh --node-address=$NODE_ADDRESS --contract-hash=$ACCOUNT_INFO_CONTRACT_HASH --public-key=$PUBLIC_KEY | jq

You should see the content of your account info file as the output of this command. You can now proceed to CSPR.Live to see your details displayed there: https://cspr.live/account/YOUR-PUBLIC-KEY