# Interacting with a Smart Contract

## Prerequisites

Ensure Olatte is installed correctly:

```shell
olatte --version
```

If this command fails, see [Setting up your environment.](https://ola-2.gitbook.io/ola-developer-documents/quick_start/setup_environment)

## Introduction

Olatte enables interaction with smart contracts via two primary methods:

* **call**: for read-only functions.
* **invoke**: for write functions that modify the state.

## Call a function

The call command can query a smart contract function without sending a transaction.

As an example you can use the get\_proposer function which expect index of the proposal and returns the address of the proposer:

```shell
olatte call --network=pre-alpha vote_simple_abi.json  \
    0x444b2e790621ac6b74923f7ad92....\
    winningProposal
```

> * vote\_simple\_abi.json is the smart contract's abi file.
> * 0x444b.. is the contract address
> * winningProposal is function name. For functions with parameters, enter the function's inputs after the function name.

This will return the winner proposal:

```shell
    0
```

## Invoke a function

when we need to modify the state of the smart contract, we need to send a transaction. This requires the use of the invoke command in Olatte, which sends a transaction to the Ola network.

In this example, we are sending a transaction to vote for proposal 7.

```shell
olatte invoke --network pre-alpha vote_simple_abi.json \
0x444b2e790621ac6b74923f7ad92.... \
vote 7
```
