Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Current »

Video of the afternoon session: https://youtu.be/yhkGWWO_I7k

Participants

Goals

  • Using the Docker ‘hack’ - create a local network.

  • Install the client on their local machine

  • Compile the contracts - we will deploy counter-define and then counter-call

  • Deploy to your local network

  • Observe effects

  • We will record the session.

Pre-Requisites

  1. Clone the repository on your machine

git clone https://github.com/CasperLabs/CasperLabs.git

2. Install docker and docker compose

docker: https://docs.docker.com/v17.09/engine/installation/
docker-compose: https://docs.docker.com/compose/install/

3. Pull the dev images from docker

docker pull casperlabs/node:dev
docker pull casperlabs/execution-engine:dev

4. Export CL_VERSION to dev

export CL_VERSION=dev

5. Ensure that your Docker Compose is up to date

6. Set up your Casperlabs network

docker create network casperlabs
make node-0

8. Bring the bootstrap up

make node-0/up

9. Now you can make more nodes.

make node-1/up node-2/up

10. To create a Clarity instance run

make up

Install the CasperLabs Client:

brew tap CasperLabs/CasperLabs
brew install CasperLabs_Client


Update: due to version mismatches please either build the client or use the tarball.

https://repo.casperlabs.io/casperlabs/repo/dev/casperlabs-client-0.11.0.tgz
tar -xvzf casperlabs-client-0.11.0.tgz
alias casperlabs-client=$PWD/casperlabs-client-0.11.0/bin/casperlabs-client

6. Compile the contracts

Navigate to the execution-engine folder to build the example smart contracts.

cd ~/CasperLabs/execution-engine
make setup
make build-example-contracts

Software Version (GitHash)

Docker tag: dev

What you need to know:

  • To simplify the process, we are deploying from the faucet account (we can skip funding an account to pay for the deployment)

Step by Step Plan

Title

Description

Notes

Verify pre-requisites

Check that everyone has managed to get through the setup.

See above

Set up a local 3 node network

Using the Docker hack, set up a local network

To remove old networks use:

make clean

Deploy counter-define

Propose a block

Deploy counter-call

Propose a block

Here we will deploy a contract to the local network to install it. Then we will call the contract using a separate transaction.

Counter Define deployment & Proposal

cd ~/CasperLabs/hack/docker

ACCOUNT_ID="$(cat keys/faucet-account/account-id-hex)"
casperlabs-client --host localhost --port 40401 deploy \
     --gas-price 1 \
     --from "$ACCOUNT_ID" \
     --session $PWD/../../execution-engine/target/wasm32-unknown-unknown/release/counter_define.wasm \
     --payment-amount 10000000 \
     --public-key keys/faucet-account/account-public.pem \
     --private-key keys/faucet-account/account-private.pem

casperlabs-client --host localhost --port-internal 40402 propose

Counter Call deployment

cd ~/CasperLabs/hack/docker

ACCOUNT_ID="$(cat keys/faucet-account/account-id-hex)"
casperlabs-client --host localhost --port 40401 deploy \
     --gas-price 1 \
     --from "$ACCOUNT_ID" \
     --session $PWD/../../execution-engine/target/wasm32-unknown-unknown/release/counter_call.wasm \
     --payment-amount 10000000 \
     --public-key keys/faucet-account/account-public.pem \
     --private-key keys/faucet-account/account-private.pem

casperlabs-client --host localhost --port-internal 40402 propose

  • Keep track of the number of times counter-call is executed so we can verify the output of the query later.

Propose a block

Call the client to propose a block

Same as above.

Obtain the block hash

Obtain the block hash for use in the state query

Call the client to get the block hash (can also tail the logs and see the block in the network)

casperlabs-client --host localhost --port 40401 show-blocks

Perform a state query

Using the gRPC

casperlabs-client --host localhost --port 40401 query-state \
    -t address \
    -k $ACCOUNT_ID \
    -p "counter/count" \
    --block-hash <block-hash-of the latest block>

Outcome:

  • The export needs to happen again if a new terminal is opened.

  • Make sure that you don’t have any old Docker containers floating around from old nodes.

  • Do not make a mistake when creating node-0 (Medha did node-o and it was problematic)

  • To add CLarity and GraphQL to the Docker network run:

    • make up

It won’t be possible to fund accounts using CLarity, but it is possible to observe what the deploy errors are.

  • We ran into problems with payment. Root cause - there IS a version difference with the client that matters. This will be resolved when Node 0.10 releases. In the meantime, grab the tarball or build the client from dev.

https://repo.casperlabs.io/casperlabs/repo/dev/casperlabs-client-0.10.0.tgz
tar -xvzf casperlabs-client-0.10.0.tgz
alias casperlabs-client=$PWD/casperlabs-client-0.10.0/bin/casperlabs-client

Action items

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

Decisions

  • No labels