# Getting Started

## Installation

OS requirement\
-NodeJs(5.0 +)\
-Windows,Linux,or Mac OS X

```
npm install -g visionbox
```

> #### 📘
>
> If the command in the shell fails due to a permission issue, please follow this command to install again: sudo npm install -g visionbox --unsafe-perm=true --allow-root --save-dev grunt

> #### 📘
>
> For Windows, the best way to run VisionBox is to install an Ubuntu subsystem: <https://docs.microsoft.com/en-us/windows/wsl/install-win10>. After running Ubuntu from the prompt, proceed as usual. It is not recommended to run VisionBox from Powershell.

## Initialize a VisionBox Project

Enter the following command under an empty folder to create an initialized project

```
visionbox init
```

The initialized project contains:

| File         | Description                                                                                                               |
| ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| contract     | The directory storing all smart contract files.                                                                           |
| migrations   | The directory storing all javascript files for migration.                                                                 |
| test         | The directory storing all test scripts for testing the smart contract.                                                    |
| visionbox.js | The configuration file of the project. Declare your Full Node address and Event Server and Solidity Version in this file. |

## Basic Commands

| Command                                                                          | Description                                                                                         |
| -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| init                                                                             | Initialize a VisionBox Project                                                                      |
| compile                                                                          | Compiles all the smart contracts. The compiled result is stored into ./build/contracts.             |
| This command only compiles files that have been modified since the last compile. |                                                                                                     |
| compile --compile-all                                                            | Re-compiles all the smart contracts.                                                                |
| migrate                                                                          | Deploys the contract. This command only migrates changes since the last successful migration.       |
| migrate --reset                                                                  | Re-migrates all the smart contracts.                                                                |
| test \[path]                                                                     | Runs all test scripts. Test file name definition is optional. It also can be run with --reset flag. |
| console                                                                          | The console supports the visionbox command.                                                         |
