# Deploying Smart Contract

***

### Compile the Contract

Run `forge build` to compile your **Solidity smart contract**, ensuring that the code is free of errors and ready for deployment on **SupraEVM**.

```
forge build
```

### Deploy the Contract using force create:

Use `forge create` to deploy your contract on **SupraEVM**, specifying the contract path, RPC URL, and private key. This command will broadcast the transaction to the network, making the contract live.

{% code overflow="wrap" %}

```
forge create src/SimpleStorage.sol:SimpleStorage --rpc-url https://rpc-evmstaging.supra.com/rpc/v1/eth --private-key 0xPrivateKey --broadcast 
```

{% endcode %}

<figure><img src="/files/aytmB4lQWEOUjyyaalfN" alt=""><figcaption></figcaption></figure>

***

### Using Cast Send for Transactions

Interact with your deployed contract using `cast send`, which allows you to execute functions on-chain.

You can interact with the deployed contract using `cast send`.

For example, to call the `set` function:

{% code overflow="wrap" %}

```
cast send <DeployedContractAddress> "set(uint256)" 42 --rpc-url https://rpc-evmstaging.supra.com/rpc/v1/eth --private-key 0xYourPrivateKey
```

{% endcode %}

***

### View Contract State using Cast Call

Retrieve stored data from your contract using `cast call`, which reads contract state without sending a transaction, making it gas-free.

To view the state of the contract, use `cast call`:

{% code overflow="wrap" %}

```
cast call <DeployedContractAddress> "get() view returns (uint256)" --rpc-url https://rpc-evmstaging.supra.com/rpc/v1/eth
```

{% endcode %}

By using `forge create` and `cast send`, you can deploy and interact with your smart contract on the Supra EVM network.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://supraoracles.gitbook.io/supra/network/evm/getting-started/foundry/deploying-smart-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
