Casper Hackathon
# Submission 1: Create and deploy a simple, smart contract with cargo casper and cargo test
Build the Contract
The step to compile the smart contract into WASM. Inside the contract folder, run the following command:
```
cd contract
cargo build --release
```
Test the Contract
In addition to creating the contract, the Casper crate also automatically created sample tests in the my-project/tests folder.
```
cd ..
make test
```
![](https://i.imgur.com/fBM5rhB.png)
Writing Smart Contract with AssemblyScipt
Compile to WASM - To compile the contract to WASM, use npm to run the asbuild script from the project root:
`npm run asbuild`
![](https://i.imgur.com/eif5Ols.png)
Local Network Testing
Installing a Virtual Environment
Run the following commands to set it up
`source env/bin/activate`
Activate the NCTL environment with the following command.
`source casper-node/utils/nctl/activate`
Compile the NCTL binary scripts.
`nctl-compile`
Spin up the network
`nctl-assets-setup && nctl-start`
![](https://i.imgur.com/yBFuaHH.png)
The Casper Client
Run the commands below to install the client
```
rustup toolchain install nightly
cargo +nightly-2021-06-17 install casper-client --locked
```
![](https://i.imgur.com/tRGWWfl.png)
Sending a Deployment to the Testnet
![](https://i.imgur.com/dW0jE3J.png)
Check to see that the contract executed properly, and that the block was finalized.
![](https://i.imgur.com/B8Um5WC.png)
# Submission 2: Complete one of the existing tutorials for writing smart contracts
## Multi-Signature Tutorial
Compile the smart contract and create the WASM file using these commands:
```
cd contract
cargo build --release
```
Navigate to your casper-node folder and run the following NCTL commands.
```
nctl-compile
nctl-assets-setup && nctl-start
```
![](https://i.imgur.com/DkpGYV0.png)
See your faucet account details with the command below.
`nctl-view-faucet-account`
![](https://i.imgur.com/8RJ8W0z.png)
Testing the Client
Navigate to your /keys-manager/client folder and run the keys-manager using npm. Your WASM file’s path is relative to the client folder, so you need to run the file from here.
`npm run start:atomic`
```
(env) root@virtual-machine-57383-vps-eu:~/keys-manager/client# npm run start:atomic
> keys-manager@1.0.0 start:atomic
> node -r dotenv/config ./src/scenario-atomic.js
0.1 Fund main account.
Signed by: account-hash-7dc0c7c76d065cc1eaaf07d7407600f4da8c5cc5efcf710c81b768a229a3276b
Deploy hash: f558478cd45925a6bff4509fb4f9177ce40f532789cd172973ee7523cc4b3c46
Deploy result:
{
deploy: {
hash: 'f558478cd45925a6bff4509fb4f9177ce40f532789cd172973ee7523cc4b3c46',
header: {
account: '01c0e6b116f004c0983144a4f8e954724fdf8f244e943ecf7c102d4a7062882953',
timestamp: '2021-09-20T21:50:05.435Z',
ttl: '30m',
gas_price: 1,
body_hash: '4a1799c64196c3e0bf32aa32cbdf54ca1e7bde37f002161053c3924313f8f14a',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
[x]0.2 Install Keys Manager contract
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 5028804f39fdfe8543d5eda0ef1cd5e262d88d3e7808c4897881f8a33291326d
Deploy result:
{
deploy: {
hash: '5028804f39fdfe8543d5eda0ef1cd5e262d88d3e7808c4897881f8a33291326d',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:51:08.601Z',
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-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
1. Set faucet's weight to 3
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: bf63e550b6f7e9ac46f3a9bcf5d08fdf8366f549fa8e2a8d1c45c01a46077d57
Deploy result:
{
deploy: {
hash: 'bf63e550b6f7e9ac46f3a9bcf5d08fdf8366f549fa8e2a8d1c45c01a46077d57',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:52:14.753Z',
ttl: '30m',
gas_price: 1,
body_hash: '4ba0dcd4acb35af56d747d3160b1c3f617f71225de2b9ef2afa9f62da6ab80e8',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
2. Set Keys Management Threshold to 3
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 2dfeb0a54e1f9d588e79b643b787164073b570264cf00e06d4e5b6583c47b5a2
Deploy result:
{
deploy: {
hash: '2dfeb0a54e1f9d588e79b643b787164073b570264cf00e06d4e5b6583c47b5a2',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:53:19.783Z',
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-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
}
],
actionThresholds: { deployment: 1, keyManagement: 3 }
}
3. Set Deploy Threshold to 2.
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 9146fbf6b348bcf033776dd4c7d746181f42383e2bf6615f6272086d9cdc6bdd
Deploy result:
{
deploy: {
hash: '9146fbf6b348bcf033776dd4c7d746181f42383e2bf6615f6272086d9cdc6bdd',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:54:26.051Z',
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-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
4. Add first new key with weight 1.
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 9a37fc62899a7284fdd383d1935b986ca801d77eae94ea26b7f74724338eab91
Deploy result:
{
deploy: {
hash: '9a37fc62899a7284fdd383d1935b986ca801d77eae94ea26b7f74724338eab91',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:55:31.103Z',
ttl: '30m',
gas_price: 1,
body_hash: 'ececb8124ec2006ba0bfffdd0944333a4a9f1a4827dccbc14b51f673f37e5aba',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-13b084c65b95b6b6bf5abb1ad284d7e1432618650e26646fd9177eeb9cb32a69',
weight: 1
},
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
5. Add second new key with weight 1.
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: c21e334f1c4866c0aefc92992c1c424acf31d2e6bc18f54038ab37431ca3b378
Deploy result:
{
deploy: {
hash: 'c21e334f1c4866c0aefc92992c1c424acf31d2e6bc18f54038ab37431ca3b378',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:56:37.022Z',
ttl: '30m',
gas_price: 1,
body_hash: 'd174f5edca36a35f136ae22d53993c5b143a3d4277d39f18fb963dcfb73599a1',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-13b084c65b95b6b6bf5abb1ad284d7e1432618650e26646fd9177eeb9cb32a69',
weight: 1
},
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
},
{
accountHash: 'account-hash-3c9de90121d0f890dbe5ccd395aa6af79014150f767faf2e615679881adefb4e',
weight: 1
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
6. Make a transfer from faucet using the new accounts.
Signed by: account-hash-13b084c65b95b6b6bf5abb1ad284d7e1432618650e26646fd9177eeb9cb32a69
Signed by: account-hash-3c9de90121d0f890dbe5ccd395aa6af79014150f767faf2e615679881adefb4e
Deploy hash: 1602084b6b64d925fa9d5dc32efd86c4b2479c936d5d6b57317a12c653c489ba
Deploy result:
{
deploy: {
hash: '1602084b6b64d925fa9d5dc32efd86c4b2479c936d5d6b57317a12c653c489ba',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:57:41.877Z',
ttl: '30m',
gas_price: 1,
body_hash: '788ed788cebcff7507efd2c6d96fab0a33d148786d1e537173abd7fa8a9bb8c9',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object], [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-13b084c65b95b6b6bf5abb1ad284d7e1432618650e26646fd9177eeb9cb32a69',
weight: 1
},
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
},
{
accountHash: 'account-hash-3c9de90121d0f890dbe5ccd395aa6af79014150f767faf2e615679881adefb4e',
weight: 1
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
7. Remove the first account
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 3f9c23bfc9daa66c82cd883c92ba462e52bbab03a72ac6fdd1834295f7351265
Deploy result:
{
deploy: {
hash: '3f9c23bfc9daa66c82cd883c92ba462e52bbab03a72ac6fdd1834295f7351265',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:58:47.710Z',
ttl: '30m',
gas_price: 1,
body_hash: '650537485ccce59babdef80a179a081fff317fc7f85416ab9dfc8c361da34479',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
},
{
accountHash: 'account-hash-3c9de90121d0f890dbe5ccd395aa6af79014150f767faf2e615679881adefb4e',
weight: 1
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
}
8. Remove the second account
Signed by: account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b
Deploy hash: 4ab07f779a6a3a9bbeb7529f629077fbe23ee725626f05879117281c0dea3af1
Deploy result:
{
deploy: {
hash: '4ab07f779a6a3a9bbeb7529f629077fbe23ee725626f05879117281c0dea3af1',
header: {
account: '0203e3b192c2b810646b3e72380dadcbbf1fcfa979d92a5bf30c32ec11c7c0815fa4',
timestamp: '2021-09-20T21:59:53.572Z',
ttl: '30m',
gas_price: 1,
body_hash: '97a0f3f9d658d97e83f75651ae0e14370d26fa97bc9cb1a721e9e50a50cd6a54',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-72813c6cc22eeaa048959c92ba7fecc29e016ee74d5fad7db4fdd52bf3f12c26'
},
{
name: 'keys_manager_hash',
key: 'uref-2fa2c802bf6bf52fe3e491dedf385f21bc4ac001aefedcd6ee0b812492844e7e-007'
}
],
mainPurse: 'uref-85bb27fdf7456feef84cd239bf13cfd0812b5e845543c8378a1bf07ff3637651-007',
associatedKeys: [
{
accountHash: 'account-hash-398543480114926dc07bbee780bf5ed9bd50c3f6c6f146dfebf062c1d92cc36b',
weight: 3
}
],
actionThresholds: { deployment: 2, keyManagement: 3 }
```
> Additional Scenarios
# Submission 3: Demonstrate key management concepts
## Scenario 1: signing transactions with a single key
> Step 1: Make a new code to demo the scenario 1 and ~/keys-manager/client/src
The code is below:
```
(env) root@virtual-machine-57383-vps-eu:~/keys-manager/client# cat src/scenario_1.js
const keyManager = require("./key-manager");
const TRANSFER_AMOUNT = process.env.TRANSFER_AMOUNT || 2500000000;
(async function () {
let deploy;
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);
})();
```
> Step 2: Add the scenario 1 location to package.json
Run the command below to demo the srcipt:
`npm run start:scenario_1`
```
root@virtual-machine-57383-vps-eu:~/keys-manager/client# npm run start:scenario_1
> keys-manager@1.0.0 start:scenario_1
> node -r dotenv/config ./src/scenario_1.js
0.1 Fund main account.
Signed by: account-hash-7dc0c7c76d065cc1eaaf07d7407600f4da8c5cc5efcf710c81b768a229a3276b
Deploy hash: 1be513bccdea3b39aaf28801884fd9fd0ca259565c06fad8932c19e65eac49be
Deploy result:
{
deploy: {
hash: '1be513bccdea3b39aaf28801884fd9fd0ca259565c06fad8932c19e65eac49be',
header: {
account: '01c0e6b116f004c0983144a4f8e954724fdf8f244e943ecf7c102d4a7062882953',
timestamp: '2021-09-20T21:57:22.039Z',
ttl: '30m',
gas_price: 1,
body_hash: 'a8af2eb04df2b7866bf2cfa2eeb5f8ca5ad51e86a3542d5fb17f1ceb270993ff',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
namedKeys: [],
mainPurse: 'uref-1b7970f8e50c3a8bd04b2162d20ea196d0ecccf0376febb5c78689d04bca9838-007',
associatedKeys: [
{
accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
[x]0.2 Install Keys Manager contract
Signed by: account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412
Deploy hash: 8c5870e6bb7aeaa524746310e6354ccb51d1f5b9b97fbe2dd50a9897ce5adb11
Deploy result:
{
deploy: {
hash: '8c5870e6bb7aeaa524746310e6354ccb51d1f5b9b97fbe2dd50a9897ce5adb11',
header: {
account: '0203296ef0603f57475781be750f119eb96abb95e98290d12db837625f250ba183cf',
timestamp: '2021-09-20T21:58:27.132Z',
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-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-986e6491f1c0ae6a31a2953e258f1797c95166459d939579cf695b1f9d6afa06'
},
{
name: 'keys_manager_hash',
key: 'uref-fe482ef92fef69ace8e44c746e4845c48033b68daf2c4d9fee50b8540f08df57-007'
}
],
mainPurse: 'uref-1b7970f8e50c3a8bd04b2162d20ea196d0ecccf0376febb5c78689d04bca9838-007',
associatedKeys: [
{
accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
1. Set faucet's weight to 1
Signed by: account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412
Deploy hash: 86c8316a12ecfb8f73b20df1c208eecb7f41eae905e8d156d24b8b6340bc3278
Deploy result:
{
deploy: {
hash: '86c8316a12ecfb8f73b20df1c208eecb7f41eae905e8d156d24b8b6340bc3278',
header: {
account: '0203296ef0603f57475781be750f119eb96abb95e98290d12db837625f250ba183cf',
timestamp: '2021-09-20T21:59:33.421Z',
ttl: '30m',
gas_price: 1,
body_hash: '1d55b69f94d0274e051f592947a5efd85515e3cf98df38d2cfff0ce62250aed8',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-986e6491f1c0ae6a31a2953e258f1797c95166459d939579cf695b1f9d6afa06'
},
{
name: 'keys_manager_hash',
key: 'uref-fe482ef92fef69ace8e44c746e4845c48033b68daf2c4d9fee50b8540f08df57-007'
}
],
mainPurse: 'uref-1b7970f8e50c3a8bd04b2162d20ea196d0ecccf0376febb5c78689d04bca9838-007',
associatedKeys: [
{
accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
2. Set Keys Management Threshold to 1
Signed by: account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412
Deploy hash: d56e0c1a534cef062fefc1afa391272cffa723c03a14c51cdcce60f1aac02188
Deploy result:
{
deploy: {
hash: 'd56e0c1a534cef062fefc1afa391272cffa723c03a14c51cdcce60f1aac02188',
header: {
account: '0203296ef0603f57475781be750f119eb96abb95e98290d12db837625f250ba183cf',
timestamp: '2021-09-20T22:00:38.300Z',
ttl: '30m',
gas_price: 1,
body_hash: 'fcbeef2291716fba37f9f05b6883b80e5985a3e7ccdd8e779cca24912b24871b',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-986e6491f1c0ae6a31a2953e258f1797c95166459d939579cf695b1f9d6afa06'
},
{
name: 'keys_manager_hash',
key: 'uref-fe482ef92fef69ace8e44c746e4845c48033b68daf2c4d9fee50b8540f08df57-007'
}
],
mainPurse: 'uref-1b7970f8e50c3a8bd04b2162d20ea196d0ecccf0376febb5c78689d04bca9838-007',
associatedKeys: [
{
accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
3. Set Deploy Threshold to 1.
Signed by: account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412
Deploy hash: 01534126bf3b963e5f228c0746b602de67de438e47ad9b9268296a292a43c220
Deploy result:
{
deploy: {
hash: '01534126bf3b963e5f228c0746b602de67de438e47ad9b9268296a292a43c220',
header: {
account: '0203296ef0603f57475781be750f119eb96abb95e98290d12db837625f250ba183cf',
timestamp: '2021-09-20T22:01:44.222Z',
ttl: '30m',
gas_price: 1,
body_hash: '4807b024a8e1e7c7d1da5a9101a21f38303d4689905d88d4585eec852fd7216b',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-986e6491f1c0ae6a31a2953e258f1797c95166459d939579cf695b1f9d6afa06'
},
{
name: 'keys_manager_hash',
key: 'uref-fe482ef92fef69ace8e44c746e4845c48033b68daf2c4d9fee50b8540f08df57-007'
}
],
mainPurse: 'uref-1b7970f8e50c3a8bd04b2162d20ea196d0ecccf0376febb5c78689d04bca9838-007',
associatedKeys: [
{
accountHash: 'account-hash-51787f838d0887e9939bd50dcfe4b97f248d9ed9fa3b8ce5157416a68c201412',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
```
# Submission 4: Learn to transfer tokens to an account on the Casper Testnet
Send the transfer
![](https://i.imgur.com/Tv0uG3Q.png)
Deploy the transfer
![](https://i.imgur.com/7v8RReC.png)
# Submission 5: Learn to Delegate and Undelegate on the Casper Testnet
Delegate the token
![](https://i.imgur.com/zjBU9h1.png)
![](https://i.imgur.com/9PbHzkq.png)
Undelegate the token
![](https://i.imgur.com/gnEcyYr.png)
![](https://i.imgur.com/BE19LRr.png)