2. How to Use Starknet IDE
The process of writing, testing, compiling, deploying, interacting, and querying with Starknet Cairo smart contracts
Last updated
The process of writing, testing, compiling, deploying, interacting, and querying with Starknet Cairo smart contracts
Last updated
After entering the project, you can click on the "preview" option at the top right corner of the readme.md file in the folder to preview it.
In the Explorer panel, you can create new files (or folders), refresh the directory, and download files. You can also directly click on the files that come with the template.
Click on a contract file to edit the code.
Once your contract code is written, click on the "Compiler" button in the right-side menu to open the compilation module. After selecting the Module Package Path, click on "Test."
After a successful test, the test results will be displayed in the console.
On the right-hand menu bar, under the Compiler section, click on "Build" to start compiling the contract.
After a successful compilation, a "target" folder will be generated in the current directory.
Before deploying the contract, you need to click on "Connect Wallet" in the top right corner and choose to connect either Argent X or Braavos.
Click on the "Deploy & Interaction" button on the right side, which will take you to the deployment and interaction page. Once there, select the compiled package and contract. After selecting the desired options, click on "Deploy" to initiate the deployment process (then confirm the transaction in your wallet).
Deploying a smart contract in Starknet requires two steps:
Declaring the class hash of your contract, i.e. sending your contract’s code to the network.
Deploying a contract, i.e. creating an instance of the code you previously declared.
Once the contract is successfully deployed, the console will output the result of the deployment along with relevant information.
If you haven't selected a contract in the "Select Compiled Contract" section, you can upload a locally compiled file for contract deployment.
In addition, you can also click on "Import Deployed Package" to import a previously deployed contract for contract interaction.
You can also deploy a contract by clicking on "Use On-Chain Contract Classhash" and using a previously declared classhash for deployment.
After a successful contract deployment, you can interact with the contract. Click on the deployed contract, choose the corresponding interface, and click on "Execute" to initiate the write interaction.
Click on "Account Objects" and enter the corresponding fields to query the relevant information.
If you prefer using the command line for development, you can open the Starknet Sandbox, which comes pre-loaded with Starkli, Scarb, Dojo, Starknet Foundry, Git and Node.js V16。
If you've started a process on a port in the Sandbox and wish to access that port, please refer to ChainIDE - Port Forwarding.