# Steps to run a local Aleo node and deploy a contract
1. Install snarkOS following the instructions on [their Github repo](https://github.com/AleoHQ/snarkOS).
2. Run the node in development mode
```
snarkos start --nodisplay --dev 0 --beacon ""
```
You will be given the a Private Key, a View Key and an Address. Take note of these as you'll need them later.
3. In another window, run the following command to scan the node for spendable records.
```
snarkos developer scan -v <VIEW_KEY> --start 0 --end 1 --endpoint "http://localhost:3030"
```
Here, `<VIEW_KEY>` is the View Key you were given in step 2.
As I understand it, these "spendable records" are the equivalent of Bitcoin's UTXOs. The node generates these records but it quickly spends them, so you have to transfer the funds out to another wallet ASAP.
4. Create a new Aleo account to act as the deployer:
```
aleo account new
```
Take note of the Private Key, View Key and Address.
5. Transfer funds to the deployer account:
```
snarkos developer transfer --amount 10000000 --recipient <DEPLOYER_ADDRESS> --private-key <PRIVATE_KEY> --query "http://localhost:3030" --broadcast "http://localhost:3030/testnet3/transaction/broadcast" --input-record <INPUT_RECORD>
```
Here, `<DEPLOYER_ADDRESS>` is the address from the account you created in step 4, `<PRIVATE_KEY>` is the private key you got from step 2 and `<INPUT_RECORD>` is any of the unspent records you got in step 3. The amount `10000000` is kind of arbitrary, you could try with more if you like.
6. Get the recently transferred unspent record from your deployer account:
```
snarkos developer scan -v <DEPLOYER_VIEW_KEY> --start 0 --end <LATEST_BLOCK_MINED> --endpoint "http://localhost:3030"
```
Here the `<DEPLOYER_VIEW_KEY>` is the view key you got from step 4 and `<LATEST_BLOCK_MINED>` is the latest block mined by the running node. You should get a single entry corresponding to the record you transfered in step 5.
7. From the `build` directory of the Zenet project, execute the following command:
```
snarkos developer deploy zenet.aleo --private-key <DEPLOYER_PRIVATE_KEY> --query "http://localhost:3030" --path "./" --broadcast "http://localhost:3030/testnet3/transaction/broadcast" --record <DEPLOYER_INPUT_RECORD> --fee 6000000
```
Here, the value `6000000` was determined by trial and error. `600000` didn't work so I tried with 10 times that and it worked :-)
8. Execute the `new` function on the recently deployed `zenet.aleo` contract:
```
snarkos developer execute zenet.aleo new --private-key <DEPLOYER_PRIVATE_KEY> --query "http://localhost:3030" --broadcast "http://localhost:3030/testnet3/transaction/broadcast"
```
9. Execute the `make_move` function on the recently deployed `zenet.aleo` contract:
```
snarkos developer execute zenet.aleo make_move 9u8 3u8 "{ cell_state: 1023u32, occupant: 682u32, p1_turn: true }" --private-key <DEPLOYER_PRIVATE_KEY> --query "http://localhost:3030" --broadcast "http://localhost:3030/testnet3/transaction/broadcast"
```
This is what I have done so far. Now we have to try to invoque the deployed contract from different wallets other than the deployer account, simulating different players. We might have to include logic into the contract to prevent anyone to be able to do this.