diff --git a/docusaurus.config.js b/docusaurus.config.js index 89df84e2..adba332d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -65,6 +65,16 @@ const config = { organizationName: "cartesi", // Usually your GitHub org/user name. projectName: "cartesi", // Usually your repo name. scripts: ["/js/index.js"], + headTags: [ + { + tagName: 'link', + attributes: { + rel: 'alternate', + type: 'text/plain', + href: '/llms.txt', + }, + }, + ], // markdown: { format: "md" }, // NOTE: Use this to disable MDX and use MD instead presets: [ [ @@ -340,6 +350,7 @@ const config = { }, }), plugins: [ + require.resolve("./plugins/serve-markdown.js"), [ "@docusaurus/plugin-content-docs", { diff --git a/plugins/serve-markdown.js b/plugins/serve-markdown.js new file mode 100644 index 00000000..a8bd932c --- /dev/null +++ b/plugins/serve-markdown.js @@ -0,0 +1,343 @@ +// @ts-check +'use strict'; + +/** + * Docusaurus plugin: serve-markdown + * + * Makes every documentation page available as raw Markdown in two ways: + * 1. Appending .md to a URL + * /cartesi-rollups/2.0/development/building-an-application.md + * 2. Sending Accept: text/markdown header + * → server returns Markdown instead of HTML + * + * Also generates .md files alongside HTML during `docusaurus build`, + * so the static build supports .md URL access too. + * + * Additionally serves and generates llms-full.txt — a single file containing + * all documentation pages concatenated, for LLM consumption. + * + * Docusaurus v3 lifecycle used: + * - allContentLoaded – receives allContent from every plugin; used to build + * the permalink → source-file map. + * - configureWebpack – attaches Express middleware to the webpack-dev-server. + * webpack-merge v5 chains functions, so Docusaurus's own + * setupMiddlewares (HMR / eval-source-map) is preserved. + * - postBuild – writes .md files and llms-full.txt into the output dir. + */ + +const path = require('path'); +const fs = require('fs'); + +// --------------------------------------------------------------------------- +// Helpers +// --------------------------------------------------------------------------- + +/** + * Resolve a Docusaurus "@site/" source path to an absolute filesystem path. + * + * @param {string} siteDir + * @param {string} source e.g. "@site/docs/foo.md" + * @returns {string} + */ +function resolveSource(siteDir, source) { + if (source.startsWith('@site/')) { + return path.join(siteDir, source.slice('@site/'.length)); + } + return source; +} + +/** + * Walk the allContent object and collect every { permalink → absFilePath } + * pair from all @docusaurus/plugin-content-docs instances. + * + * allContent shape in Docusaurus v3: + * allContent[pluginName][pluginId] = plugin.content + * + * For plugin-content-docs, plugin.content is: + * { loadedVersions: [ { docs: [ { permalink, source, … } ] } ] } + * + * @param {Record>} allContent + * @param {string} siteDir + * @returns {Map} permalink → absolute source path + */ +function buildUrlMap(allContent, siteDir) { + const map = new Map(); + + for (const instancesById of Object.values(allContent)) { + for (const pluginContent of Object.values(instancesById)) { + const versions = pluginContent?.loadedVersions; + if (!Array.isArray(versions)) continue; + + for (const version of versions) { + const docs = version?.docs; + if (!Array.isArray(docs)) continue; + + for (const doc of docs) { + const { permalink, source } = doc; + if (!permalink || !source) continue; + // Normalize: always store with trailing slash so toPermalink lookups + // are consistent regardless of how Docusaurus emits the permalink. + const normalised = permalink.endsWith('/') ? permalink : permalink + '/'; + map.set(normalised, resolveSource(siteDir, source)); + } + } + } + } + + return map; +} + +/** + * Determine the permalink to look up for this request, or return null if + * this request should not be handled by the markdown plugin. + * + * @param {string} reqPath e.g. "/some/page.md" or "/some/page/" + * @param {boolean} wantsMarkdown true when Accept: text/markdown was sent + * @returns {string|null} + */ +function toPermalink(reqPath, wantsMarkdown) { + if (reqPath.endsWith('.md')) { + // /some/page.md → /some/page/ + // /some/dir/.md → /some/dir/ (don't double the trailing slash) + const stripped = reqPath.slice(0, -'.md'.length); + return stripped.endsWith('/') ? stripped : stripped + '/'; + } + if (wantsMarkdown) { + return reqPath.endsWith('/') ? reqPath : reqPath + '/'; + } + return null; +} + +/** + * Build the Express request handler that serves raw Markdown for individual pages. + * + * @param {Map} urlMap + * @param {string} siteDir + * @returns {import('express').RequestHandler} + */ +function makeMarkdownHandler(urlMap, siteDir) { + return function markdownHandler(req, res, next) { + const wantsMarkdown = (req.headers['accept'] ?? '').includes('text/markdown'); + const permalink = toPermalink(req.path, wantsMarkdown); + if (!permalink) return next(); + + const sourceFile = urlMap.get(permalink); + + // Root URL has no markdown doc source — serve llms.txt as the site index. + if (!sourceFile && permalink === '/') { + try { + const content = fs.readFileSync(path.join(siteDir, 'static', 'llms.txt'), 'utf8'); + res.setHeader('Content-Type', 'text/markdown; charset=utf-8'); + res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate'); + res.setHeader('X-Content-Type-Options', 'nosniff'); + return res.send(content); + } catch { + return next(); + } + } + + if (!sourceFile) return next(); + + let content; + try { + content = fs.readFileSync(sourceFile, 'utf8'); + } catch { + return next(); + } + + res.setHeader('Content-Type', 'text/markdown; charset=utf-8'); + res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate'); + res.setHeader('X-Content-Type-Options', 'nosniff'); + return res.send(content); + }; +} + +/** + * Concatenate all documentation pages into a single string for llms-full.txt. + * Pages are sorted by permalink for consistent ordering. + * Each page is preceded by a URL header so LLMs can anchor content to its source. + * + * @param {Map} urlMap + * @param {string} siteUrl e.g. "https://docs.cartesi.io" + * @returns {string} + */ +function buildLlmsFullContent(urlMap, siteUrl) { + const parts = []; + const sortedEntries = [...urlMap.entries()].sort(([a], [b]) => a.localeCompare(b)); + + for (const [permalink, sourcePath] of sortedEntries) { + let content; + try { + content = fs.readFileSync(sourcePath, 'utf8'); + } catch { + continue; + } + const pageUrl = siteUrl.replace(/\/$/, '') + permalink; + parts.push(`\n\n---\n\nSource: ${pageUrl}\n\n${content.trim()}`); + } + + return parts.join(''); +} + +/** + * Build the Express request handler that serves /llms.txt dynamically in dev, + * rewriting the hardcoded production domain to match the incoming request host. + * This allows tools/scorers running against a tunnel or staging URL to discover + * and test pages on that host rather than the production domain. + * + * @param {string} siteDir + * @param {string} siteUrl canonical production URL (e.g. "https://docs.cartesi.io") + * @returns {import('express').RequestHandler} + */ +function makeLlmsTxtHandler(siteDir, siteUrl) { + return function llmsTxtHandler(req, res, next) { + if (req.path !== '/llms.txt') return next(); + + let content; + try { + content = fs.readFileSync(path.join(siteDir, 'static', 'llms.txt'), 'utf8'); + } catch { + return next(); + } + + // Rewrite the canonical domain to the host of this request so that + // scanners/scorers (e.g. running against an ngrok tunnel) can follow + // the links and test markdown serving on the correct origin. + const reqOrigin = `${req.protocol}://${req.headers['host']}`; + if (reqOrigin && reqOrigin !== siteUrl) { + content = content.split(siteUrl).join(reqOrigin); + } + + res.setHeader('Content-Type', 'text/plain; charset=utf-8'); + res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate'); + res.setHeader('X-Content-Type-Options', 'nosniff'); + return res.send(content); + }; +} + +/** + * Build the Express request handler that serves llms-full.txt dynamically in dev. + * + * @param {Map} urlMap + * @param {string} siteUrl + * @returns {import('express').RequestHandler} + */ +function makeLlmsFullHandler(urlMap, siteUrl) { + return function llmsFullHandler(req, res, next) { + if (req.path !== '/llms-full.txt') return next(); + + const content = buildLlmsFullContent(urlMap, siteUrl); + res.setHeader('Content-Type', 'text/plain; charset=utf-8'); + res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate'); + res.setHeader('X-Content-Type-Options', 'nosniff'); + return res.send(content); + }; +} + +// --------------------------------------------------------------------------- +// Plugin factory +// --------------------------------------------------------------------------- + +/** + * @param {import('@docusaurus/types').LoadContext} context + * @returns {import('@docusaurus/types').Plugin} + */ +module.exports = function serveMarkdownPlugin(context) { + const { siteDir, siteConfig } = context; + const siteUrl = siteConfig.url || 'https://docs.cartesi.io'; + + // Shared mutable map populated in allContentLoaded and consumed in + // configureWebpack + postBuild. allContentLoaded always runs before both. + const urlMap = new Map(); + + return { + name: 'docusaurus-plugin-serve-markdown', + + // ── 1. Build URL → source file map (Docusaurus v3 hook) ───────────────── + // + // In Docusaurus v3, allContent is available only in allContentLoaded, not + // in contentLoaded. allContentLoaded runs after every plugin's + // contentLoaded, and before configureWebpack / postBuild. + // + async allContentLoaded({ allContent }) { + const discovered = buildUrlMap(allContent, siteDir); + for (const [permalink, absPath] of discovered) { + urlMap.set(permalink, absPath); + } + }, + + // ── 2. Dev server: intercept .md / Accept:text/markdown requests ───────── + // + // configureWebpack returns a partial webpack config that is merged with the + // base config using webpack-merge. In webpack-merge v5, functions are + // CHAINED, so Docusaurus's own setupMiddlewares (which adds the HMR / + // eval-source-map middleware) still runs alongside ours. + // + // We attach our handlers to devServer.app directly instead of pushing into + // the middlewares array, which keeps ordering concerns simpler and avoids + // any interference with Docusaurus's own middleware list. + // + configureWebpack(_config, isServer) { + if (isServer) return {}; + + const markdownHandler = makeMarkdownHandler(urlMap, siteDir); + const llmsFullHandler = makeLlmsFullHandler(urlMap, siteUrl); + const llmsTxtHandler = makeLlmsTxtHandler(siteDir, siteUrl); + + return { + devServer: { + setupMiddlewares(middlewares, devServer) { + // devServer.app is the underlying Express application. + // Middleware registered here runs before webpack-dev-server's + // built-in static-file / HMR routes. + devServer.app.use(llmsTxtHandler); // dynamic /llms.txt (host-rewritten) + devServer.app.use(llmsFullHandler); // dynamic /llms-full.txt + devServer.app.use(markdownHandler); // .md URLs + Accept: text/markdown + return middlewares; // leave existing middlewares untouched + }, + }, + }; + }, + + // ── 3. Production build: write .md files and llms-full.txt ─────────────── + async postBuild({ outDir }) { + let written = 0; + let skipped = 0; + + // Write individual .md files next to HTML pages + for (const [permalink, sourcePath] of urlMap.entries()) { + // /some/page/ → outDir/some/page.md + const relPath = permalink.replace(/^\//, '').replace(/\/$/, ''); + if (!relPath) continue; // skip the bare root + + const mdOutputPath = path.join(outDir, relPath + '.md'); + const outputDir = path.dirname(mdOutputPath); + + try { + if (!fs.existsSync(sourcePath)) { skipped++; continue; } + fs.mkdirSync(outputDir, { recursive: true }); + fs.writeFileSync(mdOutputPath, fs.readFileSync(sourcePath, 'utf8'), 'utf8'); + written++; + } catch { + skipped++; + } + } + + // Write llms-full.txt — all documentation concatenated + try { + const llmsFullContent = buildLlmsFullContent(urlMap, siteUrl); + fs.writeFileSync(path.join(outDir, 'llms-full.txt'), llmsFullContent, 'utf8'); + } catch { + // Non-fatal: llms-full.txt is a convenience file + } + + // Use Docusaurus's logger so the message integrates with build output + // eslint-disable-next-line @typescript-eslint/no-var-requires + const logger = require('@docusaurus/logger').default; + logger.info( + `[serve-markdown] wrote ${written} .md files and llms-full.txt to build output` + + (skipped ? ` (${skipped} skipped)` : ''), + ); + }, + }; +}; diff --git a/static/llms.txt b/static/llms.txt index d0209b6c..8f54376c 100644 --- a/static/llms.txt +++ b/static/llms.txt @@ -1,21 +1,121 @@ -# Cartesi Rollups v2.0 +# Cartesi Documentation -> Cartesi Rollups is a modular blockchain framework that enables developers to build decentralized applications using the Linux operating system and any programming language. +> Cartesi rollups is a modular blockchain framework that enables developers to build decentralized applications using the Linux operating system and any programming language, with support for fraud proofs, application-specific rollups, and a full Cartesi Machine emulator. -## Getting Started -- [Overview](https://docs.cartesi.io/cartesi-rollups/2.0/): Introduction to Cartesi Rollups framework +## Instructions for AI Agents + +Use this file to discover and navigate Cartesi's documentation. Each link below points to a documentation page; append `.md` to any URL to retrieve its raw Markdown source (e.g., `https://docs.cartesi.io/cartesi-rollups/2.0/development/building-an-application.md`). A complete machine-readable copy of all docs is available at [https://docs.cartesi.io/llms-full.txt](https://docs.cartesi.io/llms-full.txt). + +When answering questions about Cartesi, use the Rollups v2.0 pages (under `/cartesi-rollups/2.0/`). The Cartesi Machine section covers the off-chain computation layer; the Rollups sections cover the on-chain contracts and node. Fraud Proofs are a distinct sub-system documented separately. + +## Overview + +- [Home](https://docs.cartesi.io/): Cartesi documentation home + +## New to Cartesi + +- [New to Cartesi](https://docs.cartesi.io/new-to-cartesi/): Introduction for newcomers +- [Cartesi Overview](https://docs.cartesi.io/new-to-cartesi/overview/): What is Cartesi +- [Scalability](https://docs.cartesi.io/new-to-cartesi/scalability/): How Cartesi addresses blockchain scalability +- [Choose your Onboarding Path](https://docs.cartesi.io/new-to-cartesi/onboarding/): Guided onboarding paths for different profiles + +## Get Started + +- [Get Started](https://docs.cartesi.io/get-started/): Entry point for all Cartesi products +- [Quickstart](https://docs.cartesi.io/get-started/quickstart/): Build and run your first Cartesi application +- [Optimistic Rollups](https://docs.cartesi.io/get-started/optimistic-rollups/): How optimistic rollups work +- [Appchains](https://docs.cartesi.io/get-started/app-chains/): Application-specific rollup chains +- [Cartesi Machine](https://docs.cartesi.io/get-started/cartesi-machine/): Introduction to the Cartesi Machine +- [CLI commands](https://docs.cartesi.io/get-started/cli-commands/): Cartesi CLI reference +- [Fraud-proof system](https://docs.cartesi.io/get-started/fraud-proofs/): Overview of Cartesi fraud proofs + +## Cartesi Machine + +- [Introduction](https://docs.cartesi.io/cartesi-machine/): Cartesi Machine overview +- [Blockchain - Introduction](https://docs.cartesi.io/cartesi-machine/blockchain/): Machine in the blockchain context +- [Hash view of state](https://docs.cartesi.io/cartesi-machine/blockchain/hash/): Merkle-tree based state hashing +- [Verification game](https://docs.cartesi.io/cartesi-machine/blockchain/vg/): On-chain dispute resolution +- [Host - Overview](https://docs.cartesi.io/cartesi-machine/host/): Running the machine from the host +- [Command-line interface](https://docs.cartesi.io/cartesi-machine/host/cmdline/): cartesi-machine CLI reference +- [Lua interface](https://docs.cartesi.io/cartesi-machine/host/lua/): Scripting the machine with Lua +- [Target - Overview](https://docs.cartesi.io/cartesi-machine/target/): Software running inside the machine +- [System architecture](https://docs.cartesi.io/cartesi-machine/target/architecture/): RISC-V ISA and hardware model +- [Linux environment](https://docs.cartesi.io/cartesi-machine/target/linux/): Linux OS inside the Cartesi Machine + +## Cartesi Rollups v2.0 — Getting Started + +- [Overview](https://docs.cartesi.io/cartesi-rollups/2.0/): Cartesi Rollups v2.0 introduction - [Architecture](https://docs.cartesi.io/cartesi-rollups/2.0/getting-started/architecture/): On-chain and off-chain components -- [Installation](https://docs.cartesi.io/cartesi-rollups/2.0/development/installation/): Install Cartesi CLI and dependencies +- [Concepts](https://docs.cartesi.io/cartesi-rollups/2.0/getting-started/concepts/): Key concepts and terminology +- [Installation](https://docs.cartesi.io/cartesi-rollups/2.0/getting-started/Installation/): Install Cartesi CLI and dependencies +- [Cartesi Machine](https://docs.cartesi.io/cartesi-rollups/2.0/core-concepts/cartesi-machine/): Cartesi Machine in the rollups context + +## Cartesi Rollups v2.0 — Development -## Development +- [Installation](https://docs.cartesi.io/cartesi-rollups/2.0/development/installation/): Install development tools - [Creating an Application](https://docs.cartesi.io/cartesi-rollups/2.0/development/creating-an-application/): Bootstrap a new Cartesi dApp -- [Building an Application](https://docs.cartesi.io/cartesi-rollups/2.0/development/building-an-application/): Build your application for the Cartesi Machine -- [Running an Application](https://docs.cartesi.io/cartesi-rollups/2.0/development/running-an-application/): Run and test locally -- [Send Inputs and Assets](https://docs.cartesi.io/cartesi-rollups/2.0/development/send-inputs-and-assets/): How to send inputs and assets to your dApp -- [Query Outputs](https://docs.cartesi.io/cartesi-rollups/2.0/development/query-outputs/): Vouchers and notices -- [Asset Handling](https://docs.cartesi.io/cartesi-rollups/2.0/development/asset-handling/): Deposits and withdrawals +- [Building an application](https://docs.cartesi.io/cartesi-rollups/2.0/development/building-an-application/): Build your application for the Cartesi Machine +- [Running an application](https://docs.cartesi.io/cartesi-rollups/2.0/development/running-an-application/): Run and test locally +- [Sending inputs and assets](https://docs.cartesi.io/cartesi-rollups/2.0/development/send-inputs-and-assets/): How to send inputs and assets to your dApp +- [Query outputs](https://docs.cartesi.io/cartesi-rollups/2.0/development/query-outputs/): Vouchers, notices and reports +- [Asset handling](https://docs.cartesi.io/cartesi-rollups/2.0/development/asset-handling/): Deposits and withdrawals +- [Advanced configuration](https://docs.cartesi.io/cartesi-rollups/2.0/development/Advanced-configuration/): cartesi.toml configuration guide + +## Cartesi Rollups v2.0 — Development Snippets + +- [Request handling (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/request_handling_cpp/): C++ advance/inspect handler snippet +- [Request handling (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/request_handling_go/): Go advance/inspect handler snippet +- [Request handling (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/request_handling_js/): JavaScript handler snippet +- [Request handling (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/request_handling_py/): Python handler snippet +- [Request handling (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/request_handling_rs/): Rust handler snippet +- [Implementing outputs (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/implementing_outputs_cpp/): C++ outputs snippet +- [Implementing outputs (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/implementing_outputs_go/): Go outputs snippet +- [Implementing outputs (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/implementing_outputs_js/): JavaScript outputs snippet +- [Implementing outputs (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/implementing_outputs_py/): Python outputs snippet +- [Implementing outputs (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/implementing_outputs_rs/): Rust outputs snippet +- [Sending notice (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/sending_notice_cpp/): C++ notice snippet +- [Sending notice (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/sending_notice_go/): Go notice snippet +- [Sending report (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/sending_report_cpp/): C++ report snippet +- [Sending report (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/sending_report_go/): Go report snippet +- [Decode ERC-20 (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_decode_erc20_cpp/): C++ ERC-20 decode snippet +- [Decode ERC-20 (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_decode_erc20_go/): Go ERC-20 decode snippet +- [Decode ERC-20 (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_decode_erc20_js/): JavaScript ERC-20 decode snippet +- [Decode ERC-20 (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_decode_erc20_py/): Python ERC-20 decode snippet +- [Decode ERC-20 (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_decode_erc20_rs/): Rust ERC-20 decode snippet +- [Withdraw ERC-20 (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_erc20_cpp/): C++ ERC-20 withdraw snippet +- [Withdraw ERC-20 (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_erc20_go/): Go ERC-20 withdraw snippet +- [Withdraw ERC-20 (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_erc20_js/): JavaScript ERC-20 withdraw snippet +- [Withdraw ERC-20 (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_erc20_py/): Python ERC-20 withdraw snippet +- [Withdraw ERC-20 (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_erc20_rs/): Rust ERC-20 withdraw snippet +- [Withdraw Ether (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_ether_cpp/): C++ Ether withdraw snippet +- [Withdraw Ether (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_ether_go/): Go Ether withdraw snippet +- [Withdraw Ether (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_ether_js/): JavaScript Ether withdraw snippet +- [Withdraw Ether (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_ether_py/): Python Ether withdraw snippet +- [Withdraw Ether (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/development/snippets/asset_withdraw_ether_rs/): Rust Ether withdraw snippet + +## Cartesi Rollups v2.0 — API Reference + +- [API Reference Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/): HTTP API overview +- [Rollup HTTP API](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/cartesi-rollup-http-api/): Backend HTTP API specification +- [Add Voucher](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/add-voucher/): Emit a voucher from the backend +- [Add Notice](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/add-notice/): Emit a notice from the backend +- [Add Report](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/add-report/): Emit a report from the backend +- [Register Exception](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/register-exception/): Register an exception +- [Finish](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/rollup/finish/): Complete input processing +- [Inspect State (spec)](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/inspect/inspect-state-http-api-for-cartesi-rollups/): Inspect HTTP API specification +- [Inspect](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/inspect/inspect/): Query application state + +## Cartesi Rollups v2.0 — Backend API + +- [Introduction](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/introduction/): Communication between Cartesi Machine and node +- [Notices](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/notices/): Informational statements +- [Vouchers](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/vouchers/): Executable actions on base layer +- [Reports](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/reports/): Application logs +- [Exception](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/exception/): Register exceptions +- [Finish](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/finish/): Complete request processing + +## Cartesi Rollups v2.0 — Contracts API -## Smart Contracts API - [Contracts Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/overview/): All smart contracts in the framework - [InputBox](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/input-box/): Entry point for user inputs - [Application](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/application/): Per-dApp contract holding assets @@ -26,38 +126,127 @@ - [ERC1155SinglePortal](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/portals/ERC1155SinglePortal/): ERC-1155 single token deposits - [ERC1155BatchPortal](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/portals/ERC1155BatchPortal/): ERC-1155 batch deposits - [Consensus Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/overview/): Validates claims from validators +- [AbstractConsensus](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/abstract-consensus/): Base consensus contract +- [IConsensus](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/iconsensus/): Consensus interface +- [IOutputsMerkleRootValidator](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/ioutputs-merkle-root-validator/): Outputs Merkle root validator interface - [Authority](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/authority/): Single-owner consensus +- [AuthorityFactory](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/authority/authority-factory/): Deploy Authority contracts +- [IAuthority](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/authority/iauthority/): Authority interface +- [IAuthorityFactory](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/authority/iauthority-factory/): Authority factory interface - [Quorum](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/quorum/): Multi-validator consensus +- [QuorumFactory](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/quorum/quorum-factory/): Deploy Quorum contracts +- [IQuorum](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/quorum/iquorum/): Quorum interface +- [IQuorumFactory](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/contracts/consensus/quorum/iquorum-factory/): Quorum factory interface -## Backend API -- [HTTP API](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/introduction/): Communication between Cartesi Machine and node -- [Notices](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/notices/): Informational statements -- [Vouchers](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/vouchers/): Executable actions on base layer -- [Reports](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/reports/): Application logs -- [Exception](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/exception/): Register exceptions -- [Finish](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/backend/finish/): Complete request processing +## Cartesi Rollups v2.0 — JSON-RPC API + +- [JSON-RPC Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/overview/): Node management API overview +- [Methods](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/): All JSON-RPC methods +- [Types](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/types/): JSON-RPC type definitions +- [List Applications](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/applications/applications-list/): List all applications +- [Get Application](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/applications/applications-get/): Get a specific application +- [List Epochs](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/epochs/epochs-list/): List all epochs +- [Get Epoch](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/epochs/epochs-get/): Get a specific epoch +- [Get Last Accepted Epoch Index](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/epochs/jsonrpc-epochs-last-accepted/): Get last accepted epoch +- [List Inputs](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/inputs/inputs-list/): List all inputs +- [Get Input](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/inputs/inputs-get/): Get a specific input +- [Get Processed Input Count](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/inputs/jsonrpc-inputs-processed-count/): Get processed input count +- [List Outputs](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/outputs/outputs-list/): List all outputs +- [Get Output](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/outputs/outputs-get/): Get a specific output +- [List Reports](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/reports/reports-list/): List all reports +- [Get Report](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/reports/reports-get/): Get a specific report +- [Get Chain ID](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/node/node-chain-id/): Get node chain ID +- [Get Node Version](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/methods/node/node-version/): Get node version -## Frontend APIs -- [GraphQL Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/graphql/overview/): Query application state -- [JSON-RPC Overview](https://docs.cartesi.io/cartesi-rollups/2.0/api-reference/jsonrpc/overview/): Node management API +## Cartesi Rollups v2.0 — Deployment -## Deployment - [Introduction](https://docs.cartesi.io/cartesi-rollups/2.0/deployment/introduction/): Overview of deployment options -- [Self-Hosted Deployment](https://docs.cartesi.io/cartesi-rollups/2.0/deployment/self-hosted/): Run your own node -- [Snapshot](https://docs.cartesi.io/cartesi-rollups/2.0/deployment/snapshot/): Machine state management - -## Tutorials -- [Counter](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/counter/): Simple counter dApp -- [Calculator](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/calculator/): Mathematical operations -- [Ether Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/ether-wallet/): Handle ETH deposits and withdrawals -- [ERC-20 Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/erc-20-token-wallet/): Token wallet -- [ERC-721 Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/erc-721-token-wallet/): NFT wallet -- [Marketplace](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/marketplace/): Build a marketplace dApp -- [React Frontend](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/react-frontend-application/): Build a frontend application -- [CLI Account Abstraction](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/cli-account-abstraction-feauture/): Use CLI account abstraction features - -## Resources -- [Community Tools](https://docs.cartesi.io/cartesi-rollups/2.0/resources/community-tools/): Third-party tools and integrations -- [Integration Guides](https://docs.cartesi.io/cartesi-rollups/2.0/resources/integration-guides/): Integration examples +- [Self-hosted deployment](https://docs.cartesi.io/cartesi-rollups/2.0/deployment/self-hosted/): Run your own node +- [Public snapshot](https://docs.cartesi.io/cartesi-rollups/2.0/deployment/snapshot/): Machine state management + +## Cartesi Rollups v2.0 — Tutorials + +- [Counter](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/counter/): Build a counter application +- [Calculator](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/calculator/): Build a calculator application +- [Marketplace](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/marketplace/): Build a marketplace application +- [Ether Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/ether-wallet/): Integrating Ether wallet functionality +- [ERC-20 Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/erc-20-token-wallet/): Integrating ERC20 token wallet functionality +- [ERC-721 Wallet](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/erc-721-token-wallet/): Integrating ERC721 token wallet functionality +- [React Frontend](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/react-frontend-application/): Build a React frontend for Cartesi apps +- [CLI Account Abstraction](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/cli-account-abstraction-feature/): Sponsored transactions via CLI account abstraction +- [Utilizing test tokens](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/utilizing-the-cli-test-tokens/): Utilizing test tokens in dev environment + +## Cartesi Rollups v2.0 — Tutorial Snippets + +- [Counter (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/counter-cpp/): Counter application C++ snippet +- [Counter (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/counter-go/): Counter application Go snippet +- [Counter (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/counter-js/): Counter application JavaScript snippet +- [Counter (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/counter-py/): Counter application Python snippet +- [Counter (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/counter-rs/): Counter application Rust snippet +- [Calculator (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/calculator-cpp/): Calculator application C++ snippet +- [Calculator (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/calculator-go/): Calculator application Go snippet +- [Calculator (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/calculator-js/): Calculator application JavaScript snippet +- [Calculator (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/calculator-py/): Calculator application Python snippet +- [Calculator (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/calculator-rs/): Calculator application Rust snippet +- [Marketplace (C++)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/marketplace-cpp/): Marketplace application C++ snippet +- [Marketplace (Go)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/marketplace-go/): Marketplace application Go snippet +- [Marketplace (JavaScript)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/marketplace-js/): Marketplace application JavaScript snippet +- [Marketplace (Python)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/marketplace-py/): Marketplace application Python snippet +- [Marketplace (Rust)](https://docs.cartesi.io/cartesi-rollups/2.0/tutorials/snippets/marketplace-rs/): Marketplace application Rust snippet + +## Cartesi Rollups v2.0 — Resources + +- [Community tools](https://docs.cartesi.io/cartesi-rollups/2.0/resources/community-tools/): Third-party tools and integrations +- [Integrations guide](https://docs.cartesi.io/cartesi-rollups/2.0/resources/integration-guides/): Integration examples - [Migration Guide](https://docs.cartesi.io/cartesi-rollups/2.0/resources/migration-guide/): Migrate from v1.x to v2.0 -- [Mainnet Considerations](https://docs.cartesi.io/cartesi-rollups/2.0/resources/mainnet-considerations/): Production deployment considerations \ No newline at end of file +- [Mainnet considerations](https://docs.cartesi.io/cartesi-rollups/2.0/resources/mainnet-considerations/): Production deployment considerations + +## Fraud Proofs + +- [Overview](https://docs.cartesi.io/fraud-proofs/): Fraud proof system overview and PRT introduction +- [Introduction](https://docs.cartesi.io/fraud-proofs/fraud-proof-basics/introduction/): Beginner-friendly fraud proof introduction +- [Bonds](https://docs.cartesi.io/fraud-proofs/fraud-proof-basics/bonds/): Bond mechanism in the fraud-proof system +- [Epoch Lifecycle](https://docs.cartesi.io/fraud-proofs/fraud-proof-basics/epochs/): Epoch boundaries and lifecycle +- [State Transition Function](https://docs.cartesi.io/fraud-proofs/fraud-proof-basics/state-transition-function/): State transition function explained +- [PRT Introduction](https://docs.cartesi.io/fraud-proofs/prt/prt-introduction/): Permissionless Refereed Tournament overview +- [PRT Algorithm](https://docs.cartesi.io/fraud-proofs/prt/prt-algorithm/): PRT algorithm details +- [PRT Architecture](https://docs.cartesi.io/fraud-proofs/prt/prt-architecture/): PRT system architecture +- [Honeypot Introduction](https://docs.cartesi.io/fraud-proofs/honeypot/introduction/): Honeypot application overview +- [Honeypot Application Logic](https://docs.cartesi.io/fraud-proofs/honeypot/application-logic/): Honeypot implementation details +- [Honeypot with PRT](https://docs.cartesi.io/fraud-proofs/honeypot/prt-integration/): Honeypot PRT integration +- [DaveConsensus API Reference](https://docs.cartesi.io/fraud-proofs/references/daveconsensus/): DaveConsensus contract reference +- [Deployments](https://docs.cartesi.io/fraud-proofs/references/deployments/): PRT and Honeypot deployed contracts +- [PRT v1 Deployments](https://docs.cartesi.io/fraud-proofs/references/prt-v1-deployments/): PRT v1 deployed contracts +- [PRT Core Contracts](https://docs.cartesi.io/fraud-proofs/references/tournament/): Tournament contract reference + +## Cartesi Compute (Legacy) + +- [Cartesi Compute](https://docs.cartesi.io/cartesi-compute/): Cartesi Compute SDK category root +- [Cartesi Compute SDK](https://docs.cartesi.io/compute/): Cartesi Compute SDK overview +- [Overview](https://docs.cartesi.io/compute/overview/): Overview of Cartesi Compute +- [How it works](https://docs.cartesi.io/compute/how/): How Cartesi Compute works +- [Architecture](https://docs.cartesi.io/compute/architecture/): Cartesi Compute architecture +- [Drives](https://docs.cartesi.io/compute/drives/): Input and output drives +- [Instantiate](https://docs.cartesi.io/compute/instantiate/): Instantiate a computation +- [Integer Drive](https://docs.cartesi.io/compute/integer_drive/): Integer drive type +- [Logger drives](https://docs.cartesi.io/compute/logger_drive/): Logger drive type +- [Machines off-chain](https://docs.cartesi.io/compute/machine-offchain/): Off-chain machine management +- [Machines on-chain](https://docs.cartesi.io/compute/machine-onchain/): On-chain machine management +- [The off-chain API](https://docs.cartesi.io/compute/off-chain-api/): Off-chain API reference +- [Provider drives](https://docs.cartesi.io/compute/provider/): Provider drive type +- [Platform services](https://docs.cartesi.io/compute/services/): Platform services +- [Supported networks](https://docs.cartesi.io/compute/supported-networks/): Supported blockchain networks +- [Execution timeline](https://docs.cartesi.io/compute/timeline/): Computation execution timeline +- [Topologies](https://docs.cartesi.io/compute/topologies/): Network topologies +- [Wallets](https://docs.cartesi.io/compute/wallet/): Wallet integration +- [Putting Things Together](https://docs.cartesi.io/compute/workflow/): End-to-end workflow +- [On-chain API](https://docs.cartesi.io/compute/api/): On-chain API reference +- [References](https://docs.cartesi.io/compute/references/): Reference documentation + +## Earn CTSI + +- [Earn CTSI](https://docs.cartesi.io/earn-ctsi/): Staking and earning CTSI overview +- [How to stake](https://docs.cartesi.io/earn-ctsi/staking/): Step-by-step staking guide +- [Create a public pool](https://docs.cartesi.io/earn-ctsi/public-pool/): Create and manage a staking pool +- [Run a private node](https://docs.cartesi.io/earn-ctsi/run-node/): Run a Cartesi node privately +- [FAQs](https://docs.cartesi.io/earn-ctsi/staking-faq/): Staking frequently asked questions