Ervin Dimitri # Get Started With Casper Hackathon: The Friendly Hackathon: Start Building on Casper! # **Tasks** # 1. Create and deploy a simple, smart contract with cargo casper and cargo test I got some issues to test the smart contract, because it was missing wasm-unknown-unknown folder in Rust Wasm Path, so I had to add manually ![](https://i.imgur.com/tJAGBNf.png) Compiled and tested the smart contract successfully ![](https://i.imgur.com/32iEKK8.png) # 2. Complete one of the existing tutorials for writing smart contracts ## ERC-20 implementation Implement the ERC-20 standard for Casper ![](https://i.imgur.com/CJgWo1F.png) # 3. Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios After following the tutorial how to install all the required tools Here is the output: ![](https://i.imgur.com/xh7MDmt.png) ## Scenario 2: deploying with special keys 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. const keyManager = require('./key-manager'); const TRANSFER_AMOUNT = process.env.TRANSFER_AMOUNT || 2500000000; (async function () { // 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. // To achive the task, I will: // 1. Set Keys Management Threshold to 2. // 2. Set Deploy Threshold to 1. // 3. Set mainAccount's weight to 2. // 4. Add first new key with weight 1 (first account). let deploy; let masterKey = keyManager.randomMasterKey(); let mainAccount = masterKey.deriveIndex(1); let firstAccount = masterKey.deriveIndex(2); 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); // Deploy threshold is 1 const deployThereshold = 1; // Key Managment threshold is 2 const keyManagementThreshold = 2; const accounts = [ { publicKey: mainAccount.publicKey, weight: 2 }, { publicKey: firstAccount.publicKey, weight: 1 }, ]; console.log("\n[x] Update keys deploy."); deploy = keyManager.keys.setAll(mainAccount, deployThereshold, keyManagementThreshold, accounts); await keyManager.sendDeploy(deploy, [mainAccount]); await keyManager.printAccount(mainAccount); })(); Output: ![](https://i.imgur.com/FtZFsmN.png) # 4. Learn to transfer tokens to an account on the Casper Testnet. #### Account already funded with 1000 CSPR ![](https://i.imgur.com/oIE6WqJ.png) #### Transfering tokens from an accout to another ![](https://i.imgur.com/vlKuqrY.png) #### Successfully transferred 60 CSPR Transaction ID: 63e35be5d30aa32e5d813340ed0eaeaf90d63413c504740e250d0b9ff18a8955 ![](https://i.imgur.com/Kowu6Md.png) # 5. Learn to Delegate and Undelegate on the Casper Testnet. ## Delegate ![](https://i.imgur.com/lySIYMA.png) ![](https://i.imgur.com/kv7M5s6.png) Transaction ID: 1ae3b16ac085c2ebdbd8980729c6c4da51c9b90ea6f3c108f11eaf0c837393b4 ## Undelegate ![](https://i.imgur.com/lfpnlqH.png) ![](https://i.imgur.com/vVRC79x.png) Transaction ID: 733150213a248525b48f922a4e7e9e025b9f58581f32d08eda006077d5ca4d50