diff --git a/.vscode/ltex.dictionary.en-US.txt b/.vscode/ltex.dictionary.en-US.txt new file mode 100644 index 00000000..f10f69fb --- /dev/null +++ b/.vscode/ltex.dictionary.en-US.txt @@ -0,0 +1,8 @@ +Cartesi +dApp +Rollups +Prevado +XMTP +Farcaster +onchain +Mugen diff --git a/.vscode/ltex.hiddenFalsePositives.en-US.txt b/.vscode/ltex.hiddenFalsePositives.en-US.txt new file mode 100644 index 00000000..5c4c1e91 --- /dev/null +++ b/.vscode/ltex.hiddenFalsePositives.en-US.txt @@ -0,0 +1,4 @@ +{"rule":"BASE_BASIS","sentence":"^\\QThis guide covers the Cartesi+Espresso integration and how to upgrade Cartesi application such that inputs can be submitted via Espresso instead of the regular base layer.\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\QIntegrating Cartesi and Chronicle offers Cartesi applications access to onchain and offcahin data like, price feed without developers having to set up additional systems or intermediaries.\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\QPrevado Id:\\E$"} +{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\QThe Devnet environment functions similarly to a mainnet.\\E$"} diff --git a/README.md b/README.md index 839c5bf1..ab9f5eaa 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cartesi Documentation -Welcome to the official Cartesi documentation repository. This documentation is built using [Docusaurus 2.4.3](https://docusaurus.io/). +Welcome to the official Cartesi documentation repository. This documentation is built using [Docusaurus 3.6.3](https://docusaurus.io/). ## Requirements diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx index 72d6d8ee..df14d717 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -1,26 +1,48 @@ --- id: inspect-state-http-api-for-cartesi-rollups title: "Inspect-state HTTP API for Cartesi Rollups" -description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend. -" +description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; - - Version: 0.4.0 + -# Inspect-state HTTP API for Cartesi Rollups + + + + API that allows the dApp frontend to make inspect-state requests to the dApp backend. -
-

License

- Apache-2.0 + +
+

+ License +

+ Apache-2.0 +
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect.api.mdx index 2dfac41c..c88b0fe2 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/inspect/inspect.api.mdx @@ -1,44 +1,47 @@ --- id: inspect title: "Inspect dApp state REST API" -description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL. -The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. -If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. - -The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. -In case of exception, the field exception_payload will contain the exception payload; -Otherwise, this field will be null. - -When running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request. -On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. -Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -" -sidebar_label: Inspect dApp state REST API +description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL." +sidebar_label: "Inspect dApp state REST API" 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"},"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"},"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"}}}},"metadata":{"type":"object","description":"Contain the blockchain Metadata for the given inspect request","properties":{"active_epoch_index":{"type":"integer","description":"Epoch that was inspected","example":0},"current_input_index":{"type":"integer","description":"Current input index when the state was inspected"}}}}}}}},"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"}}}}},"method":"get","path":"/{payload}","servers":[{"url":"https://"},{"url":"http://localhost:5005/inspect"}],"info":{"title":"Inspect-state HTTP API for Cartesi Rollups","version":"0.4.0","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"}} +api: eJztV0tvGzcQ/iuELk4AW1LdpA+lKGC4SmPAeUBR0EMSGNTuSMt4l9ySXEuCoP/eb0iutLJspLf24Iu9Gs6LM988uOmZmqz0yuirvDfqKe1qynzvtJeTy6yq+QT0aaGcqMgXJheOdO6E1CIxnzkvPQlLfzfkvPBG+IJEflHXYiazW3CLWjqn9CIc1HJdGgk13jJJ6UD9NLnuf9HT43NXmKbMxSywnJHOTE75qyCT7MMhe0dWLFVZipyYIRwnBfDn0/T12S9QfzXfuza3Rnv2TRPhOuBiJ4UUM6WlXXekWaS9CL5xby8QDZnfKUc5czSOEpejn16I4CSEYTFeyZKrjQZTBpsSbsMMB61xrRkZdYOzNtY7sSDNaYH62foonClQhxoyJARBIgVuK05kllHtT07FiaVvCBK+DMi0YjJyesLh0JCCV2YudvTTYG2uCDHfEW/anIQQp0sExh1Lm7ZXX/R79mCJ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vh8OWg3eB5dis9NyFMhylJe8qb6fSDuPhwFTDcblkT9I2mdvCKXYpxHPZf9IegYIATZxIa005xUWMo0tl5OD50fblc9mU47hu7GCRZN7i+uhy/+zhmmX7hq7K3vZ82dimgXXILcw+s7CH8t4+see6hFwg3DRiqEaZK6s4N2uUlMEc9k/HHKcflPp42e0Q+vYee3kNP76H/83soTYbO4NimDrVJPfhzb9TuZmiVHAambTYM2k+23G6ZDM/tGnR83kmr5Iz7KNp0rhx/o6/PZYnMPt4pnk3Sa+u5eMytdrHUvFbeybLhX/i8pXXn3bb9CtYCqw6GOLsQT+OLoiN39NDiQbAbQn+OpxhM/wA+YVts sidebar_class_name: "get api-method" -info_path: cartesi-rollups/api/inspect/inspect-state-http-api-for-cartesi-rollups +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/inspect/inspect-state-http-api-for-cartesi-rollups +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Inspect dApp state REST API This method sends an inspect-state request to the dApp backend passing the payload string in the URL. The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. +The status string can be either 'accept', 'reject', or 'exception'. In case of exception, the field exception_payload will contain the exception payload; Otherwise, this field will be null. @@ -46,20 +49,35 @@ When running on machine mode, the whole Cartesi Machine is rolled back after pro On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -
Path Parameters
- -Inspect state response. - -
Schema
    reports object[]
    metadata object
    - -Contain the blockchain Metadata for the given inspect request - -
- -Error response. - -
Schema
  • string
    - -Detailed error message. -
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-notice.api.mdx index a9564682..ce85a2b1 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-notice.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-notice.api.mdx @@ -1,31 +1,40 @@ --- id: add-notice title: "Add a new notice" -description: "The dApp backend can call this method to add a new notice when processing advance-state request. -A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. -Between calls to the finish method, the notice method can be called at least 32k times. - -The returned value is the index of the notice for the current advance request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new notice +description: "The dApp backend can call this method to add a new notice when processing advance-state request." +sidebar_label: "Add a new notice" 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 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 at least 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":"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"}}}}}},"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}}}}}},"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"}}}}},"method":"post","path":"/notice","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","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 'address': 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"},"postman":{"name":"Add a new notice","description":{"content":"The dApp backend can call this method to add a new notice when processing 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 at least 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"}}}}} +api: eJztWG1v2zYQ/iuEvijBXNtx2g0LlgFpl2EBti5osk+OkdLS2VIjkxpJxTEM//c9R1K24qRd94JhA2YgNnU6Hp977ng8Zp3omox0pVYXeXKSyDx/q12ZUdJLcrKZKWt+hzfXBYn8rK7FVGZ3pHKRSYW/qhKuKK1YkCt0LpwWMCGkULQUylsSy4KUqI3OyNpSzaFwL1VGL6yTjoShXxuyrn+jztoJYeEpWSHVSmSFVHOMYdoBQ6kcGSUrEabrmZd6ZK6QTizkSkzZbEVYxrXTppXO7mCqVFjpNbklUYC/NTwrVWmL6EjPiyKe6Bs7DMs8ieCiExVJ68Tx6E64ckEWhm8U02TINUZB515WDRDbCDynhxZvtDzTxj9mjTEEsJGaDikXSmhoGLHUJre9jqVMN8oxnwaa0jjLkOiezKozHWGMD691vkpO1kmmQaByPJR1XZWZD/7gg+UorxObFbSQPHKrmhB3Pf1AmYMdRBCp4kqy/LaWq0rLvKNonQGaJ3lzGRQB2mM/Z2eoWYgCLkxLJQEXLCwko732YTAg1S01B97IDNGGZ4ZEOnxIoVpVeglqpytRS6gyoTAlc8rKBbJCNYspz/C5kGnQamutfGJqhTRYOcJC34P3UoE2kN1jyznJfEo0SztzfGZIET0Vy9IVCLma4+clMjP3xqwYjUY9cfTVMb6+HvLoFeeyErSo3Wo7G0lgqIZlcB/gMxuBM+9aCBY8WdQV07nDBLErnRdGMpPNZieL+3WzYWGAbkOMRsMh/zyOxxtDkhHssrCPBf6mrPCZ2VHjzTonA70QY4gayL58+TRNtC152ObJT2TuKhLOkMe35eVodLxz/cIv1yXDS95FEiInOc1kU7mnVJwbgzxoKdujwdGDG9QVCs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euyOjjg/3TsX3O40Q0zznzR+aTupNNlX/58dQ3labxgL7C/ITVyyZdvfJ8kGGifwv6S5GXrpEIaNbgc4H2wyZ/fAIpfDIM= sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new notice The dApp backend can call this method to add a new notice when processing advance-state request. A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. @@ -34,16 +43,35 @@ Between calls to the finish method, the notice method can be called at least 32k The returned value is the index of the notice for the current advance request. In other words, the index counting restarts at every request. -
Request Body
-Created the notice. + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-report.api.mdx index 8af8b845..ae2d0550 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-report.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-report.api.mdx @@ -1,44 +1,74 @@ --- id: add-report title: "Add a new report" -description: "The dApp can call this method to add a new report for the given rollup request. -A report can be a diagnostic or a log; reports are not discarded when a request is rejected. -Between calls to the finish method, the report method can be called any number of times. -" -sidebar_label: Add a new report +description: "The dApp can call this method to add a new report for the given rollup request." +sidebar_label: "Add a new report" hide_title: true hide_table_of_contents: true -api: {"operationId":"addReport","description":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","requestBody":{"content":{"application/json":{"schema":{"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"}}}}}},"responses":{"200":{"description":"Create the report."},"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"}}}}},"method":"post","path":"/report","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","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 'address': 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"},"postman":{"name":"Add a new report","description":{"content":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","type":"text/plain"},"url":{"path":["report"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztV21v2zYQ/iuEvijBXNt1VwzzlgFpl2EBhi5ovE+OkdLS2WIjkxpF2TEM//c9R1K28tKu24BhHyYgjnQ8Hp977kWnXWIqstIpoy/zZJzIPH9PlbEu6SU51ZlVFa9hZVKQyM+rSmRS468shStULVbkCpMLZwS2Cik0bYT1FsTCWOiQWKo1aWFNWTYV1n5vqHb9G33e6rHBOWFvruRSm9qpTGCrFKVZfheVaiEtCW0clOpM2pxysSlgVrYWBcBY+kiZoxzW35DbEAWkNcNjJAulVV1EzD0vihiiGxEKb8IBUm+FblZzssIshFMrqmEZzMQj35h8m4x3SWa0I+34VlZVqTLP5+BjzcTtkjoraCX5zm0rApVmzjBhp7LMvlNU82olt6WReUexdlbp5ZNQXAVFobR34QI/lpqVKOhezJWWdsvcrySzPPFuW/DjNkZkhbQSDNnAZzq8T6FalmYDd+dbUUmosrMwJXPK1EqWkQKQWEgEy1hLdWW0j7nRhG2OcNBPCJnStZM6ox5bzknmc6JF2tnjIyFF9FRslCtESXqJf1+D7twbq8VoNO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6+uEwfhP/Djk6iPJ0bgB0EHwRzT2V18f/F7lo2spO6+wB99uTwerzoT/v+fQZ3PoDiTdkbWfRyAdnH4myaRUYxpPLuxZLeby5p+s+V+z2KgtviKmuJ2La2Sc57IpjNYKjCxkfXT4h1teUwLUXgx4XNZvWz4/CffXDw7hh3nvo47ul2ss87IevXr9QRq8/hFt0KxQGrlhr/28DtOcGN8PvjvAC/bJSVmkgaTNtbDyXz9Af+jPv0= sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new report The dApp can call this method to add a new report for the given rollup request. A report can be a diagnostic or a log; reports are not discarded when a request is rejected. Between calls to the finish method, the report method can be called any number of times. -
Request Body
- -Create the report. -
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-voucher.api.mdx index e4870977..89f02872 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-voucher.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/add-voucher.api.mdx @@ -1,31 +1,40 @@ --- id: add-voucher title: "Add a new voucher" -description: "The dApp backend can call this method to add a new voucher when processing an advance-state request. -Vouchers are collateral effects actionable in the blockchain. -Between calls to the finish method, the voucher method can be called at least 32k times. - -The returned value is the index of the voucher for the current advance-state request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new voucher +description: "The dApp backend can call this method to add a new voucher when processing an advance-state request." +sidebar_label: "Add a new voucher" hide_title: true hide_table_of_contents: true -api: {"operationId":"addVoucher","description":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called at least 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","description":"Ethereum address.","example":"0x1111111111111111111111111111111111111111"},"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"}}}}}},"responses":{"200":{"description":"Created the voucher.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123}}}}}},"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"}}}}},"method":"post","path":"/voucher","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"address":"0x1111111111111111111111111111111111111111","payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","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 'address': 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"},"postman":{"name":"Add a new voucher","description":{"content":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called at least 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["voucher"],"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"}}}}} +api: eJztWG1v4zYM/iuCv7jFckma3m1YsQ7o3TqswHYrrt2+tEVPsZnYqyN5ktwkCPLf91CSE6cv97INw31YgDa2TFIPyYcUnVWiazLSlVqd5clRIvP8d91kBZmkl+RkM1PW/BCPLgsS+Uldi7HM7kjlIpMKf1UlXFFaMSNX6Fw4LWBDSK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f6jhOIwk4rYnd899v1UDaF79QRy85ffv318r7KaNa+lnNwt2aVkm5FIc831fmun91cENr6OE0JApu7vlg7Kxt5nOaa+tnP2jayXwKSfbYurIeXqjrI1UU9pDV+qJw+GwVeJPjVpye5PUs/gIsjjIS7Dc2xDexuopy+t0f2uEIdOidHsHcTGMBRtI7EccOo7FKg1m0iORyiyj2qXrazUvULvi0jQUwQVg6QUizJ06qLebGth5KightH0uvr0Y0K9EOojKPcFVchzu9ve3kdsJ2fGxGA1Hj0KUvtWijmCi6bgfeGKWfoybomV148I9rVSN99/DDrXddqBj7MyI9jpQdiSu0nhxy60vvWFsaZybvOeUPsbZRiy2nC6edhRDEraL/Eljk0BOHiLIpZPpzVWKziY313Z6i/MULTO96T2wFPvGByy1EjdbzXUnZp+e1tbDmNd4y4l9NiioB/SRbkzCiuflZ0D/e4Dj7hFvuPsgXEwuaBFduGHlv4Ebd49ww90u3FBKV21Fg6Cbmm7FqPo0WmMqrDHXfJTWMQA1+UGSVdo6/DLDRJWlx95cFkbPO62EFhw0HF9dJzaL/8CPZ1Fvd4zANwsdBGOMrHfx/PIvHzAyk6p7gD98uX04l3Xev/5/Zf5iX5njaN2ZvNdxHlvFGfYqaROMaZNHUF5arcbS0m+mWq95GQYNXrmvcHkvTckh5juYKjBBQpWH3jta8tgYSPHikjdmccSCf295+AbEI3DQOPF95YOyN50B/PzXi0sIj+OPADOUMFaNnPMPBPh/lOBCe5L69ye/tkoqTEoN3hvwPNjkz1/YEi73 sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new voucher The dApp backend can call this method to add a new voucher when processing an advance-state request. Vouchers are collateral effects actionable in the blockchain. @@ -34,17 +43,35 @@ Between calls to the finish method, the voucher method can be called at least 32 The returned value is the index of the voucher for the current advance-state request. In other words, the index counting restarts at every request. -
Request Body
- -Created the voucher. -
Schema
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api.info.mdx index 4b6a64cd..a51327c8 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api.info.mdx @@ -1,75 +1,33 @@ --- id: cartesi-rollup-http-api title: "Cartesi Rollup HTTP API" -description: "API that the Cartesi Rollup HTTP Server implements. - -In the box below, there is an example of a dApp backend that uses the Rollup HTTP API. - -``` -import requests -import sys - -rollup = sys.argv[1] - -def check_status_code(response): - if response.status_code not in range(200, 300): - print(f'Error: invalid status code {response.status_code}') - sys.exit(1) - return response - -finish = {'status': 'accept'} -while True: - print('Sending finish') - r = check_status_code(requests.post(rollup + '/finish', json=finish)) - if r.status_code == 202: - print('No pending rollup request, trying again') - continue - - rollup_request = r.json() - if rollup_request['request_type'] == 'advance_state': - print('Sending voucher') - voucher = { - 'address': rollup_request['data']['metadata']['msg_sender'], - 'payload': rollup_request['data']['payload'] - } - check_status_code(requests.post(rollup + '/voucher', json=voucher)) - - print('Sending notice') - notice = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/notice', json=notice)) - - print('Sending report') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - finish['status'] = 'accept' - - elif rollup_request['request_type'] == 'inspect_state': - print('Sending report per inspect request') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - else: - print('Throwing rollup exception') - exception = {'payload': rollup_request['data']['payload']} - requests.post(rollup + '/exception', json=exception) - break -``` -" +description: "API that the Cartesi Rollup HTTP Server implements." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; - - Version: 0.4.0 + -# Cartesi Rollup HTTP API + + + + API that the Cartesi Rollup HTTP Server implements. @@ -126,7 +84,18 @@ while True: break ``` -
-

License

- Apache-2.0 + +
+

+ License +

+ Apache-2.0 +
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/finish.api.mdx index a1b1516f..5859d92a 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/finish.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/finish.api.mdx @@ -1,56 +1,51 @@ --- id: finish title: "Finish and get next request" -description: "The dApp backend should call this method to start processing rollup requests. -The Rollup HTTP Server returns the next rollup request in the response body. - -The possible values for the request_type field are 'advance_state' and 'inspect_state'. -The data field contains the rollup request input data. -For advance-state requests, the input data contains the advance-state metadata and the payload. -For inspect-state requests, the input data contains only the payload. - -After processing an rollup request, the dApp-backend should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. -The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. - -If the advance-state request is rejected, the vouchers and notices are discarded. -In contrast, reports are not discarded in case of reject. -When running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request. - -During a finish call, the next rollup request might not be immediately available. -When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready. -When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. -When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -" -sidebar_label: Finish and get next request +description: "The dApp backend should call this method to start processing rollup requests." +sidebar_label: "Finish and get next request" hide_title: true hide_table_of_contents: true -api: {"operationId":"finish","description":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing an rollup request, the dApp-backend should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of reject.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accept","reject"],"example":"accept"}}}}}},"responses":{"200":{"description":"Finish accepted and next rollup request returned.","content":{"application/json":{"schema":{"type":"object","properties":{"request_type":{"type":"string","enum":["advance_state","inspect_state"],"example":"advance_state"},"data":{"type":"object","oneOf":[{"type":"object","properties":{"metadata":{"type":"object","properties":{"msg_sender":{"type":"string","description":"Ethereum address.","example":"0x1111111111111111111111111111111111111111"},"epoch_index":{"type":"integer","format":"uint64","description":"Identifier encoded as integer.","example":123},"input_index":{"type":"integer","format":"uint64","description":"Identifier encoded as integer.","example":123},"block_number":{"type":"integer","format":"uint64","description":"Identifier encoded as integer.","example":123},"timestamp":{"type":"integer","format":"uint64","description":"Unix timestamp in milliseconds.","example":1609459200000}}},"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"}}},{"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"}}}]}}}}}},"202":{"description":"Finish accepted but try again to obtain the next request."},"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"}}}}},"method":"post","path":"/finish","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"status":"accept"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","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 'address': 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"},"postman":{"name":"Finish and get next request","description":{"content":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing an rollup request, the dApp-backend should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of reject.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","type":"text/plain"},"url":{"path":["finish"],"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"}}}}} +api: eJztWVtv2zgW/iuEX5Ri3cRJ21k02CyQnclgA0xnijaDfUiClJZoi1OJ1JKULwj83/c7JCVTjtN0ZxazfYgfEps6POfwO3fqfqQbYbiTWl0Wo9PRTCppy9F4VAibG9nQAyxflYIV503Dpjz/LFTBbKnbqmA5ryrmSmlZLVypC+Y0s44bxxqjc2GtVHNmdFW1DTPi362wzh7eKGL3Iaz+8+rqPfsozEIYULjWKAuGgimxcjs7mVT+kRG20coKNtXFGtwCv0ZD2rQSbMErULOZNpHab75z60awmRTQmhvBMl4suMrFHdR1ImMch8qkso3IXVyLihbc8bgx18pxGTV8oFzTOk+MfT9CeBTw0jPrTz/2e7fEQ57DPcCUexpSjh43fF1pXkQBUduvFqBVtd5hc6POZw7IJ9biaudkgSFZ/+U+6/M5j3YJvhM94QkQCtGAEcnTvVHbyjE9S42W6DVm0nVyZ9J7nSBXc62NxtnZSs7BltKVMHWei8ZlDPpkRvwGzLLHnVDOlYYynhdBJ1Sv1UBc518zaSAtnr0TTgbjHlnAuddOHvzL2R6r9w5lWVBWFMEEC93mpTDWc1faSUDjfbmQNuemEAT6pfJaG06GM6LRxgUibNgSUijlHCGEkwUh2PqvUsD2rVJkFigtC6jGvkc0CyvZO56XUomgSrcYMXvHFZ/7AMYvF7ADbtIEzEQHYB14UJZYltyRSZfcsqkAmHTwXMgFCU/s6HH6oTXeNTuYyfHGj6aJWs5L5887RSDUtSgkdIDv8wWXFUeO6A7rdtNaF2h7/IIw/EPgNLy10a+Wpa62aIiVyFtKtKwFZlVyrtQTuM91OzZipaYD6yKKfiKpRgfOQc9OJ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HniHw+PtFwuD7l/fKjN/CjutUc/XX5/8fPHC9pzWLq6Cq6SGhPiQ4imc8K+IZSO6RvfMCcGP5xq5A6BROBba+QGSbMgi35AKYEP+20vqp86dnDwnD99+nSjIA1jYj+d9wt2bYkm9p5n9PsQHfni+viW1hEFSFYCNT4Y445K9EHn/C9ObxTDR8628ZDQeQ9FfBmu5uIAxXPMXk0m3Sb6NAgHdzDLvCOegnbBK0wm6Qxzv4/zJnuxZUIqi5V0B8dxMXTOvUp0jjh8nLH7LLDJTvs7g82NWpYIP3ZlWhGVC4plH+MFRtjeCTXgsw+UePdF8XMQAf0Ly2IAZWNGnn4Wfr14sUVuANnZGc1VDyDKftasu015cHVj1n5ypqyW4kJpSarWn9+rHeKzSyJnkEwaHSSqDCius3ReyG5Jt50rtYd6dojFi4xUn7hERtgu0ieLTTlssqsB9VHZ7XXWTQX+e9/3Z7fjHU6xJn2BU0dxu925STD7erN2J4x2jT/JsI+CEi50UkzCivfL/0L136dwlB71Db++qG64WkrVDSt/jrpRelQ3/BqqG0LpuotoOGgf0x2ZqL7OrYe3wo+7dQSgEf3VbBeH3yZMorLi4WmuSqOXSSoRKwIN5Ss9RL/4B87xqNZbiVHxfiHRYGoE/xzrlx+mwKTmKingXYeHOjgXbtDE7TZZyQXS86uO51cdz686nl91PL/qeH7V8W286ojXA8ntwSYOpPdxDr/uXttjYiaUaOX+fgqn/9VUmw0tA12zxjq+LriR5Bn0C5xKwE33sxjcP4s1jc0hE7y8IrlEjhpDc/buuwUa48OO8+6lyOO0t8kdwvtfPl6BeBrf3ZBJsWr4kl6r4O/piF4J+NIc3kzQ2v2owqTYwr3wPPCkz38AEjR2Yw== sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Finish and get next request The dApp backend should call this method to start processing rollup requests. The Rollup HTTP Server returns the next rollup request in the response body. -The possible values for the request_type field are 'advance_state' and 'inspect_state'. +The possible values for the request_type field are 'advance_state' and 'inspect_state'. The data field contains the rollup request input data. For advance-state requests, the input data contains the advance-state metadata and the payload. For inspect-state requests, the input data contains only the payload. After processing an rollup request, the dApp-backend should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. +For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. If the advance-state request is rejected, the vouchers and notices are discarded. @@ -62,20 +57,35 @@ When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Ma When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -
Request Body
- -Finish accepted and next rollup request returned. - -
Schema
    data object
    oneOf
    metadata object
- -Finish accepted but try again to obtain the next request. - -
- -Error response. - -
Schema
  • string
    - -Detailed error message. -
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/register-exception.api.mdx index 863aa3c7..9bcfe709 100644 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/register-exception.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/register-exception.api.mdx @@ -1,44 +1,74 @@ --- id: register-exception title: "Register an exception" -description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens. -This method should be the last method ever called by the dApp backend, and it should not expect the call to return. -The Rollup HTTP Server will pass the exception info to the Cartesi Server Manager. -" -sidebar_label: Register an exception +description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens." +sidebar_label: "Register an exception" hide_title: true hide_table_of_contents: true -api: {"operationId":"registerException","description":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend, and it should not expect the call to return.\nThe Rollup HTTP Server will pass the exception info to the Cartesi Server Manager.\n","requestBody":{"content":{"application/json":{"schema":{"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"}}}}}},"responses":{"200":{"description":"Accepted the exception throw."},"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"}}}}},"method":"post","path":"/exception","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"payload":"0xdeadbeef"},"info":{"title":"Cartesi Rollup HTTP API","version":"0.4.0","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 'address': 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"},"postman":{"name":"Register an exception","description":{"content":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend, and it should not expect the call to return.\nThe Rollup HTTP Server will pass the exception info to the Cartesi Server Manager.\n","type":"text/plain"},"url":{"path":["exception"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztV99v2zYQ/lcIvSjBXNtNVwwzlgFZl2EBti5ovCfHSGnpbKmRSY2kYhuG//d9R1K2nKRd1wHDHuaHRDoej99990PHbaJrMtKVWl3lySgxtCitI3O5zqhmadJLcrKZKcPbKBkXJPKLuha20E2Vi0xWlXBFacWSXKFzsSpIidJhQSntRG10RgRx6QrokTD0R0M2LlhbqoWQcxwppBLUHisKWdekbP9WjTu245kz8pYqCTNxhR5ggbHgqNnGL3uUM5ndk8p7sJ4zqmiBkdG6psx51eCEBjbXGOUPJfFOV1VTi5/H42txQ4YPWJXQq6W1ftcBbanmmvez9I00jmzZbvlVKr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ThlbKvMH/nB4zyl9irNl7EE3oMh08UQRB+Eg5B+M5ggWx+Qxglw6mU4nKZqU3D/bxR0+Jeh+6bT3yFLsG5+w1GpMDzt3Hc4+P6ythzGu8ZUD+1FSUA/oI11OgsTn5d+A/mWA4+kRb3j7JFx8tNEiunCD5N+BG0+PcMPbMdxQSpO2opGg+5pu1aj6vLTGQMTD6V+mdSSgJj9D+Xk2Wvtv0kSVpafejHna6bSS/ae+68RhOPpyPz6K+nBiBL4XdBDMDMn7+P3i7ywbWUrV+YC/i9eno7vM4zGrM/f/f5v6J7epOMx2Zt1dHJu2cWqcJIcoYL7joY+F2+1MWvrdVLsdi8GgwX1sgscHaUo541FuMoWxAqMeGT9m3tOG57sQuRdjPprVq4YhPLm98dAZdoQBv6PbhTvtjLvXv92MoTaLd8Mlqowv5HLF90b8HSV40N4Xf53wsm1SYZhpwAnWw8n8+xMfanKG sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Register an exception The dApp should call this method when it cannot proceed with the request processing after an exception happens. This method should be the last method ever called by the dApp backend, and it should not expect the call to return. The Rollup HTTP Server will pass the exception info to the Cartesi Server Manager. -
Request Body
- -Accepted the exception throw. -
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.js b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.js deleted file mode 100644 index b635753d..00000000 --- a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [{"type":"doc","id":"api/rollup/cartesi-rollup-http-api"},{"type":"category","label":"UNTAGGED","items":[{"type":"doc","id":"api/rollup/finish","label":"Finish and get next request","className":"api-method post"},{"type":"doc","id":"api/rollup/add-voucher","label":"Add a new voucher","className":"api-method post"},{"type":"doc","id":"api/rollup/add-notice","label":"Add a new notice","className":"api-method post"},{"type":"doc","id":"api/rollup/add-report","label":"Add a new report","className":"api-method post"},{"type":"doc","id":"api/rollup/register-exception","label":"Register an exception","className":"api-method post"}]}]; \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.ts new file mode 100644 index 00000000..df3b9291 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-0.8/api/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.8/api/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx index 82e7e10b..f8b37435 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -1,26 +1,48 @@ --- id: inspect-state-http-api-for-cartesi-rollups title: "Inspect-state HTTP API for Cartesi Rollups" -description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend. -" +description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; - - Version: 0.5.1 + -# Inspect-state HTTP API for Cartesi Rollups + + + + API that allows the dApp frontend to make inspect-state requests to the dApp backend. -
-

License

- Apache-2.0 + +
+

+ License +

+ Apache-2.0 +
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect.api.mdx index 8bf2e46b..9e492c87 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/inspect/inspect.api.mdx @@ -1,44 +1,47 @@ --- id: inspect title: "Inspect dApp state REST API" -description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL. -The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. -If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. - -The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. -In case of exception, the field exception_payload will contain the exception payload; -Otherwise, this field will be null. - -When running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request. -On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. -Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -" -sidebar_label: Inspect dApp state REST API +description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL." +sidebar_label: "Inspect dApp state REST API" 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"},"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"},"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"}}}},"processed_input_count":{"type":"integer","description":"Number of processed inputs since genesis","example":0}}}}}},"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"}}}}},"method":"get","path":"/{payload}","servers":[{"url":"https://"},{"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"}} +api: eJztV01vGzcQ/SvEXpQAtqS4cT+UooDhKq2BNAkUBT0kgUHtjrRMdsktybUsCPrvfUNypbVlI8f24ItNDYczw5k3b7jbzDRkpVdGXxXZJFPaNZT77CQryOVWNbwD+bxUTtTkS1MIR7pwQmqRlE+dl56EpX9acl54I3xJorhoGrGQ+Tdoi0Y6p/QqbDRyUxkJM96ySOkg/Th7M/ys58f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1dOtHzWVVA+T6SMw+50wvHl6UrBd4xJyFUwfUhrfLPE5l4fnF1MnhnerC2DGG3MoTHx7FS0xCAAsxiisY755edurSLhKuC8uHOcgpCsKHcODapKNtgkEO8ii4TjNWlthu/S+cZPR6NcCw+Q6kfw19n5Do/aVoFOZXFY86ifn4/H5qHvW8kBTemlCmu6WJA3vP+fz9+Li/RX32v7pMUMztQ1XlUOKeRwPz4cvIMFUI64kLKZBe9FgUtDp2XCM7buhr9froQzbQ2NXo3TWjd5cXU7ffpjymWHp6yrb3S8bhxRaVXJfuwfesSH93x55+7iHnuXcSdwMSFMtde8G3UQPytHObPphznm5j6ftAZFPHwlPHwlPHwn/54+ENBl6g2OXGGqbOPhTNukeLKBKTgPLtlsG7Udb7XYsRuR2AzmWN9IquWAeBU0XyvEavL6UFSr7OFM8m6VPkOfisbC615bmt9aNrFr+heU32vQ+ZnZfoFpi/mNYcwhxNz6ze+eOvj54EOyH0B/TOQbTv1f6Bz0= sidebar_class_name: "get api-method" -info_path: cartesi-rollups/api/inspect/inspect-state-http-api-for-cartesi-rollups +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/inspect/inspect-state-http-api-for-cartesi-rollups +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Inspect dApp state REST API This method sends an inspect-state request to the dApp backend passing the payload string in the URL. The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. +The status string can be either 'accept', 'reject', or 'exception'. In case of exception, the field exception_payload will contain the exception payload; Otherwise, this field will be null. @@ -46,16 +49,35 @@ When running on machine mode, the whole Cartesi Machine is rolled back after pro On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -
Path Parameters
-Inspect state response. + + -
Schema
    reports object[]
+ + + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-notice.api.mdx index 29cc3b9d..963d96bd 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-notice.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-notice.api.mdx @@ -1,31 +1,40 @@ --- id: add-notice title: "Add a new notice" -description: "The dApp backend can call this method to add a new notice when processing the advance-state request. -A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. -Between calls to the finish method, the notice method can be called up to 32k times. - -The returned value is the index of the notice for the current advance request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new notice +description: "The dApp backend can call this method to add a new notice when processing the advance-state request." +sidebar_label: "Add a new notice" 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"}}}}}},"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}}}}}},"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"}}}}},"method":"post","path":"/notice","servers":[{"url":"https://"},{"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"}}}}} +api: eJztWG1v2zYQ/iuE9kEJ5tiO22yYsQxIuwwLsHVBk31KgpSWzpYamdRIKo5n+L/vOZKyFSftuhcMG7AAbaTT8fjcc8e7Y1aJrslIV2p1lifjROb5G+3KjJJekpPNTFnzN3y5LEjkJ3UtJjK7I5WLTCr8qyrhitKKOblC58JpARNCCkULobwlsShIidrojKwt1Qz6BKV7qTI6sE46EoZ+aci6/rU6aReFzSdkhVRLkRVSzfAM87y6VI6MkpUIy/XUSz06V0gn5nIpJmy2Imzj2mWTSmd3MFUq7PSK3IIouLAxPC1VaYvoTM+LIp7oHzsNy7yIctHUvPDF6E64ck4WVq8V82TINUZB4V5WDeDaiDqnhxZsNDvVxr9mjTEEpJGXDiNnSmhoGLHQJre9jqVMN8oxoQaa0jhQ5QTdk1l2liOO8eWVzpfJeJVkGuwpx4+yrqsy89EfvLcc5lVis4Lmkp/csiYEXk/eU+ZgByFErriSLH+t5bLSMu8oWmeA5tnEicrMRKm8C6fsEzVzUcCTSakkUIOMuWTQlz4UxiJyC83BNzJDxOGgIZEOH1KoVpVegOHJEsahyrzClMwpK+fIDNXMJ7zC50Omwa6ttfIJqhVSYek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u/gHofw5w3D3iDW8fhYuZA2WiCzdI/hm4cfcIN7w9hhuO01V7qpGkm3PdqlH1aamNea7GTPK7qR0JqMmPgLykPYv/TpqosvTUm8vC6EWnnNADk8YnsOPERvgX/Pgg6u2OEfhG0EEwwbR5F3uYb5KYF/Mm85jmIKXHdWtzieM20G2EfGvAVIim8quvLiI0aoziuH4ampUWtwN01Ng2T1sA6JsXROJqi/Fm7zNZlwffhtHwoF27WbHfNnEedCKypwMA45kaiVkQLjShu3OTlJPKD2w5OU6nzfiwcYpyvtE51g93x83XHBe3ikdolho6qGSjsmLznW8FGFGY+7lU3dln57a9O5l27nv/X+H/s1f4ePno3E3WcdJdxSn/KonxxzzOucuS1WoiLf1sqvWaxbBnlpDj8V6akpOV32CpwGiO2xlfC+5oyfN4yJmDS96X1cEB/3Vo90rIl4Sw4sQX64/q3nRuKOc/XVxCeRL/JsEHDVIjF/z3Cvw/TvCgfQ77C6WXrZIKOdTgYoXvwSb//Aaw932v sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new notice The dApp backend can call this method to add a new notice when processing the advance-state request. A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. @@ -34,17 +43,35 @@ Between calls to the finish method, the notice method can be called up to 32k ti The returned value is the index of the notice for the current advance request. In other words, the index counting restarts at every request. -
Request Body
- -Created the notice. -
Schema
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-report.api.mdx index de379682..3ce313d4 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-report.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-report.api.mdx @@ -1,44 +1,74 @@ --- id: add-report title: "Add a new report" -description: "The dApp can call this method to add a new report for the given rollup request. -A report can be a diagnostic or a log; reports are not discarded when a request is rejected. -Between calls to the finish method, the report method can be called any number of times. -" -sidebar_label: Add a new report +description: "The dApp can call this method to add a new report for the given rollup request." +sidebar_label: "Add a new report" hide_title: true hide_table_of_contents: true -api: {"operationId":"addReport","description":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\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"}}}}}},"responses":{"200":{"description":"Created the report."},"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"}}}}},"method":"post","path":"/report","servers":[{"url":"https://"},{"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 report","description":{"content":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","type":"text/plain"},"url":{"path":["report"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api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VPePCa379/f6uxG1fNGEbVfqDaVCwTa/05f/elXawmJ1MeRyqg9lB6f4cC4erqLjUZdZsMOBrdaoFHzQ9J0ZLzYYpaZ6VeUBcZ2BNfDYfNIn5K5ITrzhMfjSPIrmShEK1eh/A6ti9p3iVHByUMmR6U657EQUuutnoPie2I58i52CZBTTISiUxTKl2yu9XrHDkoxramCC4AS27AMBelsLzZ1ELPS6QEavucRN1I6JciGcTFPcHhfh6+jo4OzD2i7PxcnA5Pn1GUvDWijGAen8uIE7vhYblA6WnzwrVJ6drb72GHJG0qyTl2ZkTdFpRHEpMkvtxxCUumjC2R2YoPCm85Jc9xNoytTA2KbBtPHGInHAb5SZBAQOrPYPjlKYpMOplMJwmqlNy/V4s7HB8of8m090RbrB2f0NRITA8rdy3ePt+1jZXRt/GTnftRYpATqCVtXsKIj82/AP3vAY67R7zh65NwwxHQhhv7r38Fbtw9wg1fj+GGdJo0WY0g3ed1I0bF54U2mqASXd6fhnYkoCTfN/GSJhf/mzRRUdFza8a5NetWOaEHJo0zsGXEfvAf2PFR1IcdI/D9QAvBDC3afTzD/CGJDjyrU49pCVJ6XLdcc9PhY6B9EHKrrZzCofK7ry4iHNToX3EbsrRQFVpqnKjx2LxsAODcvCESkwPGafcLWarjN6E1PG7W7lccNYc4NzoR2fMGgPHMrUQvCBPqcLrzISlnhW/YMnIcTvv2YW+UvyFd+SsTcMbLkZ/NaIV2gYMRo5aOC1nrNN/PcyuNFoW5X0rd7n2eXP6edqatS9L/N8nWTTK2861ufxd7x23smyedyCg6XI4GHtluZ7KiX22x2/EwUFtcRCd4XUmr2P38BU05ml2yvtG+pw13uMELx2Pel8WLmvd/dm3ltjusuPDlryXbxjptdfvXv9yMITaLl2IOWoxaueYLM35HHbwYHw/+DuXHtp0C7VyNSwrmw878/AHHRbUf sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new report The dApp can call this method to add a new report for the given rollup request. A report can be a diagnostic or a log; reports are not discarded when a request is rejected. Between calls to the finish method, the report method can be called any number of times. -
Request Body
- -Created the report. -
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-voucher.api.mdx index 390161d4..ab579440 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-voucher.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/add-voucher.api.mdx @@ -1,31 +1,40 @@ --- id: add-voucher title: "Add a new voucher" -description: "The dApp backend can call this method to add a new voucher when processing an advance-state request. -Vouchers are collateral effects actionable in the blockchain. -Between calls to the finish method, the voucher method can be called up to 32k times. - -The returned value is the index of the voucher for the current advance-state request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new voucher +description: "The dApp backend can call this method to add a new voucher when processing an advance-state request." +sidebar_label: "Add a new voucher" hide_title: true hide_table_of_contents: true -api: {"operationId":"addVoucher","description":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","description":"20-byte address of the destination contract for which the payload will be sent.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"payload":{"type":"string","description":"String in Ethereum hex binary format describing a method call to be executed by the destination contract.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xcdcd77c0' corresponds to a payload with length 4 and bytes 205, 205, 119, 192.\nTo describe the method call, the payload should consist of a function selector (method identifier) followed\nby its ABI-encoded arguments.\nref: https://docs.soliditylang.org/en/v0.8.19/abi-spec.html\n","example":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"}}}}}},"responses":{"200":{"description":"Created the voucher.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123}}}}}},"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"}}}}},"method":"post","path":"/voucher","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"destination":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","payload":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"},"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 voucher","description":{"content":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["voucher"],"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"}}}}} +api: eJztWG1v2zgS/iuE7oMSnGM7bpMmweWAtJvgAtztFk3uviRBSktjixtZ1JJUHJ/h/77PkJStOE1393o49MMZaCqNOMNn3odcJromI53S1WWenCQyz/+lm6wgk/SSnGxmVM0f8em6IJGf1bUYy+yBqlxkssK/shSuUFbMyBU6F04LyBBSVDQXj0GUmBdUidr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ZO03sVJgUOTScvlWFr6pylXKyZDoFmAjsdHaRTbl98gqiCJDusPLA+04HE7RMTeNW/My2ELvoncPq3y8SVwnPla/NW1d53D08efrq6xeBxvyDiPQDVyzrdn+HuS4EH7CPVnXU9bJnyP0ODMh+9BJv9+BZ2zK4Q= sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Add a new voucher The dApp backend can call this method to add a new voucher when processing an advance-state request. Vouchers are collateral effects actionable in the blockchain. @@ -34,17 +43,35 @@ Between calls to the finish method, the voucher method can be called up to 32k t The returned value is the index of the voucher for the current advance-state request. In other words, the index counting restarts at every request. -
Request Body
- -Created the voucher. -
Schema
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api.info.mdx index c6b02167..9ddf37f3 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api.info.mdx @@ -1,81 +1,33 @@ --- id: cartesi-rollup-http-api title: "Cartesi Rollup HTTP API" -description: "API that the Cartesi Rollup HTTP Server implements. - -In the box below, there is an example of a dApp backend that uses the Rollup HTTP API. - -``` -import requests -import sys - -rollup = sys.argv[1] - -def check_status_code(response): - if response.status_code not in range(200, 300): - print(f'Error: invalid status code {response.status_code}') - sys.exit(1) - return response - -finish = {'status': 'accept'} -while True: - print('Sending finish') - r = check_status_code(requests.post(rollup + '/finish', json=finish)) - if r.status_code == 202: - print('No pending rollup request, trying again') - continue - - rollup_request = r.json() - if rollup_request['request_type'] == 'advance_state': - print('Sending voucher') - voucher = { - 'destination': rollup_request['data']['metadata']['msg_sender'], - 'payload': rollup_request['data']['payload'] - } - check_status_code(requests.post(rollup + '/voucher', json=voucher)) - - print('Sending notice') - notice = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/notice', json=notice)) - - print('Sending report') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - finish['status'] = 'accept' - - elif rollup_request['request_type'] == 'inspect_state': - print('Sending report per inspect request') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - else: - print('Throwing rollup exception') - exception = {'payload': rollup_request['data']['payload']} - requests.post(rollup + '/exception', json=exception) - break -``` - -In production mode, if the dApp exits the Rollups initialization script will register a Rollup Exception. -See [/exception](#api-Default-registerException). - -In host mode, the Cartesi Rollups infrastructure is not able to detect that the dApp exited. -It is up to the dApp developer to re-launch the dApp. -" +description: "API that the Cartesi Rollup HTTP Server implements." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; - - Version: 0.5.1 + -# Cartesi Rollup HTTP API + + + + API that the Cartesi Rollup HTTP Server implements. @@ -138,7 +90,18 @@ See [/exception](#api-Default-registerException). In host mode, the Cartesi Rollups infrastructure is not able to detect that the dApp exited. It is up to the dApp developer to re-launch the dApp. -
-

License

- Apache-2.0 + +
+

+ License +

+ Apache-2.0 +
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/finish.api.mdx index ad7a80e4..32860b3c 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/finish.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/finish.api.mdx @@ -1,56 +1,51 @@ --- id: finish title: "Finish and get next request" -description: "The dApp backend should call this method to start processing rollup requests. -The Rollup HTTP Server returns the next rollup request in the response body. - -The possible values for the request_type field are 'advance_state' and 'inspect_state'. -The data field contains the rollup request input data. -For advance-state requests, the input data contains the advance-state metadata and the payload. -For inspect-state requests, the input data contains only the payload. - -After processing a rollup request, the dApp back-end should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. -The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. - -If the advance-state request is rejected, the vouchers and notices are discarded. -In contrast, reports are not discarded in case of rejection. -When running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request. - -During a finish call, the next rollup request might not be immediately available. -When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready. -When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. -When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -" -sidebar_label: Finish and get next request +description: "The dApp backend should call this method to start processing rollup requests." +sidebar_label: "Finish and get next request" hide_title: true hide_table_of_contents: true -api: {"operationId":"finish","description":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accept","reject"],"example":"accept"}}}}}},"responses":{"200":{"description":"Finish accepted and next rollup request returned.","content":{"application/json":{"schema":{"type":"object","properties":{"request_type":{"type":"string","enum":["advance_state","inspect_state"],"example":"advance_state"},"data":{"type":"object","oneOf":[{"type":"object","properties":{"metadata":{"type":"object","properties":{"msg_sender":{"type":"string","description":"20-byte address of the account that submitted the input.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"epoch_index":{"type":"integer","format":"uint64","description":"Deprecated. Always receives 0.","example":0},"input_index":{"type":"integer","format":"uint64","description":"Input index starting from genesis.","example":123},"block_number":{"type":"integer","format":"uint64","description":"Block number when input was posted.","example":10000000},"timestamp":{"type":"integer","format":"uint64","description":"Unix timestamp of block in milliseconds.","example":1588598533000}}},"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"}}},{"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"}}}]}}}}}},"202":{"description":"Finish accepted but try again to obtain the next request."},"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"}}}}},"method":"post","path":"/finish","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"status":"accept"},"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":"Finish and get next request","description":{"content":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","type":"text/plain"},"url":{"path":["finish"],"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"}}}}} +api: eJztWt9TGzkS/ldUvoeBOgPGBALUcVVkA3VUXXZTga19AIrIM7JHmxlpVtLY+Cj/7/e1pBmPDYTs5uoqD/iB2Jp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I8fLfOjQ+QhFfhmuJmIDk3CfoXM2m+hTIR3cxjjxgXgM2ikvcCzpHmAenuK8SDaXTAiyuJduYzcuhrG5hUR6xJPHCXtIApvkuL0zWNyoWY70Y1emFhFcAJZcxguMsL0RasDnKaPEuy/Kn41o0L+zJCZQ0mcU6Sfh1+bm0nIrJjs5oUPVIxMlP2vW3KY8ursxc39spqrWtQuVJalqr7+HHfKzKSInkEyINjpQViiuk+5hIbklbGtXao9xNhaLFxldPHGJnLBcpE+CBAJSf6CBX9ZR0GSV3F4nzbHAf28H/+S2v8Yt9qWvcGoobpc7Fx27fbtrGy2jb+NPcu6zhgmXOl27hBUfm38C+l8DHKVHvOHXV+GG66Uu3LDy/4EbpUe44dcq3JBO101WI0jbvG7IRPFtob16M/x8aEcDVKK9nm1y8cc0kyiseKzNVW70rFNOxD0ZjTKwo0S7+B16PIt6KTECbxc6CEZG8C+xh/kmiZE9q8N1VbgQk+PlDRS1gW4jpNlcOomm8h9fXVho1Bh4iwLAJtL6+9umbZ41ANA3L4Vg10uMtxt/45Xceh+mwq1mb7tjs2nia1d1qwMA4RnTva2BCnXo7tQk6baSZrVMOAqndnxolQr3vv6OEDhB2T7NxBTjAgUjVo3YKnit0rx9TrM3nUqBquSqM/s0wzFGiIlwK/Pv+nzauXh7fUv0+pbo9S3R61ui17dEr2+Jfpi3RPFypXP3sojH+Yd4i3Hd/KeH236PrEQrDw8jxP2vplgsaBnWNXOs4+uUG0mRQb/AKYe56Xb7+qH3Rczp0iEUg60rkkvkaDN0S7H+WoYuQcKO0+Z90vO0t50bmI+/XF6BeBRfe5FLsWr4jN5I4e9xj96m+O4cXurQ2kOvwDm7RnjheeBJn/8Cbqzwow== sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Finish and get next request The dApp backend should call this method to start processing rollup requests. The Rollup HTTP Server returns the next rollup request in the response body. -The possible values for the request_type field are 'advance_state' and 'inspect_state'. +The possible values for the request_type field are 'advance_state' and 'inspect_state'. The data field contains the rollup request input data. For advance-state requests, the input data contains the advance-state metadata and the payload. For inspect-state requests, the input data contains only the payload. After processing a rollup request, the dApp back-end should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. +For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. If the advance-state request is rejected, the vouchers and notices are discarded. @@ -62,20 +57,35 @@ When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Ma When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -
Request Body
- -Finish accepted and next rollup request returned. - -
Schema
    data object
    oneOf
    metadata object
- -Finish accepted but try again to obtain the next request. - -
- -Error response. - -
Schema
  • string
    - -Detailed error message. -
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/register-exception.api.mdx index d0f8ef87..3fdab4c3 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/register-exception.api.mdx +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/register-exception.api.mdx @@ -1,33 +1,40 @@ --- id: register-exception title: "Register an exception" -description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens. -This method should be the last method ever called by the dApp backend while processing a request. - -When running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request. -No HTTP status code will be sent or received. - -When running in host mode, the Rollup HTTP Server returns the status code 200. -In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -" -sidebar_label: Register an exception +description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens." +sidebar_label: "Register an exception" hide_title: true hide_table_of_contents: true -api: {"operationId":"registerException","description":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\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"}}}}}},"responses":{"200":{"description":"Accepted the exception throw."},"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"}}}}},"method":"post","path":"/exception","servers":[{"url":"https://"},{"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":"Register an exception","description":{"content":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\n","type":"text/plain"},"url":{"path":["exception"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztWNtuI7kR/RVCeWgbsSWNN4MgwnoBZ9ZBDGRnjbGCBLAND9VdUnPdIjsk27Ii6N9zimRfZHv29pDkYfUgdfNSPHXqxtJuZGqy0iujr4rRbGRppZwne/mcU82jo5NRQS63Kr7NRvOSRHFR18KVpqkKkcuqEr5UTqzJl6YQm5K0UB4TWhsvamtyIgwrX2IdCUv/asilCeeUXgm5xJFCakHtsaKUdU3aje/0fCA7nbmgIKmSEJNm6AkSGAuOWmzDdEC5kPkjaUalKjo4swWCI+70Pxi0bbTmKaV5YdHkAcnaFHQSBH6Q1pNT4oYsn/ad1HKF31o2jtzBiu9kXipNUKnAMVjs4zxprywJ56UnYZZhbJ3WegOQ0jN1G+mg49JYZisn9cSoBtwB8kcj/jqfXwdRjRM5QIJimALcOBwjjE17qXhTw9IweZ1un0xVNXWUmfSz5BurI/DhMWfTKSReabEwMGkuoXyUoXTd+B7Fo4IJDwwvHfi8/OeHy+v51fcfAzuBlc7qaxgHnHYyQMFG2iKoAE9M6v/ZFNvRbDfKjfZQlR/hLZXKgx9PfnDsqLuRy0taS37y25rgumbxA+UecmBdeL1X5Hi2ltvKyGKw0HkLlt50/bRYwCdBIqO/xJelZi1KehYLpaXdMu619MF5oYSyoNpvjMhLaWUOX3dCwrbZ9DnD0qoym+i1tcRS9guIkgXlai0roZv1gnd4do7cWEuuNsycEQZus9h6wkF/gb2Vhpl0DotCckGyWBAts8Eex5tkp0OwTEV6hZ8/BGuwMCfOzs5OxLs/foWvP0356T0OuEB0rmu/HTJgqYZkmKAPukhdUC3aDJqs64pZ7TFh2CsfBq8T+ft9P9Ynn/2exyN6F60F7+OfQ8tc5LyDXrqTL63ZjEd7NuRSNpV/vfPS2hAp8YQxkA28ytOzn9SVVG/70xfc5Fvy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njU0mklG52X3TxfrXFFYe7XUg/uPp867QfN9Msb6qBz+q2d/62d/5+186mNGnRZ+3Rh36V+5XbUOzE6C1aSB3e7BWD+3Vb7PQ+DRLvFOB6fpFUcdvwGYSWaDLKhwXmkLXcW0fFP53w0L68ahvDq7wNud+KO2FoO1g7h3g8arevvb+ZYtkh/TrAt+A81ueE/LvA9G+HBBF1CIxvGdqMK1+gGJGE+nsyf/wBFo88H sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + -## Register an exception The dApp should call this method when it cannot proceed with the request processing after an exception happens. This method should be the last method ever called by the dApp backend while processing a request. @@ -38,17 +45,35 @@ No HTTP status code will be sent or received. When running in host mode, the Rollup HTTP Server returns the status code 200. In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -
Request Body
- -Accepted the exception throw. -
+ + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. + + + -
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.js b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.js deleted file mode 100644 index b635753d..00000000 --- a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [{"type":"doc","id":"api/rollup/cartesi-rollup-http-api"},{"type":"category","label":"UNTAGGED","items":[{"type":"doc","id":"api/rollup/finish","label":"Finish and get next request","className":"api-method post"},{"type":"doc","id":"api/rollup/add-voucher","label":"Add a new voucher","className":"api-method post"},{"type":"doc","id":"api/rollup/add-notice","label":"Add a new notice","className":"api-method post"},{"type":"doc","id":"api/rollup/add-report","label":"Add a new report","className":"api-method post"},{"type":"doc","id":"api/rollup/register-exception","label":"Register an exception","className":"api-method post"}]}]; \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.ts new file mode 100644 index 00000000..17df0621 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-0.9/api/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-0.9/api/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-0.9/build-dapps/create-dapp.md b/cartesi-rollups_versioned_docs/version-0.9/build-dapps/create-dapp.md index 2108c843..bd9f47aa 100644 --- a/cartesi-rollups_versioned_docs/version-0.9/build-dapps/create-dapp.md +++ b/cartesi-rollups_versioned_docs/version-0.9/build-dapps/create-dapp.md @@ -136,7 +136,7 @@ This command sets the FORTUNE_CMD variable to a string that, when executed, runs logger.info(f"Received notice status {response.status_code} body {response.content}") ``` -The `quote` runs the command stored in FORTUNE_CMD using a shell, captures the output (including errors), and then decodes it from bytes to a string, storing the result in the variable output. The `output` creates a formatted string with placeholders, replacing {input} and {quote} with the values of the variables input and quote, respectively, and assigns the resulting string to the variable output. +The `quote` runs the command stored in FORTUNE_CMD using a shell, captures the output (including errors), and then decodes it from bytes to a string, storing the result in the variable output. The `output` creates a formatted string with placeholders, replacing `{input}` and `{quote}` with the values of the variables input and quote, respectively, and assigns the resulting string to the variable output. 5. We then change the code of the `def handle_inspect(data):` function to: diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx index 78b09ec2..f8b37435 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -1,25 +1,48 @@ --- id: inspect-state-http-api-for-cartesi-rollups title: "Inspect-state HTTP API for Cartesi Rollups" -description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend. -" +description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -# Inspect-state HTTP API for Cartesi Rollups + + API that allows the dApp frontend to make inspect-state requests to the dApp backend. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect.api.mdx index e19e8611..41985cf0 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/inspect/inspect.api.mdx @@ -1,37 +1,38 @@ --- id: inspect title: "Inspect dApp state REST API" -description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL. -The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. -If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. - -The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. -In case of exception, the field exception_payload will contain the exception payload; -Otherwise, this field will be null. - -When running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request. -On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. -Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -" -sidebar_label: Inspect dApp state REST API +description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL." +sidebar_label: "Inspect dApp state REST API" 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"},"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"},"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"}}}},"processed_input_count":{"type":"integer","description":"Number of processed inputs since genesis","example":0}}}}}},"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"}}}}},"method":"get","path":"/{payload}","servers":[{"url":"https://"},{"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"}} +api: eJztV01vGzcQ/SvEXpQAtqS4cT+UooDhKq2BNAkUBT0kgUHtjrRMdsktybUsCPrvfUNypbVlI8f24ItNDYczw5k3b7jbzDRkpVdGXxXZJFPaNZT77CQryOVWNbwD+bxUTtTkS1MIR7pwQmqRlE+dl56EpX9acl54I3xJorhoGrGQ+Tdoi0Y6p/QqbDRyUxkJM96ySOkg/Th7M/ys58f7rjRtVYhFUDklnZuCilfhTPKPgOwNWbFWVSUKYoWwnQwgno/z16c/w/zV8hDa0hrtOTZNhOtAi4MUUiyUlnbTO81HuotgjXt7gWzI4kY5KlijdZS0HP34UoQgcRge45UsucZoKOXwKRE23HDSWte5kdE2NBtjvRMr0lwWmF9sjtKZEnXXQo6CIEmkoG3FQOY5NX5wIgaWviJJWBmI6ZbFqOmA06FxClGZpdjLT4K3pSLkfC+87moSUpwuERT3Kl3ZXn3W7ziCNXLDtpCoaCwcRYC6raqQmL85lbbVmqOHgVrmpdIkatQvRrEuTUXiUlpPTom/0j4sWlNVnBqkQ8ilx30ba3I6YOxBZMLrOy1KA4xGH3frKFdcGS/yUupVZ+gOiqO1Ncfd8/dYI8DdW+NVztCQPqYidRBWbqPzEhA0rTsRzqRYtPF9XKE1l8bWjB/T2pxOFUPWqRvUrGtbBz9o10ZaCetkXTb5tEUfo2kb6UtsaWyEX6FAEHCAyhL63duWTjKXl1TLbLLN/KZh1QipbLf7wsoRu473z8Zj/neXG666Nky3j/pDOMpDi3k+IpumUnmIePTV8bntsV+z+BrJB+nF/byKXiPQj+O7T1JAVAB/KgejMjd1UxH3EdDP2X3GnbYuN/zjOSyQbmtkLLsI/UKcnllomLCcdvDGOuHvT1nFvctNXtEbVSvPWlQE4VzV92RIId1KjgIR9rx45YPoMkYIHx/iNXd84F7jff/u71OHpr6cciKorUVJtx2jMZSkT+SxVJa5em0Y71bmjBwhLYnB+HYA1aoy68g+jYQqcwRMSdCrqmWFLq4XfCJAOzc2Vj2A1qBHFxtPcPTahGJ4qXO0GywXJIsF0XLQOxO4V4oDxfhSVKRX+Pcy8CIbc+Ls7OxEvPjpB/z5Zcyrczi40ILqxm/2p5kcqIFlwO5Anoki+WqxWw4VOcTUq0lKJpciEXKvANJauYGy8lS774P3qYL/aQV3B9kslDKIEn1Tca100/rr3LSRplKJmGdXZI9q9DYkjVO5tyCCBRC6QorC3HbK9QMc92NIXDlLJIlgeLegpWwrf0ytU2tRgEco1dOtHzWVVA+T6SMw+50wvHl6UrBd4xJyFUwfUhrfLPE5l4fnF1MnhnerC2DGG3MoTHx7FS0xCAAsxiisY755edurSLhKuC8uHOcgpCsKHcODapKNtgkEO8ii4TjNWlthu/S+cZPR6NcCw+Q6kfw19n5Do/aVoFOZXFY86ifn4/H5qHvW8kBTemlCmu6WJA3vP+fz9+Li/RX32v7pMUMztQ1XlUOKeRwPz4cvIMFUI64kLKZBe9FgUtDp2XCM7buhr9froQzbQ2NXo3TWjd5cXU7ffpjymWHp6yrb3S8bhxRaVXJfuwfesSH93x55+7iHnuXcSdwMSFMtde8G3UQPytHObPphznm5j6ftAZFPHwlPHwlPHwn/54+ENBl6g2OXGGqbOPhTNukeLKBKTgPLtlsG7Udb7XYsRuR2AzmWN9IquWAeBU0XyvEavL6UFSr7OFM8m6VPkOfisbC615bmt9aNrFr+heU32vQ+ZnZfoFpi/mNYcwhxNz6ze+eOvj54EOyH0B/TOQbTv1f6Bz0= sidebar_class_name: "get api-method" -info_path: cartesi-rollups/api/inspect/inspect-state-http-api-for-cartesi-rollups +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/inspect/inspect-state-http-api-for-cartesi-rollups +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -## Inspect dApp state REST API + + + + + + @@ -40,7 +41,7 @@ The payload string should be URL-encoded; the inspect server will decode the str If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. The response contains a status string and the reports generated by the dApp backend. -The status string can be either 'accept', 'reject', or 'exception'. +The status string can be either 'accept', 'reject', or 'exception'. In case of exception, the field exception_payload will contain the exception payload; Otherwise, this field will be null. @@ -49,17 +50,34 @@ On host mode, it is advised against changing the dApp backend state when process Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -
Path Parameters
- -Inspect state response. - -
Schema
    reports object[]
- -Error response. - -
Schema
  • string
    + + + + + + + + + + + + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-notice.api.mdx index 1cece81f..a148d2de 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-notice.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-notice.api.mdx @@ -1,31 +1,38 @@ --- id: add-notice title: "Add a new notice" -description: "The dApp backend can call this method to add a new notice when processing the advance-state request. -A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. -Between calls to the finish method, the notice method can be called up to 32k times. - -The returned value is the index of the notice for the current advance request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new notice +description: "The dApp backend can call this method to add a new notice when processing the advance-state request." +sidebar_label: "Add a new notice" 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"}}}}}},"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}}}}}},"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"}}}}},"method":"post","path":"/notice","servers":[{"url":"https://"},{"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"}}}}} +api: eJztWG1v2zYQ/iuE9kEJ5tiO22yYsQxIuwwLsHVBk31KgpSWzpYamdRIKo5n+L/vOZKyFSftuhcMG7AAbaTT8fjcc8e7Y1aJrslIV2p1lifjROb5G+3KjJJekpPNTFnzN3y5LEjkJ3UtJjK7I5WLTCr8qyrhitKKOblC58JpARNCCkULobwlsShIidrojKwt1Qz6BKV7qTI6sE46EoZ+aci6/rU6aReFzSdkhVRLkRVSzfAM87y6VI6MkpUIy/XUSz06V0gn5nIpJmy2Imzj2mWTSmd3MFUq7PSK3IIouLAxPC1VaYvoTM+LIp7oHzsNy7yIctHUvPDF6E64ck4WVq8V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Jh2LVGYZ1S5dX6tFgTMoLk1DEVwAll6AYa6vYXm7qYGd50gJ1Pb5EO1FQj8X6SAu7glO9+Pwtr+/Ze4RZcfHYjQcPaEofaNFHcFE03E/5IlZsljOUHq6vHBtKlXj/fewwyFtK8kxdmZEex0ojzSu0vhwyyUsvWFsaZwzvOeUPsXZMnavG1BkuniiiIOwFfJPigMEpL5jIC67KHLpZHpzlaJKyc2znd2iE6L8pTe9HWuxdnzEUqtxs1257vD26aFtvYyxja8c3A8SE2pql5c40XFu/gHofw5w3D3iDW8fhYuZA2WiCzdI/hm4cfcIN7w9hhuO01V7qpGkm3PdqlH1aamNea7GTPK7qR0JqMmPgLykPYv/TpqosvTUm8vC6EWnnNADk8YnsOPERvgX/Pgg6u2OEfhG0EEwwbR5F3uYb5KYF/Mm85jmIKXHdWtzieM20G2EfGvAVIim8quvLiI0aoziuH4ampUWtwN01Ng2T1sA6JsXROJqi/Fm7zNZlwffhtHwoF27WbHfNnEedCKypwMA45kaiVkQLjShu3OTlJPKD2w5OU6nzfiwcYpyvtE51g93x83XHBe3ikdolho6qGSjsmLznW8FGFGY+7lU3dln57a9O5l27nv/X+H/s1f4ePno3E3WcdJdxSn/KonxxzzOucuS1WoiLf1sqvWaxbBnlpDj8V6akpOV32CpwGiO2xlfC+5oyfN4yJmDS96X1cEB/3Vo90rIl4Sw4sQX64/q3nRuKOc/XVxCeRL/JsEHDVIjF/z3Cvw/TvCgfQ77C6WXrZIKOdTgYoXvwSb//Aaw932v sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + -## Add a new notice + + + @@ -37,17 +44,34 @@ The returned value is the index of the notice for the current advance request. In other words, the index counting restarts at every request. -
Request Body
- -Created the notice. + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-report.api.mdx index 0d14b50e..32979e72 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-report.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-report.api.mdx @@ -1,28 +1,38 @@ --- id: add-report title: "Add a new report" -description: "The dApp can call this method to add a new report for the given rollup request. -A report can be a diagnostic or a log; reports are not discarded when a request is rejected. -Between calls to the finish method, the report method can be called any number of times. -" -sidebar_label: Add a new report +description: "The dApp can call this method to add a new report for the given rollup request." +sidebar_label: "Add a new report" hide_title: true hide_table_of_contents: true -api: {"operationId":"addReport","description":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\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"}}}}}},"responses":{"200":{"description":"Created the report."},"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"}}}}},"method":"post","path":"/report","servers":[{"url":"https://"},{"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 report","description":{"content":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","type":"text/plain"},"url":{"path":["report"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztV21vIzUQ/itW+LCpSJO0UCECRerdFVEJHdU1fEqjnrM7yfq6sRevN2mI8t95xvYm25c7DpAQH1ip6a49Hj/zzIvH244pyUqnjL7KOqOOzLJ3VBrrOr1ORlVqVclzmBnnJLKLshSp1PgrCuFyVYkludxkwhmBpUIKTWthvQYxNxYyJBZqRVpYUxR1ibnfaqpc/1ZfNHKscEZYmym50KZyKhVYKkVhFt9FoUpIS0IbB6EqlTajTKxzqJWNRgEwlj5Q6iiD9lfk1kQBacXwGMlcaVXlEXPPD0UM0YwIhRdhA6k3QtfLGVlh5sKpJVXQDGbilq9MtumMtp3UaEfa8assy0Klns/Bh4qJ23aqNKel5De3KQlUmhnDhJ7SMvtOUcWzpdwURmYtwcpZpRcvuiIKs9VKe0su8WOpXoqcHsRMaWk37IKlZLLH3noLmtzaiDSXVoIoG2hNhg8JRIvCrGH1bAPlEGWboUpmlKqlLCIT4DKX8JmxlqrSaO96ownLHGGjH+E5pSsndUo91pyRzGZE86S1xjtE7m1YK5eLgvQC/74G65lXVonT09OeOPnmK/x8O+S3Mw4bLWhZuk2bATgRmuGCAJ/ZCNR504LPYMmyLJjVAyYMO+X84HUkf7c7jMVM2O14MECvgqtOh0P+99gtry1JRnAIq35nx76by7pwz+UvrQVZjd4+wLQCydGDG5SFVC+H0Eci4w05qTh0yetGwFZy4VUfzB97eCFnUlMXmU8rRH2tM/jXGXMgkewKwZ/VxA5DEHA8QXu10U4+tNjzpniiYHDIJYyWyGWOculyfA1sU1iCWhA52XZqW2Aud66sRoPB9xkS6C6UijtM/QAC2zIQKQyyM4fm0dlweDYIsp3dtNfhfHt3yMzLxuJWZ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8WLmvd/dm3ltjusuPDlryXbxjptdfvXv9yMITaLl2IOWoxaueYLM35HHbwYHw/+DuXHtp0C7VyNSwrmw878/AHHRbUf sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -## Add a new report + + + + + + @@ -31,17 +41,34 @@ A report can be a diagnostic or a log; reports are not discarded when a request Between calls to the finish method, the report method can be called any number of times. -
Request Body
- -Created the report. + + -
+ + + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-voucher.api.mdx index 74fa46ab..89392696 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-voucher.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/add-voucher.api.mdx @@ -1,31 +1,38 @@ --- id: add-voucher title: "Add a new voucher" -description: "The dApp backend can call this method to add a new voucher when processing an advance-state request. -Vouchers are collateral effects actionable in the blockchain. -Between calls to the finish method, the voucher method can be called up to 32k times. - -The returned value is the index of the voucher for the current advance-state request. -In other words, the index counting restarts at every request. -" -sidebar_label: Add a new voucher +description: "The dApp backend can call this method to add a new voucher when processing an advance-state request." +sidebar_label: "Add a new voucher" hide_title: true hide_table_of_contents: true -api: {"operationId":"addVoucher","description":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","description":"20-byte address of the destination contract for which the payload will be sent.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"payload":{"type":"string","description":"String in Ethereum hex binary format describing a method call to be executed by the destination contract.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xcdcd77c0' corresponds to a payload with length 4 and bytes 205, 205, 119, 192.\nTo describe the method call, the payload should consist of a function selector (method identifier) followed\nby its ABI-encoded arguments.\nref: https://docs.soliditylang.org/en/v0.8.19/abi-spec.html\n","example":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"}}}}}},"responses":{"200":{"description":"Created the voucher.","content":{"application/json":{"schema":{"type":"object","properties":{"index":{"type":"integer","format":"uint64","description":"Position in the Merkle tree.","example":123}}}}}},"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"}}}}},"method":"post","path":"/voucher","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"destination":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","payload":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"},"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 voucher","description":{"content":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["voucher"],"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"}}}}} +api: eJztWG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bbN8xYA+uYVkbjZYLzb+ZOs1d4PYazda3nXHLttE+cZLSJ7OQAwnomRmGOhQhO6OzdJf0fi+MjmOJzW48NaKcr5AsLx+nDjsf6a0yPGBQ5GUA3tlRKHt2L9nS8e+LANVDNZdWef7Zuf7bG6cz/x//uk7/M+KR6LOqemVZxjl/H8cZO03sVJgUOTScvlWFr6pylXKyZDoFmAjsdHaRTbl98gqiCJDusPLA+04HE7RMTeNW/My2ELvoncPq3y8SVwnPla/NW1d53D08efrq6xeBxvyDiPQDVyzrdn+HuS4EH7CPVnXU9bJnyP0ODMh+9BJv9+BZ2zK4Q= sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + -## Add a new voucher + + + @@ -37,17 +44,34 @@ The returned value is the index of the voucher for the current advance-state req In other words, the index counting restarts at every request. -
Request Body
- -Created the voucher. + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api.info.mdx index 5faffc21..9ddf37f3 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api.info.mdx @@ -1,79 +1,31 @@ --- id: cartesi-rollup-http-api title: "Cartesi Rollup HTTP API" -description: "API that the Cartesi Rollup HTTP Server implements. - -In the box below, there is an example of a dApp backend that uses the Rollup HTTP API. - -``` -import requests -import sys - -rollup = sys.argv[1] - -def check_status_code(response): - if response.status_code not in range(200, 300): - print(f'Error: invalid status code {response.status_code}') - sys.exit(1) - return response - -finish = {'status': 'accept'} -while True: - print('Sending finish') - r = check_status_code(requests.post(rollup + '/finish', json=finish)) - if r.status_code == 202: - print('No pending rollup request, trying again') - continue - - rollup_request = r.json() - if rollup_request['request_type'] == 'advance_state': - print('Sending voucher') - voucher = { - 'destination': rollup_request['data']['metadata']['msg_sender'], - 'payload': rollup_request['data']['payload'] - } - check_status_code(requests.post(rollup + '/voucher', json=voucher)) - - print('Sending notice') - notice = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/notice', json=notice)) - - print('Sending report') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - finish['status'] = 'accept' - - elif rollup_request['request_type'] == 'inspect_state': - print('Sending report per inspect request') - report = {'payload': rollup_request['data']['payload']} - check_status_code(requests.post(rollup + '/report', json=report)) - - else: - print('Throwing rollup exception') - exception = {'payload': rollup_request['data']['payload']} - requests.post(rollup + '/exception', json=exception) - break -``` - -In production mode, if the dApp exits the Rollups initialization script will register a Rollup Exception. -See [/exception](#api-Default-registerException). - -In host mode, the Cartesi Rollups infrastructure is not able to detect that the dApp exited. -It is up to the dApp developer to re-launch the dApp. -" +description: "API that the Cartesi Rollup HTTP Server implements." sidebar_label: Introduction sidebar_position: 0 hide_title: true +custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; -import Tabs from "@theme/Tabs"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -# Cartesi Rollup HTTP API + + @@ -139,5 +91,17 @@ In host mode, the Cartesi Rollups infrastructure is not able to detect that the It is up to the dApp developer to re-launch the dApp. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/finish.api.mdx index 48884c4e..e2b91de6 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/finish.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/finish.api.mdx @@ -1,58 +1,51 @@ --- id: finish title: "Finish and get next request" -description: "The dApp backend should call this method to start processing rollup requests. -The Rollup HTTP Server returns the next rollup request in the response body. - -The possible values for the request_type field are 'advance_state' and 'inspect_state'. -The data field contains the rollup request input data. -For advance-state requests, the input data contains the advance-state metadata and the payload. -For inspect-state requests, the input data contains only the payload. - -After processing a rollup request, the dApp back-end should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. -The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. - -If the advance-state request is rejected, the vouchers and notices are discarded. -In contrast, reports are not discarded in case of rejection. -When running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request. - -During a finish call, the next rollup request might not be immediately available. -When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready. -When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. -When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -" -sidebar_label: Finish and get next request +description: "The dApp backend should call this method to start processing rollup requests." +sidebar_label: "Finish and get next request" hide_title: true hide_table_of_contents: true -api: {"operationId":"finish","description":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accept","reject"],"example":"accept"}}}}}},"responses":{"200":{"description":"Finish accepted and next rollup request returned.","content":{"application/json":{"schema":{"type":"object","properties":{"request_type":{"type":"string","enum":["advance_state","inspect_state"],"example":"advance_state"},"data":{"type":"object","oneOf":[{"type":"object","properties":{"metadata":{"type":"object","properties":{"msg_sender":{"type":"string","description":"20-byte address of the account that submitted the input.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"epoch_index":{"type":"integer","format":"uint64","description":"Deprecated. Always receives 0.","example":0},"input_index":{"type":"integer","format":"uint64","description":"Input index starting from genesis.","example":123},"block_number":{"type":"integer","format":"uint64","description":"Block number when input was posted.","example":10000000},"timestamp":{"type":"integer","format":"uint64","description":"Unix timestamp of block in milliseconds.","example":1588598533000}}},"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"}}},{"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"}}}]}}}}}},"202":{"description":"Finish accepted but try again to obtain the next request."},"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"}}}}},"method":"post","path":"/finish","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"status":"accept"},"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":"Finish and get next request","description":{"content":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","type":"text/plain"},"url":{"path":["finish"],"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"}}}}} +api: eJztWt9TGzkS/ldUvoeBOgPGBALUcVVkA3VUXXZTga19AIrI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cJ/d7GOD693r2ldWQBipVAjw/OuKNDxUYT/JvHN4rhI8fLfOjQ+QhFfhmuJmIDk3CfoXM2m+hTIR3cxjjxgXgM2ikvcCzpHmAenuK8SDaXTAiyuJduYzcuhrG5hUR6xJPHCXtIApvkuL0zWNyoWY70Y1emFhFcAJZcxguMsL0RasDnKaPEuy/Kn41o0L+zJCZQ0mcU6Sfh1+bm0nIrJjs5oUPVIxMlP2vW3KY8ursxc39spqrWtQuVJalqr7+HHfKzKSInkEyINjpQViiuk+5hIbklbGtXao9xNhaLFxldPHGJnLBcpE+CBAJSf6CBX9ZR0GSV3F4nzbHAf28H/+S2v8Yt9qWvcGoobpc7Fx27fbtrGy2jb+NPcu6zhgmXOl27hBUfm38C+l8DHKVHvOHXV+GG66Uu3LDy/4EbpUe44dcq3JBO101WI0jbvG7IRPFtob16M/x8aEcDVKK9nm1y8cc0kyiseKzNVW70rFNOxD0ZjTKwo0S7+B16PIt6KTECbxc6CEZG8C+xh/kmiZE9q8N1VbgQk+PlDRS1gW4jpNlcOomm8h9fXVho1Bh4iwLAJtL6+9umbZ41ANA3L4Vg10uMtxt/45Xceh+mwq1mb7tjs2nia1d1qwMA4RnTva2BCnXo7tQk6baSZrVMOAqndnxolQr3vv6OEDhB2T7NxBTjAgUjVo3YKnit0rx9TrM3nUqBquSqM/s0wzFGiIlwK/Pv+nzauXh7fUv0+pbo9S3R61ui17dEr2+Jfpi3RPFypXP3sojH+Yd4i3Hd/KeH236PrEQrDw8jxP2vplgsaBnWNXOs4+uUG0mRQb/AKYe56Xb7+qH3Rczp0iEUg60rkkvkaDN0S7H+WoYuQcKO0+Z90vO0t50bmI+/XF6BeBRfe5FLsWr4jN5I4e9xj96m+O4cXurQ2kOvwDm7RnjheeBJn/8Cbqzwow== sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + -## Finish and get next request + + + The dApp backend should call this method to start processing rollup requests. The Rollup HTTP Server returns the next rollup request in the response body. -The possible values for the request_type field are 'advance_state' and 'inspect_state'. +The possible values for the request_type field are 'advance_state' and 'inspect_state'. The data field contains the rollup request input data. For advance-state requests, the input data contains the advance-state metadata and the payload. For inspect-state requests, the input data contains only the payload. After processing a rollup request, the dApp back-end should call again the finish method. -For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. +For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. If the advance-state request is rejected, the vouchers and notices are discarded. @@ -65,21 +58,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 202 af When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -
Request Body
- -Finish accepted and next rollup request returned. - -
Schema
    data object
    oneOf
    metadata object
- -Finish accepted but try again to obtain the next request. - -
- -Error response. - -
Schema
  • string
    + + + + + + + + + + + + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/register-exception.api.mdx index 9b452ad9..ac1f734e 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/register-exception.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/register-exception.api.mdx @@ -1,33 +1,38 @@ --- id: register-exception title: "Register an exception" -description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens. -This method should be the last method ever called by the dApp backend while processing a request. - -When running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request. -No HTTP status code will be sent or received. - -When running in host mode, the Rollup HTTP Server returns the status code 200. -In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -" -sidebar_label: Register an exception +description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens." +sidebar_label: "Register an exception" hide_title: true hide_table_of_contents: true -api: {"operationId":"registerException","description":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\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"}}}}}},"responses":{"200":{"description":"Accepted the exception throw."},"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"}}}}},"method":"post","path":"/exception","servers":[{"url":"https://"},{"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":"Register an exception","description":{"content":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\n","type":"text/plain"},"url":{"path":["exception"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztWNtuI7kR/RVCeWgbsSWNN4MgwnoBZ9ZBDGRnjbGCBLAND9VdUnPdIjsk27Ii6N9zimRfZHv29pDkYfUgdfNSPHXqxtJuZGqy0iujr4rRbGRppZwne/mcU82jo5NRQS63Kr7NRvOSRHFR18KVpqkKkcuqEr5UTqzJl6YQm5K0UB4TWhsvamtyIgwrX2IdCUv/asilCeeUXgm5xJFCakHtsaKUdU3aje/0fCA7nbmgIKmSEJNm6AkSGAuOWmzDdEC5kPkjaUalKjo4swWCI+70Pxi0bbTmKaV5YdHkAcnaFHQSBH6Q1pNT4oYsn/ad1HKF31o2jtzBiu9kXipNUKnAMVjs4zxprywJ56UnYZZhbJ3WegOQ0jN1G+mg49JYZisn9cSoBtwB8kcj/jqfXwdRjRM5QIJimALcOBwjjE17qXhTw9IweZ1un0xVNXWUmfSz5BurI/DhMWfTKSReabEwMGkuoXyUoXTd+B7Fo4IJDwwvHfi8/OeHy+v51fcfAzuBlc7qaxgHnHYyQMFG2iKoAE9M6v/ZFNvRbDfKjfZQlR/hLZXKgx9PfnDsqLuRy0taS37y25rgumbxA+UecmBdeL1X5Hi2ltvKyGKw0HkLlt50/bRYwCdBIqO/xJelZi1KehYLpaXdMu619MF5oYSyoNpvjMhLaWUOX3dCwrbZ9DnD0qoym+i1tcRS9guIkgXlai0roZv1gnd4do7cWEuuNsycEQZus9h6wkF/gb2Vhpl0DotCckGyWBAts8Eex5tkp0OwTEV6hZ8/BGuwMCfOzs5OxLs/foWvP0356T0OuEB0rmu/HTJgqYZkmKAPukhdUC3aDJqs64pZ7TFh2CsfBq8T+ft9P9Ynn/2exyN6F60F7+OfQ8tc5LyDXrqTL63ZjEd7NuRSNpV/vfPS2hAp8YQxkA28ytOzn9SVVG/70xfc5FvyUnEeoiA7+fT4gIv5IB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e7XUg/uPp867QfN9Msb6qBz+q2d/62d/5+186mNGnRZ+3Rh36V+5XbUOzE6C1aSB3e7BWD+3Vb7PQ+DRLvFOB6fpFUcdvwGYSWaDLKhwXmkLXcW0fFP53w0L68ahvDq7wNud+KO2FoO1g7h3g8arevvb+ZYtkh/TrAt+A81ueE/LvA9G+HBBF1CIxvGdqMK1+gGJGE+nsyf/wBFo88H sidebar_class_name: "post api-method" -info_path: cartesi-rollups/api/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api +custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem" -import SchemaTabs from "@theme/SchemaTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + -## Register an exception + + + @@ -41,17 +46,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 200. In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -
Request Body
- -Accepted the exception throw. - -
- -Error response. - -
Schema
  • string
    + + + + + + + + + + + + + + -Detailed error message. -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.js b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.js deleted file mode 100644 index b635753d..00000000 --- a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [{"type":"doc","id":"api/rollup/cartesi-rollup-http-api"},{"type":"category","label":"UNTAGGED","items":[{"type":"doc","id":"api/rollup/finish","label":"Finish and get next request","className":"api-method post"},{"type":"doc","id":"api/rollup/add-voucher","label":"Add a new voucher","className":"api-method post"},{"type":"doc","id":"api/rollup/add-notice","label":"Add a new notice","className":"api-method post"},{"type":"doc","id":"api/rollup/add-report","label":"Add a new report","className":"api-method post"},{"type":"doc","id":"api/rollup/register-exception","label":"Register an exception","className":"api-method post"}]}]; \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.ts new file mode 100644 index 00000000..ed9ee98f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-1.0/api/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.0/api/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-1.0/build-dapps/create-dapp.md b/cartesi-rollups_versioned_docs/version-1.0/build-dapps/create-dapp.md index 24ed48c5..f87047a9 100644 --- a/cartesi-rollups_versioned_docs/version-1.0/build-dapps/create-dapp.md +++ b/cartesi-rollups_versioned_docs/version-1.0/build-dapps/create-dapp.md @@ -42,7 +42,7 @@ cd fortune - Change `calculator.py` to `fortune.py` - Change the dApp name in `entrypoint.sh` to `rollup-init python3 fortune.py` - Change the dApp name in the Dockerfile to `COPY ./fortune.py` -- Change the dApp name in ` docker-bake.override.hcl` to `dapp:fortune` +- Change the dApp name in `docker-bake.override.hcl` to `dapp:fortune` - Change the dApp name in `docker-compose.override.yml` to `dapp:fortune-devel-server` - Amend the Readme as required. @@ -140,7 +140,7 @@ This command sets the FORTUNE_CMD variable to a string that, when executed, runs logger.info(f"Received notice status {response.status_code} body {response.content}") ``` -The `quote` runs the command stored in FORTUNE_CMD using a shell, captures the output (including errors), and then decodes it from bytes to a string, storing the result in the variable output. The `output` creates a formatted string with placeholders, replacing {input} and {quote} with the values of the variables input and quote, respectively, and assigns the resulting string to the variable output. +The `quote` runs the command stored in FORTUNE_CMD using a shell, captures the output (including errors), and then decodes it from bytes to a string, storing the result in the variable output. The `output` creates a formatted string with placeholders, replacing `{input}` and `{quote}` with the values of the variables input and quote, respectively, and assigns the resulting string to the variable output. 5. We then change the code of the `def handle_inspect(data):` function to: diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx index 74658efc..f8b37435 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -9,18 +9,40 @@ custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; -import Export from "@theme/ApiDemoPanel/Export"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -

Inspect-state HTTP API for Cartesi Rollups

+ + API that allows the dApp frontend to make inspect-state requests to the dApp backend. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect.api.mdx index a3f207aa..8b928c91 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/inspect/inspect.api.mdx @@ -5,25 +5,34 @@ description: "This method sends an inspect-state request to the dApp backend pas sidebar_label: "Inspect dApp state REST API" 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://"},{"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"}} +api: eJztV01vGzcQ/SvEXpQAtqS4cT+UooDhKq2BNAkUBT0kgUHtjrRMdsktybUsCPrvfUNypbVlI8f24ItNDYczw5k3b7jbzDRkpVdGXxXZJFPaNZT77CQryOVWNbwD+bxUTtTkS1M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rr3LSRplKJmGdXZI9q9DYkjVO5tyCCBRC6QorC3HbK9QMc92NIXDlLJIlgeLegpWwrf0ytU2tRgEco1dOtHzWVVA+T6SMw+50wvHl6UrBd4xJyFUwfUhrfLPE5l4fnF1MnhnerC2DGG3MoTHx7FS0xCAAsxiisY755edurSLhKuC8uHOcgpCsKHcODapKNtgkEO8ii4TjNWlthu/S+cZPR6NcCw+Q6kfw19n5Do/aVoFOZXFY86ifn4/H5qHvW8kBTemlCmu6WJA3vP+fz9+Li/RX32v7pMUMztQ1XlUOKeRwPz4cvIMFUI64kLKZBe9FgUtDp2XCM7buhr9froQzbQ2NXo3TWjd5cXU7ffpjymWHp6yrb3S8bhxRaVXJfuwfesSH93x55+7iHnuXcSdwMSFMtde8G3UQPytHObPphznm5j6ftAZFPHwlPHwlPHwn/54+ENBl6g2OXGGqbOPhTNukeLKBKTgPLtlsG7Udb7XYsRuR2AzmWN9IquWAeBU0XyvEavL6UFSr7OFM8m6VPkOfisbC615bmt9aNrFr+heU32vQ+ZnZfoFpi/mNYcwhxNz6ze+eOvj54EOyH0B/TOQbTv1f6Bz0= 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.3/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Inspect dApp state REST API

+ + - + + + @@ -41,17 +50,34 @@ On host mode, it is advised against changing the dApp backend state when process Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -
Path Parameters
+ + + + + + + + + + + + + + -Inspect state response. -
Schema
    reports object[]
  • Array [
  • ]
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-notice.api.mdx index efb93d9a..bbdd8c71 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-notice.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-notice.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend can call this method to add a new notice when pro sidebar_label: "Add a new notice" 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://"},{"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"}}}}} +api: eJztWG1v2zYQ/iuE9kEJ5tiO22yYsQxIuwwLsHVBk31KgpSWzpYamdRIKo5n+L/vOZKyFSftuhcMG7AAbaTT8fjcc8e7Y1aJrslIV2p1lifjROb5G+3KjJJekpPNTFnzN3y5LEjkJ3UtJjK7I5WLTCr8qyrhitKKOblC58JpARNCCkULobwlsShIidrojKwt1Qz6BKV7qTI6sE46EoZ+aci6/rU6aReFzSdkhVRLkRVSzfAM87y6VI6MkpUIy/XUSz06V0gn5nIpJmy2Imzj2mWTSmd3MFUq7PSK3IIouLAxPC1VaYvoTM+LIp7oHzsNy7yIctHUvPDF6E64ck4WVq8V82TINUZB4V5WDeDaiDqnhxZsNDvVxr9mjTEEpJGXDiNnSmhoGLHQJre9jqVMN8oxoQaa0jhQ5QTdk1l2liOO8eWVzpfJeJVkGuwpx4+yrqsy89EfvLcc5lVis4Lmkp/csiYEXk/eU+ZgByFErriSLH+t5bLSMu8oWmeA5tnEicrMRKm8C6fsEzVzUcCTSakkUIOMuWTQlz4UxiJyC83BNzJDxOGgIZEOH1KoVpVegOHJEsahyrzClMwpK+fIDNXMJ7zC50Omwa6ttfIJqhVSYekIG30H+ksF9sB5jy3nJPMJ0TTtrPHZITc+LEpXiIrUDL9eIjtzb8yK0WjUE4dfvsB/Xw356YjzWQma127ZZcBQDcsIQYDPbATqvGshZvBkXlfM6hYTxK50XngeyV+vt7J4btdrFgboNoRqNBzyr8dheW1IMoJtMvaxwd+UHD5BO2p8YGdkoBdiDFED2Rcvn2TLubYlP7Z58iOZu4qEM+TxbXg5HL3oOn/GG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NZlwffhtHwoF27WbHfNnEedCKypwMA45kaiVkQLjShu3OTlJPKD2w5OU6nzfiwcYpyvtE51g93x83XHBe3ikdolho6qGSjsmLznW8FGFGY+7lU3dln57a9O5l27nv/X+H/s1f4ePno3E3WcdJdxSn/KonxxzzOucuS1WoiLf1sqvWaxbBnlpDj8V6akpOV32CpwGiO2xlfC+5oyfN4yJmDS96X1cEB/3Vo90rIl4Sw4sQX64/q3nRuKOc/XVxCeRL/JsEHDVIjF/z3Cvw/TvCgfQ77C6WXrZIKOdTgYoXvwSb//Aaw932v 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.3/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new notice

+ + - + + + @@ -35,17 +44,34 @@ The returned value is the index of the notice for the current advance request. In other words, the index counting restarts at every request. -
Request Body
+ + -Created the notice. + + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-report.api.mdx index f381a263..05938e55 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-report.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-report.api.mdx @@ -5,25 +5,34 @@ description: "The dApp can call this method to add a new report for the given ro sidebar_label: "Add a new report" hide_title: true hide_table_of_contents: true -api: {"operationId":"addReport","description":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\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":"Report"}}}},"responses":{"200":{"description":"Created the report."},"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":"/report","servers":[{"url":"https://"},{"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 report","description":{"content":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","type":"text/plain"},"url":{"path":["report"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztV21vIzUQ/itW+LCpSJO0UCECRerdFVEJHdU1fEqjnrM7yfq6sRevN2mI8t95xvYm25c7DpAQH1ip6a49Hj/zzIvH244pyUqnjL7KOqOOzLJ3VBrrOr1ORlVqVclzmBnnJLKLshSp1PgrCuFyVYkludxkwhmBpUIKTWthvQYxNxYyJBZqRVpYUxR1ibnfaqpc/1ZfNHKscEZYmym50KZyKhVYKkVhFt9FoUpIS0IbB6EqlTajTKxzqJWNRgEwlj5Q6iiD9lfk1kQBacXwGMlcaVXlEXPPD0UM0YwIhRdhA6k3QtfLGVlh5sKpJVXQDGbilq9MtumMtp3UaEfa8ass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xNoytTA2KbBtPHGInHAb5SZBAQOrPYPjlKYpMOplMJwmqlNy/V4s7HB8of8m090RbrB2f0NRITA8rdy3ePt+1jZXRt/GTnftRYpATqCVtXsKIj82/AP3vAY67R7zh65NwwxHQhhv7r38Fbtw9wg1fj+GGdJo0WY0g3ed1I0bF54U2mqASXd6fhnYkoCTfN/GSJhf/mzRRUdFza8a5NetWOaEHJo0zsGXEfvAf2PFR1IcdI/D9QAvBDC3afTzD/CGJDjyrU49pCVJ6XLdcc9PhY6B9EHKrrZzCofK7ry4iHNToX3EbsrRQFVpqnKjx2LxsAODcvCESkwPGafcLWarjN6E1PG7W7lccNYc4NzoR2fMGgPHMrUQvCBPqcLrzISlnhW/YMnIcTvv2YW+UvyFd+SsTcMbLkZ/NaIV2gYMRo5aOC1nrNN/PcyuNFoW5X0rd7n2eXP6edqatS9L/N8nWTTK2861ufxd7x23smyedyCg6XI4GHtluZ7KiX22x2/EwUFtcRCd4XUmr2P38BU05ml2yvtG+pw13uMELx2Pel8WLmvd/dm3ltjusuPDlryXbxjptdfvXv9yMITaLl2IOWoxaueYLM35HHbwYHw/+DuXHtp0C7VyNSwrmw878/AHHRbUf 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.3/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new report

+ + - + + + @@ -32,17 +41,34 @@ A report can be a diagnostic or a log; reports are not discarded when a request Between calls to the finish method, the report method can be called any number of times. -
Request Body
+ + -Created the report. + + + -
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-voucher.api.mdx index 31301a39..28dbc8eb 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-voucher.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/add-voucher.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend can call this method to add a new voucher when pr sidebar_label: "Add a new voucher" hide_title: true hide_table_of_contents: true -api: {"operationId":"addVoucher","description":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","description":"20-byte address of the destination contract for which the payload will be sent.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"payload":{"type":"string","description":"String in Ethereum hex binary format describing a method call to be executed by the destination contract.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xcdcd77c0' corresponds to a payload with length 4 and bytes 205, 205, 119, 192.\nTo describe the method call, the payload should consist of a function selector (method identifier) followed\nby its ABI-encoded arguments.\nref: https://docs.soliditylang.org/en/v0.8.19/abi-spec.html\n","example":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"}},"title":"Voucher"}}}},"responses":{"200":{"description":"Created the voucher.","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":"/voucher","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"destination":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","payload":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"},"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 voucher","description":{"content":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["voucher"],"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"}}}}} +api: eJztWG1v2zgS/iuE7oMSnGM7bpMmweWAtJvgAtztFk3uviRBSktjixtZ1JJUHJ/h/77PkJStOE1393o49MMZaCqNOMNn3odcJromI53S1WWenCQyz/+lm6wgk/SSnGxmVM0f8em6IJGf1bUYy+yBqlxkssK/shSuUFbMyBU6F04LyBBSVDQXj0GUmBdUidrojKxV1VSAUeaPsspozzrpSBj6pSHr+rdV3N0KaUhkuizx2chS0GRCmQM5YzhyXJJQFXYmMS519pAVUlVgf09uThRwWQbDKyaqUraICHue1CKLqFmVMXkuykVTM+eb0YNwakYWYm8r1t6Qa0yFBY+ybLC/9aJUldOT0JNncifa+PesMYYq96q6l5XQzptIm9z2OgIz3VSOjWWwUhpW3Ql6JLPosMNJ8eW9zhfJyTLJdOWwIT/Kui5V5n07+NmyD5eJBbqZ5Ce3qAle1eOfYVfIgXsQCU6R5a9wPTaXwfXrxdYZIHoRGaPh3ngBteB4gLWtLToyBMMy8J03zLxQWeGX1HJRapmLuUIYwQEW0PuQT09yVpe85fBp8ub4Ij+kg30p86Oji8OLtxkdyvdHR6N3o3fH2WRyMT4ejQ4PkxWUCPJ+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ZZR7dLVbYUpB8a9Ng1FcAFYegUL80gR2NtNDeR8ySjBtH0uADvRoH8W6SAy9wRn6ml4293dWO6ZyU5P0cpHL0yU/qhFHcFE0XE/xIlZ+LFnirLZtQvXVVU1Xn8PO9SXtgqeYmdGtNOB8mzFTRof7rn8pneMLY3Dsdec0pc4W4vFstfF087bcMKGyL+0U6jgl20UuXQyvbtJUWHl+tlO7zGAonSnd70tabF2fUVSu+Juw7nq2O33u7bVMvo2vrJzXzUMcgK1pGuXQPGx+Qeg/2eA4+4Rb3j7KlxDXCa6cAPlfwM37h7hhrfncEM63bRZjSBd53W7jMrfF9qYxzF2ut8M7WiAmvwIzyxtLn6fZqLS0kttrguj551yQk9sNM7AjhJr4jfo8SrqzY4R+JrQQTDGqPwQe5hvkph18yacTmYwSo/rlmuvO7gNdBuhhYcw0aKp/Duc9UKjDmdYQ1OceOBF2bbN8xYA+uYVkbjZYLzb+ZOs1d4PYazda3nXHLttE+cZLSJ7OQAwnomRmGOhQhO6OzdJf0fi+MjmOJzW48NaKcr5AsLx+nDjsf6a0yPGBQ5GUA3tlRKHt2L9nS8e+LANVDNZdWef7Zuf7bG6cz/x//uk7/M+KR6LOqemVZxjl/H8cZO03sVJgUOTScvlWFr6pylXKyZDoFmAjsdHaRTbl98gqiCJDusPLA+04HE7RMTeNW/My2ELvoncPq3y8SVwnPla/NW1d53D08efrq6xeBxvyDiPQDVyzrdn+HuS4EH7CPVnXU9bJnyP0ODMh+9BJv9+BZ2zK4Q= 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.3/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new voucher

+ + - + + + @@ -35,17 +44,34 @@ The returned value is the index of the voucher for the current advance-state req In other words, the index counting restarts at every request. -
Request Body
+ + -Created the voucher. + + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx index 49196439..9ddf37f3 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx @@ -9,13 +9,23 @@ custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; -import Export from "@theme/ApiDemoPanel/Export"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -

Cartesi Rollup HTTP API

+ + @@ -81,5 +91,17 @@ In host mode, the Cartesi Rollups infrastructure is not able to detect that the It is up to the dApp developer to re-launch the dApp. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/finish.api.mdx index 6a3a72f2..6e0358f3 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/finish.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/finish.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend should call this method to start processing rollu sidebar_label: "Finish and get next request" hide_title: true hide_table_of_contents: true -api: {"operationId":"finish","description":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accept","reject"],"example":"accept"}},"title":"Finish"}}}},"responses":{"200":{"description":"Finish accepted and next rollup request returned.","content":{"application/json":{"schema":{"type":"object","properties":{"request_type":{"type":"string","enum":["advance_state","inspect_state"],"example":"advance_state"},"data":{"type":"object","oneOf":[{"type":"object","properties":{"metadata":{"type":"object","properties":{"msg_sender":{"type":"string","description":"20-byte address of the account that submitted the input.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"epoch_index":{"type":"integer","format":"uint64","description":"Deprecated. Always receives 0.","example":0},"input_index":{"type":"integer","format":"uint64","description":"Input index starting from genesis.","example":123},"block_number":{"type":"integer","format":"uint64","description":"Block number when input was posted.","example":10000000},"timestamp":{"type":"integer","format":"uint64","description":"Unix timestamp of block in milliseconds.","example":1588598533000}},"title":"Metadata"},"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":"Advance"},{"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":"Inspect"}]}},"title":"RollupRequest"}}}},"202":{"description":"Finish accepted but try again to obtain the next request."},"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":"/finish","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"status":"accept"},"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":"Finish and get next request","description":{"content":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","type":"text/plain"},"url":{"path":["finish"],"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"}}}}} +api: eJztWt9TGzkS/ldUvoeBOgPGBALUcVVkA3VUXXZTga19AIrIM7JHmxlpVtLY+Cj/7/e1pBmPDYTs5uoqD/iB2JpW99e/W5o89HQlDHdSq4usd9wbSyVt3uv3MmFTIyt6gOWrXLDstKrYiKdfhMqYzXVdZCzlRcFcLi0rhct1xpxm1nHjWGV0KqyVasKMLoq6Ykb8UQvr7PaNInafwuq/rq4+skthpsKAwtVGWTAUTIl7t7aTSeUfGWErraxgI53NwS3wqzSkjQrBprwANRtrE6n95js3rwQbSwHU3AiW8GzKVSruANeJhHEolUhlK5G6uBaBZtzxuDHVynEZET4CV9XOE2PfOYRHAVueWat93+9dEq/yXN0Dm3JPQ+DoccXnheZZFBDRfrMArYr5GpsbdTp2sHzHW3xNscCvdf7Wuvf5hEe/hNiJkfCCETJRgRHJ061T68IxPe46rYOrz6Rr5I6ljzpBoeZqG52ztpWCg82ky+HqNBWVSxjwJEb8DpslzwehnCgNMJ4XmU6oFtWKuCa+xtJAWtS9EU4O496yXD3tJ2/8i/ETXm8DyrIAVmTBB1Ndp7kw1nNX2kmYxsdyJm3KTSbI6BfKozacPGdEpY0LRNiwJKRUSjlSCJoFIchz7P4tF4qZWinyDHDLDOjYT0hoYSX7wNNcKhHQNIvRbB+44hOfw/jlgvlgOmmC2URjwzLwoEIxy7kjr864ZSMBe5LuqZBTEt5xpTfV+9qE6IyWptjrP1spSjnJnVd5hFwoS5FJYED48ymXBUeZaJR165WtybUnQoPM+F3GqXhtY2jNcl0srSHuRVqTD1gNmxUdvbrBwH25W/MRyzUprLMo+oW6GmM4BT0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plgsaBnWNXOs4+uUG0mRQb/AKYe56Xb7+qH3Rczp0iEUg60rkkvkaDN0S7H+WoYuQcKO0+Z90vO0t50bmI+/XF6BeBRfe5FLsWr4jN5I4e9xj96m+O4cXurQ2kOvwDm7RnjheeBJn/8Cbqzwow== 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.3/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Finish and get next request

+ + - + + + @@ -49,21 +58,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 202 af When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -
Request Body
+ + + + + + + + + + + + + + -Finish accepted and next rollup request returned. -
Schema
    data object
  • oneOf
    metadata object
- -Finish accepted but try again to obtain the next request. - -
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/register-exception.api.mdx index 51bb5509..c2ecb42a 100644 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/register-exception.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/register-exception.api.mdx @@ -5,25 +5,34 @@ description: "The dApp should call this method when it cannot proceed with the r sidebar_label: "Register an exception" hide_title: true hide_table_of_contents: true -api: {"operationId":"registerException","description":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\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":"Exception"}}}},"responses":{"200":{"description":"Accepted the exception throw."},"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":"/exception","servers":[{"url":"https://"},{"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":"Register an exception","description":{"content":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\n","type":"text/plain"},"url":{"path":["exception"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztWNtuI7kR/RVCeWgbsSWNN4MgwnoBZ9ZBDGRnjbGCBLAND9VdUnPdIjsk27Ii6N9zimRfZHv29pDkYfUgdfNSPHXqxtJuZGqy0iujr4rRbGRppZwne/mc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info_path: cartesi-rollups/rollups-apis/rollup/cartesi-rollup-http-api +info_path: cartesi-rollups/_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Register an exception

+ + - + + + @@ -37,17 +46,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 200. In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -
Request Body
+ + + + + + + + + + + + + + -Accepted the exception throw. -
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.js b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.js deleted file mode 100644 index 4ad0073b..00000000 --- a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [{"type":"doc","id":"rollups-apis/rollup/cartesi-rollup-http-api"},{"type":"category","label":"UNTAGGED","items":[{"type":"doc","id":"rollups-apis/rollup/finish","label":"Finish and get next request","className":"api-method post"},{"type":"doc","id":"rollups-apis/rollup/add-voucher","label":"Add a new voucher","className":"api-method post"},{"type":"doc","id":"rollups-apis/rollup/add-notice","label":"Add a new notice","className":"api-method post"},{"type":"doc","id":"rollups-apis/rollup/add-report","label":"Add a new report","className":"api-method post"},{"type":"doc","id":"rollups-apis/rollup/register-exception","label":"Register an exception","className":"api-method post"}]}]; \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.ts new file mode 100644 index 00000000..60679f6d --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-1.3/rollups-apis/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.3/rollups-apis/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-1.5/development/community-tools.md b/cartesi-rollups_versioned_docs/version-1.5/development/community-tools.md deleted file mode 100644 index b51b18c8..00000000 --- a/cartesi-rollups_versioned_docs/version-1.5/development/community-tools.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -id: community-tools -title: Community tools ---- - -Several tools created and maintained by the community streamline the dApp creation process on Cartesi Rollups. - -## Deroll - -Introducing Deroll, a powerful TypeScript framework designed to simplify the development of dApps on Cartesi. - -- **Features**: - - Simplifies dApp development with intuitive methods. - - Handles advance and inspect requests easily. - - Comprehensive wallet functionality for ERC20, ERC721 and ERC-1155 token standards. - - Integrated router for complex routing logic. - -- **Getting Started**: - - Create a new Deroll project by running: - ```bash - npm init @deroll/app - ``` - -- **Resources**: - - [Deroll Documentation](https://deroll.dev) - - [Deroll GitHub Repository](https://github.com/tuler/deroll) - ---- - -## NoNodo - -NoNodo is a cutting-edge development tool for Cartesi Rollups that allows applications to run directly on the host machine, bypassing Docker or RISC-V compilation. - -- **Features**: - - Run applications directly on the host machine for faster performance. - - No Docker or RISC-V Required. - -- **Getting Started**: - - Install NoNodo by running: - ```bash - npm i -g nonodo - ``` -- **Resources**: - - [NoNodo GitHub Repository](https://github.com/Calindra/nonodo) - ---- - -## Cartesify - -Cartesify is a robust Web3 client designed for seamless interaction with the Cartesi Machine. - -- **Features**: - - Send transactions to the Cartesi Machine. - - Query data efficiently. - - Engage with backend systems using a REST-like interface. - -- **Resources**: - - [Cartesify GitHub Repository](https://github.com/Calindra/cartesify) - ---- - -## Tikua - -Tikua is a versatile JS Cartesi package designed for seamless integration with any visual library, whether in browser or terminal environments. - -- **Features**: - - Integrates smoothly with any visual library on both Browser and Terminal. - - Supports any provider or network with extensive configurability. - - Handles multi-chain applications. - - Provides warnings for unsupported provider chains. - - Retrieve machine results. - -- **Resources**: - - - [Tikua GitHub Repository](https://github.com/doiim/tikua) - - ---- - -## Rollmelette - -Rollmelette is a high-level framework that simplifies building Cartesi applications using the Go programming language. - -- **Features**: - - Simplifies the development of Cartesi applications. - - Provides a high-level API for interacting with the Cartesi Machine. - - Simplifies sending inputs, retrieving outputs and asset handling - - Supports the Go programming language. - -- **Resources**: - - [Rollmelette GitHub Repository](https://github.com/rollmelette/rollmelette) - ---- - -## Python-Cartesi - -Python-Cartesi is a high-level framework that simplifies the development of Cartesi applications using Python. - -- **Features**: - - Simplifies the development of Cartesi applications. - - Prioritizes testing, equipping developers with tools to write tests for DApps within a local Python environment. - - Allows full control over inputs and outputs for scenarios where high-level tools may be insufficient - - Supports the Python programming language. - -- **Getting Started**: - - Install Python-Cartesi by running: - ```bash - pip install python-cartesi - ``` -- **Resources**: - - [Python-Cartesi GitHub Repository](https://github.com/prototyp3-dev/python-cartesi) - ---- - -## TypeScript-SQLite template - -A backend application built with TypeScript and SQLite, designed to complement a corresponding frontend project. - -- **Features**: - - TypeScript and SQLite for backend development. - - Integration with React for the frontend. - - Ethers.js for seamless blockchain interaction. - - Template designed for easy project initiation. - -- **Resources**: - - [TypeScript-SQLite GitHub Repository](https://github.com/doiim/cartesi-ts-sqlite) - - [Pre-deployed demo available on the Sepolia Network](https://doiim.github.io/cartesi-ts-react-sqlite/). - ---- - -## Python-Wallet - -A Python-based wallet implementation for Cartesi dApps designed to handle various types of assets. - -- **Features**: - - Simplifies asset handling for Cartesi dApps. - - Deposit assets into the dApp. - - Transfer assets within the dApp. - - Withdraw assets from the dApp. - -- **Resources**: - - [Python-Wallet GitHub Repository](https://github.com/jplgarcia/python-wallet/tree/main) - - [Full example](https://github.com/jplgarcia/python-wallet/blob/main/dapp.py) ---- -## CartDevKit - -CartDevKit is an all-in-one package for building on Cartesi. - -- **Features**: - - CLI tool for easy project setup. - - Templates for backend, frontend and Cartesify. - -- **Getting Started**: - - Create a new project: - ```bash - npx cartdevkit@latest create mydapp - ``` - -- **Resources**: - - [CartDevKit GitHub Repository](https://github.com/gconnect/cartdev-kit) - - [CartDevKit Documentation](https://africlab.gitbook.io/cartdevkit) \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/external-resources/community-tools.md b/cartesi-rollups_versioned_docs/version-1.5/external-resources/community-tools.md new file mode 100644 index 00000000..b27fd071 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-1.5/external-resources/community-tools.md @@ -0,0 +1,177 @@ +--- +id: community-tools +title: Community tools +--- + +Several tools created and maintained by the community streamline the dApp creation process on Cartesi Rollups. + +## Deroll + +Introducing Deroll, a powerful TypeScript framework designed to simplify the development of dApps on Cartesi. + +- **Features**: + + - Simplifies dApp development with intuitive methods. + - Handles advance and inspect requests easily. + - Comprehensive wallet functionality for ERC20, ERC721 and ERC-1155 token standards. + - Integrated router for complex routing logic. + +- **Getting Started**: + + - Create a new Deroll project by running: + ```bash + npm init @deroll/app + ``` + +- **Resources**: + - [Deroll Documentation](https://deroll.dev) + - [Deroll GitHub Repository](https://github.com/tuler/deroll) + +--- + +## NoNodo + +NoNodo is a cutting-edge development tool for Cartesi Rollups that allows applications to run directly on the host machine, bypassing Docker or RISC-V compilation. + +:::caution Disclaimer: +This tool runs in a non-reproducible execution mode, which is not provable on-chain. As such cannot be used by deployed applications, instead is used for providing a faster iterative development emperience. +::: + +- **Features**: + + - Run applications directly on the host machine for faster performance. + - No Docker or RISC-V Required. + +- **Getting Started**: + - Install NoNodo by running: + ```bash + npm i -g nonodo + ``` +- **Resources**: + - [NoNodo GitHub Repository](https://github.com/Calindra/nonodo) + +--- + +## Cartesify + +Cartesify is a robust Web3 client designed for seamless interaction with the Cartesi Machine. + +- **Features**: + + - Send transactions to the Cartesi Machine. + - Query data efficiently. + - Engage with backend systems using a REST-like interface. + +- **Resources**: + - [Cartesify GitHub Repository](https://github.com/Calindra/cartesify) + +--- + +## Tikua + +Tikua is a versatile JS Cartesi package designed for seamless integration with any visual library, whether in browser or terminal environments. + +- **Features**: + + - Integrates smoothly with any visual library on both Browser and Terminal. + - Supports any provider or network with extensive configurability. + - Handles multi-chain applications. + - Provides warnings for unsupported provider chains. + - Retrieve machine results. + +- **Resources**: + + - [Tikua GitHub Repository](https://github.com/doiim/tikua) + +--- + +## Rollmelette + +Rollmelette is a high-level framework that simplifies building Cartesi applications using the Go programming language. + +- **Features**: + + - Simplifies the development of Cartesi applications. + - Provides a high-level API for interacting with the Cartesi Machine. + - Simplifies sending inputs, retrieving outputs and asset handling + - Supports the Go programming language. + +- **Resources**: + - [Rollmelette GitHub Repository](https://github.com/rollmelette/rollmelette) + +--- + +## Python-Cartesi + +Python-Cartesi is a high-level framework that simplifies the development of Cartesi applications using Python. + +- **Features**: + + - Simplifies the development of Cartesi applications. + - Prioritizes testing, equipping developers with tools to write tests for DApps within a local Python environment. + - Allows full control over inputs and outputs for scenarios where high-level tools may be insufficient + - Supports the Python programming language. + +- **Getting Started**: + - Install Python-Cartesi by running: + ```bash + pip install python-cartesi + ``` +- **Resources**: + - [Python-Cartesi GitHub Repository](https://github.com/prototyp3-dev/python-cartesi) + +--- + +## TypeScript-SQLite template + +A backend application built with TypeScript and SQLite, designed to complement a corresponding frontend project. + +- **Features**: + + - TypeScript and SQLite for backend development. + - Integration with React for the frontend. + - Ethers.js for seamless blockchain interaction. + - Template designed for easy project initiation. + +- **Resources**: + - [TypeScript-SQLite GitHub Repository](https://github.com/doiim/cartesi-ts-sqlite) + - [Pre-deployed demo available on the Sepolia Network](https://doiim.github.io/cartesi-ts-react-sqlite/). + +--- + +## Python-Wallet + +A Python-based wallet implementation for Cartesi dApps designed to handle various types of assets. + +- **Features**: + + - Simplifies asset handling for Cartesi dApps. + - Deposit assets into the dApp. + - Transfer assets within the dApp. + - Withdraw assets from the dApp. + +- **Resources**: + - [Python-Wallet GitHub Repository](https://github.com/jplgarcia/python-wallet/tree/main) + - [Full example](https://github.com/jplgarcia/python-wallet/blob/main/dapp.py) + +--- + +## CartDevKit + +CartDevKit is an all-in-one package for building on Cartesi. + +- **Features**: + + - CLI tool for easy project setup. + - Templates for backend, frontend and Cartesify. + +- **Getting Started**: + + - Create a new project: + ```bash + npx cartdevkit@latest create mydapp + ``` + +- **Resources**: + - [CartDevKit GitHub Repository](https://github.com/gconnect/cartdev-kit) + - [CartDevKit Documentation](https://africlab.gitbook.io/cartdevkit) diff --git a/cartesi-rollups_versioned_docs/version-1.5/external-resources/integration-guides.md b/cartesi-rollups_versioned_docs/version-1.5/external-resources/integration-guides.md new file mode 100644 index 00000000..1caede82 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-1.5/external-resources/integration-guides.md @@ -0,0 +1,62 @@ +--- +id: integration-guides +title: Integrations guide +--- + +Guides for integrating external protocols into your Cartesi application. Each integration offers a unique functionality to your application. + +## Avail Integration + +Avail is a Web3 infrastructure layer that allows modular execution layers to scale and interoperate in a trust minimized way. It stands out as one of the few data availability layers that combines validity proofs with data availability sampling. This guide will walk you through setting up a Cartesi dApp using Avail on your local machine. You will learn how to send transactions either directly (through Cartesi Rollups Smart Contracts deployed on an L1) or through Avail DA using EIP-712 signed messages. Also, how to inspect the dApp state and outputs through the APIs provided by the Cartesi Rollups Framework. + +- **Resources**: + - Integration Guide: [Mugen Docs](https://docs.mugen.builders/cartesi-avail-tutorial/introduction) + +--- + +## Espresso Integration + +Espresso is the protocol for coordinated block building: enabling & incentivizing chains to work together as one unified system. It offers low-cost data availability and also decentralized sequencing. This guide covers the Cartesi+Espresso integration and how to upgrade Cartesi application such that inputs can be submitted via Espresso instead of the regular base layer. + +- **Resources**: + - Integration Guide: [Docs](https://docs.google.com/document/d/1jKtuEPLPK7FUgAhkX7tMRjkIsNgAJ3OYrKtppjUYUrk/edit?tab=t.0#heading=h.fih7t9k0olyg) + +--- + +## Push Integration + +Push protocol is a web3 native communication network, enabling cross-chain notifications, messaging, and more for apps, wallets, and services. This integration is an application level integration that requires developers to run a specialized server for picking up and routing messages and notifications to the push network. + +- **Resources**: + - Integration Guide: [Github](https://github.com/Mugen-Builders/push-cartesi) + - Demo Video: [Youtube](https://www.youtube.com/watch?v=SO-xhHT85Bk) + +--- + +## Chronicle Integration + +Chronicle is an oracle solution, making tremendous strides in redefining access to cost-efficient and verifiable data. Integrating Cartesi and Chronicle offers Cartesi applications access to onchain and offcahin data like, price feed without developers having to set up additional systems or intermediaries. + +- **Resources**: + - Integration Guide: [Github](https://github.com/Mugen-Builders/cartesi-chronicle-integration/tree/main) + - Demo Video: [x](https://x.com/MichaelAsiedu_/status/1826200037786878012) + +--- + +## Prevado ID + +Prevado ID is a set of tools that enable secure identity verification they also facilitate trusted and secured relationship between apps and users. Integrating Cartesi and Prevado provides developers with the ability to verify users identity onchain using zero knowledge proofs, without having to concern themselves with the underlining architecture and setups. + +- **Resources**: + - Article Guide: [Medium](https://medium.com/@jathinjagannath/building-secure-scalable-and-private-dapps-with-decentralized-identity-management-f755991f012b) + +--- + +## XMTP + +XMTP is an open protocol, network, and standards for secure, private web3 messaging. Integrating Cartesi and XMTP will allow Cartesi applications to access this network for decentralized and private messaging, thereby allowing Cartesi applications communicate and also send messages/ notifications to users. At the moment this is an application level integration and would require the developer to set up and run a server dedicated to this integration. + +- **Resources**: + - Integration Guide: [Github](https://github.com/Mugen-Builders/xmtp-cartesi) + - Demo Video: [x](https://x.com/shanemac/status/1828174660133101661?s=46) + - Article Guide: [Medium](https://medium.com/@idogwuchi/integrating-cartesi-dapps-with-xmtp-bridging-decentralised-computation-and-secured-communication-360fa7bdb1d1) diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx index 74658efc..f8b37435 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -9,18 +9,40 @@ custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; -import Export from "@theme/ApiDemoPanel/Export"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -

Inspect-state HTTP API for Cartesi Rollups

+ + API that allows the dApp frontend to make inspect-state requests to the dApp backend. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect.api.mdx index ff6c3bff..9c04e8f6 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/inspect/inspect.api.mdx @@ -5,25 +5,34 @@ description: "This method sends an inspect-state request to the dApp backend pas sidebar_label: "Inspect dApp state REST API" 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://"},{"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"}} +api: eJztV01vGzcQ/SvEXpQAtqS4cT+UooDhKq2BNAkUBT0kgUHtjrRMdsktybUsCPrvfUNypbVlI8f24ItNDYczw5k3b7jbzDRkpVdGXxXZJFPaNZT77CQryOVWNbwD+bxUTtTkS1MIR7pwQmqRlE+dl56EpX9acl54I3xJorhoGrGQ+Tdoi0Y6p/QqbDRyUxkJM96ySOkg/Th7M/ys58f7rjRtVYhFUDklnZuCilfhTPKPgOwNWbFWVSUKYoWwnQwgno/z16c/w/zV8hDa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GG3MoTHx7FS0xCAAsxiisY755edurSLhKuC8uHOcgpCsKHcODapKNtgkEO8ii4TjNWlthu/S+cZPR6NcCw+Q6kfw19n5Do/aVoFOZXFY86ifn4/H5qHvW8kBTemlCmu6WJA3vP+fz9+Li/RX32v7pMUMztQ1XlUOKeRwPz4cvIMFUI64kLKZBe9FgUtDp2XCM7buhr9froQzbQ2NXo3TWjd5cXU7ffpjymWHp6yrb3S8bhxRaVXJfuwfesSH93x55+7iHnuXcSdwMSFMtde8G3UQPytHObPphznm5j6ftAZFPHwlPHwlPHwn/54+ENBl6g2OXGGqbOPhTNukeLKBKTgPLtlsG7Udb7XYsRuR2AzmWN9IquWAeBU0XyvEavL6UFSr7OFM8m6VPkOfisbC615bmt9aNrFr+heU32vQ+ZnZfoFpi/mNYcwhxNz6ze+eOvj54EOyH0B/TOQbTv1f6Bz0= sidebar_class_name: "get api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Inspect dApp state REST API

+ + - + + + @@ -41,17 +50,34 @@ On host mode, it is advised against changing the dApp backend state when process Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. -
Path Parameters
+ + + + + + + + + + + + + + -Inspect state response. -
Schema
    reports object[]
  • Array [
  • ]
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-notice.api.mdx index 900aaf95..ba2dbc10 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-notice.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-notice.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend can call this method to add a new notice when pro sidebar_label: "Add a new notice" 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://"},{"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":"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iO2xlfC+5oyfN4yJmDS96X1cEB/3Vo90rIl4Sw4sQX64/q3nRuKOc/XVxCeRL/JsEHDVIjF/z3Cvw/TvCgfQ77C6WXrZIKOdTgYoXvwSb//Aaw932v sidebar_class_name: "post api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new notice

+ + - + + + @@ -35,17 +44,34 @@ The returned value is the index of the notice for the current advance request. In other words, the index counting restarts at every request. -
Request Body
+ + -Created the notice. + + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-report.api.mdx index b25f0444..8b1fdfad 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-report.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-report.api.mdx @@ -5,25 +5,34 @@ description: "The dApp can call this method to add a new report for the given ro sidebar_label: "Add a new report" hide_title: true hide_table_of_contents: true -api: {"operationId":"addReport","description":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\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":"Report"}}}},"responses":{"200":{"description":"Created the report."},"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":"/report","servers":[{"url":"https://"},{"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 report","description":{"content":"The dApp can call this method to add a new report for the given rollup request.\nA report can be a diagnostic or a log; reports are not discarded when a request is rejected.\nBetween calls to the finish method, the report method can be called any number of times.\n","type":"text/plain"},"url":{"path":["report"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztV21vIzUQ/itW+LCpSJO0UCECRerdFVEJHdU1fEqjnrM7yfq6sRevN2mI8t95xvYm25c7DpAQH1ip6a49Hj/zzIvH244pyUqnjL7KOqOOzLJ3VBrrOr1ORlVqVclzmBnnJLKLshSp1PgrCuFyVYkludxkwhmBpUIKTWthvQYxNxYyJBZqRVpYUxR1ibnfaqpc/1ZfNHKscEZYmym50KZyKhVYKkVhFt9FoUpIS0IbB6EqlTajTKxzqJWNRgEwlj5Q6iiD9lfk1kQBacXwGMlcaVXlEXPPD0UM0YwIhRdhA6k3QtfLGVlh5sKpJVXQDGbilq9MtumMtp3UaEfa8assy0Klns/Bh4qJ23aqNKel5De3KQlUmhnDhJ7SMvtOUcWzpdwURmYtwcpZpRcvuiIKs9VKe0su8WOpXoqcHsRMaWk37IKlZLLH3noLmtzaiDSXVoIoG2hNhg8JRIvCrGH1bAPlEGWboUpmlKqlLCIT4DKX8JmxlqrSaO96ownLHGGjH+E5pSsndUo91pyRzGZE86S1xjtE7m1YK5eLgvQC/74G65lXVonT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vAf2PFR1IcdI/D9QAvBDC3afTzD/CGJDjyrU49pCVJ6XLdcc9PhY6B9EHKrrZzCofK7ry4iHNToX3EbsrRQFVpqnKjx2LxsAODcvCESkwPGafcLWarjN6E1PG7W7lccNYc4NzoR2fMGgPHMrUQvCBPqcLrzISlnhW/YMnIcTvv2YW+UvyFd+SsTcMbLkZ/NaIV2gYMRo5aOC1nrNN/PcyuNFoW5X0rd7n2eXP6edqatS9L/N8nWTTK2861ufxd7x23smyedyCg6XI4GHtluZ7KiX22x2/EwUFtcRCd4XUmr2P38BU05ml2yvtG+pw13uMELx2Pel8WLmvd/dm3ltjusuPDlryXbxjptdfvXv9yMITaLl2IOWoxaueYLM35HHbwYHw/+DuXHtp0C7VyNSwrmw878/AHHRbUf sidebar_class_name: "post api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new report

+ + - + + + @@ -32,17 +41,34 @@ A report can be a diagnostic or a log; reports are not discarded when a request Between calls to the finish method, the report method can be called any number of times. -
Request Body
+ + -Created the report. + + + -
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher.api.mdx index f13fa2bd..650ce25c 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend can call this method to add a new voucher when pr sidebar_label: "Add a new voucher" hide_title: true hide_table_of_contents: true -api: {"operationId":"addVoucher","description":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","description":"20-byte address of the destination contract for which the payload will be sent.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"payload":{"type":"string","description":"String in Ethereum hex binary format describing a method call to be executed by the destination contract.\nThe first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte.\nFor instance, '0xcdcd77c0' corresponds to a payload with length 4 and bytes 205, 205, 119, 192.\nTo describe the method call, the payload should consist of a function selector (method identifier) followed\nby its ABI-encoded arguments.\nref: https://docs.soliditylang.org/en/v0.8.19/abi-spec.html\n","example":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"}},"title":"Voucher"}}}},"responses":{"200":{"description":"Created the voucher.","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":"/voucher","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"destination":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","payload":"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"},"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 voucher","description":{"content":"The dApp backend can call this method to add a new voucher when processing an advance-state request.\nVouchers are collateral effects actionable in the blockchain.\nBetween calls to the finish method, the voucher method can be called up to 32k times.\n\nThe returned value is the index of the voucher for the current advance-state request.\nIn other words, the index counting restarts at every request.\n","type":"text/plain"},"url":{"path":["voucher"],"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"}}}}} +api: eJztWG1v2zgS/iuE7oMSnGM7bpMmweWAtJvgAtztFk3uviRBSktjixtZ1JJUHJ/h/77PkJStOE1393o49MMZaCqNOMNn3odcJromI53S1WWenCQyz/+lm6wgk/SSnGxmVM0f8em6IJGf1bUYy+yBqlxkssK/shSuUFbMyBU6F04LyBBSVDQXj0GUmBdUidrojKxV1VSAUeaPsspozzrpSBj6pSHr+rdV3N0KaUhkuizx2chS0GRCmQM5YzhyXJJQFXYmMS519pAVUlVgf09uThRwWQbDKyaqUraICHue1CKLqFmVMXkuykVTM+eb0YNwakYWYm8r1t6Qa0yFBY+ybLC/9aJUldOT0JNncifa+PesMYYq96q6l5XQzptIm9z2OgIz3VSOjWWwUhpW3Ql6JLPosMNJ8eW9zhfJyTLJdOWwIT/Kui5V5n07+NmyD5eJBbqZ5Ce3qAle1eOfYVfIgXsQCU6R5a9wPTaXwfXrxdYZIHoRGaPh3ngBteB4gLWtLToyBMMy8J03zLxQWeGX1HJRapmLuUIYwQEW0PuQT09yVpe85fBp8ub4Ij+kg30p86Oji8OLtxkdyvdHR6N3o3fH2WRyMT4ejQ4PkxWUCPJ+G/KVJ3MInbP5qZmJAkYfAy8MDJAzWDuwjH3EbiKFA14zWHqirHEIh/HiVX37IXImylgn3FwLBCrT2whPh08ptitLPQ+CaomlbEHAkTllaobgr5rZmDlcAVSZRkjZWlc+2XSFDIDxsdEFTKsqBAsCrceSszzL373LhmmHxyeF7BjeFaKkaor/3iIvcy/MitHwoBf+7O8f48/xiDXRrUnIK9wxSe+ZO22hmzJnI1gFvaGNFJOm8qkLH5eIOGDdifwqh9fVRJHZXZ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gK1pGuXQPGx+Qeg/2eA4+4Rb3j7KlxDXCa6cAPlfwM37h7hhrfncEM63bRZjSBd53W7jMrfF9qYxzF2ut8M7WiAmvwIzyxtLn6fZqLS0kttrguj551yQk9sNM7AjhJr4jfo8SrqzY4R+JrQQTDGqPwQe5hvkph18yacTmYwSo/rlmuvO7gNdBuhhYcw0aKp/Duc9UKjDmdYQ1OceOBF2bbN8xYA+uYVkbjZYLzb+ZOs1d4PYazda3nXHLttE+cZLSJ7OQAwnomRmGOhQhO6OzdJf0fi+MjmOJzW48NaKcr5AsLx+nDjsf6a0yPGBQ5GUA3tlRKHt2L9nS8e+LANVDNZdWef7Zuf7bG6cz/x//uk7/M+KR6LOqemVZxjl/H8cZO03sVJgUOTScvlWFr6pylXKyZDoFmAjsdHaRTbl98gqiCJDusPLA+04HE7RMTeNW/My2ELvoncPq3y8SVwnPla/NW1d53D08efrq6xeBxvyDiPQDVyzrdn+HuS4EH7CPVnXU9bJnyP0ODMh+9BJv9+BZ2zK4Q= sidebar_class_name: "post api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Add a new voucher

+ + - + + + @@ -35,17 +44,34 @@ The returned value is the index of the voucher for the current advance-state req In other words, the index counting restarts at every request. -
Request Body
+ + -Created the voucher. + + + -
Schema
+ + + -Error response. + + + -
Schema
  • string
    -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx index 49196439..9ddf37f3 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx @@ -9,13 +9,23 @@ custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; -import Export from "@theme/ApiDemoPanel/Export"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -

Cartesi Rollup HTTP API

+ + @@ -81,5 +91,17 @@ In host mode, the Cartesi Rollups infrastructure is not able to detect that the It is up to the dApp developer to re-launch the dApp. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/finish.api.mdx index a2544071..ea7acd3a 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/finish.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/finish.api.mdx @@ -5,25 +5,34 @@ description: "The dApp backend should call this method to start processing rollu sidebar_label: "Finish and get next request" hide_title: true hide_table_of_contents: true -api: {"operationId":"finish","description":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accept","reject"],"example":"accept"}},"title":"Finish"}}}},"responses":{"200":{"description":"Finish accepted and next rollup request returned.","content":{"application/json":{"schema":{"type":"object","properties":{"request_type":{"type":"string","enum":["advance_state","inspect_state"],"example":"advance_state"},"data":{"type":"object","oneOf":[{"type":"object","properties":{"metadata":{"type":"object","properties":{"msg_sender":{"type":"string","description":"20-byte address of the account that submitted the input.","example":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},"epoch_index":{"type":"integer","format":"uint64","description":"Deprecated. Always receives 0.","example":0},"input_index":{"type":"integer","format":"uint64","description":"Input index starting from genesis.","example":123},"block_number":{"type":"integer","format":"uint64","description":"Block number when input was posted.","example":10000000},"timestamp":{"type":"integer","format":"uint64","description":"Unix timestamp of block in milliseconds.","example":1588598533000}},"title":"Metadata"},"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":"Advance"},{"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":"Inspect"}]}},"title":"RollupRequest"}}}},"202":{"description":"Finish accepted but try again to obtain the next request."},"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":"/finish","servers":[{"url":"https://"},{"url":"http://localhost:5005/rollup"}],"jsonRequestBodyExample":{"status":"accept"},"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":"Finish and get next request","description":{"content":"The dApp backend should call this method to start processing rollup requests.\nThe Rollup HTTP Server returns the next rollup request in the response body.\n\nThe possible values for the request_type field are 'advance_state' and 'inspect_state'.\nThe data field contains the rollup request input data.\nFor advance-state requests, the input data contains the advance-state metadata and the payload.\nFor inspect-state requests, the input data contains only the payload.\n\nAfter processing a rollup request, the dApp back-end should call again the finish method.\nFor advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'.\nThe Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request.\n\nIf the advance-state request is rejected, the vouchers and notices are discarded.\nIn contrast, reports are not discarded in case of rejection.\nWhen running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request.\n\nDuring a finish call, the next rollup request might not be immediately available.\nWhen the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready.\nWhen running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out.\nWhen the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before.\n","type":"text/plain"},"url":{"path":["finish"],"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"}}}}} +api: eJztWt9TGzkS/ldUvoeBOgPGBALUcVVkA3VUXXZTga19AIrIM7JHmxlpVtLY+Cj/7/e1pBmPDYTs5uoq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JvHN4rhI8fLfOjQ+QhFfhmuJmIDk3CfoXM2m+hTIR3cxjjxgXgM2ikvcCzpHmAenuK8SDaXTAiyuJduYzcuhrG5hUR6xJPHCXtIApvkuL0zWNyoWY70Y1emFhFcAJZcxguMsL0RasDnKaPEuy/Kn41o0L+zJCZQ0mcU6Sfh1+bm0nIrJjs5oUPVIxMlP2vW3KY8ursxc39spqrWtQuVJalqr7+HHfKzKSInkEyINjpQViiuk+5hIbklbGtXao9xNhaLFxldPHGJnLBcpE+CBAJSf6CBX9ZR0GSV3F4nzbHAf28H/+S2v8Yt9qWvcGoobpc7Fx27fbtrGy2jb+NPcu6zhgmXOl27hBUfm38C+l8DHKVHvOHXV+GG66Uu3LDy/4EbpUe44dcq3JBO101WI0jbvG7IRPFtob16M/x8aEcDVKK9nm1y8cc0kyiseKzNVW70rFNOxD0ZjTKwo0S7+B16PIt6KTECbxc6CEZG8C+xh/kmiZE9q8N1VbgQk+PlDRS1gW4jpNlcOomm8h9fXVho1Bh4iwLAJtL6+9umbZ41ANA3L4Vg10uMtxt/45Xceh+mwq1mb7tjs2nia1d1qwMA4RnTva2BCnXo7tQk6baSZrVMOAqndnxolQr3vv6OEDhB2T7NxBTjAgUjVo3YKnit0rx9TrM3nUqBquSqM/s0wzFGiIlwK/Pv+nzauXh7fUv0+pbo9S3R61ui17dEr2+Jfpi3RPFypXP3sojH+Yd4i3Hd/KeH236PrEQrDw8jxP2vplgsaBnWNXOs4+uUG0mRQb/AKYe56Xb7+qH3Rczp0iEUg60rkkvkaDN0S7H+WoYuQcKO0+Z90vO0t50bmI+/XF6BeBRfe5FLsWr4jN5I4e9xj96m+O4cXurQ2kOvwDm7RnjheeBJn/8Cbqzwow== sidebar_class_name: "post api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Finish and get next request

+ + - + + + @@ -49,21 +58,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 202 af When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. -
Request Body
+ + + + + + + + + + + + + + -Finish accepted and next rollup request returned. -
Schema
    data object
  • oneOf
    metadata object
- -Finish accepted but try again to obtain the next request. - -
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/register-exception.api.mdx index 395a0421..98417fa3 100644 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/register-exception.api.mdx +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/register-exception.api.mdx @@ -5,25 +5,34 @@ description: "The dApp should call this method when it cannot proceed with the r sidebar_label: "Register an exception" hide_title: true hide_table_of_contents: true -api: {"operationId":"registerException","description":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\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":"Exception"}}}},"responses":{"200":{"description":"Accepted the exception throw."},"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":"/exception","servers":[{"url":"https://"},{"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":"Register an exception","description":{"content":"The dApp should call this method when it cannot proceed with the request processing after an exception happens.\nThis method should be the last method ever called by the dApp backend while processing a request.\n\nWhen running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request.\nNo HTTP status code will be sent or received.\n\nWhen running in host mode, the Rollup HTTP Server returns the status code 200.\nIn both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded.\n","type":"text/plain"},"url":{"path":["exception"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +api: eJztWNtuI7kR/RVCeWgbsSWNN4MgwnoBZ9ZBDGRnjbGCBLAND9VdUnPdIjsk27Ii6N9zimRfZHv29pDkYfUgdfNSPHXqxtJuZGqy0iujr4rRbGRppZwne/mcU82jo5NRQS63Kr7NRvOSRHFR18KVpqkKkcuqEr5UTqzJl6YQm5K0UB4TWhsvamtyIgwrX2IdCUv/asilCeeUXgm5xJFCakHtsaKUdU3aje/0fCA7nbmgIKmSEJNm6AkSGAuOWmzDdEC5kPkjaUalKjo4swWCI+70Pxi0bbTmKaV5YdHkAcnaFHQSBH6Q1pNT4oYsn/ad1HKF31o2jtzBiu9kXipNUKnAMVjs4zxprywJ56UnYZZhbJ3WegOQ0jN1G+mg49JYZisn9cSoBtwB8kcj/jqfXwdRjRM5QIJimALcOBwjjE17qXhTw9IweZ1un0xVNXWUmfSz5BurI/DhMWfTKSReab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1cUZajidQKTRKfz4Cd2G64pK2SfIS+cnpRugv4BdgzSNpmc42RGdDSAcrDiNksPD5zFsnvGlsniiQtH0Jyy1zhbxp5MA4rsEE8aYiP0g/zJEEBAGmoy7PISRSG9zO5vMyQq2T271QPKCTJgdn/yQlrKHT8iqV1x3+/cD3j7+aZttUy2Ta9s3C8Sg5hALhnyEkeCb/4C6L8OcDo94Y1vPwoXhRtpYgg3jvx34KbTE9z4dgg3htNtG9Vw0i6u22VU/TzXxqWoxq3vJ107EVBTuEfxljYW/z9posrRa23mfOMZpJOu3A+V6C9Iv16PL6LuT0zAu4EBggV6gcdUw0KRfNVvqWXfw3EZGBZCvnorr1BU/h2yi4iFOnYNbQeLiprKZnedRN28IRK3Pcb7o9/JWp1+G2+Hp6+63+O2iL/olg4vAIxnadGMWqjQxOrORVIuqnBnK8izO3XXh06p0NdceV4PnFjZzRZoGituUnjU0mklG52X3TxfrXFFYe7XUg/uPp867QfN9Msb6qBz+q2d/62d/5+186mNGnRZ+3Rh36V+5XbUOzE6C1aSB3e7BWD+3Vb7PQ+DRLvFOB6fpFUcdvwGYSWaDLKhwXmkLXcW0fFP53w0L68ahvDq7wNud+KO2FoO1g7h3g8arevvb+ZYtkh/TrAt+A81ueE/LvA9G+HBBF1CIxvGdqMK1+gGJGE+nsyf/wBFo88H sidebar_class_name: "post api-method" info_path: cartesi-rollups/_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api custom_edit_url: null --- -import ApiTabs from "@theme/ApiTabs"; -import DiscriminatorTabs from "@theme/DiscriminatorTabs"; -import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint"; -import MimeTabs from "@theme/MimeTabs"; -import ParamsItem from "@theme/ParamsItem"; -import ResponseSamples from "@theme/ResponseSamples"; -import SchemaItem from "@theme/SchemaItem"; -import SchemaTabs from "@theme/SchemaTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; -

Register an exception

+ + - + + + @@ -37,17 +46,34 @@ When running in host mode, the Rollup HTTP Server returns the status code 200. In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. -
Request Body
+ + + + + + + + + + + + + + -Accepted the exception throw. -
- -Error response. - -
Schema
  • string
    - -Detailed error message. - -
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.js b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.js deleted file mode 100644 index e40358fe..00000000 --- a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = [{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api"},{"type":"category","label":"UNTAGGED","items":[{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/finish","label":"Finish and get next request","className":"api-method post"},{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher","label":"Add a new voucher","className":"api-method post"},{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/add-notice","label":"Add a new notice","className":"api-method post"},{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/add-report","label":"Add a new report","className":"api-method post"},{"type":"doc","id":"_versioned_docs/version-1.5/rollups-apis/rollup/register-exception","label":"Register an exception","className":"api-method post"}]}]; \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.ts new file mode 100644 index 00000000..cb8cdf2c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-1.5/rollups-apis/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-1.5/rollups-apis/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/delegate-call-vouchers.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/delegate-call-vouchers.md new file mode 100644 index 00000000..3edea9ce --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/delegate-call-vouchers.md @@ -0,0 +1,76 @@ +--- +id: delegate-call-vouchers +title: DELEGATECALL Vouchers +--- + +:::danger Security Considerations +DELEGATECALL Vouchers are a powerful feature that should be used with extreme caution. Incorrect implementation can lead to serious security vulnerabilities as the target contract's code has full access to the Application contract's storage and funds. +::: + +DELEGATECALL Vouchers are an extension of vouchers that enables advanced smart contract interactions through the [`DELEGATECALL`](https://www.evm.codes/?fork=cancun#f4) opcode. + +Unlike regular vouchers, DELEGATECALL vouchers allow dApps to separate their execution logic from their storage context. When using DELEGATECALL voucher, the Application contract always maintains the storage, context, and funds (both ETH and tokens), while the target contract provides only the execution logic. This separation enables more flexible and reusable smart contract patterns while keeping all state changes and assets within the Application contract. + +When a DELEGATECALL voucher is executed through the Application contract, the code at the target address is executed with the following characteristics: + +- All storage operations occur in the Application contract's storage space +- All funds (ETH and tokens) remain in and are managed by the Application contract +- The msg.sender and msg.value from the original transaction are preserved +- The execution logic comes from the target contract, but operates on the Application contract's state and funds + +This mechanism, where the Application contract maintains the state and funds while borrowing logic from other contracts, enables powerful patterns such as: + +- **Paid Vouchers**: Vouchers that provide payment to the user who executes them. + +- **Future Vouchers**: Vouchers that are time-locked and can only be executed after a specific timestamp. + +- **Expirable Vouchers**: Vouchers that have an expiration timestamp, after which they can no longer be executed. + +- **Targeted Vouchers**: Vouchers that are restricted to execution by specific addresses or a list of authorized addresses. + +- **Atomic Vouchers**: A sequence of message calls that must be executed in order, ensuring atomicity of the operations. + +- **Re-executable Vouchers**: Vouchers that can be executed multiple times, unlike standard vouchers which can only be executed once. + +- **Ordered Vouchers**: Vouchers that must be executed in a specific sequence. For example, voucher A can only be executed after voucher B has been executed. + +The [`Application`](../contracts/application.md) contract handles the execution of DELEGATECALL vouchers through its [`executeOutput()`](../../contracts/application/#executeoutput) function, which validates and processes the DELEGATECALL operation on the blockchain. + +## Implementation Considerations + +When implementing DELEGATECALL vouchers, consider the following: + +1. **Storage Layout**: Since all storage operations happen in the Application contract, the storage layout of the target contract must be compatible with the Application contract's layout to prevent unintended storage collisions. + +2. **Security**: Since DELEGATECALL operations execute code in the context of the Application contract, careful validation of the target contract and its code is essential to prevent malicious modifications to the Application's state. + +3. **State Management**: All state changes occur in the Application contract's storage, making it the single source of truth for the application's state. + +:::note create a DELEGATECALL voucher +[Refer to the documentation here](../../development/asset-handling.md) for implementing DELEGATECALL vouchers in your dApp. +::: + +## Execution Context + +In a DELEGATECALL voucher execution: + +- The Application contract provides the execution context and storage +- The target contract provides only the logic to be executed +- All storage operations affect the Application contract's state +- msg.sender and msg.value from the original transaction are preserved + +This architecture, where the Application contract maintains all state while being able to execute logic from other contracts, makes DELEGATECALL vouchers particularly useful for customizable logics while keeping all application state centralized in the Application contract. + +## 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. + +Delegate call vouchers, like regular vouchers, are executed on the blockchain upon the closure of the corresponding epoch. This ensures that all state changes and logic executions are properly validated and recorded in the blockchain. + +You can manually set the epoch length to facilitate quicker execution of DELEGATECALL vouchers during development. + +:::note epoch duration +[Refer to the documentation here](../../development/cli-commands.md/#run) to manually configure epoch length during development. +::: \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/exception.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/exception.md new file mode 100644 index 00000000..4b505136 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/exception.md @@ -0,0 +1,91 @@ +--- +id: exception +title: Exception +--- + +The `/exception` endpoint is used to register an exception when the dApp cannot proceed with request processing. This should be the last method called by the dApp backend while processing a request. + +When an exception occurs during request processing, the dApp backend should: +1. Call the `/exception` endpoint with a payload describing the error +2. Not make any further API calls after registering the exception +3. Exit the processing loop + +The Rollup HTTP Server will: +- Skip the input with the reason [`EXCEPTION`](../graphql/enums/completion-status.md) +- Forward the exception message +- Return status code 200 + +The exception payload should be a hex-encoded string starting with '0x' followed by pairs of hexadecimal numbers. + +Let's see how a Cartesi dApp's backend handles exceptions: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + +

+
+```javascript
+async function handle_advance(data) {
+  console.log("Received advance request data " + JSON.stringify(data));
+
+  try {
+    // Process the request
+    // ...
+  } catch (error) {
+    // Register exception and exit
+    await fetch(rollup_server + "/exception", {
+      method: "POST",
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: JSON.stringify({
+        payload: "0x" + Buffer.from(error.message).toString("hex"),
+      }),
+    });
+    process.exit(1);
+  }
+
+  return "accept";
+}
+```
+
+
+
+ + +

+
+```python
+def handle_advance(data):
+   logger.info(f"Received advance request data {data}")
+
+   try:
+       # Process the request
+       # ...
+   except Exception as e:
+       # Register exception and exit
+       response = requests.post(
+           rollup_server + "/exception",
+           json={"payload": "0x" + e.message.encode("utf-8").hex()},
+       )
+       logger.info(
+           f"Received exception status {response.status_code} body {response.content}"
+       )
+       sys.exit(1)
+
+   return "accept"
+```
+
+
+
+ +
+ +## Notes + +- This endpoint should only be called when the dApp cannot proceed with request processing +- After calling this endpoint, the dApp should not make any further API calls +- The exception payload should be a hex-encoded string starting with '0x' +- An empty payload is represented by the string '0x' diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/finish.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/finish.md new file mode 100644 index 00000000..896a494c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/finish.md @@ -0,0 +1,145 @@ +--- +id: finish +title: Finish +--- + +The `/finish` endpoint is used to indicate 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. + +The dApp backend should call the `/finish` endpoint to start processing rollup requests. The Rollup HTTP Server returns the next rollup request in the response body. + +The possible values for the `request_type` field are: +- `'advance_state'` - For requests that modify the dApp state +- `'inspect_state'` - For read-only queries about the dApp state + +For advance-state requests, the input data contains: +- The advance-state metadata (including the account address that submitted the input) +- The payload + +For inspect-state requests, the input data contains only the payload. + +After processing a rollup request, the dApp backend should call the `/finish` endpoint again. For advance-state requests, depending on the processing result, it should set the `status` field to either `'accept'` or `'reject'`. The status field is ignored for inspect-state requests. + +If an advance-state request is rejected: +- Any vouchers and notices generated during processing are discarded +- Reports are not discarded +- The state is reverted to its previous condition + +During a finish call, the next rollup request might not be immediately available. In this case: +- The Rollup HTTP Server returns status code 202 +- When receiving status 202, the dApp backend should retry the finish call with the same arguments + +Let's see how a Cartesi dApp's backend processes requests using the finish endpoint: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + +

+
+```javascript
+const rollup_server = process.env.ROLLUP_HTTP_SERVER_URL;
+console.log("HTTP rollup_server url is " + rollup_server);
+
+async function handle_advance(data) {
+  console.log("Received advance request data " + JSON.stringify(data));
+  return "accept";
+}
+
+async function handle_inspect(data) {
+  console.log("Received inspect request data " + JSON.stringify(data));
+  return "accept";
+}
+
+var handlers = {
+  advance_state: handle_advance,
+  inspect_state: handle_inspect,
+};
+
+var finish = { status: "accept" };
+
+(async () => {
+  while (true) {
+    const finish_req = await fetch(rollup_server + "/finish", {
+      method: "POST",
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: JSON.stringify(finish),
+    });
+
+    console.log("Received finish status " + finish_req.status);
+
+    if (finish_req.status == 202) {
+      console.log("No pending rollup request, trying again");
+    } else {
+      const rollup_req = await finish_req.json();
+      var handler = handlers[rollup_req["request_type"]];
+      finish["status"] = await handler(rollup_req["data"]);
+    }
+  }
+})();
+```
+
+
+
+ + +

+
+```python
+from os import environ
+import logging
+import requests
+
+logging.basicConfig(level="INFO")
+logger = logging.getLogger(__name__)
+
+rollup_server = environ["ROLLUP_HTTP_SERVER_URL"]
+logger.info(f"HTTP rollup_server url is {rollup_server}")
+
+def handle_advance(data):
+   logger.info(f"Received advance request data {data}")
+   return "accept"
+
+def handle_inspect(data):
+   logger.info(f"Received inspect request data {data}")
+   return "accept"
+
+handlers = {
+   "advance_state": handle_advance,
+   "inspect_state": handle_inspect,
+}
+
+finish = {"status": "accept"}
+
+while True:
+   logger.info("Sending finish")
+   response = requests.post(rollup_server + "/finish", json=finish)
+   logger.info(f"Received finish status {response.status_code}")
+   if response.status_code == 202:
+       logger.info("No pending rollup request, trying again")
+   else:
+       rollup_request = response.json()
+       data = rollup_request["data"]
+       handler = handlers[rollup_request["request_type"]]
+       finish["status"] = handler(rollup_request["data"])
+```
+
+
+
+ +
+ +## Notes + +- The `/finish` endpoint must be called after processing each request to indicate readiness for the next one +- For advance state requests, the status field determines whether the request is accepted or rejected +- For inspect state requests, the status field is ignored +- If an advance state request is rejected: + - Any vouchers and notices generated during processing are discarded + - Reports are not discarded + - The state is reverted to its previous condition +- During a finish call, the next rollup request might not be immediately available: + - The Rollup HTTP Server returns status code 202 + - When receiving status 202, the dApp backend should retry the finish call with the same arguments diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/introduction.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/introduction.md new file mode 100644 index 00000000..46890102 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/introduction.md @@ -0,0 +1,228 @@ +--- +id: introduction +title: Introduction +--- + +The backend of a Cartesi dApp processes requests in the following manner: + + - **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: + + - **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. + + - **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. + + - **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: + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + +

+
+```javascript
+const rollup_server = process.env.ROLLUP_HTTP_SERVER_URL;
+console.log("HTTP rollup_server url is " + rollup_server);
+
+async function handle_advance(data) {
+  console.log("Received advance request data " + JSON.stringify(data));
+  return "accept";
+}
+
+async function handle_inspect(data) {
+  console.log("Received inspect request data " + JSON.stringify(data));
+  return "accept";
+}
+
+var handlers = {
+  advance_state: handle_advance,
+  inspect_state: handle_inspect,
+};
+
+var finish = { status: "accept" };
+
+(async () => {
+  while (true) {
+    const finish_req = await fetch(rollup_server + "/finish", {
+      method: "POST",
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: JSON.stringify({ status: "accept" }),
+    });
+
+    console.log("Received finish status " + finish_req.status);
+
+    if (finish_req.status == 202) {
+      console.log("No pending rollup request, trying again");
+    } else {
+      const rollup_req = await finish_req.json();
+      var handler = handlers[rollup_req["request_type"]];
+      finish["status"] = await handler(rollup_req["data"]);
+    }
+  }
+})();
+```
+
+
+
+ + +

+
+```python
+from os import environ
+import logging
+import requests
+
+logging.basicConfig(level="INFO")
+logger = logging.getLogger(__name__)
+
+rollup_server = environ["ROLLUP_HTTP_SERVER_URL"]
+logger.info(f"HTTP rollup_server url is {rollup_server}")
+
+def handle_advance(data):
+   logger.info(f"Received advance request data {data}")
+   return "accept"
+
+def handle_inspect(data):
+   logger.info(f"Received inspect request data {data}")
+   return "accept"
+
+
+handlers = {
+   "advance_state": handle_advance,
+   "inspect_state": handle_inspect,
+}
+
+finish = {"status": "accept"}
+
+while True:
+   logger.info("Sending finish")
+   response = requests.post(rollup_server + "/finish", json=finish)
+   logger.info(f"Received finish status {response.status_code}")
+   if response.status_code == 202:
+       logger.info("No pending rollup request, trying again")
+   else:
+       rollup_request = response.json()
+       data = rollup_request["data"]
+       handler = handlers[rollup_request["request_type"]]
+       finish["status"] = handler(rollup_request["data"])
+
+```
+
+
+
+ + +

+
+```rust
+use json::{object, JsonValue};
+use std::env;
+
+pub async fn handle_advance(
+    _client: &hyper::Client,
+    _server_addr: &str,
+    request: JsonValue,
+) -> Result<&'static str, Box> {
+    println!("Received advance request data {}", &request);
+    let _payload = request["data"]["payload"]
+        .as_str()
+        .ok_or("Missing payload")?;
+    // TODO: add application logic here
+    Ok("accept")
+}
+
+pub async fn handle_inspect(
+    _client: &hyper::Client,
+    _server_addr: &str,
+    request: JsonValue,
+) -> Result<&'static str, Box> {
+    println!("Received inspect request data {}", &request);
+    let _payload = request["data"]["payload"]
+        .as_str()
+        .ok_or("Missing payload")?;
+    // TODO: add application logic here
+    Ok("accept")
+}
+
+#[tokio::main]
+async fn main() -> Result<(), Box> {
+    let client = hyper::Client::new();
+    let server_addr = env::var("ROLLUP_HTTP_SERVER_URL")?;
+
+    let mut status = "accept";
+    loop {
+        println!("Sending finish");
+        let response = object! {"status" => status.clone()};
+        let request = hyper::Request::builder()
+            .method(hyper::Method::POST)
+            .header(hyper::header::CONTENT_TYPE, "application/json")
+            .uri(format!("{}/finish", &server_addr))
+            .body(hyper::Body::from(response.dump()))?;
+        let response = client.request(request).await?;
+        println!("Received finish status {}", response.status());
+
+        if response.status() == hyper::StatusCode::ACCEPTED {
+            println!("No pending rollup request, trying again");
+        } else {
+            let body = hyper::body::to_bytes(response).await?;
+            let utf = std::str::from_utf8(&body)?;
+            let req = json::parse(utf)?;
+
+            let request_type = req["request_type"]
+                .as_str()
+                .ok_or("request_type is not a string")?;
+            status = match request_type {
+                "advance_state" => handle_advance(&client, &server_addr[..], req).await?,
+                "inspect_state" => handle_inspect(&client, &server_addr[..], req).await?,
+                &_ => {
+                    eprintln!("Unknown request type");
+                    "reject"
+                }
+            };
+        }
+    }
+}
+```
+
+
+
+
+ +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. + +![img](../../../../static/img/v1.3/advance.jpg) + +Here is how an advance request works in the dApp architecture: + +- 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 3: After 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. + +![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 `
/inspect/` with a payload in the request body. For example: + +```shell +curl -X POST http://localhost:8080/inspect/ \ + -H "Content-Type: application/json" \ + -d '{"payload": "0xdeadbeef"}' +``` + +The payload should be a hex-encoded string starting with '0x' followed by pairs of hexadecimal numbers. + +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). diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/notices.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/notices.md similarity index 67% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/notices.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/notices.md index 9bd5eaad..2a6b8ae6 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/notices.md +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/notices.md @@ -1,20 +1,19 @@ --- id: notices title: Notices - --- A notice is a verifiable data declaration that attests to off-chain events or conditions and is accompanied by proof. -Notices provide a mechanism to communicate essential off-chain events in the execution layer to the base layer in a verifiable manner. +Notices provide a mechanism to communicate essential off-chain events from the execution layer to the base layer in a verifiable manner. Consider a scenario within a gaming dApp where players engage in battles. Upon the conclusion of a match, the dApp's backend generates a notice proclaiming the victorious player. This notice contains pertinent off-chain data regarding the match outcome. Once created, the notice is submitted to the rollup server as evidence of the off-chain event. -Crucially, the base layer conducts on-chain validation of these notices through the [`validateNotice()`](../json-rpc/application.md/#validatenotice) function of the `CartesiDApp` contract. +Crucially, the base layer conducts on-chain validation of these notices through the [`executeOutput()`](../contracts/application.md/#executeoutput) function of the `Application` contract. 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'; @@ -24,25 +23,30 @@ import TabItem from '@theme/TabItem';

 
 ```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) {
-    //Do something when there is an 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";
 }
+
 ```
 
 
@@ -52,14 +56,13 @@ async function handle_advance(data) {

 
 ```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
+       # Send the input payload as a notice
        response = requests.post(
            rollup_server + "/notice", json={"payload": inputPayload}
        )
@@ -67,9 +70,8 @@ def handle_advance(data):
            f"Received notice status {response.status_code} body {response.content}"
        )
    except Exception as e:
-       #  Emits report with error message here
+       # Emit report with error message here
    return status
-
 ```
 
 
@@ -78,5 +80,5 @@ def handle_advance(data): :::note querying notices -Frontend clients can query notices using a GraphQL API exposed by the Cartesi Nodes. [Refer to the documentation here](../../development/retrieve-outputs.md/#query-all-reports) to query notices from the rollup server. +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. ::: diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/reports.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/reports.md similarity index 94% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/reports.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/reports.md index 112e43b2..5429ac8d 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/backend/reports.md +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/reports.md @@ -3,15 +3,14 @@ id: reports title: Reports --- -Reports are stateless logs, offering a means to record read-only information without changing the state. Primarily used for logging and diagnostic purposes, reports provide valuable insights into the operation and performance of a dApp. +Reports are stateless logs, offering a means to record read-only information without changing the state. Primarily used for logging and diagnostic purposes, reports provide valuable insights into the operation and performance of a dApp. -Unlike notices, reports lack any association with proof and are therefore unsuitable for facilitating trustless interactions, such as on-chain processing or convincing independent third parties of dApp outcomes. +Unlike notices, reports lack any association with proof and are therefore unsuitable for facilitating trustless interactions, such as on-chain processing or convincing independent third parties of dApp outcomes. Consider a scenario within a financial dApp where users conduct transactions. In the event of a processing error, such as a failed transaction or insufficient funds, the dApp may generate a report detailing the encountered issue. This report, encapsulating relevant diagnostic data, aids developers in identifying and resolving underlying problems promptly. Here is how you can write your application to send reports to the rollup server: - import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -78,7 +77,6 @@ def handle_advance(data): - :::note querying reports -Frontend clients can query reports using a GraphQL API exposed by the Cartesi Nodes. [Refer to the documentation to query reports](../../development/retrieve-outputs.md/#query-all-reports) from your dApp. +Frontend clients can query reports using a GraphQL API exposed by the Cartesi Nodes. [Refer to the documentation to query reports](../../development/query-outputs.md/#query-all-reports) from your dApp. ::: diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/vouchers.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/vouchers.md new file mode 100644 index 00000000..9cfd85c3 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/backend/vouchers.md @@ -0,0 +1,122 @@ +--- +id: vouchers +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. + +A 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 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. + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + +

+
+```python
+# Voucher creation process
+import requests
+import json
+from os import environ
+from eth_utils import function_signature_to_4byte_selector
+from eth_abi import decode, encode
+
+rollup_server = environ["ROLLUP_HTTP_SERVER_URL"]
+
+def emit_voucher(function_signature, destination, types, values):
+    selector = function_signature_to_4byte_selector(function_signature)    
+    encoded_params = encode(types, values)
+    payload = "0x" + (selector + encoded_params).hex()
+    response = requests.post(rollup_server + "/voucher", json={"payload": payload, "destination": destination, "value": '0x' + encode(["uint256"], [0]).hex()})
+    if response.status_code == 200 or response.status_code == 201:
+        logger.info(f"Voucher emitted successfully with data: {payload}")
+    else:
+        logger.error(f"Failed to emit Voucher with data: {payload}. Status code: {response.status_code}")
+
+
+emit_voucher("mint(address)", "0x784f0c076CC55EAD0a585a9A13e57c467c91Dc3a", ["address"], [data["metadata"]["msg_sender"]])
+```
+
+
+
+ + +

+
+```javascript
+import { stringToHex, encodeFunctionData, erc20Abi, zeroHash } from "viem";
+
+async function handle_advance(data) {
+  console.log("Received advance request data " + JSON.stringify(data));
+  const sender = data["metadata"]["msg_sender"];
+  const erc20Token = "0x784f0c076CC55EAD0a585a9A13e57c467c91Dc3a"; // Sample ERC20 token address
+
+    const call = encodeFunctionData({
+    abi: erc20Abi,
+    functionName: "transfer",
+    args: [sender, BigInt(10)],
+  });
+
+  let voucher = {
+    destination: erc20Token,
+    payload: call,
+    value: zeroHash,
+  };
+
+  await emitVoucher(voucher);
+  return "accept";
+}
+
+
+const emitVoucher = async (voucher) => {
+  try {
+    await fetch(rollup_server + "/voucher", {
+      method: "POST",
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: JSON.stringify(voucher),
+    });
+  } catch (error) {
+    //Do something when there is an error
+  }
+};
+
+```
+
+
+
+ +
+ +:::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 + +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. + +You can manually set the epoch length to facilitate quicker asset deposits and withdrawals. + +:::note epoch duration +[Refer to the documentation here](../../development/cli-commands.md/#run) to manually configure epoch length during development. +::: diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application-factory.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application-factory.md new file mode 100644 index 00000000..c2ba3f85 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application-factory.md @@ -0,0 +1,107 @@ +--- +id: application-factory +title: ApplicationFactory +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/dapp/ApplicationFactory.sol + title: Application Factory contract +--- + +The **ApplicationFactory** contract is a tool for reliably deploying new instances of the [`Application`](../contracts/application.md) contract with or without a specified salt value for address derivation. + +Additionally, it provides a function to calculate the address of a potential new `CartesiDApp` contract based on input parameters. + +This contract ensures efficient and secure deployment of `Application` contracts within the Cartesi Rollups framework. + +## Functions + +### `newApplication()` + +```solidity +function newApplication( + IOutputsMerkleRootValidator outputsMerkleRootValidator, + address appOwner, + bytes32 templateHash, + bytes calldata dataAvailability +) external override returns (IApplication) +``` + +Deploys a new Application contract without a salt value for address derivation. + +Emits an `ApplicationCreated` event upon successful deployment. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputsMerkleRootValidator` | `IOutputsMerkleRootValidator` | The initial outputs Merkle root validator contract | +| `appOwner` | `address` | Address of the owner of the application | +| `templateHash` | `bytes32` | Hash of the template for the application | +| `dataAvailability` | `bytes` | The data availability solution | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IApplication` | The deployed Application contract | + +### `newApplication()` (with salt) + +```solidity +function newApplication( + IOutputsMerkleRootValidator outputsMerkleRootValidator, + address appOwner, + bytes32 templateHash, + bytes calldata dataAvailability, + bytes32 salt +) external override returns (IApplication) +``` + +Deploys a new `Application` contract with a specified salt value for address derivation. + +Emits an `ApplicationCreated` event upon successful deployment. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputsMerkleRootValidator` | `IOutputsMerkleRootValidator` | The initial outputs Merkle root validator contract | +| `appOwner` | `address` | Address of the owner of the application | +| `templateHash` | `bytes32` | Hash of the template for the application | +| `dataAvailability` | `bytes` | The data availability solution | +| `salt` | `bytes32` | Salt value for address derivation | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IApplication` | The deployed Application contract | + +### `calculateApplicationAddress()` + +```solidity +function calculateApplicationAddress( + IOutputsMerkleRootValidator outputsMerkleRootValidator, + address appOwner, + bytes32 templateHash, + bytes calldata dataAvailability, + bytes32 salt +) external view override returns (address) +``` + +Calculates the address of a potential new Application contract based on input parameters. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputsMerkleRootValidator` | `IOutputsMerkleRootValidator` | The initial outputs Merkle root validator contract | +| `appOwner` | `address` | Address of the owner of the application | +| `templateHash` | `bytes32` | Hash of the template for the application | +| `dataAvailability` | `bytes` | The data availability solution | +| `salt` | `bytes32` | Salt value for address derivation | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | Address of the potential new Application contract | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application.md new file mode 100644 index 00000000..50ead232 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/application.md @@ -0,0 +1,348 @@ +--- +id: application +title: Application +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/dapp/Application.sol + title: Application contract + - url: https://docs.openzeppelin.com/contracts/5.x/ + title: OpenZeppelin Contracts +--- + +The **Application** contract serves as the base layer representation of the application running on the execution layer. The application can interact with other smart contracts through the execution and validation of outputs. These outputs, generated by the application backend on the execution layer, can be proven in the base layer through claims submitted by a consensus contract. + +Every Application is subscribed to a consensus contract and governed by a single address—the owner. The consensus has the authority to submit claims, which are then used to validate outputs. The owner has complete control over the Application and can replace the consensus at any time. Consequently, users of an Application must trust both the consensus and the application owner. Depending on centralization or ownership concerns, the ownership model can be modified. This process is managed by the consensus contract. For more information about different ownership and consensus models, refer to the [IConsensus](https://github.com/cartesi/rollups-contracts/blob/prerelease/2.0.0/contracts/consensus/IConsensus.sol). + +This contract inherits from the following contracts: + +- `IApplication` +- `Ownable` +- `ERC721Holder` +- `ERC1155Holder` +- `ReentrancyGuard` + +For more information, please consult [OpenZeppelin's official documentation](https://docs.openzeppelin.com/contracts/5.x/). + +## State Variables + +### `_deploymentBlockNumber` +Deployment block number + +```solidity +uint256 immutable _deploymentBlockNumber = block.number; +``` + +### `_templateHash` +The initial machine state hash. + +*See the `getTemplateHash` function.* + +```solidity +bytes32 internal immutable _templateHash; +``` + +### `_executed` +Keeps track of which outputs have been executed. + +*See the `wasOutputExecuted` function.* + +```solidity +BitMaps.BitMap internal _executed; +``` + +### `_outputsMerkleRootValidator` +The current outputs Merkle root validator contract. + +*See the `getOutputsMerkleRootValidator` and `migrateToOutputsMerkleRootValidator` functions.* + +```solidity +IOutputsMerkleRootValidator internal _outputsMerkleRootValidator; +``` + +### `_dataAvailability` +The data availability solution. + +*See the `getDataAvailability` function.* + +```solidity +bytes internal _dataAvailability; +``` + +## Functions + +### `constructor` + +Creates an `Application` contract. + +*Reverts if the initial application owner address is zero.* + +```solidity +constructor( + IOutputsMerkleRootValidator outputsMerkleRootValidator, + address initialOwner, + bytes32 templateHash, + bytes memory dataAvailability +) Ownable(initialOwner); +``` + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputsMerkleRootValidator` | `IOutputsMerkleRootValidator` | The initial outputs Merkle root validator contract | +| `initialOwner` | `address` | The initial application owner | +| `templateHash` | `bytes32` | The initial machine state hash | +| `dataAvailability` | `bytes` | The data availability solution | + +### `receive()` + +```solidity +receive() external payable +``` + +Accept Ether transfers. + +*If you wish to transfer Ether to an application while informing the backend of it, then please do so through the Ether portal contract.* + +### `executeOutput()` + +```solidity +function executeOutput(bytes calldata output, OutputValidityProof calldata proof) external override nonReentrant +``` + +Execute an output. + +*On a successful execution, emits a OutputExecuted event.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `output` | `bytes` | The output | +| `proof` | `OutputValidityProof` | The proof used to validate the output against a claim accepted to the current outputs Merkle root validator contract | + +### `migrateToOutputsMerkleRootValidator()` + +```solidity +function migrateToOutputsMerkleRootValidator(IOutputsMerkleRootValidator newOutputsMerkleRootValidator) external override onlyOwner +``` + +Migrate the application to a new outputs Merkle root validator. + +*Can only be called by the application owner.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `newOutputsMerkleRootValidator` | `IOutputsMerkleRootValidator` | The new outputs Merkle root validator | + +### `wasOutputExecuted()` + +```solidity +function wasOutputExecuted(uint256 outputIndex) external view override returns (bool) +``` + +Check whether an output has been executed. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputIndex` | `uint256` | The index of output | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | Whether the output has been executed before | + +### `validateOutput()` + +```solidity +function validateOutput(bytes calldata output, OutputValidityProof calldata proof) public view override +``` + +Validate an output. + +*May raise any of the errors raised by validateOutputHash.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `output` | `bytes` | The output | +| `proof` | `OutputValidityProof` | The proof used to validate the output against a claim accepted to the current outputs Merkle root validator contract | + +### `validateOutputHash()` + +```solidity +function validateOutputHash(bytes32 outputHash, OutputValidityProof calldata proof) public view override +``` + +Validate an output hash. + +*May raise InvalidOutputHashesSiblingsArrayLength or InvalidOutputsMerkleRoot.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputHash` | `bytes32` | The output hash | +| `proof` | `OutputValidityProof` | The proof used to validate the output against a claim accepted to the current outputs Merkle root validator contract | + +### `getTemplateHash()` + +```solidity +function getTemplateHash() external view override returns (bytes32) +``` + +Get the application's template hash. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bytes32` | The application's template hash | + +### `getOutputsMerkleRootValidator()` + +```solidity +function getOutputsMerkleRootValidator() external view override returns (IOutputsMerkleRootValidator) +``` + +Get the current outputs Merkle root validator. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IOutputsMerkleRootValidator` | The current outputs Merkle root validator | + +### `getDataAvailability()` + +```solidity +function getDataAvailability() external view override returns (bytes memory) +``` + +Get the data availability solution used by application. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bytes` | Solidity ABI-encoded function call that describes the source of inputs that should be fed to the application. | + +### `getDeploymentBlockNumber()` + +```solidity +function getDeploymentBlockNumber() external view override returns (uint256) +``` + +Get number of block in which contract was deployed. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The deployment block number | + +### `owner()` + +```solidity +function owner() public view override(IOwnable, Ownable) returns (address) +``` + +Returns the address of the current owner. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The address of the current owner | + +### `renounceOwnership()` + +```solidity +function renounceOwnership() public override(IOwnable, Ownable) +``` + +Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner. + +### `transferOwnership()` + +```solidity +function transferOwnership(address newOwner) public override(IOwnable, Ownable) +``` + +Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `newOwner` | `address` | The new owner address | + +### `_isOutputsMerkleRootValid()` + +```solidity +function _isOutputsMerkleRootValid(bytes32 outputsMerkleRoot) internal view returns (bool) +``` + +Check if an outputs Merkle root is valid, according to the current outputs Merkle root validator. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputsMerkleRoot` | `bytes32` | The output Merkle root | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | Whether the outputs Merkle root is valid | + +### `_executeVoucher()` + +```solidity +function _executeVoucher(bytes calldata arguments) internal +``` + +Executes a voucher. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `arguments` | `bytes` | ABI-encoded arguments | + +### `_executeDelegateCallVoucher()` + +```solidity +function _executeDelegateCallVoucher(bytes calldata arguments) internal +``` + +Executes a delegatecall voucher. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `arguments` | `bytes` | ABI-encoded arguments | + +## Events + +### `OutputExecuted()` + +```solidity +event OutputExecuted(uint64 outputIndex, bytes output); +``` + +An output was executed from the Application, this event is emitted when a output is executed so it must be triggered on a successful call to [executeOutput](#executeOutput). + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `outputIndex` | `uint64` | The index of the output | +| `output` | `bytes` | The output | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/abstract-consensus.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/abstract-consensus.md new file mode 100644 index 00000000..89a4624f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/abstract-consensus.md @@ -0,0 +1,66 @@ +--- +id: abstract-consensus +title: AbstractConsensus +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/AbstractConsensus.sol + title: AbstractConsensus Contract +--- + +The **AbstractConsensus** contract provides an abstract implementation of `IConsensus` with common consensus functionality. + +## Functions + +### `isOutputsMerkleRootValid()` + +```solidity +function isOutputsMerkleRootValid(address appContract, bytes32 outputsMerkleRoot) public view override returns (bool) +``` + +Check whether an outputs Merkle root is valid. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | True if the outputs Merkle root is valid | + +### `getEpochLength()` + +```solidity +function getEpochLength() public view override returns (uint256) +``` + +Get the epoch length. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The epoch length | + +### `supportsInterface()` + +```solidity +function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) +``` + +Check if the contract supports a specific interface. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `interfaceId` | `bytes4` | The interface identifier | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | True if the interface is supported | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority-factory.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority-factory.md new file mode 100644 index 00000000..d09cfece --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority-factory.md @@ -0,0 +1,80 @@ +--- +id: authority-factory +title: AuthorityFactory +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/authority/AuthorityFactory.sol + title: AuthorityFactory Contract +--- + +The **AuthorityFactory** contract allows anyone to reliably deploy new `IAuthority` contracts. + +## Functions + +### `newAuthority()` + +```solidity +function newAuthority(address authorityOwner, uint256 epochLength) external override returns (IAuthority) +``` + +Deploy a new authority contract. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IAuthority` | The deployed authority contract | + +### `newAuthority()` (with salt) + +```solidity +function newAuthority(address authorityOwner, uint256 epochLength, bytes32 salt) external override returns (IAuthority) +``` + +Deploy a new authority contract deterministically using CREATE2. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the authority address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IAuthority` | The deployed authority contract | + +### `calculateAuthorityAddress()` + +```solidity +function calculateAuthorityAddress( + address authorityOwner, + uint256 epochLength, + bytes32 salt +) external view override returns (address) +``` + +Calculate the address of an authority to be deployed deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the authority address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The deterministic authority address | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority.md new file mode 100644 index 00000000..a2f8cf25 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/authority.md @@ -0,0 +1,87 @@ +--- +id: authority +title: Authority +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/authority/Authority.sol + title: Authority Contract +--- + +The **Authority** contract implements a single-owner consensus mechanism where only the contract owner can submit and accept claims. + +## Functions + +### `submitClaim()` + +```solidity +function submitClaim( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) external onlyOwner +``` + +Submit a claim to the consensus. Only the contract owner can call this function. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +### `owner()` + +```solidity +function owner() public view override(IOwnable, Ownable) returns (address) +``` + +Returns the address of the current owner. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The current owner address | + +### `renounceOwnership()` + +```solidity +function renounceOwnership() public override(IOwnable, Ownable) +``` + +Leaves the contract without owner. It will not be possible to call onlyOwner functions. + +### `transferOwnership()` + +```solidity +function transferOwnership(address newOwner) public override(IOwnable, Ownable) +``` + +Transfers ownership of the contract to a new account. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `newOwner` | `address` | The new owner address | + +### `supportsInterface()` + +```solidity +function supportsInterface(bytes4 interfaceId) public view override(IERC165, AbstractConsensus) returns (bool) +``` + +Check if the contract supports a specific interface. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `interfaceId` | `bytes4` | The interface identifier | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | True if the interface is supported | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority-factory.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority-factory.md new file mode 100644 index 00000000..11423631 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority-factory.md @@ -0,0 +1,96 @@ +--- +id: iauthority-factory +title: IAuthorityFactory +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/authority/IAuthorityFactory.sol + title: IAuthorityFactory Interface +--- + +The **IAuthorityFactory** interface defines the contract for deploying new `IAuthority` contracts. + +## Events + +### `AuthorityCreated` + +```solidity +event AuthorityCreated(IAuthority authority) +``` + +A new authority was deployed. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authority` | `IAuthority` | The authority | + +## Functions + +### `newAuthority()` + +```solidity +function newAuthority(address authorityOwner, uint256 epochLength) external returns (IAuthority) +``` + +Deploy a new authority. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IAuthority` | The authority | + +### `newAuthority()` (with salt) + +```solidity +function newAuthority(address authorityOwner, uint256 epochLength, bytes32 salt) external returns (IAuthority) +``` + +Deploy a new authority deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the authority address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IAuthority` | The authority | + +### `calculateAuthorityAddress()` + +```solidity +function calculateAuthorityAddress( + address authorityOwner, + uint256 epochLength, + bytes32 salt +) external view returns (address) +``` + +Calculate the address of an authority to be deployed deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `authorityOwner` | `address` | The initial authority owner | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the authority address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The deterministic authority address | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority.md new file mode 100644 index 00000000..c9a2aad5 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/authority/iauthority.md @@ -0,0 +1,19 @@ +--- +id: iauthority +title: IAuthority +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/authority/IAuthority.sol + title: IAuthority Interface +--- + +The `IAuthority` interface defines a consensus contract controlled by a single address, the owner. + +## Description + +A consensus contract controlled by a single address, the owner. This interface combines the consensus functionality with ownership management, allowing only the owner to submit claims. + +## Related Contracts + +- [`Authority`](./authority.md): Implementation of this interface +- [`IConsensus`](../iconsensus.md): Base consensus interface +- [`IOwnable`](https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/access/IOwnable.sol): Ownership management interface \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/iconsensus.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/iconsensus.md new file mode 100644 index 00000000..48348a66 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/iconsensus.md @@ -0,0 +1,165 @@ +--- +id: iconsensus +title: IConsensus +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/IConsensus.sol + title: IConsensus Interface +--- + +The `IConsensus` interface defines the main consensus contract behavior for validating and accepting claims submitted by validators. + +## Description + +Each application has its own stream of inputs. When an input is fed to the application, it may yield several outputs. Since genesis, a Merkle tree of all outputs ever produced is maintained both inside and outside the Cartesi Machine. + +The claim that validators may submit to the consensus contract is the root of this Merkle tree after processing all base layer blocks until some height. + +A validator should be able to save transaction fees by not submitting a claim if it was: +- Already submitted by the validator (see the `ClaimSubmitted` event) or +- Already accepted by the consensus (see the `ClaimAccepted` event) + +The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface. For example, a claim may be accepted if it was: +- Submitted by an authority or +- Submitted by the majority of a quorum or +- Submitted and not proven wrong after some period of time or +- Submitted and proven correct through an on-chain tournament + +## Functions + +### `submitClaim()` + +```solidity +function submitClaim( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) external +``` + +Submit a claim to the consensus. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +**Events:** +- `ClaimSubmitted`: Must be fired +- `ClaimAccepted`: MAY be fired, if the acceptance criteria is met + +### `getEpochLength()` + +```solidity +function getEpochLength() external view returns (uint256) +``` + +Get the epoch length, in number of base layer blocks. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The epoch length | + +**Note:** The epoch number of a block is defined as the integer division of the block number by the epoch length. + +## Events + +### `ClaimSubmitted()` + +```solidity +event ClaimSubmitted( + address indexed submitter, + address indexed appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) +``` + +Must trigger when a claim is submitted. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `submitter` | `address` | The submitter address | +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +### `ClaimAccepted()` + +```solidity +event ClaimAccepted( + address indexed appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) +``` + +Must trigger when a claim is accepted. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +**Note:** For each application and lastProcessedBlockNumber, there can be at most one accepted claim. + +## Errors + +### `NotEpochFinalBlock()` + +```solidity +error NotEpochFinalBlock(uint256 lastProcessedBlockNumber, uint256 epochLength) +``` + +The claim contains the number of a block that is not at the end of an epoch (its modulo epoch length is not epoch length - 1). + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `epochLength` | `uint256` | The epoch length | + +### `NotPastBlock()` + +```solidity +error NotPastBlock(uint256 lastProcessedBlockNumber, uint256 currentBlockNumber) +``` + +The claim contains the number of a block in the future (it is greater or equal to the current block number). + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `currentBlockNumber` | `uint256` | The number of the current block | + +### `NotFirstClaim()` + +```solidity +error NotFirstClaim(address appContract, uint256 lastProcessedBlockNumber) +``` + +A claim for that application and epoch was already submitted by the validator. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | + +## Related Contracts + +- [`AbstractConsensus`](./abstract-consensus.md): Abstract implementation of this interface +- [`IOutputsMerkleRootValidator`](./ioutputs-merkle-root-validator.md): Interface for validating outputs Merkle roots \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/ioutputs-merkle-root-validator.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/ioutputs-merkle-root-validator.md new file mode 100644 index 00000000..2fdadf48 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/ioutputs-merkle-root-validator.md @@ -0,0 +1,34 @@ +--- +id: ioutputs-merkle-root-validator +title: IOutputsMerkleRootValidator +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/IOutputsMerkleRootValidator.sol + title: IOutputsMerkleRootValidator Interface +--- + +The `IOutputsMerkleRootValidator` interface provides valid outputs Merkle roots for validation. + +## Description + +This interface provides functionality to check whether an outputs Merkle root is valid. ERC-165 can be used to determine whether this contract also supports any other interface (e.g. for submitting claims). + +## Functions + +### `isOutputsMerkleRootValid` +```solidity +function isOutputsMerkleRootValid(address appContract, bytes32 outputsMerkleRoot) external view returns (bool) +``` + +Check whether an outputs Merkle root is valid. + +**Parameters:** +- `appContract` (address): The application contract address +- `outputsMerkleRoot` (bytes32): The outputs Merkle root + +**Returns:** +- (bool): True if the outputs Merkle root is valid + +## Related Contracts + +- [`IConsensus`](./iconsensus.md): Interface that inherits from this interface +- [`AbstractConsensus`](./abstract-consensus.md): Abstract implementation that implements this interface \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/overview.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/overview.md new file mode 100644 index 00000000..4e69c587 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/overview.md @@ -0,0 +1,31 @@ +--- +id: overview +title: Overview +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1 + title: Smart Contracts for Cartesi Rollups +--- + +The Cartesi Rollups framework consists of components on two layers: the base layer (the foundational blockchain where an application contract is deployed, such as Ethereum) and the execution layer (the Cartesi off-chain layer where the application runs its backend logic). + +The frontend interacts with base layer smart contracts to send inputs to the backend, deposit assets, and process outputs. + +To interact with an Ethereum-compatible blockchain, the application frontend must connect to a blockchain node using Ethereum's JSON-RPC API. + +Clients can interact with Ethereum-compatible nodes using the JSON-RPC API in two ways: + +- **Querying state (read operations)** — The state can be queried by calling functions that neither alter the blockchain state nor incur gas fees. + +- **Changing state (write operations)** — The state is changed by submitting a transaction that incurs gas fees. The transaction must be cryptographically signed by an Ethereum account with sufficient funds in its wallet. + +## Cartesi Rollups Smart Contracts + +- [`InputBox`](../input-box.md): This contract receives inputs from users who want to interact with the off-chain layer. All inputs to your application are processed through this contract. + +- [`Application`](../application.md): An `Application` contract is instantiated for each dApp (i.e., each dApp has its own application address). With this address, an application can hold ownership of digital assets on the base layer, such as Ether, ERC-20 tokens, and NFTs. + +- [`ApplicationFactory`](../application-factory.md): The `ApplicationFactory` contract enables anyone to deploy [`Application`](../application.md) contracts with a simple function call. It provides greater convenience to the deployer and security to users and validators, as they can verify that the bytecode has not been maliciously altered. + +- Portals: These contracts are used to safely transfer assets from the base layer to the execution environment of your application. Currently, Portal contracts are available for the following types of assets: [Ether (ETH)](../portals/EtherPortal.md), [ERC-20 (Fungible tokens)](../portals/ERC20Portal.md), [ERC-721 (Non-fungible tokens)](../portals/ERC721Portal.md), [ERC-1155 single transfer](../portals/ERC1155SinglePortal.md), and [ERC-1155 batch token transfers](../portals/ERC1155BatchPortal.md). + + diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum-factory.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum-factory.md new file mode 100644 index 00000000..b4c12d3d --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum-factory.md @@ -0,0 +1,96 @@ +--- +id: iquorum-factory +title: IQuorumFactory +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/quorum/IQuorumFactory.sol + title: IQuorumFactory Interface +--- + +The **IQuorumFactory** interface defines the contract for deploying new `IQuorum` contracts. + +## Events + +### `QuorumCreated` + +```solidity +event QuorumCreated(IQuorum quorum) +``` + +A new quorum was deployed. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `quorum` | `IQuorum` | The quorum | + +## Functions + +### `newQuorum()` + +```solidity +function newQuorum(address[] calldata validators, uint256 epochLength) external returns (IQuorum) +``` + +Deploy a new quorum. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IQuorum` | The quorum | + +### `newQuorum()` (with salt) + +```solidity +function newQuorum(address[] calldata validators, uint256 epochLength, bytes32 salt) external returns (IQuorum) +``` + +Deploy a new quorum deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the quorum address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IQuorum` | The quorum | + +### `calculateQuorumAddress()` + +```solidity +function calculateQuorumAddress( + address[] calldata validators, + uint256 epochLength, + bytes32 salt +) external view returns (address) +``` + +Calculate the address of a quorum to be deployed deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the quorum address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The deterministic quorum address | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum.md new file mode 100644 index 00000000..660e317e --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/iquorum.md @@ -0,0 +1,140 @@ +--- +id: iquorum +title: IQuorum +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/quorum/IQuorum.sol + title: IQuorum Interface +--- + +The `IQuorum` interface defines a consensus model controlled by a small, immutable set of validators. + +## Description + +A consensus model controlled by a small, immutable set of `n` validators. You can know the value of `n` by calling the `numOfValidators` function. Upon construction, each validator is assigned a unique number between 1 and `n`. These numbers are used internally instead of addresses for gas optimization reasons. You can list the validators in the quorum by calling the `validatorById` function for each ID from 1 to `n`. + +## Functions + +### `numOfValidators` +```solidity +function numOfValidators() external view returns (uint256) +``` + +Get the number of validators. + +**Returns:** +- (uint256): The total number of validators + +### `validatorId` +```solidity +function validatorId(address validator) external view returns (uint256) +``` + +Get the ID of a validator. + +**Parameters:** +- `validator` (address): The validator address + +**Returns:** +- (uint256): The validator ID + +**Note:** Validators have IDs greater than zero. Non-validators are assigned to ID zero. + +### `validatorById` +```solidity +function validatorById(uint256 id) external view returns (address) +``` + +Get the address of a validator by its ID. + +**Parameters:** +- `id` (uint256): The validator ID + +**Returns:** +- (address): The validator address + +**Note:** Validator IDs range from 1 to `N`, the total number of validators. Invalid IDs map to address zero. + +### `numOfValidatorsInFavorOfAnyClaimInEpoch` +```solidity +function numOfValidatorsInFavorOfAnyClaimInEpoch( + address appContract, + uint256 lastProcessedBlockNumber +) external view returns (uint256) +``` + +Get the number of validators in favor of any claim in a given epoch. + +**Parameters:** +- `appContract` (address): The application contract address +- `lastProcessedBlockNumber` (uint256): The number of the last processed block + +**Returns:** +- (uint256): Number of validators in favor of any claim in the epoch + +### `isValidatorInFavorOfAnyClaimInEpoch` +```solidity +function isValidatorInFavorOfAnyClaimInEpoch( + address appContract, + uint256 lastProcessedBlockNumber, + uint256 id +) external view returns (bool) +``` + +Check whether a validator is in favor of any claim in a given epoch. + +**Parameters:** +- `appContract` (address): The application contract address +- `lastProcessedBlockNumber` (uint256): The number of the last processed block +- `id` (uint256): The ID of the validator + +**Returns:** +- (bool): Whether validator is in favor of any claim in the epoch + +**Note:** Assumes the provided ID is valid. + +### `numOfValidatorsInFavorOf` +```solidity +function numOfValidatorsInFavorOf( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) external view returns (uint256) +``` + +Get the number of validators in favor of a claim. + +**Parameters:** +- `appContract` (address): The application contract address +- `lastProcessedBlockNumber` (uint256): The number of the last processed block +- `outputsMerkleRoot` (bytes32): The outputs Merkle root + +**Returns:** +- (uint256): Number of validators in favor of claim + +### `isValidatorInFavorOf` +```solidity +function isValidatorInFavorOf( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot, + uint256 id +) external view returns (bool) +``` + +Check whether a validator is in favor of a claim. + +**Parameters:** +- `appContract` (address): The application contract address +- `lastProcessedBlockNumber` (uint256): The number of the last processed block +- `outputsMerkleRoot` (bytes32): The outputs Merkle root +- `id` (uint256): The ID of the validator + +**Returns:** +- (bool): Whether validator is in favor of claim + +**Note:** Assumes the provided ID is valid. + +## Related Contracts + +- [`Quorum`](./quorum.md): Implementation of this interface +- [`IConsensus`](../iconsensus.md): Base consensus interface \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum-factory.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum-factory.md new file mode 100644 index 00000000..4f0d09e6 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum-factory.md @@ -0,0 +1,80 @@ +--- +id: quorum-factory +title: QuorumFactory +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/quorum/QuorumFactory.sol + title: QuorumFactory Contract +--- + +The **QuorumFactory** contract allows anyone to reliably deploy new `IQuorum` contracts. + +## Functions + +### `newQuorum()` + +```solidity +function newQuorum(address[] calldata validators, uint256 epochLength) external override returns (IQuorum) +``` + +Deploy a new quorum contract. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IQuorum` | The deployed quorum contract | + +### `newQuorum()` (with salt) + +```solidity +function newQuorum(address[] calldata validators, uint256 epochLength, bytes32 salt) external override returns (IQuorum) +``` + +Deploy a new quorum contract deterministically using CREATE2. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the quorum address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `IQuorum` | The deployed quorum contract | + +### `calculateQuorumAddress()` + +```solidity +function calculateQuorumAddress( + address[] calldata validators, + uint256 epochLength, + bytes32 salt +) external view override returns (address) +``` + +Calculate the address of a quorum to be deployed deterministically. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validators` | `address[]` | The list of validators | +| `epochLength` | `uint256` | The epoch length | +| `salt` | `bytes32` | The salt used to deterministically generate the quorum address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The deterministic quorum address | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum.md new file mode 100644 index 00000000..0842e4f0 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/consensus/quorum/quorum.md @@ -0,0 +1,209 @@ +--- +id: quorum +title: Quorum +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/consensus/quorum/Quorum.sol + title: Quorum Contract +--- + +The **Quorum** contract implements a multi-validator consensus mechanism where claims are accepted when a majority of validators vote in favor. + +## Functions + +### `submitClaim()` + +```solidity +function submitClaim( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) external override +``` + +Submit a claim to the consensus. Only validators can call this function. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +### `numOfValidators()` + +```solidity +function numOfValidators() external view override returns (uint256) +``` + +Get the number of validators. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The total number of validators | + +### `validatorId()` + +```solidity +function validatorId(address validator) external view override returns (uint256) +``` + +Get the ID of a validator. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `validator` | `address` | The validator address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The validator ID (0 for non-validators, >0 for validators) | + +### `validatorById()` + +```solidity +function validatorById(uint256 id) external view override returns (address) +``` + +Get the address of a validator by its ID. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `id` | `uint256` | The validator ID | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `address` | The validator address (address(0) for invalid IDs) | + +### `numOfValidatorsInFavorOfAnyClaimInEpoch()` + +```solidity +function numOfValidatorsInFavorOfAnyClaimInEpoch( + address appContract, + uint256 lastProcessedBlockNumber +) external view override returns (uint256) +``` + +Get the number of validators in favor of any claim in a given epoch. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | Number of validators in favor of any claim in the epoch | + +### `isValidatorInFavorOfAnyClaimInEpoch()` + +```solidity +function isValidatorInFavorOfAnyClaimInEpoch( + address appContract, + uint256 lastProcessedBlockNumber, + uint256 id +) external view override returns (bool) +``` + +Check whether a validator is in favor of any claim in a given epoch. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `id` | `uint256` | The ID of the validator | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | Whether validator is in favor of any claim in the epoch | + +### `numOfValidatorsInFavorOf()` + +```solidity +function numOfValidatorsInFavorOf( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot +) external view override returns (uint256) +``` + +Get the number of validators in favor of a claim. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | Number of validators in favor of claim | + +### `isValidatorInFavorOf()` + +```solidity +function isValidatorInFavorOf( + address appContract, + uint256 lastProcessedBlockNumber, + bytes32 outputsMerkleRoot, + uint256 id +) external view override returns (bool) +``` + +Check whether a validator is in favor of a claim. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `lastProcessedBlockNumber` | `uint256` | The number of the last processed block | +| `outputsMerkleRoot` | `bytes32` | The outputs Merkle root | +| `id` | `uint256` | The ID of the validator | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | Whether validator is in favor of claim | + +### `supportsInterface()` + +```solidity +function supportsInterface(bytes4 interfaceId) public view override(IERC165, AbstractConsensus) returns (bool) +``` + +Check if the contract supports a specific interface. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `interfaceId` | `bytes4` | The interface identifier | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bool` | True if the interface is supported | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/input-box.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/input-box.md new file mode 100644 index 00000000..d5cd8e3f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/input-box.md @@ -0,0 +1,133 @@ +--- +id: input-box +title: InputBox +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/inputs/InputBox.sol + title: InputBox contract +--- + +The **InputBox** is a trustless and permissionless contract that receives arbitrary data blobs (called "inputs") from any sender and adds a compound hash to an append-only list (the "input box"). + +The hash stored on-chain comprises the hash of the input blob, block number, timestamp, input sender address, and input index. + +Data availability is guaranteed through the emission of `InputAdded` events on every successful call to `addInput`. This ensures that inputs can be retrieved by anyone at any time without relying on centralized data providers. + +From this contract's perspective, inputs are encoding-agnostic byte arrays. It is the application's responsibility to interpret, validate, and act upon these inputs. + +This contract inherits from `IInputBox`. + +## State Variables + +### `_deploymentBlockNumber` +Deployment block number + +```solidity +uint256 immutable _deploymentBlockNumber = block.number; +``` + +### `_inputBoxes` +Mapping of application contract addresses to arrays of input hashes. + +```solidity +mapping(address => bytes32[]) private _inputBoxes; +``` + +## Functions + +### `addInput()` + +```solidity +function addInput(address appContract, bytes calldata payload) external override returns (bytes32) +``` + +Send an input to an application. + +*MUST fire an InputAdded event.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `payload` | `bytes` | The input payload | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bytes32` | The hash of the input blob | + +### `getNumberOfInputs()` + +```solidity +function getNumberOfInputs(address appContract) external view override returns (uint256) +``` + +Get the number of inputs sent to an application. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | Number of inputs in the application input box | + +### `getInputHash()` + +```solidity +function getInputHash(address appContract, uint256 index) external view override returns (bytes32) +``` + +Get the hash of an input in an application's input box. + +*The provided index must be valid.* + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `index` | `uint256` | The input index | + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `bytes32` | The hash of the input at the provided index in the application input box | + +### `getDeploymentBlockNumber()` + +```solidity +function getDeploymentBlockNumber() external view override returns (uint256) +``` + +Get number of block in which contract was deployed. + +**Return Values** + +| Name | Type | Description | +|------|------|-------------| +| `[0]` | `uint256` | The deployment block number | + +## Events + +### `InputAdded()` + +```solidity +event InputAdded(address indexed appContract, uint256 indexed index, bytes input) +``` + +Emitted when an input is added to an application's input box. + +**Parameters** + +| Name | Type | Description | +|------|------|-------------| +| `appContract` | `address` | The application contract address | +| `index` | `uint256` | The input index | +| `input` | `bytes` | The input blob | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/overview.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/overview.md new file mode 100644 index 00000000..ce2566da --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/overview.md @@ -0,0 +1,31 @@ +--- +id: overview +title: Overview +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1 + title: Smart Contracts for Cartesi Rollups +--- + +The Cartesi Rollups framework consists of components on two layers: the base layer (the foundational blockchain where an application contract is deployed, such as Ethereum) and the execution layer (the Cartesi off-chain layer where the application runs its backend logic). + +The frontend interacts with base layer smart contracts to send inputs to the backend, deposit assets, and process outputs. + +To interact with an Ethereum-compatible blockchain, the application frontend must connect to a blockchain node using Ethereum's JSON-RPC API. + +Clients can interact with Ethereum-compatible nodes using the JSON-RPC API in two ways: + +- **Querying state (read operations)** — The state can be queried by calling functions that neither alter the blockchain state nor incur gas fees. + +- **Changing state (write operations)** — The state is changed by submitting a transaction that incurs gas fees. The transaction must be cryptographically signed by an Ethereum account with sufficient funds in its wallet. + +## Cartesi Rollups Smart Contracts + +- [`InputBox`](../contracts/input-box.md): This contract receives inputs from users who want to interact with the off-chain layer. All inputs to your application are processed through this contract. + +- [`Application`](../contracts/application.md): An `Application` contract is instantiated for each dApp (i.e., each dApp has its own application address). With this address, an application can hold ownership of digital assets on the base layer, such as Ether, ERC-20 tokens, and NFTs. + +- [`ApplicationFactory`](../contracts/application-factory.md): The `ApplicationFactory` contract enables anyone to deploy [`Application`](../contracts/application.md) contracts with a simple function call. It provides greater convenience to the deployer and security to users and validators, as they can verify that the bytecode has not been maliciously altered. + +- Portals: These contracts are used to safely transfer assets from the base layer to the execution environment of your application. Currently, Portal contracts are available for the following types of assets: [Ether (ETH)](../contracts/portals/EtherPortal.md), [ERC-20 (Fungible tokens)](../contracts/portals/ERC20Portal.md), [ERC-721 (Non-fungible tokens)](../contracts/portals/ERC721Portal.md), [ERC-1155 single transfer](../contracts/portals/ERC1155SinglePortal.md), and [ERC-1155 batch token transfers](../contracts/portals/ERC1155BatchPortal.md). + + diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155BatchPortal.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155BatchPortal.md new file mode 100644 index 00000000..6426db55 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155BatchPortal.md @@ -0,0 +1,33 @@ +--- +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/portals/ERC1155BatchPortal.sol + title: ERC1155BatchPortal contract +--- + +The **ERC1155BatchPortal** allows anyone to perform batch transfers of +ERC-1155 tokens to a dApp while informing the off-chain machine. + +## `depositBatchERC1155Token()` + +```solidity +function depositBatchERC1155Token( IERC1155 token, address appContract, uint256[] calldata tokenIds, uint256[] calldata values, bytes calldata baseLayerData, bytes calldata execLayerData) external; +``` + +Transfer a batch of ERC-1155 tokens to a dApp and add an input to +the dApp's input box to signal such operation. + +The caller must enable approval for the portal to manage all of their tokens +beforehand, by calling the `setApprovalForAll` function in the token contract. + +_Please make sure `tokenIds` and `values` have the same length._ + +#### Parameters + +| Name | Type | Description | +| ------------- | --------- | -------------------------------------------------------- | +| token | IERC1155 | The ERC-1155 token contract | +| appContract | address | The address of the dApp | +| tokenIds | uint256[] | The identifiers of the tokens being transferred | +| values | uint256[] | Transfer amounts per token type | +| baseLayerData | bytes | Additional data to be interpreted by the base layer | +| execLayerData | bytes | Additional data to be interpreted by the execution layer | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155SinglePortal.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155SinglePortal.md new file mode 100644 index 00000000..95dda15a --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC1155SinglePortal.md @@ -0,0 +1,31 @@ +--- +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/portals/ERC1155SinglePortal.sol + title: ERC1155SinglePortal contract +--- + +The **ERC1155SinglePortal** allows anyone to perform single transfers of ERC-1155 tokens to a dApp while informing the off-chain machine. + +### `depositSingleERC1155Token()` + +```solidity +function depositSingleERC1155Token( IERC1155 token, address appContract, uint256 tokenId, uint256 value, bytes calldata baseLayerData, bytes calldata execLayerData) external; + +``` + +Transfer an ERC-1155 token to a dApp and add an input to +the dApp's input box to signal such operation. + +The caller must enable approval for the portal to manage all of their tokens +beforehand, by calling the `setApprovalForAll` function in the token contract. + +#### Parameters + +| Name | Type | Description | +| ------------- | -------- | -------------------------------------------------------- | +| token | IERC1155 | The ERC-1155 token contract | +| appContract | address | The address of the dApp | +| tokenId | uint256 | The identifier of the token being transferred | +| value | uint256 | Transfer amount | +| baseLayerData | bytes | Additional data to be interpreted by the base layer | +| execLayerData | bytes | Additional data to be interpreted by the execution layer | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC20Portal.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC20Portal.md new file mode 100644 index 00000000..df75ab82 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC20Portal.md @@ -0,0 +1,30 @@ +--- +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/portals/ERC20Portal.sol + title: ERC20Portal contract +--- + +The **ERC20Portal** allows anyone to perform transfers of +ERC-20 tokens to a dApp while informing the off-chain machine. + +## `depositERC20Tokens()` + +```solidity +function depositERC20Tokens(IERC20 token, address appContract, uint256 value, bytes calldata execLayerData) external; +``` + +Transfer ERC-20 tokens to a dApp and add an input to +the dApp's input box to signal such operation. + +The caller must allow the portal to withdraw at least `_amount` tokens +from their account beforehand, by calling the `approve` function in the +token contract. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | -------------------------------------------------------- | +| token | IERC20 | The ERC-20 token contract address | +| appContract | address | The address of the dApp | +| value | uint256 | The amount of tokens to be transferred | +| execLayerData | bytes | Additional data to be interpreted by the execution layer | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC721Portal.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC721Portal.md new file mode 100644 index 00000000..abf53dcb --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/ERC721Portal.md @@ -0,0 +1,31 @@ +--- +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/portals/ERC721Portal.sol + title: ERC721Portal contract +--- + +The **ERC721Portal** allows anyone to perform transfers of +ERC-721 tokens to a dApp while informing the off-chain machine. + +## `depositERC721Token()` + +```solidity +function depositERC721Token( IERC721 token, address appContract, uint256 tokenId, bytes baseLayerData, bytes execLayerData) external +``` + +Transfer an ERC-721 token to a dApp and add an input to +the dApp's input box to signal such operation. + +The caller must change the approved address for the ERC-721 token +to the portal address beforehand, by calling the `approve` function in the +token contract. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | -------------------------------------------------------- | +| token | IERC721 | The ERC-721 token contract address | +| appContract | address | The address of the dApp | +| tokenId | uint256 | The identifier of the token being transferred | +| baseLayerData | bytes | Additional data to be interpreted by the base layer | +| execLayerData | bytes | Additional data to be interpreted by the execution layer | diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/EtherPortal.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/EtherPortal.md new file mode 100644 index 00000000..73b58ebf --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/contracts/portals/EtherPortal.md @@ -0,0 +1,26 @@ +--- +resources: + - url: https://github.com/cartesi/rollups-contracts/tree/v2.0.1/src/contracts/portals/EtherPortal.sol + title: EtherPortal contract +--- + +The **EtherPortal** allows anyone to perform transfers of +Ether to a dApp while informing the off-chain machine. + +## `depositEther()` + +```solidity +function depositEther(address appContract, bytes execLayerData) external payable +``` + +Transfer Ether to a dApp and add an input to +the dApp's input box to signal such operation. + +All the value sent through this function is forwarded to the dApp. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | -------------------------------------------------------- | +| appContract | address | The address of the dApp | +| execLayerData | bytes | Additional data to be interpreted by the execution layer | diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/basics.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/basics.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/basics.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/basics.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/_category_.yml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/_category_.yml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/_category_.yml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/_category_.yml diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/deprecated.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/deprecated.mdx similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/deprecated.mdx rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/deprecated.mdx diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/include.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/include.mdx similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/include.mdx rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/include.mdx diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/skip.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/skip.mdx similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/skip.mdx rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/skip.mdx diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/specified-by.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/specified-by.mdx similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/directives/specified-by.mdx rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/directives/specified-by.mdx diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/enums/completion-status.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/enums/completion-status.md new file mode 100644 index 00000000..f8f4b87b --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/enums/completion-status.md @@ -0,0 +1,51 @@ +--- +id: completion-status +title: CompletionStatus +hide_table_of_contents: false +--- + +Represents the status of an input's processing. + +```graphql +enum CompletionStatus { + "Input has not been processed yet" + UNPROCESSED + "Input has been processed and accepted" + ACCEPTED + "Input has been processed and rejected" + REJECTED + "Input processing resulted in an exception" + EXCEPTION + "Input processing was halted by the machine" + MACHINE_HALTED + "Input processing exceeded the cycle limit" + CYCLE_LIMIT_EXCEEDED + "Input processing exceeded the time limit" + TIME_LIMIT_EXCEEDED + "Input processing exceeded the payload length limit" + PAYLOAD_LENGTH_LIMIT_EXCEEDED +} +``` + +## Values + +| Value | Description | +| ----- | ----------- | +| `UNPROCESSED` | Input has not been processed yet. | +| `ACCEPTED` | Input has been processed and accepted. | +| `REJECTED` | Input has been processed and rejected. | +| `EXCEPTION` | Input processing resulted in an exception. | +| `MACHINE_HALTED` | Input processing was halted by the machine. | +| `CYCLE_LIMIT_EXCEEDED` | Input processing exceeded the cycle limit. | +| `TIME_LIMIT_EXCEEDED` | Input processing exceeded the time limit. | +| `PAYLOAD_LENGTH_LIMIT_EXCEEDED` | Input processing exceeded the payload length limit. | + +## Example Query + +```graphql +query { + input(id: "1") { + status + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/_category_.yml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/_category_.yml new file mode 100644 index 00000000..977b78ae --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/_category_.yml @@ -0,0 +1,4 @@ +label: 'Filters' +position: 6 +collapsible: true +collapsed: false \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/application-filter.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/application-filter.md new file mode 100644 index 00000000..86dcdad9 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/application-filter.md @@ -0,0 +1,139 @@ +--- +title: Application Filter +description: Documentation for filtering applications in Cartesi Rollups GraphQL API +keywords: [graphql, filter, application, query] +--- + +# Application Filter + +The Application Filter enables you to query and filter applications in the Cartesi Rollups GraphQL API. You can filter applications based on their address and other properties. + +## Structure + +The Application Filter provides the following filter options: + +```graphql +input ApplicationFilter { + address: AddressFilterInput +} + +input AddressFilterInput { + eq: String + in: [String!] + not: AddressFilterInput + notIn: [String!] +} +``` + +## Usage Examples + +### Filter by Application Address + +```graphql +query { + applications( + filter: { + address: { + eq: "0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C" + } + } + ) { + edges { + node { + address + inputs { + totalCount + } + reports { + totalCount + } + } + } + } +} +``` + +### Filter by Multiple Addresses + +```graphql +query { + applications( + filter: { + address: { + in: [ + "0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C", + "0x59b670e9fA9D0A427751Af201D676719a970857b" + ] + } + } + ) { + edges { + node { + address + inputs { + totalCount + } + notices { + totalCount + } + vouchers { + totalCount + } + } + } + } +} +``` + +### Exclude Specific Applications + +```graphql +query { + applications( + filter: { + address: { + notIn: [ + "0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C", + "0x59b670e9fA9D0A427751Af201D676719a970857b" + ] + } + } + ) { + edges { + node { + address + } + } + } +} +``` + +## Available Filter Types + +### AddressFilterInput +- `eq`: Equal to a specific address +- `in`: In array of addresses +- `not`: Not equal to a specific address +- `notIn`: Not in array of addresses + +## Best Practices + +1. **Address Format**: + - Always use checksummed Ethereum addresses + - Ensure addresses are properly formatted (0x prefix + 40 hexadecimal characters) + +2. **Query Optimization**: + - Use specific address filters when possible + - Consider using `in` filter for multiple addresses instead of separate queries + +3. **Pagination**: + - Implement pagination when querying multiple applications + - Use appropriate page sizes based on your application's needs + +4. **Error Handling**: + - Validate address format before querying + - Handle cases where no applications match the filter criteria + +5. **Security Considerations**: + - Validate and sanitize address inputs + - Implement appropriate access controls for sensitive application data \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/convenient-filter.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/convenient-filter.md new file mode 100644 index 00000000..17ee8fd9 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/convenient-filter.md @@ -0,0 +1,189 @@ +--- +id: convenient-filter +title: Convenient Filter +hide_table_of_contents: false +--- + +The ConvenientFilter provides a flexible way to filter vouchers and DELEGATECALL vouchers based on various criteria. It supports filtering by destination address, execution status, and complex logical operations. + +## Filter Structure + +```graphql +input ConvenientFilter { + destination: AddressFilterInput + executed: BooleanFilterInput + and: [ConvenientFilter] + or: [ConvenientFilter] +} +``` + +### Address Filter Input + +The `AddressFilterInput` allows filtering by Ethereum addresses: + +```graphql +input AddressFilterInput { + eq: String # Equal to + ne: String # Not equal to + in: [String] # In array of addresses + nin: [String] # Not in array of addresses + and: [ConvenientFilter] + or: [ConvenientFilter] +} +``` + +### Boolean Filter Input + +The `BooleanFilterInput` enables filtering by boolean values: + +```graphql +input BooleanFilterInput { + eq: Boolean # Equal to + ne: Boolean # Not equal to + and: [ConvenientFilter] + or: [ConvenientFilter] +} +``` + +## Usage Examples + +### 1. Filter by Destination Address + +```graphql +query { + vouchers( + filter: [ + { + destination: { + eq: "0x1234567890123456789012345678901234567890" + } + } + ] + ) { + edges { + node { + index + destination + executed + } + } + } +} +``` + +### 2. Filter by Execution Status + +```graphql +query { + delegateCallVouchers( + filter: [ + { + executed: { + eq: false + } + } + ] + ) { + edges { + node { + index + destination + executed + } + } + } +} +``` + +### 3. Complex Filter with Logical Operators + +```graphql +query { + vouchers( + filter: [ + { + and: [ + { + destination: { + eq: "0x1234567890123456789012345678901234567890" + } + }, + { + executed: { + eq: false + } + } + ] + } + ] + ) { + edges { + node { + index + destination + executed + } + } + } +} +``` + +### 4. Filter with Multiple Addresses + +```graphql +query { + delegateCallVouchers( + filter: [ + { + destination: { + in: [ + "0x1234567890123456789012345678901234567890", + "0x0987654321098765432109876543210987654321" + ] + } + } + ] + ) { + edges { + node { + index + destination + executed + } + } + } +} +``` + +## Available Filters by Type + +### Vouchers and DELEGATECALL Vouchers +- `destination`: Filter by the destination address +- `executed`: Filter by execution status + +### Input Filter +```graphql +input InputFilter { + indexLowerThan: Int # Filter inputs with index lower than value + indexGreaterThan: Int # Filter inputs with index greater than value + msgSender: String # Filter by message sender address + type: String # Filter by input type ('inputbox' or 'espresso') +} +``` + +### Application Filter +```graphql +input AppFilter { + indexLowerThan: Int # Filter apps with index lower than value + indexGreaterThan: Int # Filter apps with index greater than value + name: String # Filter by application name + address: String # Filter by application address +} +``` + +## Best Practices + +1. **Performance**: When using filters, try to be as specific as possible to improve query performance. +2. **Logical Operators**: Use `and` and `or` operators judiciously to create precise filter conditions. +3. **Address Format**: Always use the full 20-byte Ethereum address format starting with '0x'. +4. **Pagination**: Consider using filters in combination with pagination for better performance when dealing with large datasets. \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/input-filter.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/input-filter.md new file mode 100644 index 00000000..d68f93d7 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/filters/input-filter.md @@ -0,0 +1,178 @@ +--- +title: Input Filter +description: Documentation for filtering inputs in Cartesi Rollups GraphQL API +keywords: [graphql, filter, input, query] +--- + +# Input Filter + +The Input Filter allows you to query and filter inputs in the Cartesi Rollups GraphQL API. You can filter inputs based on various criteria such as input index, metadata, and timestamp. + +## Structure + +The Input Filter provides the following filter options: + +```graphql +input InputFilter { + index: BigIntFilterInput + metadata: MetadataFilterInput + timestamp: DateTimeFilterInput +} + +input MetadataFilterInput { + blockNumber: BigIntFilterInput + blockTimestamp: DateTimeFilterInput + epochIndex: BigIntFilterInput + inputIndex: BigIntFilterInput +} + +input BigIntFilterInput { + eq: String + gt: String + gte: String + in: [String!] + lt: String + lte: String + not: BigIntFilterInput + notIn: [String!] +} + +input DateTimeFilterInput { + eq: DateTime + gt: DateTime + gte: DateTime + in: [DateTime!] + lt: DateTime + lte: DateTime + not: DateTimeFilterInput + notIn: [DateTime!] +} +``` + +## Usage Examples + +### Filter by Input Index + +```graphql +query { + inputs( + filter: { + index: { + eq: "42" + } + } + ) { + edges { + node { + index + metadata { + blockNumber + blockTimestamp + } + } + } + } +} +``` + +### Filter by Block Number Range + +```graphql +query { + inputs( + filter: { + metadata: { + blockNumber: { + gte: "1000000" + lt: "1000100" + } + } + } + ) { + edges { + node { + index + metadata { + blockNumber + blockTimestamp + } + } + } + } +} +``` + +### Filter by Timestamp + +```graphql +query { + inputs( + filter: { + timestamp: { + gte: "2024-01-01T00:00:00Z" + lt: "2024-02-01T00:00:00Z" + } + } + ) { + edges { + node { + index + timestamp + metadata { + blockNumber + blockTimestamp + } + } + } + } +} +``` + +## Available Filter Types + +### BigIntFilterInput +- `eq`: Equal to +- `gt`: Greater than +- `gte`: Greater than or equal to +- `lt`: Less than +- `lte`: Less than or equal to +- `in`: In array of values +- `not`: Not equal to +- `notIn`: Not in array of values + +### DateTimeFilterInput +- `eq`: Equal to +- `gt`: Greater than +- `gte`: Greater than or equal to +- `lt`: Less than +- `lte`: Less than or equal to +- `in`: In array of values +- `not`: Not equal to +- `notIn`: Not in array of values + +### MetadataFilterInput +- `blockNumber`: Filter by block number +- `blockTimestamp`: Filter by block timestamp +- `epochIndex`: Filter by epoch index +- `inputIndex`: Filter by input index + +## Best Practices + +1. **Use Pagination**: When querying large datasets, always use pagination to limit the number of results returned. + +2. **Optimize Query Performance**: + - Use specific filters to narrow down results + - Combine multiple filters when possible + - Avoid overly broad date ranges + +3. **Date Format**: + - Use ISO 8601 format for dates (YYYY-MM-DDTHH:mm:ssZ) + - Consider timezone implications when filtering by timestamp + +4. **Index Usage**: + - Filter by index when possible, as it's the most efficient way to query + - Use index ranges for better performance + +5. **Error Handling**: + - Validate input values before querying + - Handle null or undefined values appropriately \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/generated.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/generated.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/generated.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/generated.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/_category_.yml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/_category_.yml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/_category_.yml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/_category_.yml diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-connection.md new file mode 100644 index 00000000..048cce38 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-connection.md @@ -0,0 +1,49 @@ +--- +id: app-connection +title: AppConnection +hide_table_of_contents: false +--- + +Represents a paginated list of applications. + +```graphql +type AppConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [AppEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[AppEdge!]!`](../../objects/app-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + applications(first: 10) { + totalCount + edges { + node { + address + name + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-edge.md new file mode 100644 index 00000000..35bf1055 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/app-edge.md @@ -0,0 +1,40 @@ +--- +id: app-edge +title: AppEdge +hide_table_of_contents: false +--- + +Represents a single application in a paginated list. + +```graphql +type AppEdge { + "The application at this edge" + node: Application! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`Application!`](../../objects/application) | The application at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + applications(first: 10) { + edges { + node { + id + name + address + } + cursor + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/application.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/application.md new file mode 100644 index 00000000..4a2dc21b --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/application.md @@ -0,0 +1,38 @@ +--- +id: application +title: Application +hide_table_of_contents: false +--- + +Represents a Cartesi Rollups application. + +```graphql +type Application { + "Application ID" + id: String! + "Application name" + name: String! + "Application Address" + address: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `id` | [`String!`](../../scalars/string) | Application ID. | +| `name` | [`String!`](../../scalars/string) | Application name. | +| `address` | [`String!`](../../scalars/string) | Application Address. | + +## Example Query + +```graphql +query { + application(id: "0x123...") { + id + name + address + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/completion-status.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/completion-status.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/completion-status.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/completion-status.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-connection.md new file mode 100644 index 00000000..384a38d9 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-connection.md @@ -0,0 +1,52 @@ +--- +id: delegate-call-voucher-connection +title: DelegateCallVoucherConnection +hide_table_of_contents: false +--- + +Represents a paginated list of DELEGATECALL vouchers. + +```graphql +type DelegateCallVoucherConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [DelegateCallVoucherEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[DelegateCallVoucherEdge!]!`](../../objects/delegate-call-voucher-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + delegateCallVouchers(first: 10) { + totalCount + edges { + node { + index + destination + payload + executed + transactionHash + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-edge.md new file mode 100644 index 00000000..ea174559 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher-edge.md @@ -0,0 +1,42 @@ +--- +id: delegate-call-voucher-edge +title: DelegateCallVoucherEdge +hide_table_of_contents: false +--- + +Represents a single DELEGATECALL voucher in a paginated list. + +```graphql +type DelegateCallVoucherEdge { + "The DELEGATECALL voucher at this edge" + node: DelegateCallVoucher! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`DelegateCallVoucher!`](../../objects/delegate-call-voucher) | The DELEGATECALL voucher at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + delegateCallVouchers(first: 10) { + edges { + node { + index + destination + payload + executed + transactionHash + } + cursor + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher.md new file mode 100644 index 00000000..a9dc9b80 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/delegate-call-voucher.md @@ -0,0 +1,66 @@ +--- +id: delegate-call-voucher +title: DelegateCallVoucher +hide_table_of_contents: false +--- + +Represents a DELEGATECALL voucher in a Cartesi Rollups application. + +```graphql +type DelegateCallVoucher { + "Voucher index within the context of the input that produced it" + index: Int! + "Input whose processing produced the voucher" + input: Input! + "Transaction destination address in Ethereum hex binary format (20 bytes), starting with '0x'" + destination: String! + "Transaction payload in Ethereum hex binary format, starting with '0x'" + payload: String! + "Proof object that allows this voucher to be validated and executed on the base layer blockchain" + proof: Proof + "Indicates whether the voucher has been executed on the base layer blockchain" + executed: Boolean + "The hash of executed transaction" + transactionHash: String + "The application that produced the delegateed voucher" + application: Application! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `index` | [`Int!`](../../scalars/int) | Voucher index within the context of the input that produced it. | +| `input` | [`Input!`](../../objects/input) | Input whose processing produced the voucher. | +| `destination` | [`String!`](../../scalars/string) | Transaction destination address in Ethereum hex binary format (20 bytes), starting with '0x'. | +| `payload` | [`String!`](../../scalars/string) | Transaction payload in Ethereum hex binary format, starting with '0x'. | +| `proof` | [`Proof`](../../objects/proof) | Proof object that allows this voucher to be validated and executed on the base layer blockchain. | +| `executed` | [`Boolean`](../../scalars/boolean) | Indicates whether the voucher has been executed on the base layer blockchain. | +| `transactionHash` | [`String`](../../scalars/string) | The hash of executed transaction. | +| `application` | [`Application!`](../../objects/application) | The application that produced the delegateed voucher. | + +## Example Query + +```graphql +query { + delegateCallVoucher(outputIndex: 1) { + index + input { + index + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-connection.md new file mode 100644 index 00000000..cabf1f83 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-connection.md @@ -0,0 +1,52 @@ +--- +id: input-connection +title: InputConnection +hide_table_of_contents: false +--- + +Represents a paginated list of inputs. + +```graphql +type InputConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [InputEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[InputEdge!]!`](../../objects/input-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + inputs(first: 10) { + totalCount + edges { + node { + id + index + status + msgSender + payload + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-edge.md new file mode 100644 index 00000000..2f500b71 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input-edge.md @@ -0,0 +1,42 @@ +--- +id: input-edge +title: InputEdge +hide_table_of_contents: false +--- + +Represents a single input in a paginated list. + +```graphql +type InputEdge { + "The input at this edge" + node: Input! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`Input!`](../../objects/input) | The input at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + inputs(first: 10) { + edges { + node { + id + index + status + msgSender + payload + } + cursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input.md new file mode 100644 index 00000000..a04ba1cf --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/input.md @@ -0,0 +1,122 @@ +--- +id: input +title: Input +hide_table_of_contents: false +--- + +Request submitted to the application to advance its state. + +```graphql +type Input { + "id of the input" + id: String! + "Input index starting from genesis" + index: Int! + "Status of the input" + status: CompletionStatus! + "Address responsible for submitting the input" + msgSender: String! + "Timestamp associated with the input submission, as defined by the base layer's block in which it was recorded" + timestamp: BigInt! @deprecated(reason: "Use `blockTimestamp` instead") + "Number of the base layer block in which the input was recorded" + blockNumber: BigInt! + "Input payload in Ethereum hex binary format, starting with '0x'" + payload: String! + "Get vouchers from this particular input with support for pagination" + vouchers(first: Int, last: Int, after: String, before: String): VoucherConnection! + "Get DELEGATECALL vouchers from this particular input with support for pagination" + delegateCallVouchers(first: Int, last: Int, after: String, before: String): DelegateCallVoucherConnection! + "Get notices from this particular input with support for pagination" + notices(first: Int, last: Int, after: String, before: String): NoticeConnection! + "Get reports from this particular input with support for pagination" + reports(first: Int, last: Int, after: String, before: String): ReportConnection! + "Timestamp associated with the Espresso input submission" + espressoTimestamp: String @deprecated(reason: "Will be removed") + "Number of the Espresso block in which the input was recorded" + espressoBlockNumber: String @deprecated(reason: "Will be removed") + "Input index in the Input Box" + inputBoxIndex: String + "Block timestamp" + blockTimestamp: BigInt + "Previous RANDAO value" + prevRandao: String + "The application that produced the input" + application: Application! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `id` | [`String!`](../../scalars/string) | ID of the input. | +| `index` | [`Int!`](../../scalars/int) | Input index starting from genesis. | +| `status` | [`CompletionStatus!`](../../enums/completion-status) | Status of the input. | +| `msgSender` | [`String!`](../../scalars/string) | Address responsible for submitting the input. | +| `timestamp` | [`BigInt!`](../../scalars/bigint) | Timestamp associated with the input submission, as defined by the base layer's block in which it was recorded. | +| `blockNumber` | [`BigInt!`](../../scalars/bigint) | Number of the base layer block in which the input was recorded. | +| `payload` | [`String!`](../../scalars/string) | Input payload in Ethereum hex binary format, starting with '0x'. | +| `vouchers` | [`VoucherConnection!`](../../objects/voucher-connection) | Get vouchers from this particular input with support for pagination. | +| `delegateCallVouchers` | [`DelegateCallVoucherConnection!`](../../objects/delegate-call-voucher-connection) | Get DELEGATECALL vouchers from this particular input with support for pagination. | +| `notices` | [`NoticeConnection!`](../../objects/notice-connection) | Get notices from this particular input with support for pagination. | +| `reports` | [`ReportConnection!`](../../objects/report-connection) | Get reports from this particular input with support for pagination. | +| `espressoTimestamp` | [`String`](../../scalars/string) | Timestamp associated with the Espresso input submission. | +| `espressoBlockNumber` | [`String`](../../scalars/string) | Number of the Espresso block in which the input was recorded. | +| `inputBoxIndex` | [`String`](../../scalars/string) | Input index in the Input Box. | +| `blockTimestamp` | [`BigInt`](../../scalars/bigint) | Block timestamp. | +| `prevRandao` | [`String`](../../scalars/string) | Previous RANDAO value. | +| `application` | [`Application!`](../../objects/application) | The application that produced the input. | + +## Example Query + +```graphql +query { + input(outputIndex: 1) { + id + index + status + msgSender + timestamp + blockNumber + payload + vouchers(first: 10) { + edges { + node { + index + destination + payload + } + } + } + delegateCallVouchers(first: 10) { + edges { + node { + index + destination + payload + } + } + } + notices(first: 10) { + edges { + node { + index + payload + } + } + } + reports(first: 10) { + edges { + node { + index + payload + } + } + } + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-connection.md new file mode 100644 index 00000000..4e6117cd --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-connection.md @@ -0,0 +1,53 @@ +--- +id: notice-connection +title: NoticeConnection +hide_table_of_contents: false +--- + +Represents a paginated list of notices. + +```graphql +type NoticeConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [NoticeEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[NoticeEdge!]!`](../../objects/notice-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + notices(first: 10) { + totalCount + edges { + node { + index + payload + proof { + outputIndex + outputHashesSiblings + } + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-edge.md new file mode 100644 index 00000000..63188fb6 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice-edge.md @@ -0,0 +1,43 @@ +--- +id: notice-edge +title: NoticeEdge +hide_table_of_contents: false +--- + +Represents a single notice in a paginated list. + +```graphql +type NoticeEdge { + "The notice at this edge" + node: Notice! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`Notice!`](../../objects/notice) | The notice at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + notices(first: 10) { + edges { + node { + index + payload + proof { + outputIndex + outputHashesSiblings + } + } + cursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice.md new file mode 100644 index 00000000..165b9566 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/notice.md @@ -0,0 +1,54 @@ +--- +id: notice +title: Notice +hide_table_of_contents: false +--- + +Informational statement that can be validated in the base layer blockchain. + +```graphql +type Notice { + "Notice index within the context of the input that produced it" + index: Int! + "Input whose processing produced the notice" + input: Input! + "Notice data as a payload in Ethereum hex binary format, starting with '0x'" + payload: String! + "Proof object that allows this notice to be validated by the base layer blockchain" + proof: Proof + "The application that produced the notice" + application: Application! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `index` | [`Int!`](../../scalars/int) | Notice index within the context of the input that produced it. | +| `input` | [`Input!`](../../objects/input) | Input whose processing produced the notice. | +| `payload` | [`String!`](../../scalars/string) | Notice data as a payload in Ethereum hex binary format, starting with '0x'. | +| `proof` | [`Proof`](../../objects/proof) | Proof object that allows this notice to be validated by the base layer blockchain. | +| `application` | [`Application!`](../../objects/application) | The application that produced the notice. | + +## Example Query + +```graphql +query { + notice(outputIndex: 1) { + index + input { + index + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/output-validity-proof.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/output-validity-proof.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/output-validity-proof.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/output-validity-proof.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/page-info.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/page-info.md similarity index 53% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/page-info.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/page-info.md index 94dd9a8f..589cc713 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/objects/page-info.md +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/page-info.md @@ -4,26 +4,41 @@ title: PageInfo hide_table_of_contents: false --- - Page metadata for the cursor-based Connection pagination pattern. ```graphql type PageInfo { + "Cursor pointing to the first entry of the page" startCursor: String + "Cursor pointing to the last entry of the page" endCursor: String + "Indicates if there are additional entries after the end cursor" hasNextPage: Boolean! + "Indicates if there are additional entries before the start cursor" hasPreviousPage: Boolean! } ``` - ## Fields | Name | Type | Description | -| ---- | ---- | ----------- | +| ---- |------| ----------- | | `startCursor` | [`String`](../../scalars/string) | Cursor pointing to the first entry of the page. | | `endCursor` | [`String`](../../scalars/string) | Cursor pointing to the last entry of the page. | -| `hasNextPage` | [`Boolean!`](../../scalars/boolean) | Indicates if there are more pages after the current one. | -| `hasPreviousPage` | [`Boolean!`](../../scalars/boolean) | Indicates if there are previous pages before the current one. | +| `hasNextPage` | [`Boolean!`](../../scalars/boolean) | Indicates if there are additional entries after the end cursor. | +| `hasPreviousPage` | [`Boolean!`](../../scalars/boolean) | Indicates if there are additional entries before the start cursor. | +## Example Query +```graphql +query { + inputs(first: 10) { + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/proof.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/proof.md new file mode 100644 index 00000000..57f3f671 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/proof.md @@ -0,0 +1,36 @@ +--- +id: proof +title: Proof +hide_table_of_contents: false +--- + +Data that can be used as proof to validate notices and execute vouchers on the base layer blockchain. + +```graphql +type Proof { + "Index of the output in the output box" + outputIndex: BigInt! + "Array of sibling hashes in the output box merkle tree" + outputHashesSiblings: [String]! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `outputIndex` | [`BigInt!`](../../scalars/bigint) | Index of the output in the output box. | +| `outputHashesSiblings` | [`[String]!`](../../scalars/string) | Array of sibling hashes in the output box merkle tree. | + +## Example Query + +```graphql +query { + voucher(outputIndex: 1) { + proof { + outputIndex + outputHashesSiblings + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-connection.md new file mode 100644 index 00000000..c7c90c0c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-connection.md @@ -0,0 +1,49 @@ +--- +id: report-connection +title: ReportConnection +hide_table_of_contents: false +--- + +Represents a paginated list of reports. + +```graphql +type ReportConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [ReportEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[ReportEdge!]!`](../../objects/report-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + reports(first: 10) { + totalCount + edges { + node { + index + payload + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-edge.md new file mode 100644 index 00000000..91959d2f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report-edge.md @@ -0,0 +1,39 @@ +--- +id: report-edge +title: ReportEdge +hide_table_of_contents: false +--- + +Represents a single report in a paginated list. + +```graphql +type ReportEdge { + "The report at this edge" + node: Report! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`Report!`](../../objects/report) | The report at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + reports(first: 10) { + edges { + node { + index + payload + } + cursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report.md new file mode 100644 index 00000000..8d8fd8f5 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/report.md @@ -0,0 +1,47 @@ +--- +id: report +title: Report +hide_table_of_contents: false +--- + +Application log or diagnostic information. + +```graphql +type Report { + "Report index within the context of the input that produced it" + index: Int! + "Input whose processing produced the report" + input: Input! + "Report data as a payload in Ethereum hex binary format, starting with '0x'" + payload: String! + "The application that produced the report" + application: Application! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `index` | [`Int!`](../../scalars/int) | Report index within the context of the input that produced it. | +| `input` | [`Input!`](../../objects/input) | Input whose processing produced the report. | +| `payload` | [`String!`](../../scalars/string) | Report data as a payload in Ethereum hex binary format, starting with '0x'. | +| `application` | [`Application!`](../../objects/application) | The application that produced the report. | + +## Example Query + +```graphql +query { + report(reportIndex: 1) { + index + input { + index + } + payload + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-connection.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-connection.md new file mode 100644 index 00000000..1f7eaec2 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-connection.md @@ -0,0 +1,53 @@ +--- +id: voucher-connection +title: VoucherConnection +hide_table_of_contents: false +--- + +Represents a paginated list of vouchers. + +```graphql +type VoucherConnection { + "Total number of entries that match the query" + totalCount: Int! + "List of edges in the connection" + edges: [VoucherEdge!]! + "Information about the current page" + pageInfo: PageInfo! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `totalCount` | [`Int!`](../../scalars/int) | Total number of entries that match the query. | +| `edges` | [`[VoucherEdge!]!`](../../objects/voucher-edge) | List of edges in the connection. | +| `pageInfo` | [`PageInfo!`](../../objects/page-info) | Information about the current page. | + +## Example Query + +```graphql +query { + vouchers(first: 10) { + totalCount + edges { + node { + index + destination + payload + value + executed + transactionHash + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-edge.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-edge.md new file mode 100644 index 00000000..0e5a8e8a --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher-edge.md @@ -0,0 +1,43 @@ +--- +id: voucher-edge +title: VoucherEdge +hide_table_of_contents: false +--- + +Represents a single voucher in a paginated list. + +```graphql +type VoucherEdge { + "The voucher at this edge" + node: Voucher! + "A cursor for use in pagination" + cursor: String! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `node` | [`Voucher!`](../../objects/voucher) | The voucher at this edge. | +| `cursor` | [`String!`](../../scalars/string) | A cursor for use in pagination. | + +## Example Query + +```graphql +query { + vouchers(first: 10) { + edges { + node { + index + destination + payload + value + executed + transactionHash + } + cursor + } + } +} +``` diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher.md new file mode 100644 index 00000000..b2959d38 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/objects/voucher.md @@ -0,0 +1,70 @@ +--- +id: voucher +title: Voucher +hide_table_of_contents: false +--- + +Representation of a transaction that can be carried out on the base layer blockchain, such as a transfer of assets. + +```graphql +type Voucher { + "Voucher index within the context of the input that produced it" + index: Int! + "Input whose processing produced the voucher" + input: Input! + "Transaction destination address in Ethereum hex binary format (20 bytes), starting with '0x'" + destination: String! + "Transaction payload in Ethereum hex binary format, starting with '0x'" + payload: String! + "Proof object that allows this voucher to be validated and executed on the base layer blockchain" + proof: Proof + "Value to be sent with the transaction" + value: BigInt + "Indicates whether the voucher has been executed on the base layer blockchain" + executed: Boolean + "The hash of executed transaction" + transactionHash: String + "The application that produced the voucher" + application: Application! +} +``` + +## Fields + +| Name | Type | Description | +| ---- |------| ----------- | +| `index` | [`Int!`](../../scalars/int) | Voucher index within the context of the input that produced it. | +| `input` | [`Input!`](../../objects/input) | Input whose processing produced the voucher. | +| `destination` | [`String!`](../../scalars/string) | Transaction destination address in Ethereum hex binary format (20 bytes), starting with '0x'. | +| `payload` | [`String!`](../../scalars/string) | Transaction payload in Ethereum hex binary format, starting with '0x'. | +| `proof` | [`Proof`](../../objects/proof) | Proof object that allows this voucher to be validated and executed on the base layer blockchain. | +| `value` | [`BigInt`](../../scalars/bigint) | Value to be sent with the transaction. | +| `executed` | [`Boolean`](../../scalars/boolean) | Indicates whether the voucher has been executed on the base layer blockchain. | +| `transactionHash` | [`String`](../../scalars/string) | The hash of executed transaction. | +| `application` | [`Application!`](../../objects/application) | The application that produced the voucher. | + +## Example Query + +```graphql +query { + voucher(address: "0x123...") { + index + input { + index + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/_category_.yml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/_category_.yml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/_category_.yml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/_category_.yml diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/delegate-call-vouchers.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/delegate-call-vouchers.md new file mode 100644 index 00000000..af292c50 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/delegate-call-vouchers.md @@ -0,0 +1,291 @@ +--- +id: delegate-call-vouchers +title: DELEGATECALL Vouchers +hide_table_of_contents: false +--- + +DELEGATECALL Vouchers are an extension of vouchers that enables DELEGATECALL operations to be executed on the base layer blockchain. While they share similarities with regular vouchers, they are specifically designed for DELEGATECALL operations, allowing for more flexible contract interactions. + +## 1. Get DELEGATECALL Voucher by Index + +Retrieve a specific DELEGATECALL voucher based on its output index. + +```graphql +query delegateCallVoucher($outputIndex: Int!) { + delegateCallVoucher(outputIndex: $outputIndex) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } +} +``` + +For DELEGATECALL vouchers, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](../objects/proof.md) field on DELEGATECALL voucher objects. + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `outputIndex` | [`Int!`](../../scalars/int) | The index of the DELEGATECALL voucher to retrieve. | + +### Response Type + +[`DelegateCallVoucher`](../../objects/delegate-call-voucher) + +## 2. Get DELEGATECALL Vouchers + +Retrieve a list of DELEGATECALL vouchers with support for pagination. + +```graphql +query delegateCallVouchers($first: Int, $after: String, $filter: [ConvenientFilter]) { + delegateCallVouchers(first: $first, after: $after, filter: $filter) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `first` | [`Int`](../../scalars/int) | Number of DELEGATECALL vouchers to retrieve (for pagination). | +| `after` | [`String`](../../scalars/string) | Cursor to start retrieving DELEGATECALL vouchers from (for pagination). | +| `filter` | [`[ConvenientFilter]`](../../filters/convenient-filter) | Optional filters to apply to the query. | + +### Response Type + +[`DelegateCallVoucherConnection`](../../objects/delegate-call-voucher-connection) + +## 3. Get DELEGATECALL Vouchers by Input + +Retrieve DELEGATECALL vouchers associated with a specific input. + +```graphql +query delegateCallVouchersByInput($inputIndex: Int!, $first: Int, $after: String) { + input(index: $inputIndex) { + delegateCallVouchers(first: $first, after: $after) { + edges { + node { + index + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } +} +``` + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input to retrieve DELEGATECALL vouchers for. | +| `first` | [`Int`](../../scalars/int) | Number of DELEGATECALL vouchers to retrieve (for pagination). | +| `after` | [`String`](../../scalars/string) | Cursor to start retrieving DELEGATECALL vouchers from (for pagination). | + +### Response Type + +[`DelegateCallVoucherConnection`](../../objects/delegate-call-voucher-connection) + +## Examples + +1. Fetching a specific DELEGATECALL voucher: + +```graphql +query { + delegateCallVoucher(outputIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } +} +``` + +2. Listing earlier(first 5) DELEGATECALL vouchers with filter: + +```graphql +query { + delegateCallVouchers( + first: 5 + filter: [ + { + destination: { eq: "0x1234567890123456789012345678901234567890" } + executed: { eq: false } + } + ] + ) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +3. Retrieving DELEGATECALL vouchers for a specific input: + +```graphql +query { + input(index: 10) { + delegateCallVouchers(first: 3) { + edges { + node { + index + destination + payload + proof { + outputIndex + outputHashesSiblings + } + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/inputs.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/inputs.md similarity index 52% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/inputs.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/inputs.md index 1b46ff0c..01934949 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/inputs.md +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/inputs.md @@ -13,12 +13,19 @@ Retrieve a specific input based on its identifier. ```graphql query getInput($inputIndex: Int!) { input(index: $inputIndex) { + id index status - timestamp msgSender + blockTimestamp blockNumber payload + inputBoxIndex + prevRandao + application { + address + name + } } } ``` @@ -55,13 +62,21 @@ query inputs( ) { edges { node { + id index status - timestamp msgSender + blockTimestamp blockNumber payload + inputBoxIndex + prevRandao + application { + address + name + } } + cursor } pageInfo { hasNextPage @@ -81,7 +96,7 @@ query inputs( | `last` | [`Int`](../../scalars/int) | Get at most the last `n` entries (backward pagination). | | `after` | [`String`](../../scalars/string) | Get entries after the provided cursor (forward pagination). | | `before` | [`String`](../../scalars/string) | Get entries before the provided cursor (backward pagination). | -| `where` | [`InputFilter`](../../inputs/input-filter) | Filter criteria for inputs. | +| `where` | [`InputFilter`](../../filters/input-filter) | Filter criteria for inputs. | ### Response Type @@ -93,7 +108,7 @@ query inputs( - You cannot mix forward pagination (`first`, `after`) with backward pagination (`last`, `before`) in the same query. -- The `where` argument allows you to filter inputs based the [`InputFilter`](../../inputs/input-filter). +- The `where` argument allows you to filter inputs based the [`InputFilter`](../../filters/input-filter). - When using `where` with `after` or `before`, the filter is applied first, and then the pagination is applied to the filtered results. ::: @@ -107,42 +122,80 @@ Retrieve the result of a specific input, including its associated notices, vouch ```graphql query getInputResult($inputIndex: Int!) { input(index: $inputIndex) { + id + index status - timestamp msgSender + blockTimestamp blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } reports { edges { node { index - input { - index - } payload + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } notices { edges { node { index - input { - index - } payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } vouchers { edges { node { index - input { - index - } destination payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } } @@ -168,12 +221,19 @@ query getInputResult($inputIndex: Int!) { ```graphql query { input(index: 5) { + id index status - timestamp msgSender + blockTimestamp blockNumber payload + inputBoxIndex + prevRandao + application { + address + name + } } } ``` @@ -185,12 +245,21 @@ query getInputResult($inputIndex: Int!) { inputs(first: 5) { edges { node { + id index status - timestamp msgSender + blockTimestamp + blockNumber payload + inputBoxIndex + prevRandao + application { + address + name + } } + cursor } pageInfo { hasNextPage @@ -205,14 +274,38 @@ query getInputResult($inputIndex: Int!) { ```graphql query { input(index: 10) { + id + index status - timestamp + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } notices { edges { node { index payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } vouchers { @@ -221,7 +314,23 @@ query getInputResult($inputIndex: Int!) { index destination payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } } @@ -235,11 +344,98 @@ query getInputResult($inputIndex: Int!) { inputs(first: 5, where: { indexLowerThan: 1 }) { edges { node { + id index status - timestamp msgSender + blockTimestamp + blockNumber payload + inputBoxIndex + prevRandao + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } + ``` + +5. Listing inputs with application information: + + ```graphql + query { + inputs(first: 10) { + edges { + node { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + } + } + } + ``` + +6. Retrieving a specific input with application information: + + ```graphql + query { + input(outputIndex: 1) { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + } + ``` + +7. Listing inputs with application information and cursor: + + ```graphql + query { + inputs(first: 10) { + edges { + node { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } } pageInfo { diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/notices.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/notices.md new file mode 100644 index 00000000..abc5c2c8 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/notices.md @@ -0,0 +1,337 @@ +--- +id: notices +title: Notices +hide_table_of_contents: false +--- + +Notices are informational statements that can be validated in the base layer blockchain. + +## 1. Get Notice by Index + +Retrieve a specific notice based on its index and associated input index. + +```graphql +query notice($outputIndex: Int!) { + notice(outputIndex: $outputIndex) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } +} +``` + +For notices, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](../objects/proof.md) field on notice objects. + +### Arguments + +| Name | Type | Description | +| ------------ | --------------------------- | ---------------------------------------------- | +| `outputIndex` | [`Int!`](../../scalars/int) | Index of the notice to retrieve. | + +### Response Type + +[`Notice`](../../objects/notice) + +## 2. Get Notices + +Retrieve a list of notices with support for pagination. + +```graphql +query notices { + notices { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +### Arguments + +None + +### Response Type + +[`NoticeConnection`](../../objects/notice-connection) + +## 3. Get Notices by Input + +Retrieve notices associated with a specific input. + +```graphql +query noticesByInput($inputIndex: Int!) { + input(index: $inputIndex) { + notices { + edges { + node { + index + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } +} +``` + +### Arguments + +| Name | Type | Description | +| ------------ | --------------------------- | ------------------------------------------- | +| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input to retrieve notices for. | + +### Response Type + +[`NoticeConnection`](../../objects/notice-connection) + + +## Examples + +1. Fetching a specific notice: + +```graphql +query { + notice(outputIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } +} +``` + +2. Listing earlier(first 5) notices: + +```graphql +query { + notices(first: 5) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +3. Retrieving notices for a specific input: + +```graphql +query { + input(index: 10) { + notices(first: 3) { + edges { + node { + index + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } +} +``` + +4. Listing notices with proof data and application information: + +```graphql +query { + notices(first: 10) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +5. Fetching a specific notice by output index: + +```graphql +query { + notice(outputIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + proof { + outputIndex + outputHashesSiblings + } + application { + address + name + } + } +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/reports.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/reports.md similarity index 50% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/reports.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/reports.md index 057cb383..bef2f49c 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/queries/reports.md +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/reports.md @@ -11,17 +11,29 @@ Reports contain application logs or diagnostic information and cannot be validat Retrieve a specific report based on its index and associated input index. ```graphql -query report($reportIndex: Int!, $inputIndex: Int!) { - report(reportIndex: $reportIndex, inputIndex: $inputIndex) { +query report($reportIndex: Int!) { + report(reportIndex: $reportIndex) { index input { + id index status - timestamp msgSender + blockTimestamp blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } payload + application { + address + name + } } } ``` @@ -31,7 +43,6 @@ query report($reportIndex: Int!, $inputIndex: Int!) { | Name | Type | Description | | ---- | ---- | ----------- | | `reportIndex` | [`Int!`](../../scalars/int) | Index of the report to retrieve. | -| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input associated with the report. | ### Response Type @@ -49,14 +60,31 @@ query reports { node { index input { + id index status - timestamp msgSender + blockTimestamp blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } payload + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } } @@ -81,15 +109,17 @@ query reportsByInput($inputIndex: Int!) { edges { node { index - input { - index - status - timestamp - msgSender - blockNumber - } payload + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } } @@ -108,18 +138,32 @@ query reportsByInput($inputIndex: Int!) { ## Examples - 1. Fetching a specific report: +1. Fetching a specific report: ```graphql query { - report(reportIndex: 1, inputIndex: 5) { + report(reportIndex: 1) { index input { + id index status - timestamp + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } payload + application { + address + name + } } } ``` @@ -133,11 +177,25 @@ query reportsByInput($inputIndex: Int!) { node { index input { + id index status - timestamp + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } payload + application { + address + name + } } cursor } @@ -158,10 +216,25 @@ query reportsByInput($inputIndex: Int!) { node { index input { + id index status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } } payload + application { + address + name + } } cursor } @@ -183,7 +256,16 @@ query reportsByInput($inputIndex: Int!) { node { index payload + application { + address + name + } } + cursor + } + pageInfo { + hasNextPage + endCursor } } } @@ -200,6 +282,10 @@ query reportsByInput($inputIndex: Int!) { node { index payload + application { + address + name + } } cursor } @@ -212,3 +298,72 @@ query reportsByInput($inputIndex: Int!) { } ``` +6. Listing reports with application information: + + ```graphql + query { + reports(first: 10) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } + ``` + +7. Fetching a specific report with application information: + + ```graphql + query { + report(reportIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + payload + application { + address + name + } + } + } + ``` + diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/vouchers.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/vouchers.md new file mode 100644 index 00000000..c5bbf344 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/queries/vouchers.md @@ -0,0 +1,379 @@ +--- +id: vouchers +title: Vouchers +hide_table_of_contents: false +--- + + +Vouchers represent transactions that can be carried out on the base layer blockchain, such as asset transfers. They are used to effect changes in the base layer based on the application's state. + +## 1. Get Voucher by Index + +Retrieve a specific voucher based on its index and associated input index. + +```graphql +query voucher($outputIndex: Int!) { + voucher(outputIndex: $outputIndex) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } +} +``` +For vouchers, the API provides access to proof data that can be used for validation on the base layer blockchain. This proof data is accessible through the [`Proof`](../objects/proof.md) field on voucher objects. + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `outputIndex` | [`Int!`](../../scalars/int) | The index of the voucher to retrieve. | + + + +### Response Type + +[`Voucher`](../../objects/voucher) + + +## 2. Get Vouchers + +Retrieve a list of vouchers with support for pagination. + +```graphql +query vouchers($first: Int, $after: String) { + vouchers(first: $first, after: $after) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } +} +``` + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `first` | [`Int`](../../scalars/int) | Number of vouchers to retrieve (for pagination). | +| `after` | [`String`](../../scalars/string) | Cursor to start retrieving vouchers from (for pagination). | + + +### Response Type + +[`VoucherConnection`](../../objects/voucher-connection) + + +## 3. Get Vouchers by Input + +Retrieve vouchers associated with a specific input. + +```graphql +query vouchersByInput($inputIndex: Int!, $first: Int, $after: String) { + input(index: $inputIndex) { + vouchers(first: $first, after: $after) { + edges { + node { + index + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } +} +``` + +### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `inputIndex` | [`Int!`](../../scalars/int) | Index of the input to retrieve vouchers for. | +| `first` | [`Int`](../../scalars/int) | Number of vouchers to retrieve (for pagination). | +| `after` | [`String`](../../scalars/string) | Cursor to start retrieving vouchers from (for pagination). | + +### Response Type + +[`VoucherConnection`](../../objects/voucher-connection) + + + +## Examples + +1. Fetching a specific voucher: + + ```graphql + query { + voucher(outputIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + } + ``` + +2. Listing earlier(first 5) vouchers: + + ```graphql + query { + vouchers(first: 5) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } + ``` + +3. Retrieving vouchers associated with a specific input: + + ```graphql + query { + input(index: 10) { + vouchers(first: 3) { + edges { + node { + index + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + cursor + } + pageInfo { + hasNextPage + endCursor + } + } + } + } + ``` + +4. Listing all vouchers with proof data: + + ```graphql + query { + vouchers(first: 10) { + edges { + node { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + } + pageInfo { + hasNextPage + endCursor + } + } + } + ``` + +5. Fetching a specific voucher by output index: + + ```graphql + query { + voucher(outputIndex: 1) { + index + input { + id + index + status + msgSender + blockTimestamp + blockNumber + payload + inputBoxIndex + prevRandao + application { + address + name + } + } + destination + payload + proof { + outputIndex + outputHashesSiblings + } + value + executed + transactionHash + application { + address + name + } + } + } + ``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/DateTime.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/DateTime.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/DateTime.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/DateTime.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/_category_.yml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/_category_.yml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/_category_.yml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/_category_.yml diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/big-int.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/big-int.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/big-int.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/big-int.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/boolean.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/boolean.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/boolean.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/boolean.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/int.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/int.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/int.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/int.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/string.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/string.md similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/scalars/string.md rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/scalars/string.md diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/sidebar-schema.js b/cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/sidebar-schema.js similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/graphql/sidebar-schema.js rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/graphql/sidebar-schema.js diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/index.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/index.md new file mode 100644 index 00000000..21839187 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/index.md @@ -0,0 +1,49 @@ +--- +id: http-api +title: Overview +resources: + - url: https://github.com/cartesi/machine-emulator + title: Off-chain implementation of the Cartesi Machine + - url: https://github.com/cartesi/rollups-node + title: Reference implementation of the Rollups Node + - url: https://github.com/cartesi/rollups-contracts/tree/v1.4.0/onchain/rollups/contracts + title: Smart Contracts for Cartesi Rollups +--- + +In a Cartesi dApp, the frontend and backend components communicate through the Rollups framework using HTTP and GraphQL APIs. + +When designing the APIs for this communication framework, we aimed to ensure that developers could create their applications without excessive concern about the low-level components of Cartesi Rollups. + +## Backend APIs + +In a typical Cartesi dApp, the backend contains the application's state and verifiable logic. The backend runs inside the Cartesi Machine as a regular Linux application. + +The dApp's backend interacts with the Cartesi Rollups framework by retrieving processing requests and submitting corresponding outputs. + +This interaction occurs through a set of HTTP endpoints, as illustrated in the figure below: + +![img](../../../static/img/v1.3/backend.jpg) + +You can send two types of requests to an application depending on whether you want to change or read the state: + +- **Advance**: With this request, input data changes the state of the dApp. + +- **Inspect**: This involves making an external HTTP API call to the Cartesi Node to read the dApp state without modifying it. + +## Base Layer Contracts + +The frontend component of the dApp needs to access the Cartesi Rollups framework to submit user requests and retrieve the corresponding outputs produced by the backend. + +The figure below illustrates the main use cases for these interactions: + +![img](../../../static/img/v1.3/frontend.jpg) + +- [`addInput()`](./contracts/input-box/#addinput) — This function submits input data to the InputBox smart contract on the base layer as a regular JSON-RPC blockchain transaction. When the transaction is mined and executed, it emits an event containing the submitted input's index, which the frontend can later use to query associated outputs. + +- [`executeOutput()`](./contracts/application/#executeoutput) — Submits a JSON-RPC blockchain transaction to request the execution of a given voucher or notice by the [`Application`](./contracts/application.md) smart contract on the base layer. Vouchers can only be executed when an epoch is closed. + +- Query outputs — You can submit a query to a Cartesi node to retrieve vouchers, notices, and reports as specified by the Cartesi Rollups GraphQL schema. + +- Inspect state — You can make an HTTP call to the Cartesi node to retrieve arbitrary dApp-specific application state. + + diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/inspect.yaml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect.yaml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/inspect.yaml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect.yaml diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx new file mode 100644 index 00000000..f8b37435 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect-state-http-api-for-cartesi-rollups.info.mdx @@ -0,0 +1,48 @@ +--- +id: inspect-state-http-api-for-cartesi-rollups +title: "Inspect-state HTTP API for Cartesi Rollups" +description: "API that allows the dApp frontend to make inspect-state requests to the dApp backend." +sidebar_label: Introduction +sidebar_position: 0 +hide_title: true +custom_edit_url: null +--- + +import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; +import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; + + + + + + + + + +API that allows the dApp frontend to make inspect-state requests to the dApp backend. + + +
+

+ License +

+ Apache-2.0 + +
+ \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect.api.mdx new file mode 100644 index 00000000..2782999c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/inspect/inspect.api.mdx @@ -0,0 +1,83 @@ +--- +id: inspect +title: "Inspect dApp state REST API" +description: "This method sends an inspect-state request to the dApp backend passing the payload string in the URL." +sidebar_label: "Inspect dApp state REST API" +hide_title: true +hide_table_of_contents: true +api: eJztV01vGzcQ/SvEXpQAtqS4cT+UooDhKq2BNAkUBT0kgUHtjrRMdsktybUsCPrvfUNypbVlI8f24ItNDYczw5k3b7jbzDRkpVdGXxXZJFPaNZT77CQryOVWNbwD+bxUTtTkS1MIR7pwQmqRlE+dl56EpX9acl54I3xJorhoGrGQ+Tdoi0Y6p/QqbDRyUxkJM96ySOkg/Th7M/ys58f7rjRtVYhFUDklnZuCilfhTPKPgOwNWbFWVSUKYoWwnQwgno/z16c/w/zV8hDa0hrtOTZNhOtAi4MUUiyUlnbTO81HuotgjXt7gWzI4kY5KlijdZS0HP34UoQgcRge45UsucZoKOXwKRE23HDSWte5kdE2NBtjvRMr0lwWmF9sjtKZEnXXQo6CIEmkoG3FQOY5NX5wIgaWviJJWBmI6ZbFqOmA06FxClGZpdjLT4K3pSLkfC+87moSUpwuERT3Kl3ZXn3W7ziCNXLDtpCoaCwcRYC6raqQmL85lbbVmqOHgVrmpdIkatQvRrEuTUXiUlpPTom/0j4sWlNVnBqkQ8ilx30ba3I6YOxBZMLrOy1KA4xGH3frKFdcGS/yUupVZ+gOiqO1Ncfd8/dYI8DdW+NVztCQPqYidRBWbqPzEhA0rTsRzqRYtPF9XKE1l8bWjB/T2pxOFUPWqRvUrGtbBz9o10ZaCetkXTb5tEUfo2kb6UtsaWyEX6FAEHCAyhL63duWTjKXl1TLbLLN/KZh1QipbLf7wsoRu473z8Zj/neXG666Nky3j/pDOMpDi3k+IpumUnmIePTV8bntsV+z+BrJB+nF/byKXiPQj+O7T1JAVAB/KgejMjd1UxH3EdDP2X3GnbYuN/zjOSyQbmtkLLsI/UKcnllomLCcdvDGOuHvT1nFvctNXtEbVSvPWlQE4VzV92RIId1KjgIR9rx45YPoMkYIHx/iNXd84F7jff/u71OHpr6cciKorUVJtx2jMZSkT+SxVJa5em0Y71bmjBwhLYnB+HYA1aoy68g+jYQqcwRMSdCrqmWFLq4XfCJAOzc2Vj2A1qBHFxtPcPTahGJ4qXO0GywXJIsF0XLQOxO4V4oDxfhSVKRX+Pcy8CIbc+Ls7OxEvPjpB/z5Zcyrczi40ILqxm/2p5kcqIFlwO5Anoki+WqxWw4VOcTUq0lKJpciEXKvANJauYGy8lS774P3qYL/aQV3B9kslDKIEn1Tca100/rr3LSRplKJmGdXZI9q9DYkjVO5tyCCBRC6QorC3HbK9QMc92NIXDlLJIlgeLegpWwrf0ytU2tRgEco1dOtHzWVVA+T6SMw+50wvHl6UrBd4xJyFUwfUhrfLPE5l4fnF1MnhnerC2DGG3MoTHx7FS0xCAAsxiisY755edurSLhKuC8uHOcgpCsKHcODapKNtgkEO8ii4TjNWlthu/S+cZPR6NcCw+Q6kfw19n5Do/aVoFOZXFY86ifn4/H5qHvW8kBTemlCmu6WJA3vP+fz9+Li/RX32v7pMUMztQ1XlUOKeRwPz4cvIMFUI64kLKZBe9FgUtDp2XCM7buhr9froQzbQ2NXo3TWjd5cXU7ffpjymWHp6yrb3S8bhxRaVXJfuwfesSH93x55+7iHnuXcSdwMSFMtde8G3UQPytHObPphznm5j6ftAZFPHwlPHwlPHwn/54+ENBl6g2OXGGqbOPhTNukeLKBKTgPLtlsG7Udb7XYsRuR2AzmWN9IquWAeBU0XyvEavL6UFSr7OFM8m6VPkOfisbC615bmt9aNrFr+heU32vQ+ZnZfoFpi/mNYcwhxNz6ze+eOvj54EOyH0B/TOQbTv1f6Bz0= +sidebar_class_name: "get api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/inspect/inspect-state-http-api-for-cartesi-rollups +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +This method sends an inspect-state request to the dApp backend passing the payload string in the URL. +The payload string should be URL-encoded; the inspect server will decode the string to UTF-8. +If the dApp frontend needs to pass a binary string to the backend then it is advised to use the base64 encoding. + +The response contains a status string and the reports generated by the dApp backend. +The status string can be either 'accept', 'reject', or 'exception'. +In case of exception, the field exception_payload will contain the exception payload; +Otherwise, this field will be null. + +When running on machine mode, the whole Cartesi Machine is rolled back after processing the inspect-state request. +On host mode, it is advised against changing the dApp backend state when processing an inspect-state request. +Notice that this method is synchronous, so it is not advised to perform resource-intensive operations. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods.md new file mode 100644 index 00000000..a8e64b6e --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods.md @@ -0,0 +1,129 @@ +--- +id: methods +title: Methods +--- + +# JSON-RPC API Methods + +This page provides a quick reference to all available JSON-RPC methods in the Cartesi Rollups Node API. For each method, you will find: +- A summary of what it does +- The parameters it accepts (with types and descriptions) +- **Links to detailed documentation for each method** + +Use this as a starting point to explore the API. For more details on each method, see the dedicated documentation pages in the sidebar or follow the links below. + +## Applications + +### [cartesi_listApplications](./methods/applications/list.md) +Returns a paginated list of all applications registered in the Cartesi Rollups instance. + +Parameters: +- `limit` (optional): The maximum number of applications to return per page. Default: 50, Minimum: 1 +- `offset` (optional): The starting point for the list of applications to return. Default: 0, Minimum: 0 + +### [cartesi_getApplication](./methods/applications/get.md) +Fetches detailed information about a specific application by its name or address. + +Parameters: +- `application` (required): The application's name or hex encoded address. + +## Epochs + +### [cartesi_listEpochs](./methods/epochs/list.md) +Returns a paginated list of epochs for a given application. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `status` (optional): Filter epochs by status. +- `limit` (optional): The maximum number of epochs to return per page. Default: 50, Minimum: 1 +- `offset` (optional): The starting point for the list of epochs to return. Default: 0, Minimum: 0 + +### [cartesi_getEpoch](./methods/epochs/get.md) +Fetches detailed information about a specific epoch. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `epoch_index` (required): The index of the epoch to be retrieved (hex encoded). + +### [cartesi_getLastAcceptedEpochIndex](./methods/epochs/last-accepted.md) +Fetches the latest accepted epoch index for a given application. + +Parameters: +- `application` (required): The application's name or hex encoded address. + +## Inputs + +### [cartesi_listInputs](./methods/inputs/list.md) +Returns a paginated list of inputs sent to an application. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `epoch_index` (optional): Filter inputs by a specific epoch index (hex encoded). +- `sender` (optional): Filter inputs by the sender's address (hex encoded). +- `limit` (optional): The maximum number of inputs to return per page. Default: 50, Minimum: 1 +- `offset` (optional): The starting point for the list of inputs to return. Default: 0, Minimum: 0 + +### [cartesi_getInput](./methods/inputs/get.md) +Retrieves detailed information about a specific input. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `input_index` (required): The index of the input to be retrieved (hex encoded). + +### [cartesi_getProcessedInputCount](./methods/inputs/processed-count.md) +Returns the number of inputs already processed by the application. + +Parameters: +- `application` (required): The application's name or hex encoded address. + +## Outputs + +### [cartesi_listOutputs](./methods/outputs/list.md) +Returns a paginated list of outputs (notices, vouchers, DELEGATECALL vouchers) for a given application. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `epoch_index` (optional): Filter outputs by a specific epoch index (hex encoded). +- `input_index` (optional): Filter outputs by a specific input index (hex encoded). +- `output_type` (optional): Filter outputs by output type (first 4 bytes of raw data hex encoded). +- `voucher_address` (optional): Filter outputs by the voucher address (hex encoded). +- `limit` (optional): The maximum number of outputs to return per page. Default: 50, Minimum: 1 +- `offset` (optional): The starting point for the list of outputs to return. Default: 0, Minimum: 0 + +### [cartesi_getOutput](./methods/outputs/get.md) +Retrieves detailed information about a specific output. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `output_index` (required): The index of the output to be retrieved (hex encoded). + +## Reports + +### [cartesi_listReports](./methods/reports/list.md) +Returns a paginated list of reports for a given application. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `epoch_index` (optional): Filter by epoch index (hex encoded). +- `input_index` (optional): Filter by input index (hex encoded). +- `limit` (optional): The maximum number of reports to return per page. Default: 50, Minimum: 1 +- `offset` (optional): The starting point for the list of reports to return. Default: 0, Minimum: 0 + +### [cartesi_getReport](./methods/reports/get.md) +Fetches detailed information about a specific report. + +Parameters: +- `application` (required): The application's name or hex encoded address. +- `report_index` (required): The index of the report to be retrieved (hex encoded). + +## Node Information + +### [cartesi_getChainId](./methods/node/chain-id.md) +Fetches the chain ID that node is operating on. + +No parameters required. + +### [cartesi_getNodeVersion](./methods/node/version.md) +Fetches the semantic version of the Cartesi rollups node. + +No parameters required. \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/get.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/get.md new file mode 100644 index 00000000..02eff86f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/get.md @@ -0,0 +1,121 @@ +--- +id: applications-get +title: Get Application +--- + +# Get Application + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getApplication", + "params": { + "application": "" + }, + "id": 1 +} +``` + +The `cartesi_getApplication` method retrieves detailed information about a specific application by its name or address. + +## Parameters + +| Name | Type | Required | Description | +|---------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": { + "name": "calculator", + "iapplication_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "iconsensus_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "iinputbox_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "template_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "epoch_length": "0x100", + "data_availability": "0x", + "state": "ENABLED", + "reason": "", + "iinputbox_block": "0x1", + "last_input_check_block": "0x1", + "last_output_check_block": "0x1", + "processed_inputs": "0x1", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z", + "execution_parameters": { + "snapshot_policy": "NONE", + "advance_inc_cycles": "0x1000", + "advance_max_cycles": "0x10000", + "inspect_inc_cycles": "0x1000", + "inspect_max_cycles": "0x10000", + "advance_inc_deadline": "0x1000000", + "advance_max_deadline": "0x10000000", + "inspect_inc_deadline": "0x1000000", + "inspect_max_deadline": "0x10000000", + "load_deadline": "0x1000000", + "store_deadline": "0x1000000", + "fast_deadline": "0x1000000", + "max_concurrent_inspects": 1, + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + } + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| name | string | The name of the application | +| iapplication_address | string | The Ethereum address of the application contract | +| iconsensus_address | string | The Ethereum address of the consensus contract | +| iinputbox_address | string | The Ethereum address of the input box contract | +| template_hash | string | The hash of the application template | +| epoch_length | string | The length of each epoch in blocks | +| data_availability | string | The data availability configuration | +| state | string | Current state of the application (ENABLED/DISABLED/INOPERABLE) | +| reason | string | Reason for the current state | +| iinputbox_block | string | The block number of the input box contract | +| last_input_check_block | string | The last block checked for inputs | +| last_output_check_block | string | The last block checked for outputs | +| processed_inputs | string | The number of processed inputs | +| created_at | string | Timestamp when the application was created | +| updated_at | string | Timestamp when the application was last updated | +| execution_parameters | object | Configuration parameters for application execution | + +#### Execution Parameters + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| snapshot_policy | string | The snapshot policy (NONE/EVERY_INPUT/EVERY_EPOCH) | +| advance_inc_cycles | string | Incremental cycles for advance state | +| advance_max_cycles | string | Maximum cycles for advance state | +| inspect_inc_cycles | string | Incremental cycles for inspect state | +| inspect_max_cycles | string | Maximum cycles for inspect state | +| advance_inc_deadline | string | Incremental deadline for advance state (ns) | +| advance_max_deadline | string | Maximum deadline for advance state (ns) | +| inspect_inc_deadline | string | Incremental deadline for inspect state (ns) | +| inspect_max_deadline | string | Maximum deadline for inspect state (ns) | +| load_deadline | string | Deadline for loading state (ns) | +| store_deadline | string | Deadline for storing state (ns) | +| fast_deadline | string | Deadline for fast operations (ns) | +| max_concurrent_inspects| number | Maximum number of concurrent inspect operations | +| created_at | string | Timestamp when parameters were created | +| updated_at | string | Timestamp when parameters were last updated | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/list.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/list.md new file mode 100644 index 00000000..35fd2964 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/applications/list.md @@ -0,0 +1,139 @@ +--- +id: applications-list +title: List Applications +--- + +# List Applications + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listApplications", + "params": { + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +The `cartesi_listApplications` method returns a paginated list of applications registered in the Cartesi Rollups instance. + +## Parameters + +| Name | Type | Required | Description | +|--------|--------|----------|--------------------------------------------------| +| limit | number | No | Maximum number of applications to return (default: 50, minimum: 1) | +| offset | number | No | Starting point for the list (default: 0, minimum: 0) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "name": "calculator", + "iapplication_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "iconsensus_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "iinputbox_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "template_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "epoch_length": "0x100", + "data_availability": "0x", + "state": "ENABLED", + "reason": "", + "iinputbox_block": "0x1", + "last_input_check_block": "0x1", + "last_output_check_block": "0x1", + "processed_inputs": "0x1", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z", + "execution_parameters": { + "snapshot_policy": "NONE", + "advance_inc_cycles": "0x1000", + "advance_max_cycles": "0x10000", + "inspect_inc_cycles": "0x1000", + "inspect_max_cycles": "0x10000", + "advance_inc_deadline": "0x1000000", + "advance_max_deadline": "0x10000000", + "inspect_inc_deadline": "0x1000000", + "inspect_max_deadline": "0x10000000", + "load_deadline": "0x1000000", + "store_deadline": "0x1000000", + "fast_deadline": "0x1000000", + "max_concurrent_inspects": 1, + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + } + ], + "pagination": { + "total_count": 1, + "limit": 50, + "offset": 0 + } + }, + "id": 1 +} +``` + +### Response Fields + +#### Data + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| name | string | The name of the application | +| iapplication_address | string | The Ethereum address of the application contract | +| iconsensus_address | string | The Ethereum address of the consensus contract | +| iinputbox_address | string | The Ethereum address of the input box contract | +| template_hash | string | The hash of the application template | +| epoch_length | string | The length of each epoch in blocks | +| data_availability | string | The data availability configuration | +| state | string | Current state of the application (ENABLED/DISABLED/INOPERABLE) | +| reason | string | Reason for the current state | +| iinputbox_block | string | The block number of the input box contract | +| last_input_check_block | string | The last block checked for inputs | +| last_output_check_block | string | The last block checked for outputs | +| processed_inputs | string | The number of processed inputs | +| created_at | string | Timestamp when the application was created | +| updated_at | string | Timestamp when the application was last updated | +| execution_parameters | object | Configuration parameters for application execution | + +#### Execution Parameters + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| snapshot_policy | string | The snapshot policy (NONE/EVERY_INPUT/EVERY_EPOCH) | +| advance_inc_cycles | string | Incremental cycles for advance state | +| advance_max_cycles | string | Maximum cycles for advance state | +| inspect_inc_cycles | string | Incremental cycles for inspect state | +| inspect_max_cycles | string | Maximum cycles for inspect state | +| advance_inc_deadline | string | Incremental deadline for advance state (ns) | +| advance_max_deadline | string | Maximum deadline for advance state (ns) | +| inspect_inc_deadline | string | Incremental deadline for inspect state (ns) | +| inspect_max_deadline | string | Maximum deadline for inspect state (ns) | +| load_deadline | string | Deadline for loading state (ns) | +| store_deadline | string | Deadline for storing state (ns) | +| fast_deadline | string | Deadline for fast operations (ns) | +| max_concurrent_inspects| number | Maximum number of concurrent inspect operations | +| created_at | string | Timestamp when parameters were created | +| updated_at | string | Timestamp when parameters were last updated | + +#### Pagination + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| total_count | number | Total number of applications available | +| limit | number | Number of applications returned in this response | +| offset | number | Starting point of the returned applications | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/get.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/get.md new file mode 100644 index 00000000..27801cc4 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/get.md @@ -0,0 +1,74 @@ +--- +id: epochs-get +title: Get Epoch +--- + +# Get Epoch + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getEpoch", + "params": { + "application": "", + "epoch_index": "" + }, + "id": 1 +} +``` + +The `cartesi_getEpoch` method retrieves detailed information about a specific epoch by its application and index. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| epoch_index | string | Yes | The index of the epoch to be retrieved (hex encoded) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": { + "index": "0x1", + "first_block": "0x1", + "last_block": "0x100", + "claim_hash": null, + "claim_transaction_hash": null, + "status": "OPEN", + "virtual_index": "0x1", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| index | string | The epoch index (hex encoded) | +| first_block | string | The first block number of the epoch (hex encoded) | +| last_block | string | The last block number of the epoch (hex encoded) | +| claim_hash | string | The claim hash (null if not claimed) | +| claim_transaction_hash | string | The claim transaction hash (null if not claimed) | +| status | string | Current status of the epoch | +| virtual_index | string | The virtual index of the epoch (hex encoded) | +| created_at | string | Timestamp when the epoch was created | +| updated_at | string | Timestamp when the epoch was last updated | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32001 | Epoch not found | The specified epoch does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/last-accepted.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/last-accepted.md new file mode 100644 index 00000000..6a462a13 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/last-accepted.md @@ -0,0 +1,53 @@ +--- +id: jsonrpc-epochs-last-accepted +title: Get Last Accepted Epoch Index +--- + +# Get Last Accepted Epoch Index + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getLastAcceptedEpochIndex", + "params": { + "application": "" + }, + "id": 1 +} +``` + +The `cartesi_getLastAcceptedEpochIndex` method retrieves the latest accepted epoch index for a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": "0x1" + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|------|--------|--------------------------------------------------| +| data | string | The latest accepted epoch index (hex encoded) | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/list.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/list.md new file mode 100644 index 00000000..1808db3c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/epochs/list.md @@ -0,0 +1,135 @@ +--- +id: epochs-list +title: List Epochs +--- + +# List Epochs + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listEpochs", + "params": { + "application": "", + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +The `cartesi_listEpochs` method returns a paginated list of epochs for a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| status | string | No | Filter epochs by status | +| limit | number | No | Maximum number of epochs to return (default: 50, minimum: 1) | +| offset | number | No | Starting point for the list (default: 0, minimum: 0) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "index": "0x1", + "first_block": "0x1", + "last_block": "0x100", + "claim_hash": null, + "claim_transaction_hash": null, + "status": "OPEN", + "virtual_index": "0x1", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + ], + "pagination": { + "total_count": 1, + "limit": 50, + "offset": 0 + } + }, + "id": 1 +} +``` + +### Response Fields + +#### Data + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| index | string | The epoch index (hex encoded) | +| first_block | string | The first block number of the epoch (hex encoded) | +| last_block | string | The last block number of the epoch (hex encoded) | +| claim_hash | string | The claim hash (null if not claimed) | +| claim_transaction_hash | string | The claim transaction hash (null if not claimed) | +| status | string | Current status of the epoch | +| virtual_index | string | The virtual index of the epoch (hex encoded) | +| created_at | string | Timestamp when the epoch was created | +| updated_at | string | Timestamp when the epoch was last updated | + +#### Pagination + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| total_count | number | Total number of epochs available | +| limit | number | Number of epochs returned in this response | +| offset | number | Starting point of the returned epochs | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32603 | Internal error | An internal error occurred | +| -32000 | Application not found | The specified application does not exist | + +## Example + +### Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listEpochs", + "params": { + "application": "calculator", + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +### Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "index": "0x1", + "status": "ACCEPTED", + "inputs_count": "0x1", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + ], + "pagination": { + "total_count": 1, + "limit": 10, + "offset": 0 + } + }, + "id": 1 +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/get.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/get.md new file mode 100644 index 00000000..564321c9 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/get.md @@ -0,0 +1,100 @@ +--- +id: inputs-get +title: Get Input +--- + +# Get Input + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getInput", + "params": { + "application": "", + "input_index": "" + }, + "id": 1 +} +``` + +The `cartesi_getInput` method retrieves detailed information about a specific input by its application and index. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| input_index | string | Yes | The index of the input to be retrieved (hex encoded) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": { + "epoch_index": "0x1", + "index": "0x1", + "block_number": "0x1", + "raw_data": "0x48656c6c6f", + "decoded_data": { + "chain_id": "0x1", + "application_contract": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "sender": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "block_number": "0x1", + "block_timestamp": "0x1234567890", + "prev_randao": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "index": "0x1", + "payload": "0x48656c6c6f" + }, + "status": "ACCEPTED", + "machine_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "outputs_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "transaction_reference": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this input belongs to (hex encoded) | +| index | string | The input index (hex encoded) | +| block_number | string | The block number when the input was created (hex encoded) | +| raw_data | string | The raw input data in hexadecimal format | +| decoded_data | object | The decoded input data (null if not decodable) | +| status | string | Current status of the input | +| machine_hash | string | The machine hash after processing this input | +| outputs_hash | string | The outputs hash after processing this input | +| transaction_reference | string | The transaction reference | +| created_at | string | Timestamp when the input was created | +| updated_at | string | Timestamp when the input was last updated | + +#### Decoded Data Fields + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| chain_id | string | The chain ID (hex encoded) | +| application_contract | string | The application contract address | +| sender | string | The sender address | +| block_number | string | The block number (hex encoded) | +| block_timestamp | string | The block timestamp (hex encoded) | +| prev_randao | string | The previous RANDAO value | +| index | string | The input index (hex encoded) | +| payload | string | The input payload in hexadecimal format | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32002 | Input not found | The specified input does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/list.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/list.md new file mode 100644 index 00000000..a23a2435 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/list.md @@ -0,0 +1,107 @@ +--- +id: inputs-list +title: List Inputs +--- + +# List Inputs + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listInputs", + "params": { + "application": "", + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +The `cartesi_listInputs` method returns a paginated list of inputs for a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| epoch_index | string | No | Filter inputs by a specific epoch index (hex encoded) | +| sender | string | No | Filter inputs by the sender's address (hex encoded) | +| limit | number | No | Maximum number of inputs to return (default: 50, minimum: 1) | +| offset | number | No | Starting point for the list (default: 0, minimum: 0) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "epoch_index": "0x1", + "index": "0x1", + "block_number": "0x1", + "raw_data": "0x48656c6c6f", + "decoded_data": { + "chain_id": "0x1", + "application_contract": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "sender": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "block_number": "0x1", + "block_timestamp": "0x1234567890", + "prev_randao": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "index": "0x1", + "payload": "0x48656c6c6f" + }, + "status": "ACCEPTED", + "machine_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "outputs_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "transaction_reference": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + ], + "pagination": { + "total_count": 1, + "limit": 50, + "offset": 0 + } + }, + "id": 1 +} +``` + +### Response Fields + +#### Data + +| Name | Type | Description | +|-------------------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this input belongs to (hex encoded) | +| index | string | The input index (hex encoded) | +| block_number | string | The block number when the input was created (hex encoded) | +| raw_data | string | The raw input data in hexadecimal format | +| decoded_data | object | The decoded input data (null if not decodable) | +| status | string | Current status of the input | +| machine_hash | string | The machine hash after processing this input | +| outputs_hash | string | The outputs hash after processing this input | +| transaction_reference | string | The transaction reference | +| created_at | string | Timestamp when the input was created | +| updated_at | string | Timestamp when the input was last updated | + +#### Pagination + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| total_count | number | Total number of inputs available | +| limit | number | Number of inputs returned in this response | +| offset | number | Starting point of the returned inputs | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32603 | Internal error | An internal error occurred | +| -32000 | Application not found | The specified application does not exist | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/processed-count.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/processed-count.md new file mode 100644 index 00000000..c0519eaf --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/inputs/processed-count.md @@ -0,0 +1,53 @@ +--- +id: jsonrpc-inputs-processed-count +title: Get Processed Input Count +--- + +# Get Processed Input Count + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getProcessedInputCount", + "params": { + "application": "" + }, + "id": 1 +} +``` + +The `cartesi_getProcessedInputCount` method returns the total number of inputs that have been processed by a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": "0x1" + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|------|--------|--------------------------------------------------| +| data | string | Total number of processed inputs (hex encoded) | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/chain-id.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/chain-id.md new file mode 100644 index 00000000..86db0d2e --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/chain-id.md @@ -0,0 +1,47 @@ +--- +id: node-chain-id +title: Get Chain ID +--- + +# Get Chain ID + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getChainId", + "params": {}, + "id": 1 +} +``` + +The `cartesi_getChainId` method fetches the chain ID that the node is operating on. + +## Parameters + +No parameters required. + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": "0x1" + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|------|--------|--------------------------------------------------| +| data | string | The chain ID that the node is operating on (hex encoded) | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/version.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/version.md new file mode 100644 index 00000000..26dc7b0f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/node/version.md @@ -0,0 +1,47 @@ +--- +id: node-version +title: Get Node Version +--- + +# Get Node Version + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getNodeVersion", + "params": {}, + "id": 1 +} +``` + +The `cartesi_getNodeVersion` method fetches the semantic version of the Cartesi rollups node. + +## Parameters + +No parameters required. + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": "2.0.0" + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|------|--------|--------------------------------------------------| +| data | string | The semantic version of the Cartesi rollups node | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/get.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/get.md new file mode 100644 index 00000000..6440d64f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/get.md @@ -0,0 +1,89 @@ +--- +id: outputs-get +title: Get Output +--- + +# Get Output + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getOutput", + "params": { + "application": "", + "output_index": "" + }, + "id": 1 +} +``` + +The `cartesi_getOutput` method retrieves detailed information about a specific output by its application and output index. + +## Parameters + +| Name | Type | Required | Description | +|--------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| output_index | string | Yes | The index of the output to be retrieved (hex encoded) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": { + "epoch_index": "0x1", + "input_index": "0x1", + "index": "0x1", + "raw_data": "0x48656c6c6f", + "decoded_data": { + "type": "0xc258d6e5", + "payload": "0x48656c6c6f" + }, + "hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "output_hashes_siblings": [ + "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ], + "execution_transaction_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|--------------------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this output belongs to (hex encoded) | +| input_index | string | The input index this output belongs to (hex encoded) | +| index | string | The output index (hex encoded) | +| raw_data | string | The raw output data in hexadecimal format | +| decoded_data | object | The decoded output data (null if not decodable) | +| hash | string | The output hash | +| output_hashes_siblings | array | Sibling hashes for the output hash | +| execution_transaction_hash | string | The transaction hash if executed | +| created_at | string | Timestamp when the output was created | +| updated_at | string | Timestamp when the output was last updated | + +## Output Types + +The API supports three types of outputs, which can be identified by the `type` field in the decoded data or filtered using the `output_type` parameter in list queries: + +- `0xc258d6e5`: **Notice** – Informational messages emitted by the application. +- `0x237a816f`: **Voucher** – Single-use permission to execute a call. +- `0x10321e8b`: **DelegateCallVoucher** – Single-use permission to execute a DELEGATECALL. + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32003 | Output not found | The specified output does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/list.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/list.md new file mode 100644 index 00000000..645ce816 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/outputs/list.md @@ -0,0 +1,103 @@ +--- +id: outputs-list +title: List Outputs +--- + +# List Outputs + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listOutputs", + "params": { + "application": "", + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +The `cartesi_listOutputs` method returns a paginated list of outputs for a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| epoch_index | string | No | Filter outputs by a specific epoch index (hex encoded) | +| input_index | string | No | Filter outputs by a specific input index (hex encoded) | +| output_type | string | No | Filter outputs by output type (first 4 bytes of raw data hex encoded) | +| voucher_address | string | No | Filter outputs by the voucher address (hex encoded) | +| limit | number | No | Maximum number of outputs to return (default: 50, minimum: 1) | +| offset | number | No | Starting point for the list (default: 0, minimum: 0) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "epoch_index": "0x1", + "input_index": "0x1", + "index": "0x1", + "raw_data": "0x48656c6c6f", + "decoded_data": { + "type": "0xc258d6e5", + "payload": "0x48656c6c6f" + }, + "hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "output_hashes_siblings": [ + "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ], + "execution_transaction_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + ], + "pagination": { + "total_count": 1, + "limit": 50, + "offset": 0 + } + }, + "id": 1 +} +``` + +### Response Fields + +#### Data + +| Name | Type | Description | +|--------------------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this output belongs to (hex encoded) | +| input_index | string | The input index this output belongs to (hex encoded) | +| index | string | The output index (hex encoded) | +| raw_data | string | The raw output data in hexadecimal format | +| decoded_data | object | The decoded output data (null if not decodable) | +| hash | string | The output hash | +| output_hashes_siblings | array | Sibling hashes for the output hash | +| execution_transaction_hash | string | The transaction hash if executed | +| created_at | string | Timestamp when the output was created | +| updated_at | string | Timestamp when the output was last updated | + +#### Pagination + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| total_count | number | Total number of outputs available | +| limit | number | Number of outputs returned in this response | +| offset | number | Starting point of the returned outputs | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32603 | Internal error | An internal error occurred | +| -32000 | Application not found | The specified application does not exist | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/get.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/get.md new file mode 100644 index 00000000..7422c649 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/get.md @@ -0,0 +1,68 @@ +--- +id: reports-get +title: Get Report +--- + +# Get Report + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_getReport", + "params": { + "application": "", + "report_index": "" + }, + "id": 1 +} +``` + +The `cartesi_getReport` method retrieves detailed information about a specific report by its application and index. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| report_index | string | Yes | The index of the report to be retrieved (hex encoded) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": { + "epoch_index": "0x1", + "input_index": "0x1", + "index": "0x1", + "raw_data": "0x48656c6c6f", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + }, + "id": 1 +} +``` + +### Response Fields + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this report belongs to (hex encoded) | +| input_index | string | The input index this report belongs to (hex encoded) | +| index | string | The report index (hex encoded) | +| raw_data | string | The report payload in hexadecimal format | +| created_at | string | Timestamp when the report was created | +| updated_at | string | Timestamp when the report was last updated | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32000 | Application not found | The specified application does not exist | +| -32004 | Report not found | The specified report does not exist | +| -32603 | Internal error | An internal error occurred | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/list.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/list.md new file mode 100644 index 00000000..4c101f50 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/methods/reports/list.md @@ -0,0 +1,88 @@ +--- +id: reports-list +title: List Reports +--- + +# List Reports + +## Example Request + +```json +{ + "jsonrpc": "2.0", + "method": "cartesi_listReports", + "params": { + "application": "", + "limit": 10, + "offset": 0 + }, + "id": 1 +} +``` + +The `cartesi_listReports` method returns a paginated list of reports for a specific application. + +## Parameters + +| Name | Type | Required | Description | +|-------------|--------|----------|--------------------------------------------------| +| application | string | Yes | The application's name or hex encoded address | +| epoch_index | string | No | Optional filter by epoch index (hex encoded) | +| input_index | string | No | Optional filter by input index (hex encoded) | +| limit | number | No | Maximum number of reports to return (default: 50, minimum: 1) | +| offset | number | No | Starting point for the list (default: 0, minimum: 0) | + +## Response + +```json +{ + "jsonrpc": "2.0", + "result": { + "data": [ + { + "epoch_index": "0x1", + "input_index": "0x1", + "index": "0x1", + "raw_data": "0x48656c6c6f", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z" + } + ], + "pagination": { + "total_count": 1, + "limit": 50, + "offset": 0 + } + }, + "id": 1 +} +``` + +### Response Fields + +#### Data + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| epoch_index | string | The epoch index this report belongs to (hex encoded) | +| input_index | string | The input index this report belongs to (hex encoded) | +| index | string | The report index (hex encoded) | +| raw_data | string | The report payload in hexadecimal format | +| created_at | string | Timestamp when the report was created | +| updated_at | string | Timestamp when the report was last updated | + +#### Pagination + +| Name | Type | Description | +|-------------|--------|--------------------------------------------------| +| total_count | number | Total number of reports available | +| limit | number | Number of reports returned in this response | +| offset | number | Starting point of the returned reports | + +## Error Codes + +| Code | Message | Description | +|---------|------------------------|--------------------------------------------------| +| -32602 | Invalid params | Invalid parameter values | +| -32603 | Internal error | An internal error occurred | +| -32000 | Application not found | The specified application does not exist | \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/overview.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/overview.md new file mode 100644 index 00000000..a26d904f --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/overview.md @@ -0,0 +1,148 @@ +--- +id: overview +title: Overview +--- + +# JSON-RPC API Overview + +The Cartesi Rollups Node API provides a JSON-RPC interface for interacting with Cartesi Rollups applications. This API allows you to: + +- Query application information and status +- Monitor epochs and their states +- Track inputs and their processing status +- Retrieve outputs (notices, vouchers, DELEGATECALL vouchers) +- Access reports for debugging and auditing + +## API Structure + +The API is organized into the following categories: + +### Applications +- `cartesi_listApplications`: List all registered applications +- `cartesi_getApplication`: Get details about a specific application + +### Epochs +- `cartesi_listEpochs`: List epochs for an application +- `cartesi_getEpoch`: Get details about a specific epoch +- `cartesi_getLastAcceptedEpochIndex`: Get the latest accepted epoch index + +### Inputs +- `cartesi_listInputs`: List inputs for an application +- `cartesi_getInput`: Get details about a specific input +- `cartesi_getProcessedInputCount`: Get the number of processed inputs + +### Outputs +- `cartesi_listOutputs`: List outputs (notices, vouchers, DELEGATECALL vouchers) +- `cartesi_getOutput`: Get details about a specific output + +### Reports +- `cartesi_listReports`: List reports for an application +- `cartesi_getReport`: Get details about a specific report + +## Common Features + +### Pagination +List endpoints support pagination with the following parameters: +- `limit`: Maximum number of items per page (default: 50, minimum: 1) +- `offset`: Starting point for the list (default: 0, minimum: 0) + +### Filtering +Many list endpoints support filtering by: +- `epoch_index`: Filter by epoch +- `input_index`: Filter by input +- `status`: Filter by status +- `output_type`: Filter by output type +- `voucher_address`: Filter by voucher address + +### Response Format +All responses follow the JSON-RPC 2.0 specification: +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "data": [...], + "pagination": { + "total_count": 1, + "limit": 10, + "offset": 0 + } + } +} +``` + +### Error Handling +Errors follow the JSON-RPC 2.0 error format: +```json +{ + "jsonrpc": "2.0", + "id": 1, + "error": { + "code": -32000, + "message": "Server error" + } +} +``` + +## Data Types + +The API uses several data types: +- `HexString`: Hexadecimal values prefixed with "0x" +- `Timestamp`: ISO 8601 formatted timestamps +- Various enums for states and statuses +- Complex objects for applications, epochs, inputs, outputs, and reports + +For detailed information about data types, see the [Types](types) page. + +## Best Practices + +1. **Error Handling**: Always check for errors in responses +2. **Pagination**: Use pagination to handle large result sets +3. **Filtering**: Use filters to narrow down results +4. **Rate Limiting**: Be mindful of API rate limits +5. **Caching**: Cache frequently accessed data when appropriate + +## Examples + +### Listing Applications +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "cartesi_listApplications", + "params": { + "limit": 10, + "offset": 0 + } +} +``` + +### Getting Application Details +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "cartesi_getApplication", + "params": { + "application": "my-dapp" + } +} +``` + +### Listing Inputs with Filters +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "cartesi_listInputs", + "params": { + "application": "my-dapp", + "epoch_index": "0x1", + "sender": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", + "limit": 10, + "offset": 0 + } +} +``` + +For more examples and detailed information about each method, see the [Methods](../methods) page. \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/types.md b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/types.md new file mode 100644 index 00000000..02000203 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/jsonrpc/types.md @@ -0,0 +1,244 @@ +--- +id: types +title: Types +--- + +# JSON-RPC API Types + +This page documents the data types used in the Cartesi Rollups Node API. These types are used in both request parameters and response data. + +## Basic Types + +### HexString +A string representing a hexadecimal value, prefixed with "0x". Used for addresses, hashes, and other binary data. + +Example: +```json +"0x71C7656EC7ab88b098defB751B7401B5f6d8976F" +``` + +### Timestamp +A string representing a timestamp in ISO 8601 format. + +Example: +```json +"2024-01-01T00:00:00Z" +``` + +## Enums + +### ApplicationState +The current state of an application. + +Values: +- `ENABLED`: The application is enabled and processing inputs +- `DISABLED`: The application is disabled and not processing inputs +- `ERROR`: The application encountered an error and is not processing inputs + +Example: +```json +"ENABLED" +``` + +### EpochStatus +The current status of an epoch. + +Values: +- `OPEN`: The epoch is open and accepting inputs +- `CLOSED`: The epoch is closed and not accepting inputs +- `PROCESSED`: The epoch has been processed + +Example: +```json +"OPEN" +``` + +### InputStatus +The current status of an input. + +Values: +- `ACCEPTED`: The input has been accepted and processed +- `REJECTED`: The input has been rejected +- `PENDING`: The input is pending processing + +Example: +```json +"ACCEPTED" +``` + +### SnapshotPolicy +The snapshot policy for an application. + +Values: +- `NONE`: No snapshots are taken +- `EVERY_EPOCH`: A snapshot is taken at the end of each epoch +- `EVERY_INPUT`: A snapshot is taken after each input + +Example: +```json +"NONE" +``` + +## Interfaces + +### Application +Represents a Cartesi Rollups application. + +```typescript +interface Application { + name: string; + iapplication_address: HexString; + iconsensus_address: HexString; + iinputbox_address: HexString; + template_hash: HexString; + epoch_length: HexString; + data_availability: HexString; + state: ApplicationState; + reason: string; + iinputbox_block: HexString; + last_input_check_block: HexString; + last_output_check_block: HexString; + processed_inputs: HexString; + created_at: Timestamp; + updated_at: Timestamp; + execution_parameters: ExecutionParameters; +} +``` + +### ExecutionParameters +Configuration parameters for application execution. + +```typescript +interface ExecutionParameters { + snapshot_policy: SnapshotPolicy; + advance_inc_cycles: HexString; + advance_max_cycles: HexString; + inspect_inc_cycles: HexString; + inspect_max_cycles: HexString; + advance_inc_deadline: HexString; + advance_max_deadline: HexString; + inspect_inc_deadline: HexString; + inspect_max_deadline: HexString; + load_deadline: HexString; + store_deadline: HexString; + fast_deadline: HexString; + max_concurrent_inspects: number; + created_at: Timestamp; + updated_at: Timestamp; +} +``` + +### Epoch +Represents a Cartesi Rollups epoch. + +```typescript +interface Epoch { + index: HexString; + first_block: HexString; + last_block: HexString; + claim_hash: HexString | null; + claim_transaction_hash: HexString | null; + status: EpochStatus; + virtual_index: HexString; + created_at: Timestamp; + updated_at: Timestamp; +} +``` + +### Input +Represents a Cartesi Rollups input. + +```typescript +interface Input { + epoch_index: HexString; + index: HexString; + block_number: HexString; + raw_data: HexString; + decoded_data: DecodedInput; + status: InputStatus; + machine_hash: HexString; + outputs_hash: HexString; + transaction_reference: HexString; + created_at: Timestamp; + updated_at: Timestamp; +} +``` + +### DecodedInput +The decoded data of an input. + +```typescript +interface DecodedInput { + chain_id: HexString; + application_contract: HexString; + sender: HexString; + block_number: HexString; + block_timestamp: HexString; + prev_randao: HexString; + index: HexString; + payload: HexString; +} +``` + +### Output +Represents a Cartesi Rollups output (notice, voucher, or DELEGATECALL voucher). + +```typescript +interface Output { + epoch_index: HexString; + input_index: HexString; + index: HexString; + raw_data: HexString; + decoded_data: DecodedOutput; + hash: HexString; + output_hashes_siblings: HexString[]; + execution_transaction_hash: HexString; + created_at: Timestamp; + updated_at: Timestamp; +} +``` + +### DecodedOutput +The decoded data of an output. + +```typescript +interface DecodedOutput { + type: HexString; + payload: HexString; +} +``` + +### Report +Represents a Cartesi Rollups report. + +```typescript +interface Report { + epoch_index: HexString; + input_index: HexString; + index: HexString; + raw_data: HexString; + created_at: Timestamp; + updated_at: Timestamp; +} +``` + +### Pagination +Represents pagination information for list responses. + +```typescript +interface Pagination { + total_count: number; + limit: number; + offset: number; +} +``` + +### PaginatedResponse +A generic interface for paginated responses. + +```typescript +interface PaginatedResponse { + data: T[]; + pagination: Pagination; +} +``` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/rollup.yaml b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup.yaml similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/rollup.yaml rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup.yaml diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-notice.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-notice.api.mdx new file mode 100644 index 00000000..6c726589 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-notice.api.mdx @@ -0,0 +1,77 @@ +--- +id: add-notice +title: "Add a new notice" +description: "The dApp backend can call this method to add a new notice when processing the advance-state request." +sidebar_label: "Add a new notice" +hide_title: true +hide_table_of_contents: true +api: eJztWG1v2zYQ/iuE9kEJ5tiO22yYsQxIuwwLsHVBk31KgpSWzpYamdRIKo5n+L/vOZKyFSftuhcMG7AAbaTT8fjcc8e7Y1aJrslIV2p1lifjROb5G+3KjJJekpPNTFnzN3y5LEjkJ3UtJjK7I5WLTCr8qyrhitKKOblC58JpARNCCkULobwlsShIidrojKwt1Qz6BKV7qTI6sE46EoZ+aci6/rU6aReFzSdkhVRLkRVSzfAM87y6VI6MkpUIy/XUSz06V0gn5nIpJmy2Imzj2mWTSmd3MFUq7PSK3IIouLAxPC1VaYvoTM+LIp7oHzsNy7yIctHUvPDF6E64ck4WVq8V82TINUZB4V5WDeDaiDqnhxZsNDvVxr9mjTEEpJGXDiNnSmhoGLHQJre9jqVMN8oxoQaa0jhQ5QTdk1l2liOO8eWVzpfJeJVkGuwpx4+yrqsy89EfvLcc5lVis4Lmkp/csiYEXk/eU+ZgByFErriSLH+t5bLSMu8oWmeA5tnEicrMRKm8C6fsEzVzUcCTSakkUIOMuWTQlz4UxiJyC83BNzJDxOGgIZEOH1KoVpVegOHJEsahyrzClMwpK+fIDNXMJ7zC50Omwa6ttfIJqhVSYekIG30H+ksF9sB5jy3nJPMJ0TTtrPHZITc+LEpXiIrUDL9eIjtzb8yK0WjUE4dfvsB/Xw356YjzWQma127ZZcBQDcsIQYDPbATqvGshZvBkXlfM6hYTxK50XngeyV+vt7J4btdrFgboNoRqNBzyr8dheW1IMoJtMvaxwd+UHD5BO2p8YGdkoBdiDFED2Rcvn2TLubYlP7Z58iOZu4qEM+TxbXg5HL3oOn/GG76NTkcOcprKpnJPXT81BnFvKdpx29GDG9QVisSzDn8gyb8lJ0suCeRtoxhYOXuMOAmVwZ9FPrtVzrxzNWkAHsmu9TYfyOAcixzFA7mHfGbaYN0ulZMPnUTwrnh/4XCo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3E3WcdJdxSn/KonxxzzOucuS1WoiLf1sqvWaxbBnlpDj8V6akpOV32CpwGiO2xlfC+5oyfN4yJmDS96X1cEB/3Vo90rIl4Sw4sQX64/q3nRuKOc/XVxCeRL/JsEHDVIjF/z3Cvw/TvCgfQ77C6WXrZIKOdTgYoXvwSb//Aaw932v +sidebar_class_name: "post api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +The dApp backend can call this method to add a new notice when processing the advance-state request. +A notice describes any changes to the internal state of the dApp that may be relevant to the blockchain. +Between calls to the finish method, the notice method can be called up to 32k times. + +The returned value is the index of the notice for the current advance request. +In other words, the index counting restarts at every request. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-report.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-report.api.mdx new file mode 100644 index 00000000..1f484f14 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-report.api.mdx @@ -0,0 +1,74 @@ +--- +id: add-report +title: "Add a new report" +description: "The dApp can call this method to add a new report for the given rollup request." +sidebar_label: "Add a new report" +hide_title: true +hide_table_of_contents: true +api: eJztV21vIzUQ/itW+LCpSJO0UCECRerdFVEJHdU1fEqjnrM7yfq6sRevN2mI8t95xvYm25c7DpAQH1ip6a49Hj/zzIvH244pyUqnjL7KOqOOzLJ3VBrrOr1ORlVqVclzmBnnJLKLshSp1PgrCuFyVYkludxkwhmBpUIKTWthvQYxNxYyJBZqRVpYUxR1ibnfaqpc/1ZfNHKscEZYmym50KZyKhV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6QEavucRN1I6JciGcTFPcHhfh6+jo4OzD2i7PxcnA5Pn1GUvDWijGAen8uIE7vhYblA6WnzwrVJ6drb72GHJG0qyTl2ZkTdFpRHEpMkvtxxCUumjC2R2YoPCm85Jc9xNoytTA2KbBtPHGInHAb5SZBAQOrPYPjlKYpMOplMJwmqlNy/V4s7HB8of8m090RbrB2f0NRITA8rdy3ePt+1jZXRt/GTnftRYpATqCVtXsKIj82/AP3vAY67R7zh65NwwxHQhhv7r38Fbtw9wg1fj+GGdJo0WY0g3ed1I0bF54U2mqASXd6fhnYkoCTfN/GSJhf/mzRRUdFza8a5NetWOaEHJo0zsGXEfvAf2PFR1IcdI/D9QAvBDC3afTzD/CGJDjyrU49pCVJ6XLdcc9PhY6B9EHKrrZzCofK7ry4iHNToX3EbsrRQFVpqnKjx2LxsAODcvCESkwPGafcLWarjN6E1PG7W7lccNYc4NzoR2fMGgPHMrUQvCBPqcLrzISlnhW/YMnIcTvv2YW+UvyFd+SsTcMbLkZ/NaIV2gYMRo5aOC1nrNN/PcyuNFoW5X0rd7n2eXP6edqatS9L/N8nWTTK2861ufxd7x23smyedyCg6XI4GHtluZ7KiX22x2/EwUFtcRCd4XUmr2P38BU05ml2yvtG+pw13uMELx2Pel8WLmvd/dm3ltjusuPDlryXbxjptdfvXv9yMITaLl2IOWoxaueYLM35HHbwYHw/+DuXHtp0C7VyNSwrmw878/AHHRbUf +sidebar_class_name: "post api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +The dApp can call this method to add a new report for the given rollup request. +A report can be a diagnostic or a log; reports are not discarded when a request is rejected. +Between calls to the finish method, the report method can be called any number of times. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-voucher.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-voucher.api.mdx new file mode 100644 index 00000000..206b5118 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/add-voucher.api.mdx @@ -0,0 +1,77 @@ +--- +id: add-voucher +title: "Add a new voucher" +description: "The dApp backend can call this method to add a new voucher when processing an advance-state request." +sidebar_label: "Add a new voucher" +hide_title: true +hide_table_of_contents: true +api: eJztWG1v2zgS/iuE7oMSnGM7bpMmweWAtJvgAtztFk3uviRBSktjixtZ1JJUHJ/h/77PkJStOE1393o49MMZaCqNOMNn3odcJromI53S1WWenCQyz/+lm6wgk/SSnGxmVM0f8em6IJGf1bUYy+yBqlxkssK/shSuUFbMyBU6F04LyBBSVDQXj0GUmBdUidrojKxV1VSAUeaPsspozzrpSBj6pSHr+rdV3N0KaUhkuizx2chS0GRCmQM5YzhyXJJQFXYmMS519pAVUlVgf09uThRwWQbDKyaqUraICHue1CKLqFmVMXkuykVTM+eb0YNwakYWYm8r1t6Qa0yFBY+ybLC/9aJUldOT0JNncifa+PesMYYq96q6l5XQzptIm9z2OgIz3VSOjWWwUhpW3Ql6JLPosMNJ8eW9zhfJyTLJdOWwIT/Kui5V5n07+NmyD5eJBbqZ5Ce3qAle1eOfYVfIgXsQCU6R5a9wPTaXwfXrxdYZIHoRGaPh3ngBteB4gLWtLToyBMMy8J03zLxQWeGX1HJRapmLuUIYwQEW0PuQT09yVpe85fBp8ub4Ij+kg30p86Oji8OLtxkdyvdHR6N3o3fH2WRyMT4ejQ4PkxWUCPJ+G/KVJ3MInbP5qZmJAkYfAy8MDJAzWDuwjH3EbiKFA14zWHqirHEIh/HiVX37IXImylgn3FwLBCrT2whPh08ptitLPQ+CaomlbEHAkTllaobgr5rZmDlcAVSZRkjZWlc+2XSFDI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XtgqeYmdGtNOB8mzFTRof7rn8pneMLY3Dsdec0pc4W4vFstfF087bcMKGyL+0U6jgl20UuXQyvbtJUWHl+tlO7zGAonSnd70tabF2fUVSu+Juw7nq2O33u7bVMvo2vrJzXzUMcgK1pGuXQPGx+Qeg/2eA4+4Rb3j7KlxDXCa6cAPlfwM37h7hhrfncEM63bRZjSBd53W7jMrfF9qYxzF2ut8M7WiAmvwIzyxtLn6fZqLS0kttrguj551yQk9sNM7AjhJr4jfo8SrqzY4R+JrQQTDGqPwQe5hvkph18yacTmYwSo/rlmuvO7gNdBuhhYcw0aKp/Duc9UKjDmdYQ1OceOBF2bbN8xYA+uYVkbjZYLzb+ZOs1d4PYazda3nXHLttE+cZLSJ7OQAwnomRmGOhQhO6OzdJf0fi+MjmOJzW48NaKcr5AsLx+nDjsf6a0yPGBQ5GUA3tlRKHt2L9nS8e+LANVDNZdWef7Zuf7bG6cz/x//uk7/M+KR6LOqemVZxjl/H8cZO03sVJgUOTScvlWFr6pylXKyZDoFmAjsdHaRTbl98gqiCJDusPLA+04HE7RMTeNW/My2ELvoncPq3y8SVwnPla/NW1d53D08efrq6xeBxvyDiPQDVyzrdn+HuS4EH7CPVnXU9bJnyP0ODMh+9BJv9+BZ2zK4Q= +sidebar_class_name: "post api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +The dApp backend can call this method to add a new voucher when processing an advance-state request. +Vouchers are collateral effects actionable in the blockchain. +Between calls to the finish method, the voucher method can be called up to 32k times. + +The returned value is the index of the voucher for the current advance-state request. +In other words, the index counting restarts at every request. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/cartesi-rollup-http-api.info.mdx similarity index 82% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/cartesi-rollup-http-api.info.mdx index 49196439..9ddf37f3 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api.info.mdx +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/cartesi-rollup-http-api.info.mdx @@ -9,13 +9,23 @@ custom_edit_url: null --- import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; import SchemaTabs from "@theme/SchemaTabs"; import TabItem from "@theme/TabItem"; -import Export from "@theme/ApiDemoPanel/Export"; +import Export from "@theme/ApiExplorer/Export"; -Version: 0.5.1 + + -

Cartesi Rollup HTTP API

+ + @@ -81,5 +91,17 @@ In host mode, the Cartesi Rollups infrastructure is not able to detect that the It is up to the dApp developer to re-launch the dApp. -

License

Apache-2.0
+
+

+ License +

+ Apache-2.0 + +
\ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/finish.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/finish.api.mdx new file mode 100644 index 00000000..0e7b7f58 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/finish.api.mdx @@ -0,0 +1,91 @@ +--- +id: finish +title: "Finish and get next request" +description: "The dApp backend should call this method to start processing rollup requests." +sidebar_label: "Finish and get next request" +hide_title: true +hide_table_of_contents: true +api: eJztWt9TGzkS/ldUvoeBOgPGBALUcVVkA3VUXXZTga19AIrIM7JHmxlpVtLY+Cj/7/e1pBmPDYTs5uoqD/iB2JpW99e/W5o89HQlDHdSq4usd9wbSyVt3uv3MmFT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R3cxjjxgXgM2ikvcCzpHmAenuK8SDaXTAiyuJduYzcuhrG5hUR6xJPHCXtIApvkuL0zWNyoWY70Y1emFhFcAJZcxguMsL0RasDnKaPEuy/Kn41o0L+zJCZQ0mcU6Sfh1+bm0nIrJjs5oUPVIxMlP2vW3KY8ursxc39spqrWtQuVJalqr7+HHfKzKSInkEyINjpQViiuk+5hIbklbGtXao9xNhaLFxldPHGJnLBcpE+CBAJSf6CBX9ZR0GSV3F4nzbHAf28H/+S2v8Yt9qWvcGoobpc7Fx27fbtrGy2jb+NPcu6zhgmXOl27hBUfm38C+l8DHKVHvOHXV+GG66Uu3LDy/4EbpUe44dcq3JBO101WI0jbvG7IRPFtob16M/x8aEcDVKK9nm1y8cc0kyiseKzNVW70rFNOxD0ZjTKwo0S7+B16PIt6KTECbxc6CEZG8C+xh/kmiZE9q8N1VbgQk+PlDRS1gW4jpNlcOomm8h9fXVho1Bh4iwLAJtL6+9umbZ41ANA3L4Vg10uMtxt/45Xceh+mwq1mb7tjs2nia1d1qwMA4RnTva2BCnXo7tQk6baSZrVMOAqndnxolQr3vv6OEDhB2T7NxBTjAgUjVo3YKnit0rx9TrM3nUqBquSqM/s0wzFGiIlwK/Pv+nzauXh7fUv0+pbo9S3R61ui17dEr2+Jfpi3RPFypXP3sojH+Yd4i3Hd/KeH236PrEQrDw8jxP2vplgsaBnWNXOs4+uUG0mRQb/AKYe56Xb7+qH3Rczp0iEUg60rkkvkaDN0S7H+WoYuQcKO0+Z90vO0t50bmI+/XF6BeBRfe5FLsWr4jN5I4e9xj96m+O4cXurQ2kOvwDm7RnjheeBJn/8Cbqzwow== +sidebar_class_name: "post api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +The dApp backend should call this method to start processing rollup requests. +The Rollup HTTP Server returns the next rollup request in the response body. + +The possible values for the request_type field are 'advance_state' and 'inspect_state'. +The data field contains the rollup request input data. +For advance-state requests, the input data contains the advance-state metadata and the payload. +For inspect-state requests, the input data contains only the payload. + +After processing a rollup request, the dApp back-end should call again the finish method. +For advance-state requests, depending on the result of the request processing, it should fill the status field of the request body with 'accept' or 'reject'. +The Rollup HTTP Server ignores the content of the status field for the first finish request and after an inspect-state request. + +If the advance-state request is rejected, the vouchers and notices are discarded. +In contrast, reports are not discarded in case of rejection. +When running inside a Cartesi Machine, the Cartesi Server Manager reverts the entire state of the machine to what it was before receiving the request. + +During a finish call, the next rollup request might not be immediately available. +When the dApp backend and the Rollup HTTP Server are running inside a Cartesi Machine, the Cartesi Server Manager pauses the whole machine execution until the next request is ready. +When running in host mode, the Rollup HTTP Server returns the status code 202 after 10 seconds to avoid the connection timing out. +When the Rollup HTTP Server returns 202, the dApp backend should retry the call to finish passing the same arguments as before. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/register-exception.api.mdx b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/register-exception.api.mdx new file mode 100644 index 00000000..e875b46c --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/register-exception.api.mdx @@ -0,0 +1,79 @@ +--- +id: register-exception +title: "Register an exception" +description: "The dApp should call this method when it cannot proceed with the request processing after an exception happens." +sidebar_label: "Register an exception" +hide_title: true +hide_table_of_contents: true +api: eJztWNtuI7kR/RVCeWgbsSWNN4MgwnoBZ9ZBDGRnjbGCBLAND9VdUnPdIjsk27Ii6N9zimRfZHv29pDkYfUgdfNSPHXqxtJuZGqy0iujr4rRbGRppZwne/mcU82jo5NRQS63Kr7NRvOSRHFR18KVpqkKkcuqEr5UTqzJ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KmYl3X8B8Xsu5VzBELg9RAiPOQKBH6CJ5Q7gI1HPHysFyFo7qy8oKHIPnz5893GqcZ61tPct2A2zpeE40izvl9LO3q6fbdPY8jGpCLKH98iHn9gfP6URsEx7M7LfBRyz4uBuuCpyL3WalXdIRwPBFfTaftJv7UCAt/tMyCQ86w9klWqjioIbu3JO+z414IQ6Zn5Y/epcFYjjpIrMdSaeVK6LfLophsJjIZckG2v9Ox5s9tQwlcBJbdgGFOUnF7e6iFnLdIidSOOY6OEqG/F9kkbT4R7O7n8e34uGfugLLzc1TNs1cUZajidQKTRKfz4Cd2G64pK2SfIS+cnpRugv4BdgzSNpmc42RGdDSAcrDiNksPD5zFsnvGlsniiQtH0Jyy1zhbxp5MA4rsEE8aYiP0g/zJEEBAGmoy7PISRSG9zO5vMyQq2T271QPKCTJgdn/yQlrKHT8iqV1x3+/cD3j7+aZttUy2Ta9s3C8Sg5hALhnyEkeCb/4C6L8OcDo94Y1vPwoXhRtpYgg3jvx34KbTE9z4dgg3htNtG9Vw0i6u22VU/TzXxqWoxq3vJ107EVBTuEfxljYW/z9posrRa23mfOMZpJOu3A+V6C9Iv16PL6LuT0zAu4EBggV6gcdUw0KRfNVvqWXfw3EZGBZCvnorr1BU/h2yi4iFOnYNbQeLiprKZnedRN28IRK3Pcb7o9/JWp1+G2+Hp6+63+O2iL/olg4vAIxnadGMWqjQxOrORVIuqnBnK8izO3XXh06p0NdceV4PnFjZzRZoGituUnjU0mklG52X3TxfrXFFYe7XUg/uPp867QfN9Msb6qBz+q2d/62d/5+186mNGnRZ+3Rh36V+5XbUOzE6C1aSB3e7BWD+3Vb7PQ+DRLvFOB6fpFUcdvwGYSWaDLKhwXmkLXcW0fFP53w0L68ahvDq7wNud+KO2FoO1g7h3g8arevvb+ZYtkh/TrAt+A81ueE/LvA9G+HBBF1CIxvGdqMK1+gGJGE+nsyf/wBFo88H +sidebar_class_name: "post api-method" +info_path: cartesi-rollups/_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +The dApp should call this method when it cannot proceed with the request processing after an exception happens. +This method should be the last method ever called by the dApp backend while processing a request. + +When running in production mode, the Cartesi Server Manager pauses the Cartesi Machine and reverts the entire state of the machine to what it was before receiving the request. +No HTTP status code will be sent or received. + +When running in host mode, the Rollup HTTP Server returns the status code 200. +In both cases, the input will be skipped with the reason EXCEPTION and the exception message will be forwarded. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/sidebar.ts b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/sidebar.ts new file mode 100644 index 00000000..9f4e9067 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/api-reference/rollup/sidebar.ts @@ -0,0 +1,48 @@ +import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; + +const sidebar: SidebarsConfig = { + apisidebar: [ + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/cartesi-rollup-http-api", + }, + { + type: "category", + label: "UNTAGGED", + items: [ + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/finish", + label: "Finish and get next request", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/add-voucher", + label: "Add a new voucher", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/add-notice", + label: "Add a new notice", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/add-report", + label: "Add a new report", + className: "api-method post", + }, + { + type: "doc", + id: "_versioned_docs/version-2.0/rollups-apis/rollup/register-exception", + label: "Register an exception", + className: "api-method post", + }, + ], + }, + ], +}; + +export default sidebar.apisidebar; diff --git a/cartesi-rollups_versioned_docs/version-2.0/rollups-apis/typeDefs.graphql b/cartesi-rollups_versioned_docs/version-2.0/api-reference/typeDefs.graphql similarity index 100% rename from cartesi-rollups_versioned_docs/version-2.0/rollups-apis/typeDefs.graphql rename to cartesi-rollups_versioned_docs/version-2.0/api-reference/typeDefs.graphql diff --git a/cartesi-rollups_versioned_docs/version-2.0/deployment/introduction.md b/cartesi-rollups_versioned_docs/version-2.0/deployment/introduction.md index 2e1b63be..ac75b55d 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/deployment/introduction.md +++ b/cartesi-rollups_versioned_docs/version-2.0/deployment/introduction.md @@ -9,11 +9,15 @@ resources: Applications built on Cartesi Rollups are intended to be deployed to public blockchains so users can access them. This can be done by taking advantage of a cloud-based infrastructure. -Deploying a Cartesi dApp involves two steps: deploying a smart contract that defines your dApp on-chain and then instantiating a node that runs the application’s intended backend logic. +Deploying a Cartesi dApp involves two steps: deploying a smart contract that defines your dApp on-chain and then instantiating a node that runs the application's intended backend logic. To facilitate the instantiation of such nodes, Cartesi provides an infrastructure for quickly getting them running in the cloud so the node can be run 24/7. This server will expose a single port to the internet so client applications can communicate with the node. -The Cartesi rollups node is distributed as a Docker image. Any popular cloud provider, like AWS, GCP, Azure, Digital Ocean, or Linode, can run docker containers and hence can be used to host the rollups node. +## Public snapshots + +For production deployments, applications must use **public snapshots** that are built through public workflows and published as public releases. This ensures transparency, reproducibility, trust, and auditability - essential for the trustless nature of blockchain applications. + +[Learn more about public snapshots](./snapshot.md) ## Deployment process @@ -23,23 +27,22 @@ The `cartesi build` command produces the Cartesi genesis machine, which contains After deployment, any changes to the application code will generate a different hash and, hence, require another deployment. -The smart contract that represents the application on the base layer can be deployed using the [`CartesiDAppFactory`](../rollups-apis/json-rpc/application-factory.md) smart contract. +The smart contract that represents the application on the base layer can be deployed using the [`CartesiDAppFactory`](../api-reference/contracts/application-factory.md) smart contract. There are two methods to deploy an application: -1. [Self-hosted deployment](../deployment/self-hosted.md): Deploy the application node using your infrastructure. - -2. Third-party service provider: Outsource running the application node to a service provider. +1. [Self-hosted deployment](./self-hosted.md): Deploy the application node using your infrastructure +2. Third-party service provider: Outsource running the application node to a service provider :::caution important -Deployment with a third-party service provider is under development and will be available in a future release. +Deployment with a third-party service provider is under development and will be available soon. ::: ## Supported networks As stated above, the first step in deploying a new Cartesi dApp to a blockchain requires creating a smart contract on that network that uses the Cartesi Rollups smart contracts. Cartesi has already deployed the Rollups smart contracts to several networks for convenience. -The table below shows the list of all [networks that are currently supported](https://github.com/cartesi/rollups-contracts/tree/v1.4.0/onchain/rollups/deployments) in the latest release: +The table below shows the list of all [networks that are currently supported](https://usecannon.com/packages/cartesi-rollups) in the latest release: | Network Name | Chain ID | | ---------------- | -------- | diff --git a/cartesi-rollups_versioned_docs/version-2.0/deployment/self-hosted.md b/cartesi-rollups_versioned_docs/version-2.0/deployment/self-hosted.md index d4ce4914..e4f85dc3 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/deployment/self-hosted.md +++ b/cartesi-rollups_versioned_docs/version-2.0/deployment/self-hosted.md @@ -1,27 +1,14 @@ --- id: self-hosted title: Self-hosted deployment -resources: - - url: https://www.codecademy.com/article/installing-and-using-postgresql-locally - title: Installing and Using PostgreSQL Locally - - url: https://docs.digitalocean.com/products/databases/postgresql/how-to/create/ - title: How to Create PostgreSQL Database Clusters - - url: https://www.amazonaws.cn/en/getting-started/tutorials/deploy-docker-containers/ - title: How to Deploy Docker Container - AWS - - url: https://www.digitalocean.com/solutions/docker-hosting - title: Deploy Docker Containers on Digital Ocean - - url: https://docs.docker.com/reference/cli/docker/image/tag/ - title: Docker Tag --- -The self-hosted deployment involves running your infrastructure locally or on a remote cloud server to host your application node. +This guide explains how to run a Cartesi Rollups node locally on your machine for development and testing purposes on **testnet**. -Here are the requirements: +:::warning Production Warning +**This self-hosted approach should NOT be used in *production*.** -- Wallet with sufficient funds on the chosen network. -- A cloud server -- A PostgreSQL database -- A web3 provider for interacting with the selected network +While this setup works with testnet environments, it's designed exclusively for development purposes. It lacks critical production requirements such as: ## Initiating deployment @@ -93,7 +80,7 @@ Alternatively, you can use a service like [Fly.io](https://fly.io/) to deploy yo The connection string for a PostgreSQL database must be configured at the `CARTESI_POSTGRES_ENDPOINT` variable. - You can use any PostgreSQL database, whether managed by a cloud provider or set up on your local infrastructure. The key configuration required is the connection string, encompassing the database URL, username, password, and name. The node necessitates a PostgreSQL database to store the application state, which is accessible via the [GraphQL API](../rollups-apis/graphql/basics.md). + You can use any PostgreSQL database, whether managed by a cloud provider or set up on your local infrastructure. The key configuration required is the connection string, encompassing the database URL, username, password, and name. The node necessitates a PostgreSQL database to store the application state, which is accessible via the [GraphQL API](../api-reference/graphql/basics.md). 1. With all the config variables set, here is how you can run the node on your local machine: @@ -115,57 +102,95 @@ Fly.io is a platform where you can conveniently deploy applications packaged as If deploying to Fly.io from macOS with Apple Silicon, create a Docker image for `linux/amd64` with: `cartesi deploy build --platform linux/amd64` ::: -1. [Install the flyctl CLI](https://fly.io/docs/hands-on/install-flyctl/) +## Prerequisites -1. [Create an account](https://fly.io/docs/hands-on/sign-up-sign-in/) +Before starting, ensure you have the following installed: -1. Create an application: +- Cartesi CLI: An easy-to-use tool for developing and deploying your dApps. + +- Docker Desktop 4.x: The required tool to distribute the Cartesi Rollups framework and its dependencies. + +For more details about the installation process for each of these tools, please refer to the [this section](../development/installation.md). + +## Configuration + +Before running the node, you need to configure your `.env` file with the following environment variables: + +```shell +BLOCKCHAIN_ID= +AUTH_KIND="private_key_file" +PRIVATE_KEY_FILE="/run/secrets/pk" +BLOCKCHAIN_WS_ENDPOINT="" +BLOCKCHAIN_HTTP_ENDPOINT="" +``` + +**Important notes:** + +| Variable | Description | +|----------|-------------| +| `BLOCKCHAIN_ID` | Replace `` with your blockchain network ID | +| `BLOCKCHAIN_WS_ENDPOINT` | Replace `` with your WebSocket endpoint | +| `BLOCKCHAIN_HTTP_ENDPOINT` | Replace `` with your HTTP endpoint | +| `PRIVATE_KEY_FILE` | Points to the private key file created in [**step 2**](#setting-up-the-local-node) | +| `AUTH_KIND` | Set to `"private_key_file"` for local development | + +## Setting up the local node + +1. **Download the Cartesi Rollups Node docker compose file in your project root:** ```shell - $ fly app create - New app created: + curl -L https://raw.githubusercontent.com/cartesi/docs/refs/heads/docs/deployment/cartesi-rollups_versioned_docs/version-2.0/deployment/src/compose.local.yaml -o compose.local.yaml ``` -1. Create a Postgres database application: +2. **Create a secret for private key storage:** ```shell - fly postgres create --initial-cluster-size 1 --name -database --vm-size shared-cpu-1x --volume-size 1 + mkdir -p secrets + echo "YOUR_PRIVATE_KEY" > secrets/pk ``` - Save the connection string provided by the command output. + :::danger Security + Ensure the `secrets/` directory is in a secure location and has restricted permissions, different from the project root to avoid leaking your private key. + ::: -1. Attach database to the node application: +3. **Build the application with the Cartesi CLI:** ```shell - fly postgres attach -database -a + cartesi build ``` -1. Download `fly.toml` file from deploying the contracts and move it to your application directory: + This command compiles your application into RISC-V architecture and creates a Cartesi machine snapshot locally. - ![deploy self-hosted config](../../../static/img/v1.3/fly.png) - -1. Edit the `fly.toml` file to change all occurrences of `` to the name of your application - -1. Create secrets for sensitive configuration with the actual values: +4. **Run the Cartesi Rollups Node with the application's initial snapshot attached:** ```shell - fly secrets set -a CARTESI_BLOCKCHAIN_HTTP_ENDPOINT= - fly secrets set -a CARTESI_BLOCKCHAIN_WS_ENDPOINT= - fly secrets set -a CARTESI_AUTH_MNEMONIC=`` - fly secrets set -a CARTESI_POSTGRES_ENDPOINT= + docker compose -f compose.local.yaml --env-file .env up -d ``` - Set value of the `connection_string` as provided by step 4. + This starts the local node using the configuration from your `.env` file. -1. Deploy the node: +5. **Deploy and register the application to the node:** + + ```shell + docker compose --project-name cartesi-rollups-node \ + exec advancer cartesi-rollups-cli deploy application /var/lib/cartesi-rollups-node/snapshot \ + --epoch-length 720 \ + --self-hosted \ + --salt \ + --json + ``` - Tag the image produced at the beginning of the process and push it to the Fly.io registry: + Replace `` with your application name and `` with a unique identifier. The salt must be unique for each deployment and cannot be repeated. You can generate a unique salt using: ```shell - flyctl auth docker - docker image tag registry.fly.io/ - docker image push registry.fly.io/ - fly deploy -a + cast keccak256 "your-unique-string" ``` - + After this process, you'll have your application deployed and registered to the node. + +## Accessing the node + +Once running, your local Cartesi Rollups Node will be accessible through the standard APIs: + +- Inspect endpoint: `http://localhost:10012` +- JSON-RPC endpoint: `http://localhost:10011` \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/deployment/snapshot.md b/cartesi-rollups_versioned_docs/version-2.0/deployment/snapshot.md new file mode 100644 index 00000000..2b79b0c0 --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/deployment/snapshot.md @@ -0,0 +1,184 @@ +--- +id: snapshot +title: Public snapshot +--- + +A Cartesi snapshot is a compressed representation of your application's machine state that can be deployed to rollups nodes. This process involves: + +1. Building your application with the Cartesi CLI +2. Creating a compressed snapshot archive +3. Generating checksums for verification +4. Publishing releases with snapshot artifacts + +Public snapshots are crucial for applications developed with the Cartesi Rollups framework because they enable **anyone to validate the respective application**. This transparency is fundamental to the trustless nature of blockchain applications. + +### Validation Process + +When a snapshot is public, validators can: + +1. Download the snapshot from the release +2. Verify the checksum to ensure integrity +3. Extract and inspect the machine state +4. Reproduce the build process locally +5. Compare results to ensure consistency + +This process ensures that the application behaves exactly as intended and hasn't been tampered with during deployment. + +:::danger +**Note**: Always download snapshots from verified public GitHub releases, never from local builds or private sources. +::: + +## Prerequisites + +Before building snapshots, ensure you have: + +- Cartesi CLI: An easy-to-use tool for developing and deploying your dApps. + +- Docker Desktop 4.x: The required tool to distribute the Cartesi Rollups framework and its dependencies. + +- Node and NPM: A JavaScript runtime needed to install Cartesi CLI and run various scripts. We recommend installing the LTS version to ensure best compatibility. + +For more details about the installation process for each of these tools, please refer to the [this section](../development/installation.md). + +## GitHub Actions Workflow + +The following workflow automates the snapshot building and release process: + +```yaml +name: build-and-release + +on: + push: + tags: + - "*" + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build: + name: build + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + env: + REGISTRY: ghcr.io + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: current + + - name: Install Cartesi CLI + run: npm install -g @cartesi/cli@2.0.0-alpha.16 + + - name: Log in to GHCR + if: startsWith(github.ref, 'refs/tags/') + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image and Cartesi snapshot + run: cartesi build + env: + DOCKER_BUILDKIT: 1 + BUILDKIT_INLINE_CACHE: 1 + + - name: Create compressed snapshot + if: startsWith(github.ref, 'refs/tags/') + run: | + tar -czf snapshot.tar.gz -C .cartesi/image . + sha256sum snapshot.tar.gz > snapshot.tar.gz.sha256 + + - name: Upload snapshot artifacts + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v4 + with: + name: snapshot + path: | + snapshot.tar.gz + snapshot.tar.gz.sha256 + + release: + name: release + if: startsWith(github.ref, 'refs/tags/v') + needs: build + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Download snapshot artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Prepare release assets + run: | + mkdir -p release-assets + find artifacts -name "*.tar.gz" -exec cp {} release-assets/ \; + find artifacts -name "*.sha256" -exec cp {} release-assets/ \; + + - name: Publish GitHub release + uses: softprops/action-gh-release@v2 + with: + files: release-assets/* + prerelease: ${{ contains(github.ref, '-rc') }} + fail_on_unmatched_files: true +``` + +## Workflow Breakdown + +### Triggers + +The workflow is triggered by: + +- **Tag pushes**: Any tag push triggers a build +- **Pull requests**: Builds on PRs to main branch +- **Manual dispatch**: Manual workflow execution + +### Build Job + +The build job sets up the environment with Docker Buildx, QEMU, and Node.js, installs the Cartesi CLI globally, and uses `cartesi build` to create the Cartesi machine snapshot. It then compresses the snapshot as `snapshot.tar.gz`, generates a SHA256 checksum for verification, and uploads the artifacts for the release job. + +### Release Job + +The release job downloads the build artifacts, prepares the release assets, and creates a GitHub release with the tag. It attaches the snapshot files and checksums, marking the release as prerelease if the tag contains `-rc`. + +## Release Management + +### Creating Releases + +1. **Tag your release**: + + ```shell + git tag v1.0.0 + git push origin v1.0.0 + ``` + +2. **Prereleases**: Use tags like `v1.0.0-rc` for release candidates + +3. **Release artifacts** will include: + + - `snapshot.tar.gz` - Compressed snapshot + - `snapshot.tar.gz.sha256` - Checksum file \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/deployment/src/compose.local.yaml b/cartesi-rollups_versioned_docs/version-2.0/deployment/src/compose.local.yaml new file mode 100644 index 00000000..ded253ea --- /dev/null +++ b/cartesi-rollups_versioned_docs/version-2.0/deployment/src/compose.local.yaml @@ -0,0 +1,118 @@ +name: cartesi-rollups-node +x-env: &env + CARTESI_LOG_LEVEL: info + CARTESI_AUTH_KIND: ${AUTH_KIND} + CARTESI_BLOCKCHAIN_ID: ${BLOCKCHAIN_ID} + CARTESI_AUTH_PRIVATE_KEY_FILE: ${PRIVATE_KEY_FILE} + CARTESI_BLOCKCHAIN_WS_ENDPOINT: ${BLOCKCHAIN_WS_ENDPOINT} + CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: ${BLOCKCHAIN_HTTP_ENDPOINT} + CARTESI_SNAPSHOTS_DIR: "/var/lib/cartesi-rollups-node/snapshot" + CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: 0xc70074BDD26d8cF983Ca6A5b89b8db52D5850051 + CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS: 0xC7003566dD09Aa0fC0Ce201aC2769aFAe3BF0051 + CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS: 0xc7006f70875BaDe89032001262A846D3Ee160051 + CARTESI_CONTRACTS_SELF_HOSTED_APPLICATION_FACTORY_ADDRESS: 0xc700285Ab555eeB5201BC00CFD4b2CC8DED90051 + CARTESI_DATABASE_CONNECTION: postgres://postgres:password@database:5432/rollupsdb?sslmode=disable + +secrets: + pk: + file: ./secrets/pk # TODO: change to the path of the your private key file + +services: + database: + container_name: database + image: cartesi/rollups-database:0.12.0-alpha.20 + environment: + POSTGRES_PASSWORD: password + networks: + - default + healthcheck: + test: + - CMD-SHELL + - pg_isready -U postgres || exit 1 + timeout: 1s + interval: 10s + retries: 5 + start_period: 10s + start_interval: 200ms + + evm-reader: + container_name: evm-reader + image: cartesi/rollups-runtime:0.12.0-alpha.20 + command: cartesi-rollups-evm-reader + depends_on: + database: + condition: service_healthy + networks: + - default + ports: + - "10001:10001" + environment: + <<: *env + + advancer: + container_name: advancer + image: cartesi/rollups-runtime:0.12.0-alpha.20 + command: cartesi-rollups-advancer + depends_on: + database: + condition: service_healthy + volumes: + - data:/var/lib/cartesi-rollups-node/data + - .cartesi/image:/var/lib/cartesi-rollups-node/snapshot/ + networks: + - default + ports: + - "10002:10002" + - "10012:10012" + environment: + <<: *env + secrets: + - pk + + validator: + container_name: validator + image: cartesi/rollups-runtime:0.12.0-alpha.20 + command: cartesi-rollups-validator + depends_on: + database: + condition: service_healthy + networks: + - default + ports: + - "10003:10003" + environment: + <<: *env + + claimer: + container_name: claimer + image: cartesi/rollups-runtime:0.12.0-alpha.20 + command: cartesi-rollups-claimer + depends_on: + database: + condition: service_healthy + networks: + - default + ports: + - "10004:10004" + environment: + <<: *env + secrets: + - pk + + jsonrpc-api: + container_name: jsonrpc-api + image: cartesi/rollups-runtime:0.12.0-alpha.20 + command: cartesi-rollups-jsonrpc-api + depends_on: + database: + condition: service_healthy + networks: + - default + ports: + - "10005:10005" + - "10011:10011" + environment: + <<: *env + +volumes: + data: \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/development/asset-handling.md b/cartesi-rollups_versioned_docs/version-2.0/development/asset-handling.md index 0e6b004e..106a2771 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/development/asset-handling.md +++ b/cartesi-rollups_versioned_docs/version-2.0/development/asset-handling.md @@ -8,49 +8,139 @@ resources: Assets exist on the base layer, where they have actual meaning and value. -As with any execution layer solution, a Cartesi dApp that wants to manipulate assets needs a secure way of "teleporting" the assets from the base layer to the execution layer and then a way to "teleport" them back to the base layer. +As with any execution layer solution, a Cartesi Application that wants to manipulate assets needs a secure way of "teleporting" the assets from the base layer to the execution layer and when necessary, back to the base layer. Currently, Cartesi Rollups support the following types of assets: -- [Ether (ETH)](../rollups-apis/json-rpc/portals/) -- [ERC-20](../rollups-apis/json-rpc/portals/ERC20Portal.md) -- [ERC-721](../rollups-apis/json-rpc/portals/ERC721Portal.md) -- [ERC-1155 Single](../rollups-apis/json-rpc/portals/ERC1155SinglePortal.md) -- [ERC-1155 Batch](../rollups-apis/json-rpc/portals/ERC1155BatchPortal.md) +- [Ether (ETH)](../api-reference/contracts/portals/EtherPortal.md) +- [ERC-20](../api-reference/contracts/portals/ERC20Portal.md) +- [ERC-721](../api-reference/contracts/portals/ERC721Portal.md) +- [ERC-1155 Single](../api-reference/contracts/portals/ERC1155SinglePortal.md) +- [ERC-1155 Batch](../api-reference/contracts/portals/ERC1155BatchPortal.md) -![img](../../../static/img/v1.3/assets.jpg) +![img](../../..//static/img/v2.0/onchain-contracts.jpg) ## Deposits -Portals enable the safe transfer of assets from the base layer to the execution layer. Users authorize portals to deduct assets from their accounts and initiate transfers to dApps. +Portals enable the safe transfer of assets from the base layer to the execution layer. Users authorize portals to deduct assets from their accounts and initiate transfers to the Application contract. -When an asset is deposited, it is on the base layer but gains a representation in the execution layer. The corresponding Portal contract sends an input via the `InputBox` contract describing the type of asset, amount, and some data the depositor might want the dApp to read. The off-chain machine will then interpret and validate the input payload. +When an asset is deposited, it is on the base layer but gains a representation in the execution layer. The corresponding Portal contract sends an input via the `InputBox` contract describing the type of asset, amount, and some data the depositor might want the application to read. The off-chain machine will then interpret and validate the input payload. Deposit input payloads are always specified as packed ABI-encoded parameters, as detailed below. -![img](../../..//static/img/v1.3/abi.jpg) +![img](../../..//static/img/v2.0/deposit-payload.jpg) ### ABI encoding for deposits - | Asset | Packed ABI-encoded payload fields | Standard ABI-encoded payload fields | | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------- | | Ether |
  • `address sender`,
  • `uint256 value`,
  • `bytes execLayerData`
| none | -| ERC-20 |
  • `bool success`,
  • `address token`,
  • `address sender`,
  • `uint256 amount`,
  • `bytes execLayerData`
| none | +| ERC-20 |
  • `address token`,
  • `address sender`,
  • `uint256 amount`,
  • `bytes execLayerData`
| none | | ERC-721 |
  • `address token`,
  • `address sender`,
  • `uint256 tokenId`,
  • standard ABI-encoded fields...
|
  • `bytes baseLayerData`,
  • `bytes execLayerData`
| | ERC-1155 (single) |
  • `address token`,
  • `address sender`,
  • `uint256 tokenId`,
  • `uint256 value`,
  • standard ABI-encoded fields...
|
  • `bytes baseLayerData`,
  • `bytes execLayerData`
| | ERC-1155 (batch) |
  • `address token`,
  • `address sender`,
  • standard ABI-encoded fields...
|
  • `uint256[] tokenIds`,
  • `uint256[] values`,
  • `bytes baseLayerData`,
  • `bytes execLayerData`
| - ## Withdrawing assets -Users can deposit assets to a Cartesi dApp, but only the dApp can initiate withdrawals. When a withdrawal request is made, it’s processed and interpreted off-chain by the Cartesi Machine running the dApp’s code. Subsequently, the Cartesi Machine creates a voucher containing the necessary instructions for withdrawal, which is executable when an epoch has settled. +Users can deposit assets to a Cartesi Application, but only the Application can initiate withdrawals. When a withdrawal request is made, it’s processed and interpreted off-chain by the Cartesi Machine running the application’s code. Subsequently, the Cartesi Machine creates a voucher containing the necessary instructions for withdrawal, which is executable when an epoch has settled. + +### Withdrawing Tokens + +Vouchers are crucial in allowing applications in the execution layer to interact with contracts in the base layer through message calls. They are emitted by the off-chain machine and executed by any participant in the base layer. Each voucher includes a destination address and a payload, typically encoding a function call for Solidity contracts. + +The application’s off-chain layer often requires knowledge of its address to facilitate on-chain interactions for withdrawals, for example: `transferFrom(sender, recipient, amount)`. In this case, the sender is the application itself. + +By calling [`relayDAppAddress()`](../api-reference/json-rpc/relays/relays.md), function of the `DAppAddressRelay` contract, it adds the dApp’s address as a new input for the Cartesi dApp to process. Next, the off-chain machine uses this address to generate a voucher for execution at the [`executeVoucher()`](../api-reference/json-rpc/application.md/#executevoucher) function of the `CartesiDApp` contract. + +Below is a sample JavaScript code with the implementations to transfer tokens to whoever calls the application, notice that the `const call` variable is an encoded function data containing the token contract ABI, function name and also arguments like recipient and amount, while the actual `voucher` structure itself contains a destination (erc20 token contract where the transfer execution should occur), the payload (encoded function data in `call`) and finally a value field which is initialized to `0` meaning no Ether is intended to be sent alongside this transfer request. + +```javascript +import { stringToHex, encodeFunctionData, erc20Abi, hexToString, zeroHash } from "viem"; + +const rollup_server = process.env.ROLLUP_HTTP_SERVER_URL; +console.log("HTTP rollup_server url is " + rollup_server); + +async function handle_advance(data) { + console.log("Received advance request data " + JSON.stringify(data)); + + const sender = data["metadata"]["msg_sender"]; + const payload = hexToString(data.payload); + const erc20Token = "0x784f0c076CC55EAD0a585a9A13e57c467c91Dc3a"; // Sample ERC20 token address + + const call = encodeFunctionData({ + abi: erc20Abi, + functionName: "transfer", + args: [sender, BigInt(10)], + }); + + let voucher = { + destination: erc20Token, + payload: call, + value: zeroHash, + }; + + await emitVoucher(voucher); + return "accept"; +} + +const emitVoucher = async (voucher) => { + try { + await fetch(rollup_server + "/voucher", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(voucher), + }); + } catch (error) { + //Do something when there is an error + } +}; +``` + +### Withdrawing Ether + +To execute Ether withdrawal it is important to emit a voucher with the necessary details as regarding whom you intend to send the Ether to and also the amount to send, nevertheless since the Application contract Executes vouchers by making a [safeCall](https://github.com/cartesi/rollups-contracts/blob/cb52d00ededd2da9f8bf7757710301dccb7d536d/src/library/LibAddress.sol#L18C14-L18C22) to the destination, passing a value (Ether amount to send along with the call) and a payload (function signature to call), it's acceptable to leave the payload section empty if you do not intend to call any functions in the destination address while sending just the specified value of Ether to the destination address. If you intend to call a payable function and also send Ether along, you can add a function signature matching the payable function you intend to call to the payload field. + +Below is another sample JavaScript code, this time the voucher structure has been modified to send ether to an address instead of calling a function in a smart contract, notice there is no `encodedFunctionData`, so the payload section is initialized to zeroHash. + +```javascript +import { stringToHex, encodeFunctionData, erc20Abi, hexToString, zeroHash, parseEther } from "viem"; + +const rollup_server = process.env.ROLLUP_HTTP_SERVER_URL; +console.log("HTTP rollup_server url is " + rollup_server); + +async function handle_advance(data) { + console.log("Received advance request data " + JSON.stringify(data)); + + const sender = data["metadata"]["msg_sender"]; + const payload = hexToString(data.payload); + -Vouchers are crucial in allowing dApps in the execution layer to interact with contracts in the base layer through message calls. They are emitted by the off-chain machine and executed by any participant in the base layer. Each voucher includes a destination address and a payload, typically encoding a function call for Solidity contracts. + let voucher = { + destination: sender, + payload: zeroHash, + value: numberToHex(BigInt(parseEther("1"))).slice(2), + }; -The dApp’s off-chain layer often requires knowledge of its address to facilitate on-chain interactions for withdrawals, for example: `transferFrom(sender, recipient, amount)`. In this case, the sender is the dApp itself. + await emitVoucher(voucher); + return "accept"; +} -By calling [`relayDAppAddress()`](../rollups-apis/json-rpc/relays/relays.md), function of the `DAppAddressRelay` contract, it adds the dApp’s address as a new input for the Cartesi dApp to process. Next, the off-chain machine uses this address to generate a voucher for execution at the [`executeVoucher()`](../rollups-apis/json-rpc/application.md/#executevoucher) function of the `CartesiDApp` contract. +const emitVoucher = async (voucher) => { + try { + await fetch(rollup_server + "/voucher", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(voucher), + }); + } catch (error) { + //Do something when there is an error + } +}; +``` :::note epoch length By default, Cartesi nodes close one epoch every 7200 blocks. You can [manually set the epoch length](./cli-commands.md/#run) to facilitate quicker asset-handling methods. @@ -60,7 +150,7 @@ Here are the function signatures used by vouchers to withdraw the different type | Asset | Destination | Function signature | | :------- | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | -| Ether | dApp contract | `withdrawEther(address,uint256)` [:page_facing_up:](../rollups-apis/json-rpc/application.md/#withdrawether) | +| Ether | dApp contract | `withdrawEther(address,uint256)` [:page_facing_up:](../api-reference/json-rpc/application.md/#withdrawether) | | ERC-20 | Token contract | `transfer(address,uint256)` [:page_facing_up:](https://eips.ethereum.org/EIPS/eip-20#methods) | | ERC-20 | Token contract | `transferFrom(address,address,uint256)` [:page_facing_up:](https://eips.ethereum.org/EIPS/eip-20#methods) | | ERC-721 | Token contract | `safeTransferFrom(address,address,uint256)` [:page_facing_up:](https://eips.ethereum.org/EIPS/eip-721#specification) | diff --git a/cartesi-rollups_versioned_docs/version-2.0/development/building-the-application.md b/cartesi-rollups_versioned_docs/version-2.0/development/building-the-application.md deleted file mode 100644 index fbac5190..00000000 --- a/cartesi-rollups_versioned_docs/version-2.0/development/building-the-application.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -id: building-the-application -title: Building the application ---- - -“Building” in this context compiles your application into RISC-V architecture and consequently builds a Cartesi machine containing your application. This architecture enables computation done by your application to be reproducible and verifiable. - -With the Docker engine running, change the directory to your application and build by running: - -```shell -cartesi build -``` - -The successful execution of this step will log this in your terminal: - -```shell - . - / \ - / \ -\---/---\ /----\ - \ X \ - \----/ \---/---\ - \ / CARTESI - \ / MACHINE - ' - -[INFO rollup_http_server] starting http dispatcher service... -[INFO rollup_http_server::http_service] starting http dispatcher http service! -[INFO actix_server::builder] starting 1 workers -[INFO actix_server::server] Actix runtime found; starting in Actix runtime -[INFO rollup_http_server::dapp_process] starting dapp -INFO:__main__:HTTP rollup_server url is http://127.0.0.1:5004 -INFO:__main__:Sending finish - -Manual yield rx-accepted (0x100000000 data) -Cycles: 2767791744 -2767791744: b740d27cf75b6cb10b1ab18ebd96be445ca8011143d94d8573221342108822f5 -Storing machine: please wait -Successfully copied 288MB to /Users/michaelasiedu/Code/calculator/python/.cartesi/image -``` -## Memory - -To change the default memory size for the Cartesi Machine, you can personalize it by adding a specific label in your Dockerfile. - -The line below lets you define the memory size in megabytes (MB): - -```dockerfile -LABEL io.cartesi.rollups.ram_size=128Mi -``` - -:::note environment variables -You can create a `.cartesi.env` in the project's root and override any variable controlling the rollups-node. -::: \ No newline at end of file diff --git a/cartesi-rollups_versioned_docs/version-2.0/development/cli-commands.md b/cartesi-rollups_versioned_docs/version-2.0/development/cli-commands.md index fe3f5a70..8baed5a1 100644 --- a/cartesi-rollups_versioned_docs/version-2.0/development/cli-commands.md +++ b/cartesi-rollups_versioned_docs/version-2.0/development/cli-commands.md @@ -3,10 +3,10 @@ id: cli-commands title: CLI commands --- - The Cartesi CLI provides essential tools for developing, deploying, and interacting with Cartesi applications. This page offers a quick reference to available commands and usage. ## Basic Usage + To use any command, run: ```bash @@ -21,131 +21,205 @@ cartesi help [COMMAND] ## Core Commands -| Command | Description | -|---------|-------------| -| `create` | Create a new application | -| `build` | Build the application | -| `run` | Run the application node | -| `send` | Send input to the application | -| `deploy` | Deploy application to a live network | -| `address-book` | Prints addresses of deployed smart contracts | -| `clean` | Clean build artifacts of the application | -| `doctor` | Verify the minimal system requirements | -| `hash` | Print the image hash generated by the build command | -| `shell` | Start a shell in the Cartesi machine of the application | - +| Command | Description | +| -------------- | --------------------------------------------------------------------------------- | +| `build` | Build the application | +| `send` | Send input to the application | +| `address-book` | Prints addresses of deployed smart contracts | +| `clean` | Deletes all cached build artifacts of application. | +| `doctor` | Verify the minimal system requirements | +| `hash` | Print the image hash generated by the build command | +| `shell` | Start a shell in the Cartesi machine of the application | +| `create` | Creates a new application template. | +| `logs` | Show logs of a local node environment. | +| `start` | Start a local node environment. | +| `status` | Shows the status of a local node environment. | +| `stop` | Stop a local node environment. | +| `deploy` | Deploy an application to a node. | --- -### `create` -Create a new Cartesi application from a template. +### `build` + +Compiles your application to RISC-V and builds a Cartesi machine snapshot. #### Usage: + ```bash -cartesi create NAME --template [--branch ] +cartesi build [--from-image ] [--target ] ``` #### Flags: -- `--template=