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 theHelloStarknet 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 usingsncast ourselves.
To learn how to fetch a predeployed Sepolia account, see Fetching a predeployed Sepolia account.
hello_starknet directory created in Generating HelloStarknet and run:
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.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:
HelloStarknet already declared, you can deploy an instance of it by running:
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:
get_balance function to confirm that your deployed contract’s storage — and by extension, the state of Starknet Sepolia — has indeed changed, by running: