# Casper Gitcoin Answer ## Create and deploy a simple, smart contract **Prerequisites** Install the Rust programming language ![](https://i.imgur.com/cIVvL66.png) **Installing Dependencies** CMake ![](https://i.imgur.com/lwrfg8V.png) **Development Environment Setup** Compiling the contract to WASM ![](https://i.imgur.com/4vyFxlC.png) Test the Contract ![](https://i.imgur.com/WX82DGY.png) **Setting up the Network** Compile the NCTL binary scripts. ![](https://i.imgur.com/kWJxITf.jpg) Set up the assets required to run a local network ![](https://i.imgur.com/yeT6eos.jpg) **Deploying Contracts** The Casper Client ![](https://i.imgur.com/dw8QmIJ.png) Check the Client Version ![](https://i.imgur.com/IzxGhQu.png) **Sending a Deployment to the Testnet** ![](https://i.imgur.com/UftQ5Ya.png) **Check Deploy Status** ![](https://i.imgur.com/NV2Sd7e.jpg) ## Complete one of the existing tutorials for writing smart contracts ### Multi-Signature Tutorial is choosed for installation **Building the Smart Contract** ![](https://i.imgur.com/LJ2Efuc.png) **Setting up the Client** File .env look like ![](https://i.imgur.com/YFVGlKm.png) Install the JavaScript packages in the keys-manager/client folder ![](https://i.imgur.com/9OFL9R7.png) **Testing the Client** ![](https://i.imgur.com/NADvIml.jpg) ## Demonstrate key management concepts ### Scenario 1: signing transactions with a single key is choosed for installation ``` (async function () { 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); })(); ``` ![](https://i.imgur.com/6ZenYvN.png) ## Learn to transfer tokens to an account on the Casper Testnet. ### Transfer with CLI Send the transaction ![](https://i.imgur.com/QXgCH5P.png) Sign the transaction ![](https://i.imgur.com/XOqFQuh.jpg) ### Transfer with CSPR Portal ![](https://i.imgur.com/LkPMA3D.png) ## Learn to Delegate and Undelegate on the Casper Testnet ### Delegate ![](https://i.imgur.com/iA52MLL.png) ### Undelegate ![](https://i.imgur.com/b6TsGaG.png)