# Get Started With Casper ## 1.Create and deploy a simple, smart contract with cargo casper and cargo test * Installed all prerequisites following this guide: https://docs.casperlabs.io/en/latest/dapp-dev-guide/setup-of-rust-contract-sdk.html * Created a first sample project to see how it works ![](https://i.imgur.com/M2lWySQ.png) * Set up a local casper network following this guide: https://docs.casperlabs.io/en/latest/dapp-dev-guide/setup-nctl.html ![](https://i.imgur.com/iDLaSWy.png) ![](https://i.imgur.com/eajW0PB.png) ## 2. Complete one of the existing tutorials for writing smart contracts I completed the “Multi-signature Tutorial”. * Building the Smart Contract ![](https://i.imgur.com/6u7GsqC.png) * Running the Tests ![](https://i.imgur.com/p1aPFBH.png) ![](https://i.imgur.com/Y5eTYD0.png) ## 3. Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios Scenario 1. Signing transactions with a single key Code: ``` const keyManager = require("./key-manager"); const TRANSFER_AMOUNT = process.env.TRANSFER_AMOUNT || 2500000000; (async function () { // In this example, only one key can sign transactions in // the name of this account. The key is “account-hash- // a1…” under the associated_keys. If you sign the // transaction using “account-hash-a1…”, the signed // transaction will have a weight equal to 1. For // deployments or key management, the weight required is also // 1. Therefore, the associated key meets the deployment and // key management thresholds and can perform both actions. // To achive the task, we will: // 1. Set mainAccount's weight to 1. // 2. Set Keys Management Threshold to 1. // 3. Set Deploy Threshold to 1. let deploy; // 0. Initial state of the account. // There should be only one associated key (fuacet) with weight 1. // Deployment Threshold should be set to 1. // Key Management Threshold should be set to 1. let masterKey = keyManager.randomMasterKey(); let mainAccount = masterKey.deriveIndex(1); console.log("\n0.1 Fund main account.\n"); await keyManager.fundAccount(mainAccount); await keyManager.printAccount(mainAccount); console.log("\n[x]0.2 Install Keys Manager contract"); deploy = keyManager.keys.buildContractInstallDeploy(mainAccount); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); // 1. Set mainAccount's weight to 1 console.log("\n1. Set faucet's weight to 1\n"); deploy = keyManager.keys.setKeyWeightDeploy(mainAccount, mainAccount, 1); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); // 2. Set Keys Management Threshold to 1. console.log("\n2. Set Keys Management Threshold to 1\n"); deploy = keyManager.keys.setKeyManagementThresholdDeploy(mainAccount, 1); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); // 3. Set Deploy Threshold to 1. console.log("\n3. Set Deploy Threshold to 1.\n"); deploy = keyManager.keys.setDeploymentThresholdDeploy(mainAccount, 1); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); })(); ``` Final result: ![](https://i.imgur.com/1SqCXzE.png) ## 4.Learn to transfer tokens to an account on the Casper Testnet. Check out this documentation. ![](https://i.imgur.com/EzVmemr.png) ## 5.Learn to Delegate and Undelegate on the Casper Testnet. Check out these instructions. ### Delegate Stake ![](https://i.imgur.com/KsQzsTb.png) ![](https://i.imgur.com/zObL48W.png) ![](https://i.imgur.com/M1Wbiif.png) ![](https://i.imgur.com/qjGLG9t.png) ### Undelegate Stake ![](https://i.imgur.com/IZfBq41.png) ![](https://i.imgur.com/6roQTog.png) ![](https://i.imgur.com/vdIjI8W.png) ![](https://i.imgur.com/3a3eLHW.png)