Skip to Content

Compile and Publish

Compile the package, fund your account and publish the package to your network.

--help describes a command’s arguments, for example supra move tool publish --help. The commands on this page use the active profile, and send transactions to the network that profile is for.

Compile your package

--package-dir can be left out when the current directory is the package’s root, where Move.toml is.

Compiling fetches the dependencies in Move.toml, then builds the package into a new build directory that holds its bytecode. The first compile downloads the SupraFramework repository, which can take several minutes.


execute me!
supra move tool compile --package-dir /supra/move_workspace/exampleContract

Fund your account

Publishing costs gas, paid in SUPRA from the account that publishes. On Devnet and Testnet, get SUPRA from the network’s faucet:

execute me!
supra move account fund-with-faucet

Mainnet has no faucet. To publish on Mainnet, the account needs SUPRA from another source.

Publish your package

Once the package is compiled and the account has SUPRA for gas, publish the package:

execute me!
supra move tool publish --package-dir /supra/move_workspace/exampleContract

The CLI asks you to confirm the gas unit price. Press Enter to accept it, or enter a different price in quants. The Devnet CLI also accepts it on y or yes. --accept-defaults accepts it without asking.

publish --simulate runs the publish without sending it and reports the gas it would use. It needs the account to exist on chain, so fund the account first. For an account that has not been funded, the Devnet CLI fails with:

NotFound: Account <ADDRESS> does not exist on <RPC_URL> yet. Create it by funding it, for example with supra move account fund-with-faucet --account <ADDRESS> on Devnet or Testnet

The Testnet and Mainnet CLIs fail with Resource not found: 0x1::account::Account and 400 Bad Request.

To use a profile other than the active one, pass --profile <PROFILE_NAME> to a command, or make it the active profile with supra profile activate <PROFILE_NAME>.

When a transaction does not succeed

The Devnet CLI reports a transaction whose simulation ends with a status other than Success by its hash, status, VM status and gas used, and does not send it:

The simulation of transaction <HASH> ended with status <STATUS>; it was not submitted VM status: <VM_STATUS> Gas used: <GAS_USED>

A transaction that was sent and executed with a status other than Success is reported as Transaction <HASH> was finalized with status <STATUS>, followed by the same two lines. An error answered by the RPC node is printed as the node’s message, followed by the status and the URL, for example General: Bad Request: <MESSAGE> (400 Bad Request from <RPC_URL>/rpc/v4/view). With supra --stdout json, the error field of the output carries the same text. The command exits with a failure status.

See where the gas goes

On Devnet, --profile-gas added to supra move tool publish, run or run-script simulates the transaction on the RPC node, without submitting it, and writes a report of the gas each call, operation and storage write took. See Profiling a Transaction’s Gas.

Last updated on