---
# System prepended metadata

title: 'Invoking a Starknet Contract Function Using sncast '

---

# Invoking a Starknet Contract Function Using sncast 


## Prerequisites
Before proceeding , ensure that you have installed Starknet Foundry. You can verify `sncast` by running:
```sh
sncast --version
```
If `sncast` is not installed, follow the official installation guide. Additionally, ensure that you have created and deployed a Starknet account. Find details [here](https://github.com/software-mansion/starknet-foundry).

## Steps

### 1. Interact with the Counter Contract Using `sncast`
We will use `sncast` to interact with a previously deployed Counter contract on Starknet.

**Counter Contract Address:**
```
0x0070c4689c7c2357a75efb62cadf39ebc0b076c7ac7261d577312ae9fe8a4ac2
```

#### 1.1 Create a Starknet Account
Run the following command to create a new Starknet account named `Otowo`:
```sh
sncast account create --network sepolia --name otowo
```
![Screenshot (254)](https://hackmd.io/_uploads/BJZ_7hzTJe.png)

#### 1.2 Deploy the Created Account
Deploy the created account using the Sepolia testnet RPC:
```sh
sncast account deploy -u https://free-rpc.nethermind.io/sepolia-juno/v0_7 --name otowo
```
![Screenshot (256)](https://hackmd.io/_uploads/SycYQnfTkg.png)


#### 1.3 Invoke Functions in the Counter Contract

##### Increase Count by a Specific Value
```sh
sncast --account otowo invoke --network sepolia --contract-address 0x0070c4689c7c2357a75efb62cadf39ebc0b076c7ac7261d577312ae9fe8a4ac2 --function "increase_count" --arguments 9
```
![Screenshot (259)](https://hackmd.io/_uploads/HyZo7hGTkg.png)


##### Increase Count by One
```sh
sncast --account otowo invoke --network sepolia --contract-address 0x0070c4689c7c2357a75efb62cadf39ebc0b076c7ac7261d577312ae9fe8a4ac2 --function "increase_count_by_one"
```
![Screenshot (260)](https://hackmd.io/_uploads/r143mhz6kx.png)


##### Decrease Count by a Specific Value
```sh
sncast --account otowo invoke --network sepolia --contract-address 0x0070c4689c7c2357a75efb62cadf39ebc0b076c7ac7261d577312ae9fe8a4ac2 --function "decrease_count" --arguments 5
```

![Screenshot (262)](https://hackmd.io/_uploads/BytS4hfTyl.png)



##### Decrease Count by One
```sh
sncast --account otowo invoke --network sepolia --contract-address 0x0070c4689c7c2357a75efb62cadf39ebc0b076c7ac7261d577312ae9fe8a4ac2 --function "decrease_count_by_one"
```
![Screenshot (261)](https://hackmd.io/_uploads/ry20XhfTyg.png)

### 2. Verify the Invocation
After invoking each function, verify the transaction is valid using the generated transaction hash.


---

By following these steps, you will successfully interact with the Counter contract using `sncast` and understand how to send transactions on Starknet.

