Rise In Logo

Move on Sui Course

Smart Contract Deployment:

Congratulations on making this far! Now that you have a contract, it is time for you to deploy your contract on the devnet. You will use your terminal/command line to deploy the contract. 

You can either open up your terminal inside the visual studio code like we did on the video. If you are using another IDE, you can also open your terminal from your pc/mac and go to your project’s directory.

Step 1:

In the directory enter the following command:

sui client publish --gas-budget 20000000 .

This command will deploy your contract on the devnet. In the command, 20000000 is the default gas that we will use to deploy our contract. You can increase it if you encounter any errors. Also we have a “.” at the end of the command. This means that you are deploying the contract from the current directory you are in. If you are entering the command from a different directory than your project, you should enter <your directory> instead of “.”

Step 2:

A successful deployment should give you the following output:

The yellow line is our contract id. We will use this one to call functions from our contract.

The orange one is our DevHub object. As you can see at the end of the line, it is shared.

This may look like a complicated output but do not worry, for the time being, we will only use the underlined (yellow and orange) lines. 

In the following lesson, you will learn how to call functions from our smart contract using the frontend. These ids will be used in the frontend with the following purposes:

In your result, store the object ids in a safe place.

Sui Explorer:

With the Sui Explorer you can search for your objects and can see the relevant information for your objects. 

  • Go to the Sui Explorer website and change the network to devnet on the upper right corner. 
  • On the search bar, enter your object id.
  • Now, you should be able to see your deployed object
Rise In Logo

Rise together in web3