Video recording of the session
Participants
Thomas (LedgerLeap)
Goals
Use the Docker ‘hack’ to create a local network
Enable Highway Option and set Node parameters. Start CLarity.
Start nodes. Stop nodes. Deploy ‘Counter_Define’ contract.
.Demonstrate passing of complex arguments to sessions code (a collection of tuples consisting of
PublicKey
andU512
)Query the state using CLI
Shutdown the network.
We will record the session.
Pre-Requisites
Clone the repository on your machine or ‘Pull’ the latest dev
git clone https://github.com/CasperLabs/CasperLabs.git git pull
2. Install docker and docker compose if required
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 docker pull casperlabs/client:dev // Remove any old network running docker network rm casperlabs // Install the client curl -O https://repo.casperlabs.io/casperlabs/repo/dev/casperlabs-client_0.14.0_all.deb
4. Export CL_VERSION to dev
export CL_VERSION=dev
5. Set up your Casperlabs network and Set Highway Environment variable
export CL_HIGHWAY_ENABLED=true // Default number of nodes is 3. // The default values for era length and other Highway parameters can be found in highway-env.sh cd hack/docker CL_HIGHWAY_INIT_ROUND_EXPONENT=14 make node-0/up CL_HIGHWAY_INIT_ROUND_EXPONENT=14 make node-1/up CL_HIGHWAY_INIT_ROUND_EXPONENT=14 make node-2/up //Start CLarity and Grafana make up // You can view CLarity at at https://localhost:8443 (for my aws instance https://172.31.13.204:8443/#/explorer)
11. Build example contracts
// Navigate to execution-engine subdirectory of CasperLabs git repo cd ~/CasperLabs/execution-engine make setup make build-example-contracts export PRV_KEY=~/CasperLabs/hack/docker/keys/faucet-account/account-private.pem export PUB_KEY=~/CasperLabs/hack/docker/keys/faucet-account/account-public.pem cd ~/Casperlabs/hack/docker export AC_ID="$(cat ~/CasperLabs/hack/docker/keys/faucet-account/account-id-hex)" export HOST=localhost
12. Deploy Transfer to Multiple Accounts contract
// Deploy the batched transfer smart contract export TRANSFER_BATCH_WASM=~/CasperLabs/execution-engine/target/wasm32-unknown-unknown/release/transfer_to_account_batch.wasm casperlabs-client --host $HOST deploy --private-key $PRV_KEY --payment-amount 10000000 --session $TRANSFER_BATCH_WASM // Call the transfer contract using the name it was installed under in the previous deploy. // Notice that here we are using xargs to allow passing the contents of a file as arguments // of our deploy (in the file we specify the public keys of the accounts to transfer to and // the amounts to send). // Also see the contents of the file specifying transfers export ARGS=~/CasperLabs/execution-engine/contracts/examples/transfer-to-account-batch/transfer_batch_args.json cat $ARGS xargs --null --arg-file $ARGS casperlabs-client --host $HOST deploy --private-key $PRV_KEY --payment-amount 10000000 --session-name transfer_batch --session-args // Check the deploy status. You may have to wait for the deploy to get finalized. casperlabs-client show-deploy 2e423a1a2a559215d08a1cbab18f692fdca0409a50f7dd2df542f2b708683ed8 // Query the balances to verify the transfer casperlabs-client --host $HOST balance --address $ADDRESS --block-hash $BLOCK_HASH // $BLOCK_HASH is the hash of the block that included the transfer call. We can get thsi from CLarity or using CLI casperlabs-client --host $HOST show-deploy $DEPLOY_HASH | grep block_hash -m 1
To cleanup the network stopping and removing all containers run the command make clean
.
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 with ROUND_EXPONENT=14 | Using the Docker hack, set up a local network Start CLarity and Grafana |
To remove old networks use: make clean |
Outcome:
Highway network of 3 nodes with
CL_HIGHWAY_INIT_ROUND_EXPONENT=14
was successfully set up and run.
Action items
For Help - go to Discord: https://discord.gg/mpZ9AYD
Decisions
File a bug for the orphaned block behavior observed on node restarting.