# Gitcoin for Casper
## 1 // Create and deploy a simple, smart contract
> Building a simple smart contract and the result is below
![](https://i.imgur.com/UtJ2wdT.png)
> Final Result
```
{
"id": 3056545300698198131,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy_hash": "e1d3022f0db9c53cfef623b5b32a4bca11a30585e3d8b475987ef796f36d905a"
}
}
```
> Part of checking purpose
![](https://i.imgur.com/Ul7KHvd.png)
> Final Result
```
{
"id": 3056545300698198131,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy_hash": "e1d3022f0db9c53cfef623b5b32a4bca11a30585e3d8b475987ef796f36d905a"
}
}
(env) root@gitcoin-ubuntu:~# casper-client get-deploy --node-address http://5.189.180.23:7777 e1d3022f0db9c53cfef623b5b32a4bca11a30585 e3d8b475987ef796f36d905a
{
"id": 883491213049394635,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy": {
"approvals": [
{
"signature": "[130 hex chars]",
"signer": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed"
}
],
"hash": "e1d3022f0db9c53cfef623b5b32a4bca11a30585e3d8b475987ef796f36d905a",
"header": {
"account": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed",
"body_hash": "47de396bf9d2171ffda855bae540dfc7070dca083f835caf1859bb99e687635f",
"chain_name": "casper-test",
"dependencies": [],
"gas_price": 1,
"timestamp": "2021-09-19T20:10:01.797Z",
"ttl": "30m"
},
"payment": {
"ModuleBytes": {
"args": [
[
"amount",
{
"bytes": "03809698",
"cl_type": "U512",
"parsed": "10000000"
}
]
],
"module_bytes": ""
}
},
"session": {
"ModuleBytes": {
"args": [],
"module_bytes": "[51990 hex chars]"
}
}
},
"execution_results": [
{
"block_hash": "674688eab14f967fabd7b615ee6bda9617b5eb0921a95ba3133bc9d17eb78c93",
"result": {
"Failure": {
"cost": "1383320",
"effect": {
"operations": [
{
"key": "hash-624dbe2395b9d9503fbee82162f1714ebff6b639f96d2084d26d944c354ec4c5",
"kind": "Read"
},
{
"key": "balance-b4f14f3aae5523d397b784be9547ea8153864f91cb8879209b8add1273392eea",
"kind": "Write"
},
{
"key": "balance-a9b97c0c0537ae2874759e06b863a3b82cf3593290206da8f5c6061c4a548d3f",
"kind": "Write"
},
{
"key": "hash-010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
"kind": "Read"
},
{
"key": "hash-8cf5e4acf51f54eb59291599187838dc3bc234089c46fc6ca8ad17e762ae4401",
"kind": "Read"
},
{
"key": "hash-9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
"kind": "Read"
},
{
"key": "balance-98d945f5324f865243b7c02c0417ab6eac361c5c56602fd42ced834a1ba201b6",
"kind": "Read"
}
],
"transforms": [
{
"key": "hash-9824d60dc3a5c44a20b9fd260a412437933835b52fc683d8ae36e4ec2114843e",
"transform": "Identity"
},
{
"key": "hash-010c3fe81b7b862e50c77ef9a958a05bfa98444f26f96f23d37a13c96244cfb7",
"transform": "Identity"
},
{
"key": "balance-98d945f5324f865243b7c02c0417ab6eac361c5c56602fd42ced834a1ba201b6",
"transform": "Identity"
},
{
"key": "hash-624dbe2395b9d9503fbee82162f1714ebff6b639f96d2084d26d944c354ec4c5",
"transform": "Identity"
},
{
"key": "hash-8cf5e4acf51f54eb59291599187838dc3bc234089c46fc6ca8ad17e762ae4401",
"transform": "Identity"
},
{
"key": "balance-b4f14f3aae5523d397b784be9547ea8153864f91cb8879209b8add1273392eea",
"transform": {
"AddUInt512": "10000000"
}
},
{
"key": "balance-a9b97c0c0537ae2874759e06b863a3b82cf3593290206da8f5c6061c4a548d3f",
"transform": {
"WriteCLValue": {
"bytes": "05e07c3913e7",
"cl_type": "U512",
"parsed": "992459980000"
}
}
}
]
},
"error_message": "ApiError::MissingArgument [2]",
"transfers": []
}
}
}
]
}
}
```
## 2 // Complete one of the existing tutorials for writing smart contracts
### A Counter Contract Tutorial
> Faucet Account Information
![](https://i.imgur.com/R7NaKbV.png)
> Final code
```
{
"api_version": "1.0.0",
"merkle_proof": "[2024 hex chars]",
"stored_value": {
"Account": {
"account_hash": "account-hash-287b7c85c95eaf24f5c759cc5fecd3c672ef418534dc9f9158a57c5be159d603",
"action_thresholds": {
"deployment": 1,
"key_management": 1
},
"associated_keys": [
{
"account_hash": "account-hash-287b7c85c95eaf24f5c759cc5fecd3c672ef418534dc9f9158a57c5be159d603",
"weight": 1
}
],
"main_purse": "uref-01cda9f013abc5dbc489d21a0f5bdcb4689982fc805d5433181e668013c89f65-007",
"named_keys": []
}
}
}
```
> State Root Hash
![](https://i.imgur.com/k82PTpT.png)
> Querying Network State
![](https://i.imgur.com/NTXhs89.png)
> Put Deploys (onto the Chain)
![](https://i.imgur.com/lfZ6MNf.png)
> Get Deploys (from the Chain)
![](https://i.imgur.com/Ko9s359.png)
> Deploy the Counter
![](https://i.imgur.com/GZLSmQd.png)
> Put the contract on the chain.
![](https://i.imgur.com/qHSurhB.png)
> Get status of deploy contract
![](https://i.imgur.com/9iLEzNU.png)
> View the Updated Network State
> Get the NEW state-root-hash:
![](https://i.imgur.com/ZgeHyHs.png)
> Get the network state:
![](https://i.imgur.com/81yBAHB.png)
> Increment the Counter
![](https://i.imgur.com/rruJ4jD.png)
> View the Updated Network State Again
> Get the NEW state-root-hash:
![](https://i.imgur.com/SJIWeSp.png)
> Get the network state, specifically for the count variable this time:
![](https://i.imgur.com/rshCvFN.png)
> Increment the Counter Again
![](https://i.imgur.com/ZY2meI6.png)
> View the Final Network State
> Get the NEW state-root-hash:
![](https://i.imgur.com/sYOlmGb.png)
> Get the network state, specifically for the count variable this time:
![](https://i.imgur.com/JFvzYCs.png)
## 3 // Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios
> Building the Smart Contract
![](https://i.imgur.com/w6seLZy.png)
> Setting up the Client
![](https://i.imgur.com/PI6zflx.png)
> Testing the Client
![](https://i.imgur.com/O7mrMWy.png)
### Scenario 3: signing transactions with multiple keys
Create a scenario_3.js. This script will be used for demo the scenario.
The script located at .src/
Finally, at the script location to package.json for calling at the running step.
When perform the script and here is the reult:
![](https://i.imgur.com/kUhdj11.png)
## 4 // Transfer tokens to an account
> Perform the transfer
![](https://i.imgur.com/5oRy6Ts.png)
> Transfer successfully
![](https://i.imgur.com/M7xxmV0.png)
## 5 // Delegate and Undelegate on the Casper Testnet
> Delegate on Casper Testnet will be performed below:
![](https://i.imgur.com/gQtCxKJ.png)
> Undelegate on Casper Testnet will be performed below:
![](https://i.imgur.com/XI4JshO.png)