During this workshop, we will walk through how to use the CLarity block explorer to create and fund accounts in the CasperLabs testnet, compile an example contract

Goals

Step by Step Plan

  1. Visit CLarity for the testnet at: https://testnet-explorer.casperlabs.io/#/

  2. Create an account.

  3. Store your keys in a location where you can use them to sign deploys.

  4. Navigate to the faucet and fund your account.

  5. Clone the repository on your machine

git clone -b dev https://github.com/CasperLabs/CasperLabs.git

2. Install the CasperLabs client using brew, apt, docker or tarball. Instructions are at: https://github.com/CasperLabs/CasperLabs/blob/dev/docs/INSTALL.md

3. Compile contracts

cd execution-engine
make setup
make build-contracts

4. Deploy the counter-define example contract.

casperlabs-client --host 13.57.226.23 --port 40401 deploy --session ~/CasperLabs/execution-engine/target/wasm32-unknown-unknown/release/counter_define.wasm --payment-amount 10000000 --private-key [path to private key] 

Let’s get the latest block:

query {
  dagSlice(depth: 1) {
      blockHash
  }
}

Now -let’s take a look at your account and see if it has processed on the blockchain. Navigate to the GraphQL interface and enter the following information. Note the information that needs to be appended to the query, such as account and latest block hash.

query {
  globalState(
    blockHashBase16Prefix: "LATEST BLOCK HASH"
    StateQueries: [
      {
        keyType: Address
        keyBase16: "PUBLIC KEY FOR KEY1"
        pathSegments: []
      }
    ]
  ) {
    value {
      __typename
      ... on Account {
        pubKey
        associatedKeys {
          pubKey
          weight
        }
        actionThreshold {
          deploymentThreshold
          keyManagementThreshold
        }
        namedKeys{
          name
        }
      }
    }
  }
}

You should see a result that looks like this:

{
  "data": {
    "globalState": [
      {
        "value": {
          "__typename": "Account",
          "pubKey": "3eaaf54978990c040150bf3b98e0128a3aab24d1bb1b484956678673531387fe",
          "associatedKeys": [
            {
              "pubKey": "3eaaf54978990c040150bf3b98e0128a3aab24d1bb1b484956678673531387fe",
              "weight": 1
            }
          ],
          "actionThreshold": {
            "deploymentThreshold": 1,
            "keyManagementThreshold": 1
          "namedKeys": [
            {
              "name": "counter"
            },
            {
              "name": "counter_inc"
            },
            {
              "name": "mint"
            },
            {
              "name": "pos"
            }
          ]
        }
      }
    ]
  }
}

What you need to know:

Help!

Go to Discord- we will help you there: https://discord.gg/mpZ9AYD