Skip to content

Commit

Permalink
Add usage docs for Salt feature (FuelLabs#4132)
Browse files Browse the repository at this point in the history
## Description

Added usage docs for `--salt` and `--random-salt` flags

---------

Co-authored-by: Kaya Gökalp <[email protected]>
Co-authored-by: Mohammad Fawaz <[email protected]>
  • Loading branch information
3 people authored Feb 23, 2023
1 parent a71fc79 commit d9131a9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/book/src/introduction/sway_quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ To deploy `counter_contract` on your local Fuel node, open a new terminal tab an
forc deploy --unsigned
```

where `--url` parameter is the URL where your local node is hosted.
where `--node-url` parameter is the URL where your local node is hosted.

> **Note**
> You can't use the same terminal session that is running fuel-core to run any other commands as this will end your fuel-core process.
Expand All @@ -202,6 +202,26 @@ Note the contract ID — you will need it if you want to build out a frontend to

If `forc-deploy` emits a `no such subcommand` error, try to install it with [fuelup](../introduction/installation.md) or [manually](https://github.com/FuelLabs/sway/releases).

## Deploying the contract with Salt

You can pass a "Salt" using the `--salt` flag passed to your `forc deploy` command as a 256-bit hexadecimal literal, to redeploy a contract that has been deployed already. This is useful for multiple deployments of the same contract.

To add a "Salt" while deploying your contract, you can run the following command:

```bash
forc deploy --unsigned --salt <Salt> --node-url <key> --gas-price 1
```

### Randomised Salt

Salt is `0x0000000000000000000000000000000000000000000000000000000000000000` by default. If you do not want to pass a salt manually, you can also use the --random-salt flag to randomise your salt as follows:

```bash
forc deploy --unsigned --random-salt --node-url <key> --gas-price 1
```

> Note: To be able to use the `forc deploy` and `forc run` commands, you require the `forc client` plugin that lets you interact with a Fuel node. You can read more about `forc client` [here](../forc/plugins/forc_client/index.md).
## Testing Your Contract

We will cover how to test your contract later but, if you are eager to take a look, see [Unit Testing](../testing/unit-testing.md) and [Testing with Rust](../testing/testing-with-rust.md).
Expand Down

0 comments on commit d9131a9

Please sign in to comment.