# Interacting with a Smart Contract

## Prerequisites

Ensure Olatte is installed correctly:

```shell
olatte --version
```

If this command fails, see [Setting up your environment.](/ola-developer-documents/quick_start/setup_environment.md)

## 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
```


---

# 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://ola-2.gitbook.io/ola-developer-documents/quick_start/invoke_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.
