Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
3d3e70f
docs: modified assets-handling section
Nonnyjoe Mar 16, 2025
24e855e
docs: modified building section in line with v2 updates
Nonnyjoe Mar 16, 2025
67b5833
docs: partial update to the cli command section
Nonnyjoe Mar 16, 2025
627239b
docs: update reference of dapp to application in installation section
Nonnyjoe Mar 16, 2025
f7215bd
docs: Modified graphQL queries and dapp reference in query section
Nonnyjoe Mar 16, 2025
74ff7d9
docs: updated send-inputs section in line with V2 updates
Nonnyjoe Mar 16, 2025
1347d77
docs: added page for managing devnet environment
Nonnyjoe Mar 18, 2025
54aeadc
docs: modifying the deploying an app section
Nonnyjoe Mar 19, 2025
c3adf20
docs: updated cli-commands section inline with cli2.0
Nonnyjoe Mar 20, 2025
e5baa7d
docs: updated broken links in tutorial section referencing changes in…
Nonnyjoe Mar 20, 2025
b51e83f
docs: modified page title for building and deploying an application
Nonnyjoe Mar 20, 2025
2693de4
docs: reflected first stage of reviews
Nonnyjoe Mar 21, 2025
80c42b6
docs: updated cli commands in line with cli-aplha-9
Nonnyjoe Apr 21, 2025
79b9d03
docs: updated api-reference
Nonnyjoe Jun 5, 2025
048a841
docs: restructured development section
Nonnyjoe Jun 5, 2025
52a7ff8
docs: Implemented reviews across development section
Nonnyjoe Jun 9, 2025
be450d4
docs: Rebased on staging and fixed broken links
Nonnyjoe Jun 9, 2025
3b0728d
fixup! docs: Implemented reviews across development section
Nonnyjoe Jun 11, 2025
6bb6ac4
fixup! docs: Implemented reviews across development section
Nonnyjoe Jun 11, 2025
c57e678
update delegatecall
henriquemarlon Aug 8, 2025
010e6c3
removed espresso, added react tutorials and app-chains page
riseandshaheen Jun 16, 2025
be7690b
added diagrams and minor improvements
riseandshaheen Jul 3, 2025
85fe106
added spacing on big square image
jplgarcia Jul 3, 2025
835c8b8
update application contract and add consensus section
henriquemarlon Aug 8, 2025
4e03962
minor improvements and cosmetic changes
henriquemarlon Aug 10, 2025
eeaede9
fix: id correspondence
henriquemarlon Aug 10, 2025
8f876ac
fix: id correspondence
henriquemarlon Aug 10, 2025
86fc04f
revert golang version for delegate call voucher
henriquemarlon Aug 10, 2025
2f95adb
docs(development): Updated development section in line with updates o…
Nonnyjoe Aug 12, 2025
f805fb9
feat: src files and deployment tutorial for local node deployment
henriquemarlon Aug 11, 2025
a69e103
feat: change link for compose file
henriquemarlon Aug 11, 2025
16d0850
minor improvements and snapshot section with gh actions example
henriquemarlon Aug 14, 2025
640ed44
docs: update snapshot workflow description and minor updates on self-…
henriquemarlon Aug 21, 2025
ca8da77
Fraud Proofs Tab- Content
riseandshaheen Aug 25, 2025
862fa28
cosmetic updates and review comments updated content
riseandshaheen Aug 27, 2025
181b068
cosmetic updates, dapp to app, sidebar collapse set to true
riseandshaheen Aug 28, 2025
e4f704e
honeypot application logic corrections
riseandshaheen Sep 4, 2025
32e4490
updates with review comments from lyno
riseandshaheen Sep 5, 2025
5e9875f
Rename Computation-Hash-Rollups.jpg to computation-hash-rollups.jpg
riseandshaheen Sep 5, 2025
2f529c8
minor updates
riseandshaheen Sep 8, 2025
635429b
minor refinements
riseandshaheen Sep 8, 2025
12fdc26
Default to 1.5, removed outdated commands from quickstart and removed…
riseandshaheen Sep 19, 2025
1875cc1
add: implemented a sidebar file for V2
Nonnyjoe Oct 10, 2024
aca9e25
update: Modified the Development folder for V2
Nonnyjoe Oct 10, 2024
08343b5
fix: Handled error relating to broken links
Nonnyjoe Oct 11, 2024
a297a56
docs: restructuring the api reference
henriquemarlon Oct 15, 2024
17253aa
modified: overview & quickstart merged in side-bar
riseandshaheen Oct 14, 2024
67e2d1b
remapped pages
jplgarcia Nov 21, 2024
cd255b0
setting redirects
jplgarcia Nov 21, 2024
c0103f7
fix: Handled error relating to broken links
Nonnyjoe Oct 11, 2024
cef010a
update: modified application factory contract in line with V2.0
Nonnyjoe Nov 18, 2024
5e25607
update: modified the different portals page in line with docs V2
Nonnyjoe Nov 18, 2024
f368c3a
mod: relayer page and also reference in sidebar
Nonnyjoe Nov 18, 2024
9fb2f34
mod: updated querry outputs inline with V2
Nonnyjoe Nov 25, 2024
9aadf3e
merge: merged Joao's restructure with V2 updates
Nonnyjoe Nov 25, 2024
4c8e9f6
update: modified asssets-handling inline with V2
Nonnyjoe Nov 25, 2024
4095b0e
add: Added an external resource section
Nonnyjoe Nov 7, 2024
cc4a966
update: restructured external resource position
Nonnyjoe Nov 7, 2024
316cc9d
add: Added an external resource section
Nonnyjoe Nov 7, 2024
a82a599
update: restructured external resource position
Nonnyjoe Nov 7, 2024
efe8a10
update: added shour descriptions for different integratins
Nonnyjoe Nov 18, 2024
7510d26
add: added the integrations guide section
Nonnyjoe Nov 25, 2024
6c1aa8b
update on structure, spliting architecture concepts and installation …
jplgarcia Dec 9, 2024
742e4a3
updated tutorials for v2
jplgarcia Dec 23, 2024
17891f2
admonition
jorka Dec 2, 2024
d767cae
announcement bar
jorka Dec 2, 2024
eb374a8
api item
jorka Dec 2, 2024
c5bff32
edit this page, custom icons
jorka Dec 9, 2024
b11da60
footer
jorka Dec 10, 2024
570d00a
edit icon fix
jorka Dec 11, 2024
154a5c7
edit icon fix
jorka Dec 11, 2024
683072b
remove console log
jorka Dec 12, 2024
b8dc483
sidebar version
jorka Dec 12, 2024
9cfe975
sidebar version
jorka Dec 12, 2024
95253f3
config and deps
jorka Dec 12, 2024
706e126
remove DocVersionBadge
jorka Dec 12, 2024
d1ad1b0
open api config - enable generation of previos versions
jorka Dec 13, 2024
3d6006f
generate prev versions open api
jorka Dec 13, 2024
87f5002
yarn lock
jorka Dec 13, 2024
c21ee58
remove log
jorka Dec 13, 2024
7153cc2
add deps
jorka Dec 13, 2024
6b9c8b7
fix mdx
jorka Dec 18, 2024
1f026ea
add missing page to fix broken links
jorka Dec 18, 2024
dc670ba
fix api folder for v2, comment missing redirects, switch to v2
jorka Dec 18, 2024
a42ecc8
docs: application section updated to v2
henriquemarlon Dec 2, 2024
4e5c280
docs: typos and solving requests for input-box and application consensus
henriquemarlon Mar 8, 2025
9f1d22a
docs: update from json-rpc to contracts
henriquemarlon Mar 8, 2025
748bc7d
docs: update broken links
henriquemarlon Mar 8, 2025
7876303
docs: update broken links
henriquemarlon Mar 8, 2025
43af244
docs: update from json-rpc to contracts
henriquemarlon Mar 8, 2025
802cda5
docs: solve broken links and wrong references
henriquemarlon Mar 8, 2025
70ba857
migration guide v1.5 to v2
riseandshaheen Mar 11, 2025
84d08de
feat: docs v2 products restructuring, rollups and coprocessor in navbar
riseandshaheen Apr 28, 2025
f74d440
fix: visibility of version dropdown and table of contents on coproces…
riseandshaheen Apr 29, 2025
e3d5282
doc: added quickstart(rollups) to Get-Started tab
riseandshaheen Apr 30, 2025
e35184d
refactor: removed troubleshooting, differences with rollups and nonod…
riseandshaheen May 1, 2025
6ca8049
revert: coprocessor content
riseandshaheen May 16, 2025
f5f5b69
updated content for cartesi-machine and fraud-proofs
riseandshaheen May 16, 2025
fc2db71
changed table font size for better fit
jplgarcia May 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ When an exception occurs during request processing, the dApp backend should:
3. Exit the processing loop

The Rollup HTTP Server will:
- Skip the input with the reason [`EXCEPTION`](../graphql/enums/completion-status.md)
- Skip the input with the reason [`EXCEPTION`](../jsonrpc/types.md#inputcompletionstatus)
- Forward the exception message
- Return status code 200

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ id: introduction
title: Introduction
---

The backend of a Cartesi dApp processes requests in the following manner:
The backend of a Cartesi dApp retrieves a new request as follows:

- **Finish**Called via [`/finish`](./finish.md), indicates that any previous processing has been completed and the backend is ready to handle the next request. The subsequent request is returned as the call's response and can be of the following types:
- Finish — Communicates that any previous processing has been completed and that the backend is ready to handle the subsequent request. This following request is returned as the call's response and can be of the following types:

- **Advance** — Provides input to be processed by the backend to advance the Cartesi Machine state. When processing an Advance request, the backend can call the [`/voucher`](./vouchers.md), [`/delegate-call-voucher`](./delegate-call-vouchers.md), [`/notice`](./notices.md), and [`/report`](./reports.md) endpoints. For such requests, the input data contains both the payload and metadata, including the account address that submitted the input.
- **Advance** — Provides input to be processed by the backend to advance the Cartesi Machine state. When processing an `Advance` request, the backend can call the methods `/voucher`, `/notice`, and `/report`. For such requests, the input data contains the payload and metadata, such as the account address that submitted the input.

- **Inspect** — Submits a query about the application's current state. When running inside a Cartesi Machine, this operation is guaranteed to leave the state unchanged, as the machine reverts to its exact previous condition after processing. For Inspect requests, the input data contains only a payload, and the backend can only call the [`/report`](./reports.md) endpoint.
- **Inspect** — This function submits a query about the application's current state. When running inside a Cartesi Machine, this operation is guaranteed to leave the state unchanged since the machine is reverted to its exact previous condition after processing. For Inspect requests, the input data has only a payload.

:::caution Inspect requests
Inspect requests are best suited for non-production use, such as debugging and testing. They may not function reliably in production environments, potentially leading to errors or disruptions.
:::

- **Exception** — Called by the backend when it encounters an unrecoverable error during request processing. This signals to the Rollup HTTP Server that the current request processing failed and should be terminated. See [`/exception`](./exception.md) for more details.

## Advance and Inspect

Here is a simple boilerplate application that handles Advance and Inspect requests:
Expand Down Expand Up @@ -120,34 +122,31 @@ while True:

</Tabs>

An **Advance** request involves sending input data to the base layer via JSON-RPC, allowing it to reach the dApp backend to change the application's state.
An **Advance** request involves sending input data to the base layer via JSON-RPC so they can reach the dApp backend to change the application's state.

![img](../../../../static/img/v1.3/advance.jpg)

Here is how an advance request works in the dApp architecture:
In the dApp architecture, here is how an advance request plays out.

- Step 1: Send an input to the [`addInput(address, bytes)`](../contracts/input-box.md#addinput) function of the InputBox smart contract.

- Step 2: The HTTP Rollups Server reads the data and sends it to the Cartesi Machine for processing.
- Step 2: The HTTP Rollups Server reads the data and gives it to the Cartesi machine for processing.

- Step 3: After computation, the machine state is updated, and the results are returned to the rollup server.
- Step 3: After the computation, the machine state is updated, and the results are returned to the rollup server.

An **Inspect** request involves making an external HTTP API call to the rollups server to read the dApp state without modifying it.
An **Inspect** request involves making an external HTTP API call to the rollups server to read the dApp state without changing it.

![img](../../../../static/img/v1.3/inspect.jpg)

You can make a simple inspect call from your frontend client to retrieve reports.

To perform an Inspect call, send an HTTP POST request to `<address of the node>/inspect/<application name>` with a payload in the request body. For example:
To perform an Inspect call, use an HTTP GET request to `<address of the node>/inspect/<request path>`. For example:

```shell
curl -X POST http://localhost:8080/inspect/<application name> \
-H "Content-Type: application/json" \
-d '{"payload": "0xdeadbeef"}'
curl http://localhost:8080/inspect/mypath
```

The payload should be a hex-encoded string starting with '0x' followed by pairs of hexadecimal numbers.
Once the call's response is received, the payload is extracted from the response data, allowing the backend code to examine it and produce outputs as **reports**.

After receiving the call's response, the payload is extracted from the response data, allowing the backend code to examine it and produce outputs as **reports**.

The direct output types for **Advance** requests are [vouchers](./vouchers.md), [DELEGATECALL vouchers](./delegate-call-vouchers.md), [notices](./notices.md), and [reports](./reports.md), while **Inspect** requests generate only [reports](./reports.md).
The direct output types for **Advance** requests are [vouchers](./vouchers.md), [notices](./notices.md), and [reports](./reports.md), while **Inspect** requests generate only [reports](./reports.md).
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Crucially, the base layer conducts on-chain validation of these notices through

This validation process ensures the integrity and authenticity of the submitted notices, enabling the blockchain to verify and authenticate the declared off-chain events or conditions.

Let's see how a Cartesi dApp's **Advance** request sends an output to the rollup server as a notice:
Here are sample functions you can add to your application, then call to send a notice to the rollup server:

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Expand All @@ -23,25 +23,30 @@ import TabItem from '@theme/TabItem';
<pre><code>

```javascript
async function handle_advance(data) {
console.log("Received advance request data " + JSON.stringify(data));

const inputPayload = data["payload"];
import { stringToHex, hexToString } from "viem";

const emitNotice = async (inputPayload) => {
let hexPayload = stringToHex(inputPayload); // convert payload from string to hex
try {
await fetch(rollup_server + "/notice", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ payload: inputPayload }),
body: JSON.stringify({ payload: hexPayload }),
});
} catch (error) {
// Handle error here
}
}

async function handle_advance(data) {
console.log("Received advance request data " + JSON.stringify(data));
const payload = hexToString(data.payload); // convert input from hex to string for processing
await emitNotice(payload);
return "accept";
}

```

</code></pre>
Expand All @@ -51,22 +56,16 @@ async function handle_advance(data) {
<pre><code>

```python
def handle_advance(data):
logger.info(f"Received advance request data {data}")

status = "accept"
try:
inputPayload = data["payload"]
# Send the input payload as a notice
response = requests.post(
rollup_server + "/notice", json={"payload": inputPayload}
)
logger.info(
f"Received notice status {response.status_code} body {response.content}"
)
except Exception as e:
# Emit report with error message here
return status
# Notice creation Process from a message string
def emit_notice(message):
notice_payload = {"payload": "0x" + message.encode("utf-8").hex()}
response = requests.post(rollup_server + "/notice", json=notice_payload)
if response.status_code == 200 or response.status_code == 201:
logger.info(f"Notice emitted successfully with data: {notice_payload}")
else:
logger.error(f"Failed to emit Notice with data: {notice_payload}. Status code: {response.status_code}")

emit_notice("hello world")
```

</code></pre>
Expand All @@ -75,5 +74,5 @@ def handle_advance(data):
</Tabs>

:::note querying notices
Frontend clients can query notices using a GraphQL API exposed by Cartesi Nodes. [Refer to the documentation here](../../development/query-outputs.md/#query-all-reports) to query notices from the rollup server.
Frontend clients can query notices using a GraphQL API exposed by the Cartesi Nodes. [Refer to the documentation here](../../development/query-outputs.md/#query-all-reports) to query notices from the rollup server.
:::
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,27 @@ title: Vouchers

Vouchers serve as a mechanism for facilitating on-chain actions initiated in the execution layer.

Imagine vouchers as digital authorization tickets that grant dApps the authority to execute specific actions directly on the base layer. These vouchers encapsulate the details of the desired on-chain action, such as a token swap request or asset transfer.
Imagine vouchers as digital authorization tickets, granting dApps the authority to execute specific actions directly on the base layer. This voucher encapsulates the details of the desired on-chain action, such as a token swap request or asset transfer.

A voucher explicitly specifies the action that the dApp intends to execute on the base layer.
The voucher explicitly specifies the action that the dApp intends to execute on the base layer.

For instance, in a DeFi application built on Cartesi, users may want to swap one token for another. The dApp generates a voucher that authorizes the on-chain smart contract to execute the swap on the user's behalf.

The [`Application`](../contracts/application.md) contract is crucial in validating and executing the received voucher on the blockchain. This execution process occurs through the [`executeOutput()`](../../contracts/application/#executeoutput) function, which handles different types of outputs including vouchers and DELEGATECALL vouchers.
The [`CartesiDApp`](../contracts/application.md) contract is crucial in validating and executing the received voucher on the blockchain. This execution process occurs through the [`executeVoucher()`](../contracts/application.md/#executevoucher) function, ensuring that the action specified in the voucher is legitimate and authorized.

The result of the voucher execution is recorded on the base layer. This recording typically involves submitting claims by a consensus contract, ensuring the integrity and transparency of the executed on-chain action.

:::note create a voucher
[Refer to the documentation here](../../development/asset-handling.md) for asset handling and creating vouchers in your dApp.
:::

## DELEGATECALL Vouchers

Delegate call vouchers enable advanced smart contract interactions through the [DELEGATECALL](https://www.evm.codes/?fork=cancun#f4) opcode, allowing dApps to separate their execution logic from their storage context. For more details, see [DELEGATECALL Vouchers](./delegate-call-vouchers.md).

## Epoch Configuration
## Epoch configuration

An epoch refers to a specific period during which a batch of updates is processed off-chain, and upon agreement by validators, the finalized state is recorded on-chain.

Epoch Length is the number of blocks that make up an epoch. It determines how long each epoch lasts in terms of block counts. For instance, if an epoch length is set to 7200 blocks, the epoch will end once 7200 blocks have been processed. This length directly influences how frequently updates are finalized and recorded on the blockchain.

One common use of vouchers in Cartesi dApps is to withdraw assets. Users initiate asset withdrawals by generating vouchers, which are then executed on the blockchain upon the closure of the corresponding epoch.
One everyday use of vouchers in Cartesi dApps is to withdraw assets. Users initiate asset withdrawals by generating vouchers, which are then executed on the blockchain upon the closure of the corresponding epoch.

You can manually set the epoch length to facilitate quicker asset deposits and withdrawals.

Expand Down
Loading
Loading