From 569215bbb6a85750155d69972555c983683f4cbb Mon Sep 17 00:00:00 2001 From: Michael Asiedu Date: Wed, 7 Aug 2024 14:20:15 +0000 Subject: [PATCH] fix:grammar,words,punctuations --- cartesi-rollups/core-concepts/architecture.md | 30 ++-- cartesi-rollups/core-concepts/mainnet.md | 9 +- .../core-concepts/optimistic-rollups.md | 7 +- .../development/community-tools.md | 146 +++++++++--------- cartesi-rollups/development/migration.md | 25 +-- cartesi-rollups/quickstart.md | 5 +- .../tutorials/erc-20-token-wallet.md | 23 +-- .../tutorials/erc-721-token-wallet.md | 61 ++++---- cartesi-rollups/tutorials/ether-wallet.md | 34 ++-- 9 files changed, 173 insertions(+), 167 deletions(-) diff --git a/cartesi-rollups/core-concepts/architecture.md b/cartesi-rollups/core-concepts/architecture.md index ede3a965..81b9ddab 100644 --- a/cartesi-rollups/core-concepts/architecture.md +++ b/cartesi-rollups/core-concepts/architecture.md @@ -14,7 +14,7 @@ resources: title: Dave --- -The Cartesi Rollups framework is designed to enable complex computations off-chain while maintaining the security guarantees of blockchain technology. It consists of two primary components: **the on-chain base layer** (such as Ethereum) where the dApp contract is deployed, and **the off-chain execution layer** where the dApp's backend logic operates. +The Cartesi Rollups framework is designed to enable complex computations off-chain while maintaining the security guarantees of blockchain technology. It consists of two primary components: **the on-chain base layer** (such as Ethereum), where the dApp contract is deployed, and **the off-chain execution layer**, where the dApp's backend logic operates. A decentralized application (dApp) built on Cartesi incorporates several key elements: @@ -22,9 +22,9 @@ A decentralized application (dApp) built on Cartesi incorporates several key ele - Cartesi Machine: A virtual machine (VM) that runs a complete Linux operating system, serving as the environment for executing the dApp's backend. -- Backend: The application's state and verifiable logic, which runs inside the Cartesi Machine as a standard Linux application. +- Backend: The application's state and verifiable logic run inside the Cartesi Machine as a standard Linux application. -- Frontend: The user-facing interface of the application, typically implemented as a web application or a command-line interface tool. +- Frontend: The application’s user-facing interface, typically implemented as a web application or a command-line interface tool. ![img](../../static/img/v1.5/architecture-overview.jpg) @@ -41,7 +41,7 @@ Key features of the Cartesi Machine include: - Scalability: By leveraging significant off-chain computing power, the Cartesi Machine enables complex computations while maintaining blockchain-level security. -- The Cartesi machine is self-contained and can't make an external request. To achieve reproducibility,it runs in isolation from any external influence on the computation. +- The Cartesi machine is self-contained and can't make an external request. It runs in isolation from any external influence on the computation to achieve reproducibility. The Cartesi Machine achieves its unique balance of scalability and security by performing computations off-chain but providing mechanisms to verify these computations on-chain when necessary. @@ -71,10 +71,10 @@ Portal contracts facilitate the secure transfer of assets between the base layer - [ERC-1155 Single transfers](../rollups-apis/json-rpc/portals/ERC1155SinglePortal.md) - [ERC-1155 Batch transfers](../rollups-apis/json-rpc/portals/ERC1155BatchPortal.md) -These Portal contracts implement the logic to "teleport" assets safely between layers, maintaining the integrity and ownership of the assets throughout the transfer process. +These Portal contracts implement the logic to "teleport" assets safely between layers, maintaining their integrity and ownership throughout the transfer process. ## Off-chain layer -The off-chain execution layer is centered around the Cartesi Rollups Node, which serves as the crucial middleware between the on-chain contracts and the Cartesi Machine. The node is responsible for: +The off-chain execution layer is centered around the Cartesi Rollups Node, the crucial middleware between the on-chain contracts and the Cartesi Machine. The node is responsible for: 1. Processing inputs: It reads inputs from the base layer and forwards them to the Cartesi Machine for processing. @@ -93,7 +93,7 @@ The Cartesi Rollups Node can operate in two primary modes: **2. Reader Nodes (In Development)**: These nodes focus on advancing the off-chain state and making it publicly available. They consume information from the blockchain but do not participate in the validation process. :::caution important -Currently, all Cartesi Nodes function as Validator Nodes, with Reader Node functionality under active development. +All Cartesi Nodes function as Validator Nodes, with Reader Node functionality under active development. ::: @@ -105,23 +105,23 @@ The Cartesi architecture facilitates several key processes that enable the funct ![img](../../static/img/v1.5/node-advance.jpg) -The advance state process changes the application state and it involves the following steps: +The `advance-state` process changes the application state, and it involves the following steps: - The application frontend submits an advance-state input to the `InputBox` smart contract on the base layer. - The node monitors events from the `InputBox` contract and retrieves the input data. -- The node sends the input to the application backend running inside the Cartesi Machine. +- The node sends the input to the application backend inside the Cartesi Machine. - The Cartesi Machine processes the input and generates verifiable outputs ([vouchers](../rollups-apis/backend/vouchers.md), [notices](../rollups-apis/backend/notices.md), and [reports](../rollups-apis/backend/reports.md)). -- The application frontend can then query these outputs using the node's [GraphQL API](../rollups-apis/graphql/basics.md). +- The application frontend can query these outputs using the node's [GraphQL API](../rollups-apis/graphql/basics.md). ### Inspect state ![img](../../static/img/v1.5/node-inspect.jpg) -The inspect state process allows for querying the application backend without altering its state: +The `inspect-state` process allows for querying the application backend without altering its state: - The application frontend sends an inspect-state input directly to the Cartesi Node. @@ -132,7 +132,7 @@ The inspect state process allows for querying the application backend without al - The node returns this report to the frontend via a [REST API](../rollups-apis/backend/introduction.md/#advance-and-inspect). :::note Inspect requests -It's important to note that inspect-state inputs do not produce vouchers or notices, and the current implementation processes inputs sequentially, which may impact scalability for applications heavily reliant on inspect-state functionality. +It's important to note that `inspect-state` inputs do not produce vouchers or notices, and the current implementation processes inputs sequentially, which may impact scalability for applications heavily reliant on inspect-state functionality. ::: ### Validation @@ -141,7 +141,7 @@ It's important to note that inspect-state inputs do not produce vouchers or noti The validation process ensures the integrity of the off-chain computations: -- The Cartesi Node bundles multiple advance-state inputs into an epoch. +- The Cartesi Node bundles multiple `advance-state` inputs into an epoch. - At the end of an epoch, the node computes a claim summarizing the epoch's state changes. @@ -149,7 +149,7 @@ The validation process ensures the integrity of the off-chain computations: - The application frontend can fetch proofs for specific outputs within a closed epoch. -- These proofs can be used to validate outputs on-chain, such as validating notices or executing vouchers. +- These proofs can validate outputs on-chain, such as validating notices or executing vouchers. ## Introducing Dave — an interactive fraud-proof system @@ -159,4 +159,4 @@ Dave introduces an approach where the resources required to defend against dispu With Dave, a single honest participant can effectively defend their claims on-chain, ensuring the integrity of transactions without relying on trust in validators. Based on the [Permissionless Refereed Tournaments algorithm](https://arxiv.org/abs/2212.12439), this protocol empowers anyone to validate rollups and uphold correct states on-chain, enhancing transaction security and reliability. -In a way similar to how a consensus algorithm is crucial for achieving agreement on a single state of the blockchain among all nodes in a base layer chain, Dave plays a fundamental role in ensuring the integrity and trustworthiness of state transitions within Cartesi Rollups. \ No newline at end of file +Similar to how a consensus algorithm is crucial for achieving agreement on a single state of the blockchain among all nodes in a base-layer chain, Dave plays a fundamental role in ensuring the integrity and trustworthiness of state transitions within Cartesi Rollups. diff --git a/cartesi-rollups/core-concepts/mainnet.md b/cartesi-rollups/core-concepts/mainnet.md index 4d71c52e..2a5801d9 100644 --- a/cartesi-rollups/core-concepts/mainnet.md +++ b/cartesi-rollups/core-concepts/mainnet.md @@ -23,15 +23,16 @@ Developers and users should factor this risk into their decision to use Cartesi ## Security -The Cartesi Rollups infrastructure is being built based on careful design decisions and a strong code review process that aligns with the mainstream dogma of blockchain technology. +The Cartesi Rollups infrastructure is being built based on careful design decisions and a robust code review process that aligns with the mainstream dogma of blockchain technology. -When it comes to dApp safety, the developers must also implement the same level of concern in their process. A culture of code reviews, auditing, and extensively testing their code is paramount to avoid hacks or bugs that would lead to loss of funds from users. +When it comes to dApp safety, developers must also implement the same level of concern in their process. A culture of code reviews, auditing, and extensively testing their code is paramount to avoid hacks or bugs that could lead to user funds being lost. -**The Honeypot** is a dApp designed to demonstrate the security capabilities of Cartesi Rollups. +**The Honeypot** is a dApp designed to demonstrate Cartesi Rollups’ security capabilities. As the Honeypot is tested and fortified, users and developers will have increased confidence in the security of Cartesi Rollups. Want to help test the security of Cartesi Rollups? [Try your hand at cracking the Honeypot](https://honeypot.cartesi.io/). ## Scams -Like Ethereum, Cartesi Rollups are permissionless—anybody can deploy any smart contract code they want. Interact with contracts on Cartesi Rollups precisely as you do with Ethereum, only doing so if you’ve independently verified that the application is secure. +Like Ethereum, Cartesi Rollups are permissionless—anybody can deploy any smart contract code. You can interact with contracts on Cartesi Rollups precisely as you do with Ethereum, but only if you’ve independently verified that the application is secure. + diff --git a/cartesi-rollups/core-concepts/optimistic-rollups.md b/cartesi-rollups/core-concepts/optimistic-rollups.md index 0f750205..a83a7034 100644 --- a/cartesi-rollups/core-concepts/optimistic-rollups.md +++ b/cartesi-rollups/core-concepts/optimistic-rollups.md @@ -21,9 +21,9 @@ A rollup is a blockchain scalability solution that offloads complex computations When employing rollups, the blockchain receives and logs transactions. In rare instances of an active attack or the involvement of a malicious agent, parties may disagree with a computation’s outcomes, and the blockchain will resolve these disputes. However, it's important to note that disagreements are not expected to occur under normal circumstances. -Users interact with a rollup through transactions on the base layer. They send messages (inputs) to the rollup on-chain smart contracts to define a computation to be processed and, as such, advance the state of the computing environment on the execution layer. Interested parties run an off-chain component (a node on the execution layer) that watches the blockchain for inputs, understanding and executing the state updates. +Users interact with a rollup through transactions on the base layer. They send messages (inputs) to the rollup on-chain smart contracts to define a computation to be processed and, as such, advance the state of the computing environment on the execution layer. Interested parties run an off-chain component (a node on the execution layer) that watches the blockchain for inputs, understanding, and executing the state updates. -Once in a while, the state is checkpointed on the chain, at which point it is considered finalized and can thus be accepted by any smart contract on the base layer. +Once in a while, the state is checkpointed on the chain; at this point, it is considered finalized and can thus be accepted by any smart contract on the base layer. Ensuring this operation is secure is vital, meaning that the execution layer node must somehow prove the new state to the base layer. @@ -54,7 +54,7 @@ This optimism is reinforced by financial incentives that reward honest behavior. The main advantage of Optimistic Rollups is that they are much cheaper than ZK Rollups. Posting a state update on-chain is minimal, and challenging a state update is also low. -The main disadvantage is that state updates are not immediately final. It takes time for a state update to be fully accepted, and during this period, the state update is considered "optimistic" and can be challenged. +The main disadvantage is that state updates take time to finalize and are not entirely accepted immediately. During this period, they are considered "optimistic" and can be challenged. ## Cartesi Rollups @@ -67,3 +67,4 @@ Transactions and computations occur off-chain, leading to more intricate logic w Cartesi's architecture specializes in app-specific rollups(appchains). Each dApp has its dedicated rollup for off-chain computation, enhancing scalability and performance. + diff --git a/cartesi-rollups/development/community-tools.md b/cartesi-rollups/development/community-tools.md index 00c8a81d..9a611e35 100644 --- a/cartesi-rollups/development/community-tools.md +++ b/cartesi-rollups/development/community-tools.md @@ -11,38 +11,38 @@ Several tools created and maintained by the community streamline the dApp creati A low-level verifiable fantasy console for building small games on a special RISC-V Linux machine. - **Features**: - - Create small games using a minimal API and simple tools. - - Use any programming language with support for RISC-V. - - Play games on any device with WebAssembly support. - - Record game sessions into tiny tapes for replay and verification. - - Custom leaderboards for each cartridge. + - Create small games using a minimal API and simple tools. + - Use any programming language with support for RISC-V. + - Play games on any device with WebAssembly support. + - Record game sessions into tiny tapes for replay and verification. + - Custom leaderboards for each cartridge. - **Resources**: - - [RIVES Documentation](https://rives.io/docs/category/riv) - - [RIVES Playground](https://rives.io/playground) - - [RIVES in action](https://app.rives.io/) + - [RIVES Documentation](https://rives.io/docs/category/riv) + - [RIVES Playground](https://rives.io/playground) + - [RIVES in action](https://app.rives.io/) --- ## Deroll -Introducing Deroll, a powerful TypeScript framework designed to simplify the development of dApps on Cartesi. +Introducing Deroll, a robust 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. + - 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 - ``` + - 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) + - [Deroll Documentation](https://deroll.dev) + - [Deroll GitHub Repository](https://github.com/tuler/deroll) --- @@ -51,16 +51,16 @@ Introducing Deroll, a powerful TypeScript framework designed to simplify the dev 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. + - Run applications directly on the host machine for faster performance. + - No Docker or RISC-V Required. - **Getting Started**: - - Install NoNodo by running: - ```bash - npm install -g @nonodo/cli - ``` + - Install NoNodo by running: + ```bash + npm install -g @nonodo/cli + ``` - **Resources**: - - [NoNodo GitHub Repository](https://github.com/Calindra/nonodo) + - [NoNodo GitHub Repository](https://github.com/Calindra/nonodo) --- @@ -69,65 +69,65 @@ NoNodo is a cutting-edge development tool for Cartesi Rollups that allows applic 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. + - 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) + - [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 +Tikua is a versatile JS Cartesi package designed for seamless integration with any visual library 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. + - 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) + - [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. +Rollmelette is a high-level framework simplifying 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. + - 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) + - [Rollmelette GitHub Repository](https://github.com/rollmelette/rollmelette) --- ## Python-Cartesi -Python-Cartesi is a Python high-level framework that simplifies the development of Cartesi applications using Python. +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. + - Simplifies the development of Cartesi applications. + - Prioritizes testing, equipping developers with tools to write tests for DApps within a local Python environment. + - Allows complete 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 - ``` + - Install Python-Cartesi by running: + ```bash + pip install python-cartesi + ``` - **Resources**: - - [Python-Cartesi GitHub Repository](https://github.com/prototyp3-dev/python-cartesi) + - [Python-Cartesi GitHub Repository](https://github.com/prototyp3-dev/python-cartesi) --- @@ -136,14 +136,14 @@ Python-Cartesi is a Python high-level framework that simplifies the development 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. + - 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/). + - [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/). --- @@ -152,29 +152,29 @@ A backend application built with TypeScript and SQLite, designed to complement a 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. + - 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) + - [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. + - CLI tool for easy project setup. + - Templates for backend, frontend, and Cartesify. - **Getting Started**: - - Create a new project: - ```bash - npx cartdevkit@latest create mydapp - ``` + - Create a new project: + ```bash + npx cartdevkit@latest create my-app + ``` - **Resources**: - - [CartDevKit GitHub Repository](https://github.com/gconnect/cartdev-kit) - - [CartDevKit Documentation](https://africlab.gitbook.io/cartdevkit) \ No newline at end of file + - [CartDevKit GitHub Repository](https://github.com/gconnect/cartdev-kit) + - [CartDevKit Documentation](https://africlab.gitbook.io/cartdevkit) diff --git a/cartesi-rollups/development/migration.md b/cartesi-rollups/development/migration.md index 1a7f728b..9c9e09f4 100644 --- a/cartesi-rollups/development/migration.md +++ b/cartesi-rollups/development/migration.md @@ -5,7 +5,7 @@ title: Migration guide ## Migrating from Cartesi Rollups Node v1.4 to v1.5.x -Release `v1.5.0` introduces a critical change in how epochs are closed in the Cartesi Rollups Node, transitioning from a **timestamp-based** system to a **block number-based** system. +Release `v1.5.0` introduces a critical change in how epochs are closed in the Cartesi Rollups Node, transitioning from a **timestamp-based system to a block number-based system**. Epoch closure is now determined by the `CARTESI_EPOCH_LENGTH` environment variable (in blocks) instead of `CARTESI_EPOCH_DURATION` (in seconds). @@ -21,7 +21,7 @@ Where `BLOCK_TIME` is the time to generate a block in the target network. Redeploy all contracts and your application with the new configuration. -For detailed deployment instructions, refer to the [self-hosted deployment guide](../deployment/self-hosted.md). +Refer to the [self-hosted deployment guide](../deployment/self-hosted.md) for detailed deployment instructions. :::caution Redeploying creates a new application instance. All previous inputs, outputs, claims, and funds locked in the application contract will remain associated with the old application address. @@ -62,12 +62,12 @@ This is a two-step process. First calculate the address of the new History. Afte ```shell cast call \ - --trace --verbose \ - $HISTORY_FACTORY_ADDRESS \ - "calculateHistoryAddress(address,bytes32)(address)" \ - $AUTHORITY_ADDRESS \ - $SALT \ - --rpc-url "$RPC_URL" + --trace --verbose \ + $HISTORY_FACTORY_ADDRESS \ + "calculateHistoryAddress(address,bytes32)(address)" \ + $AUTHORITY_ADDRESS \ + $SALT \ + --rpc-url "$RPC_URL" ``` If the command executes successfully, it will display the address of the new History contract. Store this address in the environment variable `NEW_HISTORY_ADDRESS` for later use. @@ -85,13 +85,13 @@ This is a two-step process. First calculate the address of the new History. Afte --rpc-url "$RPC_URL" ``` - The `cast send` command will fail if the `History` type is not recognized by Cast at the time of execution. In such cases, replace `History` with `address` as the return type for `newHistory()` and execute the command again. + The `cast send` command will fail if Cast does not recognize the _History_ type during execution. In such cases, replace _History_ with `address` as the return type for `newHistory()` and execute the command again. - Additionally, the `cast send` command may fail due to gas estimation issues. To circumvent this, provide gas constraints with the `--gas-limit` parameter (e.g., `--gas-limit 7000000`). + The `cast send` command may also fail due to gas estimation issues. To circumvent this, provide gas constraints with the `--gas-limit` parameter (e.g., `--gas-limit 7000000`). #### 3. Replace the _History_ -Make sure the environment variables from the previous step are set, including `NEW_HISTORY_ADDRESS`, which should have the address of the new History. +Ensure the environment variables from the previous step are set, including `NEW_HISTORY_ADDRESS`, which should have the address of the new History. To replace the _History_ used by the _Authority_, run this command: @@ -107,7 +107,8 @@ cast send \ After replacing the _History_, update the `CARTESI_CONTRACTS_HISTORY_ADDRESS` in the application configuration with the new _History_ address. Then, upgrade the Cartesi Rollups Node as usual. -When the Cartesi Rollups Node restarts, it will process all existing inputs, recalculate the epochs, and send the claims to the new _History_ based on the updated configuration. +When the Cartesi Rollups Node restarts, it processes all existing inputs, recalculates the epochs, and sends the claims to the new _History_ based on the updated configuration. + diff --git a/cartesi-rollups/quickstart.md b/cartesi-rollups/quickstart.md index 67e6973d..ad9da384 100644 --- a/cartesi-rollups/quickstart.md +++ b/cartesi-rollups/quickstart.md @@ -76,9 +76,9 @@ cartesi run ## Send inputs to the application -You have some options available for sending inputs to your application. One option is the `cartesi send` command. +You have some options for sending input to your application. One option is the `cartesi send` command. -Another option is [Cast](https://book.getfoundry.sh/cast/), a command-line tool enabling you to make Ethereum RPC calls. +Another option is [Cast](https://book.getfoundry.sh/cast/), a command-line tool for making Ethereum RPC calls. Additionally, you can build a custom web interface to input data into your application. @@ -133,3 +133,4 @@ There are two methods to deploy an application: :::caution important Deployment with a third-party service provider is under development and will be available in a future release. ::: + diff --git a/cartesi-rollups/tutorials/erc-20-token-wallet.md b/cartesi-rollups/tutorials/erc-20-token-wallet.md index 32542c35..5f6525d0 100644 --- a/cartesi-rollups/tutorials/erc-20-token-wallet.md +++ b/cartesi-rollups/tutorials/erc-20-token-wallet.md @@ -69,7 +69,7 @@ export class Balance { } ``` -The `Balance` class represents an individual account's balance. It includes methods to list ERC20 tokens, get, increase, and decrease the ERC20 balance. +The `Balance` class represents an individual account's balance. It includes methods to list ERC20 tokens and get, increase, and decrease the ERC20 balance. Now, create a file named `wallet.ts` in the `src/wallet` directory and add the following code: @@ -219,7 +219,7 @@ export class Wallet { ## Using the ERC20 wallet -Now, let's create a simple wallet app in the entrypoint, `src/index.ts` to test the wallet functionality. +Now, let's create a simple wallet app at the entry point `src/index.ts` to test the wallet’s functionality. :::note Run `cartesi address-book` to get the contract address of the `ERC20Portal` contract. Save this as a const in the `index.ts` file. @@ -391,7 +391,7 @@ Here is a breakdown of the wallet functionality: - We handle deposits when the sender is the `ERC20Portal`. -- For other senders, we parse the payload to determine the operation (`transfer` or `withdraw`). +- We parse the payload for other senders to determine the operation (`transfer` or `withdraw`). - For `transfers`, we call `wallet.transferErc20` and create a notice with the parsed parameters. @@ -417,7 +417,7 @@ cartesi run #### Deposits :::caution token approvals - For the [**ERC20 token stanard**](https://ethereum.org/en/developers/docs/standards/tokens/), an approval step is need. This ensures you grant explicit permission for `ERC20Portal` to transfer tokens on your behalf. + An approval step is needed for the [**ERC20 token standard**](https://ethereum.org/en/developers/docs/standards/tokens/). This ensures you grant explicit permission for `ERC20Portal` to transfer tokens on your behalf. Without this approval, the `ERC20Portal` cannot deposit your tokens to the Cartesi backend. @@ -430,7 +430,7 @@ To deposit ERC20 tokens, use the `cartesi send erc20` command and follow the pro #### Balance checks(used in Inspect requests) -To inspect balance, make an HTTP call to: +To inspect the balance, make an HTTP call to: ``` http://localhost:8080/inspect/{address}/{tokenAddress} @@ -443,12 +443,13 @@ Use the `cartesi send generic` command and follow the prompts. Here are sample p 1. For transfers: - ```js - {"operation":"transfer","erc20":"0xTokenAddress","from":"0xFromAddress","to":"0xToAddress","amount":"1000000000000000000"} - ``` + ```js + {"operation":"transfer","erc20":"0xTokenAddress","from":"0xFromAddress","to":"0xToAddress","amount":"1000000000000000000"} + ``` 2. For withdrawals: - ```js - {"operation":"withdraw","erc20":"0xTokenAddress","from":"0xFromAddress","amount":"1000000000000000000"} - ``` + ```js + {"operation":"withdraw","erc20":"0xTokenAddress","from":"0xFromAddress","amount":"1000000000000000000"} + ``` + diff --git a/cartesi-rollups/tutorials/erc-721-token-wallet.md b/cartesi-rollups/tutorials/erc-721-token-wallet.md index 027cb90e..56323ec5 100644 --- a/cartesi-rollups/tutorials/erc-721-token-wallet.md +++ b/cartesi-rollups/tutorials/erc-721-token-wallet.md @@ -3,7 +3,7 @@ id: erc-721-token-wallet title: Integrating ERC721 token wallet functionality --- -This tutorial will guide you through creating a basic ERC721(NFT) token wallet for a Cartesi backend application using TypeScript. +This tutorial will guide you through creating a basic ERC721(NFT) token wallet using TypeScript for a Cartesi backend application. :::note community tools This tutorial is for educational purposes. For production dApps, we recommend using [Deroll](https://deroll.dev/), a TypeScript package that simplifies app and wallet functionality across all token standards for Cartesi applications. @@ -77,31 +77,31 @@ export class Wallet { private accounts: Map = new Map(); private getOrCreateBalance(address: Address): Balance { - let balance = this.accounts.get(address); - if (!balance) { - balance = new Balance(address, new Map()); - this.accounts.set(address, balance); - } - return balance; + let balance = this.accounts.get(address); + if (!balance) { + balance = new Balance(address, new Map()); + this.accounts.set(address, balance); + } + return balance; } getBalance(address: Address): Balance { - return this.getOrCreateBalance(address); + return this.getOrCreateBalance(address); } getErc721Balance(address: Address, erc721: Address): { address: string; erc721: string; tokenIds: number[] } { - const balance = this.getOrCreateBalance(address); - const tokens = balance.getErc721Tokens(erc721) || new Set();; - const tokenIdsArray = Array.from(tokens); - - const result = { - address: address, - erc721: erc721, - tokenIds: tokenIdsArray - }; + const balance = this.getOrCreateBalance(address); + const tokens = balance.getErc721Tokens(erc721) || new Set();; + const tokenIdsArray = Array.from(tokens); + + const result = { + address: address, + erc721: erc721, + tokenIds: tokenIdsArray + }; - console.info(`ERC721 balance for ${address} and contract ${erc721}: ${JSON.stringify(result, null, 2)}`); - return result; + console.info(`ERC721 balance for ${address} and contract ${erc721}: ${JSON.stringify(result, null, 2)}`); + return result; } processErc721Deposit(payload: string): string { @@ -202,10 +202,10 @@ export class Wallet { ``` ## Using the wallet -Now, let's create a simple wallet app in the entrypoint, `src/index.ts` to test the wallet functionality. +Now, let's create a simple wallet app at the entry point `src/index.ts` to test the wallet’s functionality. :::note -Run `cartesi address-book` to get the addresses of the `ERC721Portal` and `DAppAddressRelay` contracts. Save these as consts in the `index.ts` file. +Run `cartesi address-book` to get the addresses of the `ERC721Portal` and `DAppAddressRelay` contracts. Save these as constants in the `index.ts` file. ::: ```typescript @@ -381,7 +381,7 @@ Here is a breakdown of the wallet functionality: - We relay the dApp address when the sender is `DAppAddressRelay`. -- For other senders, we parse the payload to determine the operation (`transfer` or `withdraw`). +- We parse the payload for other senders to determine the operation (`transfer` or `withdraw`). - For `transfers`, we call `wallet.transferErc721` and create a notice with the parsed parameters. @@ -408,7 +408,7 @@ cartesi run #### Deposits :::caution token approvals - For the [**ERC721 token stanard**](https://ethereum.org/en/developers/docs/standards/tokens/), an approval step is need. This ensures you grant explicit permission for `ERC721Portal` to transfer tokens on your behalf. + An approval step is needed for the [**ERC721 token standard**](https://ethereum.org/en/developers/docs/standards/tokens/). This ensures you grant explicit permission for `ERC721Portal` to transfer tokens on your behalf. Without this approval, the `ERC721Portal` cannot deposit your tokens to the Cartesi backend. @@ -421,7 +421,7 @@ To deposit ERC721 tokens, use the `cartesi send erc721` command and follow the p #### Balance checks(used in Inspect requests) -To inspect balance, make an HTTP call to: +To inspect the balance, make an HTTP call to: ``` http://localhost:8080/inspect/{address}/{tokenAddress} @@ -434,15 +434,16 @@ Use the `cartesi send generic` command and follow the prompts. Here are sample p 1. For transfers: - ```js - {"operation":"transfer","erc721":"0xTokenAddress","from":"0xFromAddress","to":"0xToAddress","tokenId":"1"} - ``` + ```js + {"operation":"transfer","erc721":"0xTokenAddress","from":"0xFromAddress","to":"0xToAddress","tokenId":"1"} + ``` 2. For withdrawals: - ```js - {"operation":"withdraw","erc721":"0xTokenAddress","from":"0xFromAddress","tokenId":"1"} - ``` + ```js + {"operation":"withdraw","erc721":"0xTokenAddress","from":"0xFromAddress","tokenId":"1"} + ``` + diff --git a/cartesi-rollups/tutorials/ether-wallet.md b/cartesi-rollups/tutorials/ether-wallet.md index c57889b9..6a3c4160 100644 --- a/cartesi-rollups/tutorials/ether-wallet.md +++ b/cartesi-rollups/tutorials/ether-wallet.md @@ -5,7 +5,7 @@ title: Integrating Ether wallet functionality This tutorial will build a basic Ether wallet inside a Cartesi backend application using TypeScript. -The goal is to have a backend application to track balances, receive, transfer, and withdraw Ether. +The goal is to have a backend application to track balances and receive, transfer, and withdraw Ether. :::note community tools This tutorial is for educational purposes. For production dApps, we recommend using [Deroll](https://deroll.dev/), a TypeScript package that simplifies app and wallet functionality across all token standards for Cartesi applications. @@ -13,7 +13,7 @@ This tutorial is for educational purposes. For production dApps, we recommend us ## Setting up the project -First, let's create a new TypeScript project using the [Cartesi CLI](../development/installation.md/#cartesi-cli). +First, create a new TypeScript project using the [Cartesi CLI](../development/installation.md/#cartesi-cli). ```bash cartesi create ether-wallet-dapp --template typescript @@ -39,7 +39,7 @@ yarn add -D @cartesi/rollups Let's write a configuration to generate the ABIs of the Cartesi Rollups Contracts. -We will the Solidity compiler and the contract code from the `@cartesi/rollups` package to generate the ABIs as consts. +We will the Solidity compiler and the contract code from the `@cartesi/rollups` package to generate the ABIs as constants. 1. [Install the Solidity compiler](https://docs.soliditylang.org/en/latest/installing-solidity.html). @@ -84,7 +84,7 @@ generate_abi() { echo "Extracted ABI for $contract_name" - # Create TypeScript file with exported ABI + # Create a TypeScript file with exported ABI echo "export const ${contract_name}Abi = $abi as const;" > "$output_file" echo "Generated ABI for $contract_name" @@ -116,7 +116,7 @@ And run it: ## Building the Ether wallet -Our wallet will consist of two main classes: `Balance` and `Wallet`. Let's implement each of these: +Our wallet will have two main classes: `Balance` and `Wallet`. Let's implement each of these: Create a file named `balance.ts` in the `src/wallet` directory and add the following code: @@ -146,7 +146,7 @@ export class Balance { } ``` -The `Balance` class represents an individual account's balance. It includes methods to get, increase, and decrease the Ether balance. +The `Balance` class represents an individual account's balance. It includes methods for getting, increasing, and decreasing the Ether balance. Now, create a file named `wallet.ts` in the `src/wallet` directory and add the following code: @@ -264,16 +264,16 @@ export class Wallet { ``` -The `Wallet` class manages multiple accounts and provides methods for common wallet operations. Key features include storing balances, centralizing the logic for retrieving or creating a balance and depositing, withdrawing, and transferring Ether. +The `Wallet` class manages multiple accounts and provides methods for everyday wallet operations. Key features include storing balances, centralizing the logic for retrieving or creating a balance, and depositing, withdrawing, and transferring Ether. `parseDepositPayload` and `encodeWithdrawCall` handle the low-level details of working with the base layer data. ### Voucher creation -The `encodeWithdrawCall` method returns a voucher. Creating vouchers is a key concept in Cartesi rollups for executing withdrawal operations on the base layer chain. +The `encodeWithdrawCall` method returns a voucher. Creating vouchers is a crucial concept in Cartesi rollups for executing withdrawal operations on the base layer chain. -The voucher creation process occurs during the withdrawal of Ether. Here's how it works in this application: +The voucher creation process occurs during Ether’s withdrawal. Here's how it works in this application: 1. The `encodeFunctionData` function creates the calldata for the [`function withdrawEther(address _receiver, uint256 _value) external`](../rollups-apis/json-rpc/application.md/#withdrawether) on the `CartesiDApp` contract. @@ -292,14 +292,14 @@ The voucher creation process occurs during the withdrawal of Ether. Here's how i ## Using the Ether wallet -Now, let's create a simple application in the entrypoint, `src/index.ts` to test the wallet functionality. +Now, let's create a simple application at the entry point, `src/index.ts,` to test the wallet functionality. -The [`EtherPortal`](../rollups-apis/json-rpc/portals/EtherPortal.md) contract allows anyone to perform transfers of Ether to a dApp. All deposits to a dApp is done via the `EtherPortal` contract. +The [`EtherPortal`](../rollups-apis/json-rpc/portals/EtherPortal.md) contract allows anyone to perform transfers of Ether to a dApp. All deposits to a dApp are made via the `EtherPortal` contract. -The [`DAppAddressRelay`](../rollups-apis/json-rpc/relays/relays.md) contract provides the critical information (the dApp's address) that the voucher creation process needs to function correctly. Without this relay mechanism, the off-chain part of the dApp wouldn't know its own on-chain address, making it impossible to create valid vouchers for withdrawals. +The [`DAppAddressRelay`](../rollups-apis/json-rpc/relays/relays.md) contract provides the critical information (the dApp's address) that the voucher creation process needs to function correctly. Without this relay mechanism, the off-chain part of the dApp wouldn't know its on-chain address, making it impossible to create valid vouchers for withdrawals. :::note -Run `cartesi address-book` to get the addresses of the `EtherPortal` and `DAppAddressRelay` contracts. Save these as consts in the `index.ts` file. +Run `cartesi address-book` to get the addresses of the `EtherPortal` and `DAppAddressRelay` contracts. Save these as constants in the `index.ts` file. ::: ```typescript @@ -466,17 +466,17 @@ Here is a breakdown of the wallet functionality: - We handle deposits and create a notice when the sender is the `EtherPortal`. -- For other senders, we parse the payload to determine the operation (`transfer` or `withdraw`). +- We parse the payload for other senders to determine the operation (`transfer` or `withdraw`). - For `transfers`, we call `wallet.transferEther` and create a notice with the parsed parameters. -- For `withdrawals`, we call `wallet.withdrawEther` and create voucher using the dApp dress and the parsed parameters. +For `withdrawals,` we call `wallet.withdrawEther` and create a voucher using the dApp dress and the parsed parameters. - We created helper functions to `createNotice` for deposits and transfers, `createReport` for balance checks and `createVoucher` for withdrawals. :::caution important -The dApp address strictly needs to be relayed before withdrawal requests. +The dApp address needs to be relayed strictly before withdrawal requests. To relay the dApp address, run: `cartesi send dapp-address` ::: @@ -549,4 +549,4 @@ For end-to-end functionality, developers will likely build their [custom user-fa When you run your application with `cartesi run`, there is a local instance of CartesiScan on `http://localhost:8080/explorer`. -You can execute your vouchers via the explorer, which completes the withdrawal process at the end of [an epoch](../rollups-apis/backend/vouchers.md/#epoch-configuration). \ No newline at end of file +You can execute your vouchers via the explorer, which completes the withdrawal process at the end of [an epoch](../rollups-apis/backend/vouchers.md/#epoch-configuration).