> For the complete documentation index, see [llms.txt](https://supraoracles.gitbook.io/supra/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://supraoracles.gitbook.io/supra/network/evm/overview/build-on-supraevm/foundry/start-building.md).

# Start Building

Initialize a new Foundry project and prepare it for deployment on SupraEVM.

***

{% stepper %}
{% step %}

### <mark style="color:red;">Step 1: Initialize Your Project</mark>

Create and enter a new Foundry project directory:

```
forge init foundry-project
cd foundry-project
```

{% endstep %}

{% step %}

### <mark style="color:red;">Step 2: Configure</mark> <mark style="color:red;"></mark><mark style="color:red;">`foundry.toml`</mark>

Add a SupraEVM profile to configure your RPC, chain ID, and private key:

{% hint style="info" %}
For the latest RPC URL, please refer to the [Supra Network Information](/supra/network/evm/overview/network-information.md) page.
{% endhint %}

```
[profile.supra]
rpc_url = "<SUPRAEVM_RPC_URL>"
private_key = "0xYourPrivateKey"
```

This allows Foundry to deploy and broadcast transactions to SupraEVM.
{% endstep %}

{% step %}

### <mark style="color:red;">Step 3: Create a Smart Contract</mark>

Inside `src/`, create **SimpleStorage.sol**:

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SimpleStorage {
    uint256 public storedData;

    function set(uint256 x) public {
        storedData = x;
    }

    function get() public view returns (uint256) {
        return storedData;
    }
}
```

{% endstep %}

{% step %}

### <mark style="color:red;">Step 4: Create a Deployment Script</mark>

In `script/DeploySimpleStorage.sol`:

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "forge-std/Script.sol";
import "../src/SimpleStorage.sol";

contract DeploySimpleStorage is Script {
    function run() external {
        uint256 privateKey = vm.envUint("PRIVATE_KEY");
        vm.startBroadcast(privateKey);
        new SimpleStorage();
        vm.stopBroadcast();
    }
}
```

{% endstep %}

{% step %}

### <mark style="color:red;">Step 5: Compile Your Contract</mark>

```
forge build
```

{% endstep %}

{% step %}

### <mark style="color:red;">Step 6: Deploy to SupraEVM</mark>

Use `forge create` to deploy the contract:

```
forge create src/SimpleStorage.sol:SimpleStorage \
  --rpc-url <SUPRAEVM_RPC_URL> \
  --private-key 0xYourPrivateKey \
  --broadcast
```

This broadcasts the deployment transaction to SupraEVM.
{% endstep %}

{% step %}

### <mark style="color:red;">Step 7: Interact Using</mark> <mark style="color:red;"></mark><mark style="color:red;">`cast send`</mark>

Call functions on your deployed contract:

**Set a value:**

```
cast send <ContractAddress> "set(uint256)" 42 \
  --rpc-url <SUPRAEVM_RPC_URL> \
  --private-key 0xYourPrivateKey
```

{% endstep %}

{% step %}

### <mark style="color:red;">Step 8: Read the Contract State with</mark> <mark style="color:red;"></mark><mark style="color:red;">`cast call`</mark>

This is a gas-free read:

```
cast call <ContractAddress> "get() view returns (uint256)" \
  --rpc-url <SUPRAEVM_RPC_URL> 
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://supraoracles.gitbook.io/supra/network/evm/overview/build-on-supraevm/foundry/start-building.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
