# Getting started with Casper This is a document about my implementation of the five tasks for gitcoin bounty, [Get Started With Casper](https://gitcoin.co/issue/casper-network/gitcoin-hackathon/29/100026611). ## 1. Create and deploy a simple, smart contract [with cargo casper and cargo test](https://docs.casperlabs.io/en/latest/dapp-dev-guide/setup-of-rust-contract-sdk.html) This is about building my first smart contract on the casper network. The sub task includes * Installing rust, since I didn't have it before. * Install `cargo-casper` with rust package manager, `cargo`. * Create the project which I named `first_project` * Compile to `WebAssembly` because that's what casper blockchain uses in its runtime environment. * Build and test the contract. **Below are screenshot of building the contract and the result of the test.** ![A screenshot of building the contract](https://i.imgur.com/sfgLMRP.png) ![A screenshot of testing the contract](https://i.imgur.com/eazuefU.png) ## 2. Complete one of the [existing tutorials](https://docs.casperlabs.io/en/latest/dapp-dev-guide/tutorials/index.html) for writing smart contracts I choose the [ERC-20](https://docs.casperlabs.io/en/latest/dapp-dev-guide/tutorials/erc20/index.html) because it sounds familiar. * Prepare by cloning the [erc20 repo](https://github.com/casper-ecosystem/erc20), and run make commands to compile and test contracts. * Read the code explanation. **It's hard to follow because the files/directory the in repo has changed, the tutorial needs to be updated,** ![Implementation of ERC-20](https://i.imgur.com/Z3AnpHT.png) ## 3. Demonstrate [key management concepts](https://docs.casperlabs.io/en/latest/dapp-dev-guide/tutorials/multi-sig/index.html) by modifying the client in the Multi-Sig tutorial to address one of the [additional scenarios](https://docs.casperlabs.io/en/latest/dapp-dev-guide/tutorials/multi-sig/examples.html) I hate this part because of `Error: Cannot open an HTTP server: socket.error reported AF_UNIX path too long`. Had issue with this until I moved working directory to Home. Oh, and you made the mistake of referencing `key-manager.js` instead of `scenario-atomic.js`. I choose scenario 1. All weights are defaulted to 1, so I just ran 3 tasks with mainAccount only. * Transfer to secondAccount (which does not exist). * Add firstAccount * And remove the firstAccount Below is the code to achieve those tasks. ![Code for multi sig](https://i.imgur.com/at8Bs7S.png) ## 4. Learn to transfer tokens to an account on the Casper Testnet. Check out this documentation. I made transfer with casper-client CLI ![Transfer command](https://i.imgur.com/3Op6I6Q.png) ## 5. Learn to Delegate and Undelegate on the Casper Testnet. Check out these instructions. Pretty easy to delegate and undelegate on casper testnet and below are the screenshots after completion. ![Screenshot after delegating](https://i.imgur.com/E1tHqNV.png) ![Screenshot after undelegating](https://i.imgur.com/AHNDzYp.png)