Skip to main content
If you encounter an issue while following this tutorial, see Troubleshooting.

Introduction

Welcome to the fourth installment of the Deploy your first contract guide! 🥇 Starknet Sepolia is Starknet’s testnet environment designed to provide developers with a testing ground that mirrors the behavior of the Starknet Mainnet while being connected to the Ethereum Sepolia testnet, making it ideal for debugging and optimizing your code before deploying it to production. This installment of the series will therefore guide you through the steps necessary to deploy and interact with the HelloStarknet contract on Starknet Sepolia.

Deploying a new Sepolia account

Similar to interacting with a Starknet Devnet instance, to interact with Starknet Sepolia you first need an account. However, instead fetching a predeployed Sepolia account, we will create a new account and deploy it using sncast ourselves.
To learn how to fetch a predeployed Sepolia account, see Fetching a predeployed Sepolia account.
To create the account’s information (private key, address, etc.), navigate into the hello_starknet directory created in Generating HelloStarknet and run:
When run, the command shows instructions on how to prefund the account before proceeding, which can be done using the Starknet Sepolia faucet.
Prefunding the account is required because deploying an account involves sending a DEPLOY_ACCOUNT transaction, which requires the account to contain enough STRK to pay for the transaction fee.
Once your account is funded, you can deploy it by running:
If successful, the result should resemble the following:

Deploying HelloStarknet on Sepolia

Unlike when using a Starknet Devnet instance, there’s no need for us to declare HelloStarknet on Sepolia as it has already been declared before (remember: declaration is a one-time process for each unique contract code). To verify that, you can try declaring it by navigating into the hello_starknet directory created in Generating HelloStarknet, running:
The result should resemble to the following:
With HelloStarknet already declared, you can deploy an instance of it by running:
If successful, the result should resemble the following:
Your deployed contract’s address will be different than the one listed above. Make sure to use the address of your own deployed contract in the following section.

Interacting with HelloStarknet on Sepolia

Once your instance of HelloStarknet is deployed, you can invoke its increase_balance function by running:
If successful, the result should resemble the following:
Once the invoke transaction is accepted on Starknet Sepolia, you can call your deployed contract’s get_balance function to confirm that your deployed contract’s storage — and by extension, the state of Starknet Sepolia — has indeed changed, by running:
If all goes well, the result should resemble the following (6610=421666_{10} = 42_{16}):