Skip to content

Commit

Permalink
Move files
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarros authored and masiedu4 committed Aug 9, 2024
1 parent 9cff0dc commit ca48c5c
Show file tree
Hide file tree
Showing 94 changed files with 24 additions and 24 deletions.
1 change: 0 additions & 1 deletion cartesi-rollups/rollups-apis/rollup/sidebar.js

This file was deleted.

File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A decentralized application (dApp) built on Cartesi incorporates several key ele
- Frontend: The application’s user-facing interface, typically implemented as a web application or a command-line interface tool.


![img](../../static/img/v1.5/architecture-overview.jpg)
![img](../../../static/img/v1.5/architecture-overview.jpg)

## Cartesi Machine

Expand Down Expand Up @@ -103,7 +103,7 @@ The Cartesi architecture facilitates several key processes that enable the funct

### Advance state

![img](../../static/img/v1.5/node-advance.jpg)
![img](../../../static/img/v1.5/node-advance.jpg)

The `advance-state` process changes the application state, and it involves the following steps:

Expand All @@ -119,7 +119,7 @@ The `advance-state` process changes the application state, and it involves the f

### Inspect state

![img](../../static/img/v1.5/node-inspect.jpg)
![img](../../../static/img/v1.5/node-inspect.jpg)

The `inspect-state` process allows for querying the application backend without altering its state:

Expand All @@ -137,7 +137,7 @@ It's important to note that `inspect-state` inputs do not produce vouchers or no

### Validation

![img](../../static/img/v1.5/node-validate.jpg)
![img](../../../static/img/v1.5/node-validate.jpg)

The validation process ensures the integrity of the off-chain computations:

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Here are the requirements:

The command generates a Docker image containing the rollups node and machine. You will be redirected to a web application to deploy the necessary smart contracts.

![img](../../static/img/v1.3/deploy.png)
![img](../../../static/img/v1.3/deploy.png)

## Deploying the contracts

Expand Down Expand Up @@ -83,7 +83,7 @@ Alternatively, you can use a service like [Fly.io](https://fly.io/) to deploy yo

Here is an example from [Alchemy](https://dashboard.alchemy.com/):

![img](../../static/img/v1.3/alchemy.png)
![img](../../../static/img/v1.3/alchemy.png)

:::caution important
The web3 provider URLs and wallet mnemonic are sensitive information that can compromise your application and funds. You should keep it **secure** and **private** at all times.
Expand Down Expand Up @@ -142,7 +142,7 @@ If deploying to Fly.io from macOS with Apple Silicon, create a Docker image for

1. Download `fly.toml` file from deploying the contracts and move it to your application directory:

![deploy self-hosted config](../../static/img/v1.3/fly.png)
![deploy self-hosted config](../../../static/img/v1.3/fly.png)

1. Edit the `fly.toml` file to change all occurrences of `<app-name>` to the name of your application

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Currently, Cartesi Rollups support the following types of assets:
- [ERC-1155 Single](../rollups-apis/json-rpc/portals/ERC1155SinglePortal.md)
- [ERC-1155 Batch](../rollups-apis/json-rpc/portals/ERC1155BatchPortal.md)

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

## Deposits

Expand All @@ -28,7 +28,7 @@ When an asset is deposited, it is on the base layer but gains a representation i

Deposit input payloads are always specified as packed ABI-encoded parameters, as detailed below.

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

### ABI encoding for deposits

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ You can initiate an advance request by sending input from the CLI using Cast, Ca

Advance requests involve sending input data to the L1 through a JSON-RPC call, allowing the information to reach the dApp backend and trigger a change in the application's state.

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

In the dApp architecture, here is how an advance request plays out.

Expand Down Expand Up @@ -210,7 +210,7 @@ Inspect requests are directly made to the rollup server, and the Cartesi Machine
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.
:::

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

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

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Welcome to Cartesi Rollups, where decentralized application development meets un

Utilizing the Cartesi Machine for transaction processing, developers can effortlessly implement sophisticated logic using their preferred programming language or tool. Explore the possibilities and streamline your decentralized application development journey with Cartesi Rollups.

![img](../static/img/v1.3/image.png)
![img](../../static/img/v1.3/image.png)


## Introduction

Let's delve into the workings of a Cartesi Rollup at a high level.

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


At its core, the Cartesi Rollup executes the Cartesi Machine - a robust RISCV deterministic emulator running Linux OS - fueled by ordered inputs and custom application code. Inputs sourced from the data availability layer are read by the Cartesi Node, inside of which the Cartesi Machine processes them and generates outputs. After the optimistic rollup dispute window passes, these outputs are verifiable and possibly executable on the settlement layer.
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ while True:

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)
![img](../../../../static/img/v1.3/advance.jpg)

In the dApp architecture, here is how an advance request plays out.

Expand All @@ -136,7 +136,7 @@ In the dApp architecture, here is how an advance request plays out.

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)
![img](../../../../static/img/v1.3/inspect.jpg)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The dApp's backend interacts with the Cartesi Rollups framework by retrieving pr

This is accomplished by calling a set of HTTP endpoints, as illustrated by the figure below:

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

You can send two requests to an application depending on whether you want to change or read the state.

Expand All @@ -37,7 +37,7 @@ The frontend component of the dApp needs to access the Cartesi Rollups framework

The figure below details some of the main use cases for these interactions:

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

- [`addInput()`](./json-rpc/input-box.md/#addinput) — This function submits input data to the InputBox smart contract on the base layer as a regular JSON-RPC blockchain transaction. When that transaction is mined and executed, an event containing the submitted input’s index is emitted, which the frontend can later use to query associated outputs.

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hide_title: true
hide_table_of_contents: true
api: {"operationId":"inspect","description":"This method sends an inspect-state request to the dApp backend passing the payload string in the URL.\nThe payload string should be URL-encoded; the inspect server will decode the string to UTF-8.\nIf the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding.\n\nThe response contains a status string and the reports generated by the dApp backend.\nThe status string can be either 'accept', 'reject', or 'exception'.\nIn case of exception, the field exception_payload will contain the exception payload;\nOtherwise, this field will be null.\n\nWhen running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request.\nOn host mode, it is advised against changing the dApp backend state when processing an inspect-state request.\nNotice that this method is synchronous, so it is not advised to perform resource-intensive operations.\n","parameters":[{"in":"path","name":"payload","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Inspect state response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"Whether inspection completed or not (and why not)","enum":["Accepted","Rejected","Exception","MachineHalted","CycleLimitExceeded","TimeLimitExceeded"],"example":"Accepted","title":"CompletionStatus"},"exception_payload":{"type":"string","description":"Payload in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n","example":"0xdeadbeef","title":"Payload"},"reports":{"type":"array","items":{"type":"object","properties":{"payload":{"type":"string","description":"Payload in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n","example":"0xdeadbeef","title":"Payload"}},"title":"Report"}},"processed_input_count":{"type":"integer","description":"Number of processed inputs since genesis","example":0}},"title":"InspectResponse"}}}},"default":{"description":"Error response.","content":{"text/plain":{"schema":{"type":"string","description":"Detailed error message.","example":"The request could not be understood by the server due to malformed syntax","title":"Error"}}}}},"method":"get","path":"/{payload}","servers":[{"url":"https://<dapp_inspect_url>"},{"url":"http://localhost:5005/inspect"}],"info":{"title":"Inspect-state HTTP API for Cartesi Rollups","version":"0.5.1","license":{"name":"Apache-2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"description":"API that allows the dApp frontend to make inspect-state requests to the dApp backend.\n"},"postman":{"name":"Inspect dApp state REST API","description":{"content":"This method sends an inspect-state request to the dApp backend passing the payload string in the URL.\nThe payload string should be URL-encoded; the inspect server will decode the string to UTF-8.\nIf the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding.\n\nThe response contains a status string and the reports generated by the dApp backend.\nThe status string can be either 'accept', 'reject', or 'exception'.\nIn case of exception, the field exception_payload will contain the exception payload;\nOtherwise, this field will be null.\n\nWhen running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request.\nOn host mode, it is advised against changing the dApp backend state when processing an inspect-state request.\nNotice that this method is synchronous, so it is not advised to perform resource-intensive operations.\n","type":"text/plain"},"url":{"path":[":payload"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) ","type":"text/plain"},"type":"any","value":"","key":"payload"}]},"header":[{"key":"Accept","value":"application/json"}],"method":"GET"}}
sidebar_class_name: "get api-method"
info_path: cartesi-rollups/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups
info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups
custom_edit_url: null
---

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hide_title: true
hide_table_of_contents: true
api: {"operationId":"addNotice","description":"The dApp backend can call this method to add a new notice when processing the advance-state request.\nA notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.\nBetween calls to the finish method, the notice method can be called up to 32k times.\n\nThe returned value is the index of the notice for the current advance request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"The payload is in the Ethereum hex binary format.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175.\nAn empty payload is represented by the string '0x'.\n","example":"0xdeadbeef","title":"Payload"}},"title":"Notice"}}}},"responses":{"200":{"description":"Created the notice.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123}},"title":"IndexResponse"}}}},"default":{"description":"Error response.","content":{"text/plain":{"schema":{"type":"string","description":"Detailed error message.","example":"The request could not be understood by the server due to malformed syntax","title":"Error"}}}}},"method":"post","path":"/notice","servers":[{"url":"https://<dapp_rollup_url>"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.5.1","license":{"name":"Apache-2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"description":"API that the Cartesi Rollup HTTP Server implements.\n\nIn the box below, there is an example of a dApp backend that uses the Rollup HTTP API.\n\n```\nimport requests\nimport sys\n\nrollup = sys.argv[1]\n\ndef check_status_code(response):\n if response.status_code not in range(200, 300):\n print(f'Error: invalid status code {response.status_code}')\n sys.exit(1)\n return response\n\nfinish = {'status': 'accept'}\nwhile True:\n print('Sending finish')\n r = check_status_code(requests.post(rollup + '/finish', json=finish))\n if r.status_code == 202:\n print('No pending rollup request, trying again')\n continue\n\n rollup_request = r.json()\n if rollup_request['request_type'] == 'advance_state':\n print('Sending voucher')\n voucher = {\n 'destination': rollup_request['data']['metadata']['msg_sender'],\n 'payload': rollup_request['data']['payload']\n }\n check_status_code(requests.post(rollup + '/voucher', json=voucher))\n\n print('Sending notice')\n notice = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/notice', json=notice))\n\n print('Sending report')\n report = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/report', json=report))\n\n finish['status'] = 'accept'\n\n elif rollup_request['request_type'] == 'inspect_state':\n print('Sending report per inspect request')\n report = {'payload': rollup_request['data']['payload']}\n check_status_code(requests.post(rollup + '/report', json=report))\n\n else:\n print('Throwing rollup exception')\n exception = {'payload': rollup_request['data']['payload']}\n requests.post(rollup + '/exception', json=exception)\n break\n```\n\nIn production mode, if the dApp exits the Rollups initialization script will register a Rollup Exception.\nSee [/exception](#api-Default-registerException).\n\nIn host mode, the Cartesi Rollups infrastructure is not able to detect that the dApp exited.\nIt is up to the dApp developer to re-launch the dApp.\n"},"postman":{"name":"Add a new notice","description":{"content":"The dApp backend can call this method to add a new notice when processing the advance-state request.\nA notice describes any changes to the internal state of the dApp that may be relevant to the blockchain.\nBetween calls to the finish method, the notice method can be called up to 32k times.\n\nThe returned value is the index of the notice for the current advance request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["notice"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}}
sidebar_class_name: "post api-method"
info_path: cartesi-rollups/rollups-apis/rollup/cartesi-rollup-http-api
info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api
custom_edit_url: null
---

Expand Down
Loading

0 comments on commit ca48c5c

Please sign in to comment.