Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Forc Deploy

Icon LinkBuild

Usage: forc deploy [OPTIONS] [SIGNING_KEY]

Arguments: [SIGNING_KEY] Set the key to be used for signing

Options:

-p, --path <PATH>

Path to the project.

If not specified, current working directory will be used.

--offline

Offline mode.

Prevents Forc from using the network when managing dependencies. Meaning it will only try to use previously downloaded dependencies.

-t, --terse

Terse mode.

Limited warning and error output.

--output-directory <OUTPUT_DIRECTORY>

The directory in which Forc output artifacts are placed.

By default, this is <project-root>/out.

--locked

Requires that the Forc.lock file is up-to-date.

If the lock file is missing, or it needs to be updated, Forc will exit with an error.

--ipfs-node <IPFS_NODE>

The IPFS node to use for fetching IPFS sources.

[possible values: PUBLIC, LOCAL, <GATEWAY_URL>]

--json-abi

Minify JSON ABI files.

By default the JSON for ABIs is formatted for human readability. By using this option JSON output will be "minified", i.e. all on one line without whitespace.

--json-storage-slots

Minify JSON storage slot files.

By default the JSON for initial storage slots is formatted for human readability. By using this option JSON output will be "minified", i.e. all on one line without whitespace.

--ast

Print the generated Sway AST (Abstract Syntax Tree)

--dca-graph <DCA_GRAPH>

Print the computed Sway DCA (Dead Code Analysis) graph.

DCA graph is printed to the specified path. If specified '' graph is printed to the stdout.

--dca-graph-url-format <DCA_GRAPH_URL_FORMAT>

URL format to be used in the generated DCA graph .dot file.

Variables {path}, {line}, and {col} can be used in the provided format. An example for vscode would be: "vscode://file/{path}:{line}:{col}"

--asm <ASM>..>

Print the generated ASM (assembler).

Values that can be combined:

  • virtual: initial ASM with virtual registers and abstract control flow.
  • allocated: ASM with registers allocated, but still with abstract control flow.
  • abstract: short for both virtual and allocated ASM.
  • final: final ASM that gets serialized to the target VM bytecode.
  • all: short for virtual, allocated, and final ASM.

[possible values: virtual, allocated, abstract, final, all]

--bytecode

Print the bytecode.

This is the final output of the compiler.

--ir <IR>..>

Print the generated Sway IR (Intermediate Representation).

Values that can be combined:

  • initial: initial IR prior to any optimization passes.
  • final: final IR after applying all optimization passes. : the name of an optimization pass. Prints the IR state after that pass.
  • all: short for initial, final, and all the optimization passes.
  • modified: print a requested optimization pass only if it has modified the IR.

[possible values: initial, final, all, modified, inline, simplify-cfg, sroa, dce, fn-dce, fn-dedup-release, fn-dedup-debug, mem2reg, memcpyopt, const-folding, arg-demotion, const-demotion, ret-demotion, misc-demotion]

--time-phases

Output the time elapsed over each part of the compilation process

--reverse-order

Output build errors and warnings in reverse order

--metrics-outfile <METRICS_OUTFILE>

Output compilation metrics into the specified file

--gas-price <PRICE>

Gas price for the transaction

--script-gas-limit <SCRIPT_GAS_LIMIT>

Gas limit for the transaction

--max-fee <MAX_FEE>

Max fee for the transaction

--maturity <MATURITY>

Block height until which tx cannot be included

[default: 0]

--node-url <NODE_URL>

The URL of the Fuel node to which we're submitting the transaction. If unspecified, checks the manifest's network table, then falls back to http://127.0.0.1:4000

You can also use --target, --testnet, or --mainnet to specify the Fuel node.

[env: FUEL_NODE_URL=]

--target <TARGET>

Use preset configurations for deploying to a specific target.

You can also use --node-url, --testnet, or --mainnet to specify the Fuel node.

Possible values are: [local, testnet, mainnet]

--testnet

Use preset configuration for testnet.

You can also use --node-url, --target, or --mainnet to specify the Fuel node.

--mainnet

Use preset configuration for mainnet.

You can also use --node-url, --target, or --testnet to specify the Fuel node.

--salt <SALT>

Optional 256-bit hexadecimal literal(s) to redeploy contracts.

For a single contract, use --salt <SALT>, eg.: forc deploy --salt 0x0000000000000000000000000000000000000000000000000000000000000001

For a workspace with multiple contracts, use --salt <CONTRACT_NAME>:<SALT> to specify a salt for each contract, eg.:

forc deploy --salt contract_a:0x0000000000000000000000000000000000000000000000000000000000000001 --salt contract_b:0x0000000000000000000000000000000000000000000000000000000000000002

--default-salt

Generate a default salt (0x0000000000000000000000000000000000000000000000000000000000000000) for the contract. Useful for CI, to create reproducible deployments

-o, --output-bin <BIN_FILE>

Create a binary file at the provided path representing the final bytecode

-g, --output-debug <DEBUG_FILE>

Create a file at the provided path containing debug information.

If the file extension is .json, JSON format is used. Otherwise, an .elf file containing DWARF format is emitted.

--build-profile <BUILD_PROFILE>

The name of the build profile to use

[default: release]

--default-signer

Sign the transaction with default signer that is pre-funded by fuel-core. Useful for testing against local node

--unsigned

Deprecated in favor of --default-signer

--submit-only

Submit the deployment transaction(s) without waiting for execution to complete

--manual-signing

Sign the deployment transaction manually

--override-storage-slots <JSON_FILE_PATH>

Override storage slot initialization.

By default, storage slots are initialized with the values defined in the storage block in the contract. You can override the initialization by providing the file path to a JSON file containing the overridden values.

The file format and key values should match the compiler-generated *-storage_slots.json file in the output directory of the compiled contract.

Example: forc deploy --override-storage-slots my_override.json

my_override.json: [ { "key": "<key from out/debug/storage_slots.json>", "value": "0000000000000000000000000000000000000000000000000000000000000001" } ]

--experimental <EXPERIMENTAL>

Comma separated list of all experimental features that will be enabled

[possible values: new_encoding]

--no-experimental <NO_EXPERIMENTAL>

Comma separated list of all experimental features that will be disabled

[possible values: new_encoding]

--aws-kms-signer <AWS_KMS_SIGNER>

AWS KMS signer arn. If present forc-deploy will automatically use AWS KMS signer instead of forc-wallet

-h, --help

Print help (see a summary with '-h')

-V, --version

Print version

EXAMPLES:

Icon LinkDeploy a single contract

forc deploy bc09bfa7a11a04ce42b0a5abf04fd437387ee49bf4561d575177e2946468b408

Icon LinkDeploy a single contract from a different path

forc deploy bc09bfa7a11a04ce42b0a5abf04fd437387ee49bf4561d575177e2946468b408 --path {path}

Icon LinkDeploy to a custom network

forc deploy --node-url https://testnet.fuel.network/graphql

Icon LinkEXAMPLE

You can use forc deploy, which triggers a contract deployment transaction and sends it to a running node.

Alternatively, you can deploy your Sway contract programmatically using fuels-rs Icon Link, our Rust SDK.

You can find an example within our fuels-rs book Icon Link.