---
# System prepended metadata

title: 'Task 1 Create and deploy a simple, smart contract'

---

# Task 1 Create and deploy a simple, smart contract

Install the Rust programming language 

![](https://i.imgur.com/Z8XUesE.png)

specify the target build as WebAssembly (wasm32)

![](https://i.imgur.com/M5YWs5x.png)

## Test the Contract

![](https://i.imgur.com/gL4g2p7.png)

## Compile to WASM

![](https://i.imgur.com/2rzZLus.png)

## Local Network Testing

![](https://i.imgur.com/Qvnmpcb.png)

## Deploying Contracts

![](https://i.imgur.com/yqUup6y.png)

**Check Deploy Status**

![](https://i.imgur.com/3dnn57e.png)

# Task 2 Complete one of the existing tutorials for writing smart contracts

> **Multi-Signature Tutorial**

## Building the Smart Contract

![](https://i.imgur.com/7Jz1baN.png)

## Testing the Client

```
(env) root@eanainsley2002sVM:~/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-fb80499714e7dffcb54c39c49584aa2fc1c1a1b0c38316a5475dec48e270ee66
Deploy hash: 996df5aa307e314dee666572604b6fe7a2591a7393575994556fcdc3be00405d
Deploy result:
{
  deploy: {
    hash: '996df5aa307e314dee666572604b6fe7a2591a7393575994556fcdc3be00405d',
    header: {
      account: '011edca3d11ba38676c7ee7791e9f558e3a9f9754f53e5e3be8144e1d52b6d0a17',
      timestamp: '2021-10-03T17:04:51.294Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '6d7a3db76d359a7501a4fb5f3ea3a5c037aa8e9e6f1f95b937f4090b7d1531e5',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { Transfer: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 1
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 1 }
}

[x]0.2 Install Keys Manager contract
Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: 0f33715c1c5f6f6b021d69558f714c0ddecf6832a3ac55ab9a7a3d81a49f9725
Deploy result:
{
  deploy: {
    hash: '0f33715c1c5f6f6b021d69558f714c0ddecf6832a3ac55ab9a7a3d81a49f9725',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:05:56.509Z',
      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-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 1
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 1 }
}

1. Set faucet's weight to 3

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: abaec64622a9d8909c8265487a1d1abc5ab18aa249563c9bee106fe00c0ad23a
Deploy result:
{
  deploy: {
    hash: 'abaec64622a9d8909c8265487a1d1abc5ab18aa249563c9bee106fe00c0ad23a',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:07:02.710Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '754ec203e2dec5e1d2bf067070e249170494fcb8dcb69326137d104cf06bb8d6',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 1 }
}

2. Set Keys Management Threshold to 3

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: 474e71d00a9adf216f0f7d7f02997512b7972a1cb82716adca000b4c4fd7586e
Deploy result:
{
  deploy: {
    hash: '474e71d00a9adf216f0f7d7f02997512b7972a1cb82716adca000b4c4fd7586e',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:08:07.628Z',
      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-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 3 }
}

3. Set Deploy Threshold to 2.

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: 80c71db477552e3136f991d705dd1ce8fdf1b316abaef1a4004bd4830b758a52
Deploy result:
{
  deploy: {
    hash: '80c71db477552e3136f991d705dd1ce8fdf1b316abaef1a4004bd4830b758a52',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:09:13.544Z',
      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-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}

4. Add first new key with weight 1.

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: 63b9d0d7d5f73989214627b4364765cf7a8941d79cd7286a0abb31a6783339e0
Deploy result:
{
  deploy: {
    hash: '63b9d0d7d5f73989214627b4364765cf7a8941d79cd7286a0abb31a6783339e0',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:10:19.542Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '3a2acb914d3557e29cf44fa1eaa8f60e69a0a35fe6bf647b0436105b082e6ebb',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-7fb624636b86b5cc529ab4338d8678745c17b369bd07b685b68a7e37a8d7f59c',
      weight: 1
    },
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}

5. Add second new key with weight 1.

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: deb62e3c0444fca56f5f1af92035b8d2b90811ca4613e9ea11693934ae9a3e2b
Deploy result:
{
  deploy: {
    hash: 'deb62e3c0444fca56f5f1af92035b8d2b90811ca4613e9ea11693934ae9a3e2b',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:11:24.394Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '7a8773855569e043ff74528e668cede71878d41b114b2f405a4dc42772145c72',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-7fb624636b86b5cc529ab4338d8678745c17b369bd07b685b68a7e37a8d7f59c',
      weight: 1
    },
    {
      accountHash: 'account-hash-9271fdac8973ee98d017bd7d509ca4be5c8d39b495ef05f08f7e3c37044a5409',
      weight: 1
    },
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}

6. Make a transfer from faucet using the new accounts.

Signed by: account-hash-7fb624636b86b5cc529ab4338d8678745c17b369bd07b685b68a7e37a8d7f59c
Signed by: account-hash-9271fdac8973ee98d017bd7d509ca4be5c8d39b495ef05f08f7e3c37044a5409
Deploy hash: dfc2aa83d1169b64b0a53c793261ad2e3a5df628971ca4f9d5ec3741637ec9a8
Deploy result:
{
  deploy: {
    hash: 'dfc2aa83d1169b64b0a53c793261ad2e3a5df628971ca4f9d5ec3741637ec9a8',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:12:30.302Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: 'e112480a02f125ec7e54867e5a5c63956c35767c04cbff55929e65fc5ab0c704',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { Transfer: [Object] },
    approvals: [ [Object], [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-7fb624636b86b5cc529ab4338d8678745c17b369bd07b685b68a7e37a8d7f59c',
      weight: 1
    },
    {
      accountHash: 'account-hash-9271fdac8973ee98d017bd7d509ca4be5c8d39b495ef05f08f7e3c37044a5409',
      weight: 1
    },
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}

7. Remove the first account

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: b7e3a4e302d4b956f8c281cfb7c556e34292ae3277338275768372d986b1b4bf
Deploy result:
{
  deploy: {
    hash: 'b7e3a4e302d4b956f8c281cfb7c556e34292ae3277338275768372d986b1b4bf',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:13:35.249Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '3c4a752bde08a02ae4710ea4023ff89487aba760ac24e5095659caa261aafc23',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-9271fdac8973ee98d017bd7d509ca4be5c8d39b495ef05f08f7e3c37044a5409',
      weight: 1
    },
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}

8. Remove the second account

Signed by: account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56
Deploy hash: 0f5280cbe4a786b605619d5538cd6c0059eeffe292d6528517ee8376e96c0c1b
Deploy result:
{
  deploy: {
    hash: '0f5280cbe4a786b605619d5538cd6c0059eeffe292d6528517ee8376e96c0c1b',
    header: {
      account: '02026c134aae68989272eedcfdf8c76f10c4c5b15036a90a03f16d6196a67b8f91b8',
      timestamp: '2021-10-03T17:14:41.107Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '71244e18ba3d62d197a31d6ebb10cae1d5cced45528ff8e2960bd26b9d3210e3',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-cedb534b8c12595ac4a0ed24538f4e6e79310f1cc642e29f288a86f50915406c'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-cb7cbbd6b1dacbc0fbb397d0e913cf7c87e046eefb3c928571e711d4572ad0e3-007'
    }
  ],
  mainPurse: 'uref-d6a3b62fb3b86f3ad27d20b4fb640fa16d7adec4980fb58f8e5216d3352864a7-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-ced94f3db18c951330ab945e9e6e925d8aa4fe10b61f65da946e48936e3a0b56',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}
```


# Task 3 Demonstrate key management concepts

> **Scenario 4: managing lost or stolen keys**

## Build the Scenario 4

```
const keyManager = require('./key-manager');
const TRANSFER_AMOUNT = process.env.TRANSFER_AMOUNT || 2500000000;

(async function () {

    // To achieve the task, we will:
    // 1. Set weight of safeAccount to 3.
    // 2. Set weight of browserAccount and mobileAccount to 1.
    // 3. Set Keys Management Threshold to 3.
    // 4. Set Deploy Threshold to 2.
    // 5. Deploy account changes using 'setAll' function.
 
    const masterKey = keyManager.randomMasterKey();
    const safeAccount = masterKey.deriveIndex(1);
    const browserAccount = masterKey.deriveIndex(2);
    const mobileAccount = masterKey.deriveIndex(3);
    
    console.log("Safe account: " + safeAccount.publicKey.toHex());
    console.log("Browser account: " + browserAccount.publicKey.toHex());
    console.log("Mobile account: " + mobileAccount.publicKey.toHex());
    
    let deploy;

    console.log("\n0.1 Funding safe account.");
    await keyManager.fundAccount(safeAccount);
    await keyManager.printAccount(safeAccount);

    console.log("\n0.2 Install Keys Manager contract");
    deploy = keyManager.keys.buildContractInstallDeploy(safeAccount);
    await keyManager.sendDeploy(deploy, [safeAccount]);
    await keyManager.printAccount(safeAccount);
    
    // 1. Set weight of safeAccount to 3.
    const safeAccountWeight = 3;
    // 2. Set weight of browserAccount and mobileAccount to 1.
    const keyAccountWeight = 1;
    const accounts = [
        { publicKey: safeAccount.publicKey, weight: safeAccountWeight },
        { publicKey: browserAccount.publicKey, weight: keyAccountWeight }, 
        { publicKey: mobileAccount.publicKey, weight: keyAccountWeight }, 
    ];
    
    // 3. Set Keys Management Threshold to 3.
    const keyManagementThreshold = 3;
    // 4. Set Deploy Threshold to 2.
    const deployThreshold = 2;
    
    // 5. Deploy account changes using 'setAll' function.
    console.log("\n 1. Set weight of safeAccount to 3.");
    console.log("\n 2. Set weight of browserAccount and mobileAccount to 1.");
    console.log("\n 3. Set Keys Management Threshold to 3.");
    console.log("\n 4. Set Deploy Threshold to 2.");
    console.log("\n Update keys deploy.");
    
    deploy = keyManager.keys.setAll(safeAccount, deployThreshold, keyManagementThreshold, accounts);
    await keyManager.sendDeploy(deploy, [safeAccount]);
    await keyManager.printAccount(safeAccount);

})();
```

## Testing the Scenario 4

```
(env) root@eanainsley2002sVM:~/keys-manager/client/src# npm run start:scenario_4

> keys-manager@1.0.0 start:scenario_4
> node -r dotenv/config ./src/scenario_4.js

Safe account: 0202b06d4ddb19c4a0c2556293d8abb26f24a2ed8379641a570558a6ceaf8ff171dd
Browser account: 0202f41240795ecddfaed5a5bf86ff5f4d6ed5b27b8c03b3b66591c770f79578ec64
Mobile account: 0203cb44fcb2ffdace74ea164fc89ee65fd5199e460b4f6db1e86a0e31904c254b5e

0.1 Funding safe account.
Signed by: account-hash-fb80499714e7dffcb54c39c49584aa2fc1c1a1b0c38316a5475dec48e270ee66
Deploy hash: 58e1b7b2b338157ef1e32bbdfb48118bb060f53f4418076a95a78a48cfe1a106
Deploy result:
{
  deploy: {
    hash: '58e1b7b2b338157ef1e32bbdfb48118bb060f53f4418076a95a78a48cfe1a106',
    header: {
      account: '011edca3d11ba38676c7ee7791e9f558e3a9f9754f53e5e3be8144e1d52b6d0a17',
      timestamp: '2021-10-03T17:09:15.038Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '22e2d81a813a5aa664f83d5f8a4aeafe606efd07656edc083e75fa5a1bf6af24',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { Transfer: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
  namedKeys: [],
  mainPurse: 'uref-12124eac70d0a443cec8d345a681e6ea477a986d4d3524259bffb813968b45f8-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
      weight: 1
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 1 }
}

0.2 Install Keys Manager contract
Signed by: account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652
Deploy hash: e05800e30df5fa3a445f0c31cafb3961e6910cc80fb6ac904478f77cefa3ed4c
Deploy result:
{
  deploy: {
    hash: 'e05800e30df5fa3a445f0c31cafb3961e6910cc80fb6ac904478f77cefa3ed4c',
    header: {
      account: '0202b06d4ddb19c4a0c2556293d8abb26f24a2ed8379641a570558a6ceaf8ff171dd',
      timestamp: '2021-10-03T17:10:19.274Z',
      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-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-ac78be1990e1f36b1ee223533e545b743c94a77e7537e39412f77efa770c1fde'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-0776e6e4c19d4bd2849e88cdd4348ddbe124cb91765b2abfbbf559316f0e94df-007'
    }
  ],
  mainPurse: 'uref-12124eac70d0a443cec8d345a681e6ea477a986d4d3524259bffb813968b45f8-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
      weight: 1
    }
  ],
  actionThresholds: { deployment: 1, keyManagement: 1 }
}

 1. Set weight of safeAccount to 3.

 2. Set weight of browserAccount and mobileAccount to 1.

 3. Set Keys Management Threshold to 3.

 4. Set Deploy Threshold to 2.

 Update keys deploy.
Signed by: account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652
Deploy hash: f7ace5da4491748f15f46164ffb1a617a77fa2d8e7bef199069cc1f8c5058605
Deploy result:
{
  deploy: {
    hash: 'f7ace5da4491748f15f46164ffb1a617a77fa2d8e7bef199069cc1f8c5058605',
    header: {
      account: '0202b06d4ddb19c4a0c2556293d8abb26f24a2ed8379641a570558a6ceaf8ff171dd',
      timestamp: '2021-10-03T17:11:24.928Z',
      ttl: '30m',
      gas_price: 1,
      body_hash: '80ba4bfa0c5cbb4232d82d6b8d03040577f5cd9b6e6c13a136feee324241ed67',
      dependencies: [],
      chain_name: 'casper-net-1'
    },
    payment: { ModuleBytes: [Object] },
    session: { StoredContractByName: [Object] },
    approvals: [ [Object] ]
  }
}

[x] Current state of the account:
{
  _accountHash: 'account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
  namedKeys: [
    {
      name: 'keys_manager',
      key: 'hash-ac78be1990e1f36b1ee223533e545b743c94a77e7537e39412f77efa770c1fde'
    },
    {
      name: 'keys_manager_hash',
      key: 'uref-0776e6e4c19d4bd2849e88cdd4348ddbe124cb91765b2abfbbf559316f0e94df-007'
    }
  ],
  mainPurse: 'uref-12124eac70d0a443cec8d345a681e6ea477a986d4d3524259bffb813968b45f8-007',
  associatedKeys: [
    {
      accountHash: 'account-hash-27fa0851dac2a927cba0d969ed62f5739c7d1d965cbcfbd984bc61e4acb72ada',
      weight: 1
    },
    {
      accountHash: 'account-hash-3dd24c4c96f56711031f6c835ee7e2cea26c7bc545a5f96f69f8e8e41ea64bec',
      weight: 1
    },
    {
      accountHash: 'account-hash-8127136aebe05832a341cfcfd41d9911256980721204cfc30cf468b911e93652',
      weight: 3
    }
  ],
  actionThresholds: { deployment: 2, keyManagement: 3 }
}
```


# Task 4 Learn to transfer tokens to an account on the Casper Testnet

## Send the transfer

![](https://i.imgur.com/x282T5V.png)

## Testing the transfer

```
(env) root@eanainsley2002sVM:~# casper-client get-deploy --node-address http://5.189.180.23:7777 f13e28a0f7807a15c08e94cb2c06832bc62cd2164744b2b543de6166445f268d
{
  "id": -4483241030883032492,
  "jsonrpc": "2.0",
  "result": {
    "api_version": "1.3.4",
    "deploy": {
      "approvals": [
        {
          "signature": "[130 hex chars]",
          "signer": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed"
        }
      ],
      "hash": "f13e28a0f7807a15c08e94cb2c06832bc62cd2164744b2b543de6166445f268d",
      "header": {
        "account": "01a0d100bdc7d058e915b8d100aa3b0180935ef3c3fe320d8ccf27f45bc50c0aed",
        "body_hash": "0a37e8d5d87f584d2e85550725147794855e13ab6153f9b632096310f3734900",
        "chain_name": "casper-test",
        "dependencies": [],
        "gas_price": 1,
        "timestamp": "2021-10-03T17:13:04.867Z",
        "ttl": "30m"
      },
      "payment": {
        "ModuleBytes": {
          "args": [
            [
              "amount",
              {
                "bytes": "0500f2052a01",
                "cl_type": "U512",
                "parsed": "5000000000"
              }
            ]
          ],
          "module_bytes": ""
        }
      },
      "session": {
        "Transfer": {
          "args": [
            [
              "amount",
              {
                "bytes": "05004429353a",
                "cl_type": "U512",
                "parsed": "250000000000"
              }
            ],
            [
              "target",
              {
                "bytes": "98c52059d4801fe06f29337eef8e8d9766659a8b5efeaa29e9ba76ab8216562e",
                "cl_type": {
                  "ByteArray": 32
                },
                "parsed": "98c52059d4801fe06f29337eef8e8d9766659a8b5efeaa29e9ba76ab8216562e"
              }
            ],
            [
              "id",
              {
                "bytes": "0179df0d8648700000",
                "cl_type": {
                  "Option": "U64"
                },
                "parsed": 123456789012345
              }
            ]
          ]
        }
      }
    },
    "execution_results": []
  }
}
```

# Task 5 Learn to Delegate and Undelegate on the Casper Testnet

## Delegate on the Casper Testnet

![](https://i.imgur.com/WwCD9C9.png)

## Undelegate on the Casper Testnet

![](https://i.imgur.com/j4GFcLf.png)








