Recording on Youtube: https://youtu.be/UM9Awo8HrWY

Dial in Information is at: https://casperlabs.atlassian.net/wiki/spaces/REL/pages/136544674/Weekly%2BWorkshops%2BHome

Participants

During this workshop, we will demonstrate how an owner of account 1 can grant signing authority to a another account - and then revoke this authority as well. CasperLabs accounts also support weights, so it is possible to require a certain weight in order to complete a transaction. For this demonstration, we will simply grant and revoke signing authority to an account.

Goals

Step by Step Plan

  1. 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 ….

3. Compile contracts

cd CasperLabs
cd execution-engine
make setup
make build-contracts

4. Fund accounts on DevNet - you can also create new accounts for the test as well. Make sure that all the keys you plan on using have been funded.

Create 3 keys - Key1, Key2, Key3 - and fund Key1. Leave Key2 and Key3 unfunded.

5. Export the session arguments (this simplifies the deploy command)

export NEW_KEY_HEX=[the base16 for key2]
export ARGS="[\
    {\"name\": \"target-account\", \"value\": {\"bytes_value\": \"${NEW_KEY_HEX}\"}} \
]"

Send a deployment to add a new key (key2)to the account of Key1 - this deploy is signed by key1

casperlabs-client --host deploy.casperlabs.io deploy --session [path to wasm file add_update_associated_key.wasm] --session-args "${ARGS}" --payment-amount 10000000 --private-key [path to your private key1] 

(path under CasperLabs is ‘execution-engine/target/wasm32-unknown-unknown/release/add_update_associated_key.wasm’)

Confirm that the deploy succeeded.

5. Now we will confirm that the key has the authority to run the contract.

Export our arguments for the session contract

export TO_HEX="base16-of-key3"
export AMOUNT="55"
export TXARGS="[\
    {\"name\": \"target-account\", \"value\": {\"bytes_value\": \"${TO_HEX}\"}}, \
    {\"name\": \"amount\", \"value\": {\"long_value\": \"${AMOUNT}\"}} \
]"

6. Send the deployment to transfer the token. Sign this deployment with the key that you authorized in the earlier step.

casperlabs-client --host deploy.casperlabs.io deploy --session [path to wasm file transfer_to_account.wasm] --session-args "${TXARGS}" --payment-amount 10000000 --private-key [path to your private key2] --from [base16 public key for (key1)] 

7. Revoke the key

casperlabs-client --host deploy.casperlabs.io deploy --session [path to wasm file remove_associated_key.wasm] --session-args "${ARGS}" --payment-amount 10000000 --private-key [path to your private key for key1] 

7. Re-try Step 6 - confirm that the key is not authorized.

casperlabs-client --host deploy.casperlabs.io deploy --session [path to wasm file transfer_to_account.wasm] --session-args "${TXARGS}" --payment-amount 10000000 --private-key [path to your private key2] --from [base16 public key for key1] 

We expect that the system will report an ‘Authorization failure’ - and no block is created.

Software Version (GitHash)

Docker tag: master

CasperLabs Client 0.11.0 (5777274434bf8cb676c43b0a0ca28f4e015c683e)

What you need to know:

Notes:

Title

Description

Notes

Verify pre-requisites

Check that everyone has managed to get through the setup.

Does everyone have keys in Clarity?

Has everyone cloned the repository and built the contracts?

Does everyone have the client installed? What is the version number for the Client?

Outcome:

Action items

For Help - go to Discord: https://discord.gg/mpZ9AYD

Decisions