# Casper Hackathon
## Task 1: Create and deploy a simple, smart contract with cargo casper and cargo test
Casper Node Deployment
![](https://i.imgur.com/WgmGray.png)
Contract Deployment
![](https://i.imgur.com/ZHvxjWY.png)
Check Deployment Status
![](https://i.imgur.com/bKcdkVB.png)
```
{
"id": -6102138056324616095,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy_hash": "c74962134b00deb9826f5649a3600c36651618d384ec769bebb0abcc7f378d7a"
}
}
(env) root@casper-janeisabelmw:~# casper-client get-deploy --node-address http://161.97.77.69:7777 c74962134b00deb9826f5649a3600c36651618d384ec769bebb0abcc7f378d7a
{
"id": 4949457737980343642,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy": {
"approvals": [
{
"signature": "[130 hex chars]",
"signer": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed"
}
],
"hash": "c74962134b00deb9826f5649a3600c36651618d384ec769bebb0abcc7f378d7a",
"header": {
"account": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed",
"body_hash": "47de396bf9d2171ffda855bae540dfc7070dca083f835caf1859bb99e687635f",
"chain_name": "casper-test",
"dependencies": [],
"gas_price": 1,
"timestamp": "2021-09-20T19:43:17.321Z",
"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": []
}
}
```
## Task 2: Complete one of the existing tutorials for writing smart contracts
> Multi-Signature Tutorial
Check Faucet Account
![](https://i.imgur.com/7eGNAXn.png)
> Exploring the Client Code
![](https://i.imgur.com/CVxkzCo.png)
```
> keys-manager@1.0.0 start:atomic
> node -r dotenv/config ./src/scenario-atomic.js
0.1 Fund main account.
Signed by: account-hash-19d38788088de2aeb904008e0f893b951ba3295194d909dbfa609e14f928d70c
Deploy hash: fb5bcd7727deb317056414647fdc4c6faf129162a90070f94d77864784d518de
Deploy result:
{
deploy: {
hash: 'fb5bcd7727deb317056414647fdc4c6faf129162a90070f94d77864784d518de',
header: {
account: '011355f2fd72f835496b79c9db8ffc94fb04017182518f276051aaede89b372572',
timestamp: '2021-09-20T19:50:07.544Z',
ttl: '30m',
gas_price: 1,
body_hash: 'c4571803c46226223d5a284ded90a6ce29b7d597f2102d8f508bf5e159360db1',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
[x]0.2 Install Keys Manager contract
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 0297d6bce282fe12c18f71c9ecfba7043d3d8b7288fb939e2eb251061c3cde1c
Deploy result:
{
deploy: {
hash: '0297d6bce282fe12c18f71c9ecfba7043d3d8b7288fb939e2eb251061c3cde1c',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:51:12.126Z',
ttl: '30m',
gas_price: 1,
body_hash: '8b75c87f0c5c33503df86050553e6a490fdee8d5154d9eececdc7c22618217c8',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { ModuleBytes: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
1. Set faucet's weight to 3
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 1e03cea03e5bdc66390dcf9bd77c50659360916dbb761d4889154ab24352dfb7
Deploy result:
{
deploy: {
hash: '1e03cea03e5bdc66390dcf9bd77c50659360916dbb761d4889154ab24352dfb7',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:52:18.189Z',
ttl: '30m',
gas_price: 1,
body_hash: 'eb54606652a8ecab8b66805de49da009a29f0e74cd0c91b70f2365040e986388',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
2. Set Keys Management Threshold to 3
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: b9de1beaa18bb66c86c8e76f561d7cb87a1aadb7005208060d40ef9ccf5bbb72
Deploy result:
{
deploy: {
hash: 'b9de1beaa18bb66c86c8e76f561d7cb87a1aadb7005208060d40ef9ccf5bbb72',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:53:23.694Z',
ttl: '30m',
gas_price: 1,
body_hash: '3f3394304ff22fe422511e62eed631bc501385f67fdd1fe71891f7d375550324',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 1, keyManagement: 3 }
}
3. Set Deploy Threshold to 2.
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 8fbb45943055ded0704b4ef2922c3ab277aade1141975ae8b07f4c07ffbd8e93
Deploy result:
{
deploy: {
hash: '8fbb45943055ded0704b4ef2922c3ab277aade1141975ae8b07f4c07ffbd8e93',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:54:29.106Z',
ttl: '30m',
gas_price: 1,
body_hash: '609e820d1eb41cd0fe90e6c5c4cf179afd2c9d9ba19bb0f21ca310a85450f228',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
4. Add first new key with weight 1.
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 2136cda4f58775aadb91f2bd6ca4ff97c1cf0ba30ba6e47af6419697d1e4ceab
Deploy result:
{
deploy: {
hash: '2136cda4f58775aadb91f2bd6ca4ff97c1cf0ba30ba6e47af6419697d1e4ceab',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:55:34.438Z',
ttl: '30m',
gas_price: 1,
body_hash: 'e805d15be9bac0a95ff09442cfed392681f0add3172cf46efc088e6e32d454c2',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-d4e8cea764446723e272b27f8462216bc9943d35e7b42c73f3ee394ce6b4ee7a',
weight: 1
},
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
5. Add second new key with weight 1.
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 55855bc739c4769ae79a8c883731e31a1d838812723f67443b93db2fa356f83e
Deploy result:
{
deploy: {
hash: '55855bc739c4769ae79a8c883731e31a1d838812723f67443b93db2fa356f83e',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:56:40.613Z',
ttl: '30m',
gas_price: 1,
body_hash: '0770cb22f7a4a6890c41d6ef327655885c8bbd57de56733fef28a925db9faac4',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-1c8a8dd6bd40d02f700cca9bf4b8da6fcc8b592784a24dbd3cb6d5fd0e3671f8',
weight: 1
},
{
accountHash: 'account-hash-d4e8cea764446723e272b27f8462216bc9943d35e7b42c73f3ee394ce6b4ee7a',
weight: 1
},
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
6. Make a transfer from faucet using the new accounts.
Signed by: account-hash-d4e8cea764446723e272b27f8462216bc9943d35e7b42c73f3ee394ce6b4ee7a
Signed by: account-hash-1c8a8dd6bd40d02f700cca9bf4b8da6fcc8b592784a24dbd3cb6d5fd0e3671f8
Deploy hash: b896d7087b8d651149575f003945a26494c6c316b6088517b57a923bc4778112
Deploy result:
{
deploy: {
hash: 'b896d7087b8d651149575f003945a26494c6c316b6088517b57a923bc4778112',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:57:45.859Z',
ttl: '30m',
gas_price: 1,
body_hash: '4010a79508438a8ccc1bc529d26beef0974df2d6e50d58ecfeb0fa9629d1a174',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object], [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-1c8a8dd6bd40d02f700cca9bf4b8da6fcc8b592784a24dbd3cb6d5fd0e3671f8',
weight: 1
},
{
accountHash: 'account-hash-d4e8cea764446723e272b27f8462216bc9943d35e7b42c73f3ee394ce6b4ee7a',
weight: 1
},
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
7. Remove the first account
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 7ae726f03d939bfd05b7c92971f49ea1ba6226c8d4ff8b84419459f831daae82
Deploy result:
{
deploy: {
hash: '7ae726f03d939bfd05b7c92971f49ea1ba6226c8d4ff8b84419459f831daae82',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:58:51.153Z',
ttl: '30m',
gas_price: 1,
body_hash: 'd1ce76ce01d60bff282545d70a03ba60277fef6ea05d7f36b94a9c7f65bb3f32',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-1c8a8dd6bd40d02f700cca9bf4b8da6fcc8b592784a24dbd3cb6d5fd0e3671f8',
weight: 1
},
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
8. Remove the second account
Signed by: account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44
Deploy hash: 7c9c11b133d9acd6bea8d4980f685fde9815b29a014e3573d4cb2be347815131
Deploy result:
{
deploy: {
hash: '7c9c11b133d9acd6bea8d4980f685fde9815b29a014e3573d4cb2be347815131',
header: {
account: '020299f95ee8fb2be132eb6498839cba8226622bf1c4c462d4dd56f3a49727976337',
timestamp: '2021-09-20T19:59:56.340Z',
ttl: '30m',
gas_price: 1,
body_hash: '646e2b2df138f0dd24e53466693671f8c121ea33263bafdc395816c80b4e3bb5',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-4c7d5e4c670c9a25b203b2d0c626c0ee855f2f296bd7b3bcfd83517a8898e44c'
},
{
name: 'keys_manager_hash',
key: 'uref-707b31c14fb7118daf5e8b478f725be22bd5ca7885dd7273a361d12c0687a3f8-007'
}
],
mainPurse: 'uref-b9444401f4285869e3e31f784c80dbb6985020d2d4d195b617e36c7b46c9a8aa-007',
associatedKeys: [
{
accountHash: 'account-hash-de75b97e1cd42b1a3b4ee7ee6795840f2f3b57eefc6d92e7fe3e9a0855234a44',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
```
## Task 3: Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios
**Scenario 3: signing transactions with multiple keys**
Create Scenario 3 Script for running the Key Management concepts
```
const keyManager = require('./key-manager');
const TRANSFER_AMOUNT = process.env.TRANSFER_AMOUNT || 500000000000;
(async function () {
let deploy;
let masterKey = keyManager.randomMasterKey();
let mainAccount = masterKey.deriveIndex(1);
let firstAccount = masterKey.deriveIndex(2);
let secondAccount = masterKey.deriveIndex(3);
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. Add additional key with weight 1 .
console.log("\n1. Add additional key with weight 1.\n");
deploy = keyManager.keys.setKeyWeightDeploy(mainAccount, firstAccount, 1);
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. Make a transfer from faucet using the new accounts.
console.log("\n3. Make a transfer from faucet to secondAccount.\n");
deploy = keyManager.transferDeploy(mainAccount, secondAccount, TRANSFER_AMOUNT);
await keyManager.sendDeploy(deploy, [firstAccount]);
await keyManager.printAccount(mainAccount);
// 4. Add new key with weight 1.
console.log("\n4. Add new key with weight 1\n");
deploy = keyManager.keys.setKeyWeightDeploy(mainAccount, secondAccount, 1);
await keyManager.sendDeploy(deploy, [mainAccount, firstAccount]);
await keyManager.printAccount(mainAccount);
})();
```
File pakage.json => Add the scenario_3.js directory to package.json for calling script
Run the script
`npm run start:scenario_3`
![](https://i.imgur.com/3DTQffs.png)
## Task 4: Learn to transfer tokens to an account
```
(env) root@casper-janeisabelmw:~# casper-client transfer --transfer-id 0 --node-address http://161.97.77.69:7777 --amount 250000000000 --secret-key /root/key/secret_key.pem --chain-name casper-test --target-account 01dbda3859558b5d4db04014826691b008ffed7689827b67c1033199fc67bb336c --payment-amount 50000000000
{
"id": -4825207245158508137,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy_hash": "51005bc56a290bbc89fabbfd5afdebc944aba277088f1882dbb5a27c96b94dd6"
}
}
```
```
(env) root@casper-janeisabelmw:~# casper-client get-deploy --node-address http://95.179.158.96:7777 51005bc56a290bbc89fabbfd5afdebc944aba277088f1882dbb5a27c96b94dd6
{
"id": 2519281533440806254,
"jsonrpc": "2.0",
"result": {
"api_version": "1.3.2",
"deploy": {
"approvals": [
{
"signature": "[130 hex chars]",
"signer": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed"
}
],
"hash": "51005bc56a290bbc89fabbfd5afdebc944aba277088f1882dbb5a27c96b94dd6",
"header": {
"account": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed",
"body_hash": "3e55be6235fb072462633d9788a2240c77b10abb6933e66cede4b5a6fedde1ba",
"chain_name": "casper-test",
"dependencies": [],
"gas_price": 1,
"timestamp": "2021-09-20T20:18:36.549Z",
"ttl": "30m"
},
"payment": {
"ModuleBytes": {
"args": [
[
"amount",
{
"bytes": "0500743ba40b",
"cl_type": "U512",
"parsed": "50000000000"
}
]
],
"module_bytes": ""
}
},
"session": {
"Transfer": {
"args": [
[
"amount",
{
"bytes": "05004429353a",
"cl_type": "U512",
"parsed": "250000000000"
}
],
[
"target",
{
"bytes": "4ba25af2c0244acae3bedc127d0409acee487ad82873617f35cbf519ea8beace",
"cl_type": {
"ByteArray": 32
},
"parsed": "4ba25af2c0244acae3bedc127d0409acee487ad82873617f35cbf519ea8beace"
}
],
[
"id",
{
"bytes": "010000000000000000",
"cl_type": {
"Option": "U64"
},
"parsed": 0
}
]
]
}
}
},
"execution_results": []
}
}
```
![](https://i.imgur.com/0F7lvrE.png)
## Task 5: Learn to Delegate and Undelegate on the Casper Testnet
**Delegate to Validator**
![](https://i.imgur.com/jdWQFL8.png)
![](https://i.imgur.com/9zDMVJU.png)
**Undelegate from Validator**
![](https://i.imgur.com/oJ2qScn.png)
![](https://i.imgur.com/eupESvG.png)