# Step 8: Creating an Allocation on Blobber

To create storage space on the blobber we have to use the zboxcli to interface with the blockchain.

1. [Install zboxcli](https://docs.zus.network/guides/zbox-cli/get-started#install-zboxcli).<br>
2. [Install zwalletcli](https://docs-old.zus.network/zwallet-cli/get-started#install-zwalletcli) ,[create wallet](https://docs-old.zus.network/zwallet-cli/get-started#creating-a-wallet)(if you have not created one) and get test tokens into your wallet using the command below:

```
  ./zwallet faucet --methodName pour --input "{Pay day}"
```

On Successful response:

```
Execute faucet smart contract success with txn :  50e6cf293567e456527a13a6981f1188fb6eb6b930c805c7ddba5e7e26ba9e6f
```

3. Check Token balance in zwallet using the

```
./zwallet getbalance
```

Response-

```
Balance: 1.000 ZCN (0.44 USD)
```

**Note : Before Proceeding further at least have 3 ZCN balance in the wallet. The tokens are required for staking before creating an allocation. Run** `./zwallet faucet --methodName pour --input "{Pay day}"` **command three times to get 3 ZCN tokens.**\
\
4\. Once the wallet has an available balance, you have to lock tokens into stake pool .To lock tokens into stake pool you need a id of blobbers to stake which can be fetched using the zboxcli command

```
./zbox ls-blobbers
```

The sample response will show all the active blobbers:

```
- id:                    7a90e6790bcd3d78422d7a230390edc102870fe58c15472073922024985b1c7d
  url:                   http://198.18.0.92:5052
  allocated / total capacity: 2.0 GiB / 232.2 GiB
  last_health_check:      2022-11-24 05:27:00 +0530 IST
  terms:
    read_price:          10.000 mZCN / GB
    write_price:         100.000 mZCN / GB / time_unit
    min_lock_demand:     0.1
    max_offer_duration:  744h0m0s
- id:                    f65af5d64000c7cd2883f4910eb69086f9d6e6635c744e62afcfab58b938ee25
  url:                   http://198.18.0.91:5051
  allocated / total capacity: 2.0 GiB / 232.3 GiB
  last_health_check:      2022-11-24 05:27:29 +0530 IST
  terms:
    read_price:          10.000 mZCN / GB
    write_price:         100.000 mZCN / GB / time_unit
    min_lock_demand:     0.1
    max_offer_duration:  744h0m0s
​
```

5\. Export Blobber IDs to variables.

```
export BLOBBER1=f65af5d64000c7cd2883f4910eb69086f9d6e6635c744e62afcfab58b938ee25
export BLOBBER2=7a90e6790bcd3d78422d7a230390edc102870fe58c15472073922024985b1c7d
```

6.Add tokens to the stake pools of all the active blobbers to allow them to accept allocations.

```
./zbox sp-lock --blobber_id $BLOBBER1 --tokens 1
./zbox sp-lock --blobber_id $BLOBBER2 --tokens 1
```

Sample Response:

```
tokens locked, txn hash: 04bde4414459739e9315722f61b409fa12a5ffb70b8acd483b874f2f3b810376
```

7\. Once the tokens are locked into stake pool you can create and fun storage allocation by using the zbox `newallocation` command. To understand the syntax type

```
./zbox newallocation --help
```

This will output the mandatory and optional flags that need to be added with the `newallocation` command.

| Parameter          | Description                                               | Default        | Valid Values |
| ------------------ | --------------------------------------------------------- | -------------- | ------------ |
| allocationFileName | local file to store allocation information                | allocation.txt | file path    |
| cost               | returns the cost of the allocation, no allocation created |                | flag         |
| data               | number of data shards, effects upload and download speeds | 2              | int          |
| expire             | duration to allocation expiration                         | 720h           | duration     |
| free\_storage      | free storage marker file.                                 |                | file path    |
| owner              | owner's id, use for funding an allocation for another     |                | string       |
| owner\_public\_key | public key, use for funding an allocation for another     |                | string       |
| lock               | lock write pool with given number of tokens               |                | float        |
| mcct               | max challenge completion time                             | 1h             | duration     |
| parity             | number of parity shards, effects availability             | 2              | int          |
| read\_price        | filter blobbers by read price range                       | 0-inf          | range        |
| size               | size of space reserved on blobbers                        | 2147483648     | bytes        |
| usd                | give token value in USD                                   |                | flag         |
| write\_price       | filter blobbers by write price range                      | 0-inf          | range        |

7.For getting started we can create a basic allocation with 1 `data` and `parity` shard. Lock some tokens using `lock float` variable(for example 0.5) .\
The complete command would be :

```
./zbox newallocation --lock 0.5 --data 1 --parity 1 
```

Successful Response will create an allocation with allocation ID:

```
Allocation created :fa34be9c225077ede736b8012738d6b591aff822d75a630701ae99c05c32fac7
```

**Note: For creating allocation with more data and parity shards, run more blobbers. The sum of `data` and `parity` shards should be equal or smaller than the number of running blobbers.**\
\
8.If you have successfully created an allocation verify it by running

```
./zbox listallocations
```

You will see your allocation ID listed with the specified configuration:

Response:

```
  ID   |    SIZE    |          EXPIRATION           | DATASHARDS | PARITYSHARDS | FINALIZED | CANCELED | R  PRICE | W  PRICE
+------------------------------------------------------------------+------------+-------------------------------+------------+--------------+-----------+----------+----------+----------+
  52fb9b5926c06e43a9290e9d7ad3217a4aee51c94684baf0fc174aa41abe6059 | 2147483648 | 2021-05-14 17:50:59 +0000 UTC |   2 |            2 | false     | false    |     0.04 |     0.04
```

**Notes:**

* If you are not able to create allocation and getting "transaction not found on any of the sharders", check error causes in [zbox Tips and Troubleshooting](https://docs-old.zus.network/guides/zbox-cli/tips-and-troubleshooting) Section.
* To upload files on an allocation, modify allocation and use advanced features check [zboxcli ](https://docs-old.zus.network/guides/zbox-cli)documentation.
