Get started with Casper
**Task 1: Deploy a simple, smart contract with cargo casper and cargo test**
1.1 Writting SmartContract AssemblyScript
![](https://i.imgur.com/szW9uBx.png)
1.2 Installing a Virtual Environment and Accessing to **env**
![](https://i.imgur.com/tPRo2Ph.png)
1.3 Deploying Contracts
Nightly version of the compiler.
![](https://i.imgur.com/G8fzvvO.png)
Final Deployment
![](https://i.imgur.com/0qrBmsI.png)
![](https://i.imgur.com/5KLE79v.png)
![](https://i.imgur.com/wEjZXYQ.png)
**Task 2: Complete one of the existing tutorials for writing smart contracts**
2.1 Clone the contract from GitHub
![](https://i.imgur.com/0EETafO.png)
2.2 Prepare the environment
![](https://i.imgur.com/zAnggwu.png)
2.3 Compile the contract and run the contract unit tests
Compile the contract
![](https://i.imgur.com/KfHUy5t.png)
Run the contract unit tests
![](https://i.imgur.com/WIXpVLL.png)
![](https://i.imgur.com/dhJ3FDU.png)
**Task 3: Demonstrate key management concepts by modifying the client in the Multi-Sig tutorial to address one of the additional scenarios**
3.1 Implementing the Smart Contract
Download the example contract and client for key management.
![](https://i.imgur.com/TbK8hH3.png)
3.2 Building the Smart Contract.
![](https://i.imgur.com/CUcw1pO.png)
![](https://i.imgur.com/lYOwezQ.png)
3.3 Setting up a local Casper Network
![](https://i.imgur.com/OgCKlPD.png)
See the faucet account details
![](https://i.imgur.com/RCSozcp.png)
3.4 Additional Scenarios
> Scenario 1: signing transactions with a single key
Code >>
![](https://i.imgur.com/YoCEYVZ.png)
Run the code >>
```
> 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-a9ec364847fdebff865f532c1023250c84b833d3a76496e51e48fbc9d18ecf24
Deploy hash: a0f2143c39b8db999eddbb221796605059f9334a91ae9d2347ba8d3f45db0ca5
Deploy result:
{
deploy: {
hash: 'a0f2143c39b8db999eddbb221796605059f9334a91ae9d2347ba8d3f45db0ca5',
header: {
account: '01af862896071a1275f98c19250f4f8e600591e630eb38cb49c16db8b195cb0c65',
timestamp: '2021-09-22T18:46:45.715Z',
ttl: '30m',
gas_price: 1,
body_hash: '1215151fd53161ef2cde57c6ad7c5c6f4f4f9a4f0dca16f61ab498c06075bc96',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { Transfer: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
namedKeys: [],
mainPurse: 'uref-8764c08db481fdf7844d4af8608cc51ecb7cb5bceeb6c82ab2ad98b48b393583-007',
associatedKeys: [
{
accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
[x]0.2 Install Keys Manager contract
Signed by: account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d
Deploy hash: 9117469712cd508ec2bbef828f212ef21e418e12f093d20e5e9d3de637268af2
Deploy result:
{
deploy: {
hash: '9117469712cd508ec2bbef828f212ef21e418e12f093d20e5e9d3de637268af2',
header: {
account: '020286db789721776a5b4848c8bad1bf8e70c81927ae72c4e36e83a6b19a8c0c9f13',
timestamp: '2021-09-22T18:47:48.928Z',
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-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-89ffd3591514ca83d881e521009f10e3ec1583f6485ad35f8ecd964007a0fd75'
},
{
name: 'keys_manager_hash',
key: 'uref-742c8c49700dfb581bf2314673ac4230165ca5492497a805c432c00c282b69e5-007'
}
],
mainPurse: 'uref-8764c08db481fdf7844d4af8608cc51ecb7cb5bceeb6c82ab2ad98b48b393583-007',
associatedKeys: [
{
accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
1. Set faucet's weight to 1
Signed by: account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d
Deploy hash: 9d1e2bb6f53289bbb104cc7fd48fd8c2536ba18d720e7c73d76a797ad9a658be
Deploy result:
{
deploy: {
hash: '9d1e2bb6f53289bbb104cc7fd48fd8c2536ba18d720e7c73d76a797ad9a658be',
header: {
account: '020286db789721776a5b4848c8bad1bf8e70c81927ae72c4e36e83a6b19a8c0c9f13',
timestamp: '2021-09-22T18:48:55.023Z',
ttl: '30m',
gas_price: 1,
body_hash: 'bedcfddeeaf010655a4f415f4d143cd4d26c80d7c9cf763cb90c56952ed0135a',
dependencies: [],
chain_name: 'casper-net-1'
},
payment: { ModuleBytes: [Object] },
session: { StoredContractByName: [Object] },
approvals: [ [Object] ]
}
}
[x] Current state of the account:
{
_accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-89ffd3591514ca83d881e521009f10e3ec1583f6485ad35f8ecd964007a0fd75'
},
{
name: 'keys_manager_hash',
key: 'uref-742c8c49700dfb581bf2314673ac4230165ca5492497a805c432c00c282b69e5-007'
}
],
mainPurse: 'uref-8764c08db481fdf7844d4af8608cc51ecb7cb5bceeb6c82ab2ad98b48b393583-007',
associatedKeys: [
{
accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
2. Set Keys Management Threshold to 1
Signed by: account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d
Deploy hash: 0d40e352e5113ab6c4d6f8df193bb14db2484be71e12f58a208cc9448c7e77d0
Deploy result:
{
deploy: {
hash: '0d40e352e5113ab6c4d6f8df193bb14db2484be71e12f58a208cc9448c7e77d0',
header: {
account: '020286db789721776a5b4848c8bad1bf8e70c81927ae72c4e36e83a6b19a8c0c9f13',
timestamp: '2021-09-22T18:50:00.009Z',
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-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-89ffd3591514ca83d881e521009f10e3ec1583f6485ad35f8ecd964007a0fd75'
},
{
name: 'keys_manager_hash',
key: 'uref-742c8c49700dfb581bf2314673ac4230165ca5492497a805c432c00c282b69e5-007'
}
],
mainPurse: 'uref-8764c08db481fdf7844d4af8608cc51ecb7cb5bceeb6c82ab2ad98b48b393583-007',
associatedKeys: [
{
accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
3. Set Deploy Threshold to 1.
Signed by: account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d
Deploy hash: b4fe5537258f0ac8652c8847211304140e6f900bf4ff83f83d37211a2deb0bfb
Deploy result:
{
deploy: {
hash: 'b4fe5537258f0ac8652c8847211304140e6f900bf4ff83f83d37211a2deb0bfb',
header: {
account: '020286db789721776a5b4848c8bad1bf8e70c81927ae72c4e36e83a6b19a8c0c9f13',
timestamp: '2021-09-22T18:51:05.991Z',
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-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
namedKeys: [
{
name: 'keys_manager',
key: 'hash-89ffd3591514ca83d881e521009f10e3ec1583f6485ad35f8ecd964007a0fd75'
},
{
name: 'keys_manager_hash',
key: 'uref-742c8c49700dfb581bf2314673ac4230165ca5492497a805c432c00c282b69e5-007'
}
],
mainPurse: 'uref-8764c08db481fdf7844d4af8608cc51ecb7cb5bceeb6c82ab2ad98b48b393583-007',
associatedKeys: [
{
accountHash: 'account-hash-87d6ab4b920ba4d43753913790a63d1e6cdaffcce984ceafe19f3300ebe5816d',
weight: 1
}
],
actionThresholds: { deployment: 1, keyManagement: 1 }
}
```
**Task 4: Learn to transfer tokens to an account on the Casper Testnet.**
![](https://i.imgur.com/lQBD4JD.png)
---
![](https://i.imgur.com/ZPj6pZ2.png)
**Task 5: Learn to Delegate and Undelegate on the Casper Testnet**
> Delegate
![](https://i.imgur.com/mevdC7I.png)
> Undelegate
![](https://i.imgur.com/sbm9MR1.png)