> For the complete documentation index, see [llms.txt](https://docs.swisstronik.com/swisstronik-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swisstronik.com/swisstronik-docs/development/swisstronikjs-sdk/swisstronik-and-ethereum-calls.md).

# Swisstronik & Ethereum calls

Calls in the blockchain context are read-only interactions with the blockchain, retrieving information from the blockchain without altering, deleting, or adding data.

### Ethereum Calls

We can use ethers.js to execute calls to the Ethereum blockchain. specifically for smart contracts, we can use `provider.call({to, data})` to retrieve values from smart contracts

```javascript
provider.call({
  to: "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
  // Function selector for `function getMessage(uint256)` + encoded argument `1`
  data: "0xa5f3c4f600000000000000000000000000000000000000000000000000000000000000001"
});
```

In this code example, the function `call` is made to the `to` smart contract address, executing the `view returns` function `getMessage(uint256)` while providing the argument `1`. This process will return a message from the smart contract.

#### Swisstronik Calls

For Swisstronik calls, we need to make sure the `data` field of the `call` is encrypted using SwisstronikJS.

```javascript
provider.call({
  to: "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
  //The `data` field must be an encrypted value, otherwise, the call will not work
  data: "0xf53a7d4fcf3116b8476ac3f986542794f0df2516070c555580ae29049c0ec91b8a2d82d2bf06694fea0c485fa48cb34b596a9f496a19f2ecb3c1da0540544cffb03f1dee14d7887fea1de6d982a46edfaab773"
});
```

This example shows that when making Swisstronik calls, **the data field needs to be filled with an encrypted value using SwisstronikJS**. Otherwise, the call won't work. Let's now explore how to encrypt this data for successful calls on the Swisstronik blockchain.


---

# 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://docs.swisstronik.com/swisstronik-docs/development/swisstronikjs-sdk/swisstronik-and-ethereum-calls.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.
