# Get Started with Casper ## 1. Create and deploy a simple, smart contract with cargo casper and cargo test * Created sample project ![](https://i.imgur.com/x5XCvoG.png) * Local network compilation ![](https://i.imgur.com/Au6OUzV.png) * Local network started ![](https://i.imgur.com/sq6vtZt.png) ## 2 Complete one of the existing tutorials for writing smart contracts Complete Multi-Signature Tutorial * Compile contract ![](https://i.imgur.com/UC7b1y9.png) * Start local network ![](https://i.imgur.com/IDkqyuH.png) * View faucet account ![](https://i.imgur.com/gu41W4n.png) * Running tests ![](https://i.imgur.com/2L45KlG.png) ![](https://i.imgur.com/UgBzKwW.png) ![](https://i.imgur.com/y00kSoN.png) ![](https://i.imgur.com/l2KGG7q.png) ## 3 Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios **Implement Scenario 2** In this example, you have two keys. One key can only perform deployments, while the second key can perform key management and deployments. The key with account address a1 can deploy and make account changes, but the second key with account address b2 can only deploy. * Write scenario ``` const keyManager = require('./key-manager'); // In this example, you have two keys. One key can only perform deployments, // while the second key can perform key management and deployments. // The key with account address a1 can deploy and make account changes, but the second key // with account address b2 can only deploy. (async function () { // 1) Set weight of `mainAccount` to 2 // 2) Set key management Threshold to 2 // 3) Set deploy threshold to 1 // 4) Add new key with weight 1 (deploy allowed) let deploy; // 0. Initial state of the account. // There should be only one associated key (faucet) 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); // deployment and management let deployAccount = masterKey.deriveIndex(2); // only for deployment 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 2 console.log("\n1. Set faucet's weight to 2\n"); deploy = keyManager.keys.setKeyWeightDeploy(mainAccount, mainAccount, 2); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); // 2) Set Keys Management Threshold to 2. console.log("\n2. Set Keys Management Threshold to 2\n"); deploy = keyManager.keys.setKeyManagementThresholdDeploy(mainAccount, 2); 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); // 4) Add first new key with weight 1 (first account). console.log("\n4. Add first new key with weight 1.\n"); deploy = keyManager.keys.setKeyWeightDeploy(mainAccount, deployAccount, 1); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); })(); ``` * Run scenario ![](https://i.imgur.com/BwJBrPf.png) ![](https://i.imgur.com/7YT8IuF.png) ![](https://i.imgur.com/aUSXwWk.png) ![](https://i.imgur.com/dmV3SSM.png) ![](https://i.imgur.com/iqQIHwm.png) ## 4. Learn to transfer tokens to an account on the Casper Testnet. Check out this documentation. I have completed the transfer via cli client source: **01e19973969d75ec68492bf08be3bc638662fdf994019d97e93f26e4ccec0748e8** target: **01d1b47d965e2bdf58b838cf8be04674c68a2913a956287cbbae4620389e851c43** Transfer deploy: https://testnet.cspr.live/deploy/65d53a88ee3f86c7047bf5048088108006d26a579f12b9ce8230601974ef640c * Make a transfer ![](https://i.imgur.com/6mRqS9y.png) * Query transfer details![](https://i.imgur.com/cOztvpZ.png) ## 5. Learn to Delegate and Undelegate on the Casper Testnet. Check out these instructions. I have completed the delegate and undelegate operations via cli client Validator: **017d96b9a63abcb61c870a4f55187a0a7ac24096bdb5fc585c12a686a4d892009e** Delegator: **01e19973969d75ec68492bf08be3bc638662fdf994019d97e93f26e4ccec0748e8** Delegate deploy: https://testnet.cspr.live/deploy/6646d81de6b2243525f6f509a02b153a5b020d4f2649d3c7ca64cc3e1cdd82cc Undelegate deploy: https://testnet.cspr.live/deploy/5a9aed433d0fefeb8317b9f1441cc3f095df3bca10aef74c250eb0491a1edda3 * Delegate 5 CSPR ![](https://i.imgur.com/J6s4IOt.png) * Undelegate 3 CSPR![](https://i.imgur.com/BmgUC2R.png)