square-codeDeploy Your Contract (Foundry)

Deploy Your First Contract (Foundry)

This guide deploys a simple Solidity contract to SATUCHAIN Testnet using Foundry (forge/cast).

Requirements

1) Install Foundry

If Foundry is not installed:

curl -L https://foundry.paradigm.xyz | bash
foundryup

Confirm:

forge --version
cast --version

2) Create a New Project

3) Add the Contract

Create src/Storage.sol:

4) Configure Environment Variables

Create a .env file:

Notes:

  • Use a testnet-only wallet private key.

  • Never commit .env to version control.

Load env vars (Linux/macOS):

Windows PowerShell:

5) Build

6) Deploy

Deploy Storage using forge create:

Output will include:

  • Deployed contract address

  • Transaction hash

7) Verify on Explorer

  1. Search the transaction hash or contract address.

  2. Confirm the contract creation transaction succeeded.

8) Interact With the Contract (Optional)

Replace <CONTRACT_ADDRESS> with your deployed address.

Read the value:

Set a new value (example: 123):

Then read again:

Troubleshooting

Insufficient funds

  • Claim more tSTU and retry.

Invalid sender / signature error

  • Verify the private key and ensure it matches the account with tSTU.

RPC not responding

  • Confirm RPC URL is correct and retry the command.

Last updated