diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 4e810ac2c..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Deploy -on: - push: - branches: - - main - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -# Allow one concurrent deployment -concurrency: - group: pages - cancel-in-progress: true - -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: read # To push a branch - pages: write # To push to a GitHub Pages site - id-token: write # To update the deployment status - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install mdbook - run: | - cargo install mdbook --locked --version 0.4.31 - - name: Build Book - run: | - mdbook build - # - name: Setup Pages - # uses: actions/configure-pages@v3 - # - name: Upload artifact - # uses: actions/upload-pages-artifact@v1 - # with: - # # Upload entire repository - # path: 'book' - # - name: Deploy to GitHub Pages - # id: deployment - # uses: actions/deploy-pages@v2 - - - name: Rename book to public_html - run: mv book public_html - - - name: scp upload to production site - run: | - sshpass -p ${{ secrets.PROD_PASS }} scp -o 'StrictHostKeyChecking no' -r public_html/ ${{ secrets.PROD_USER }}@${{ secrets.PROD_IP }}:~/ diff --git a/.github/workflows/install-mdbook/action.yml b/.github/workflows/install-mdbook/action.yml new file mode 100644 index 000000000..5560adc4c --- /dev/null +++ b/.github/workflows/install-mdbook/action.yml @@ -0,0 +1,15 @@ +name: Install mdbook and dependencies + +description: Install mdbook with the dependencies we need. + +runs: + using: composite + steps: + # The --locked flag is important for reproducible builds. + - name: Install mdbook + run: cargo install mdbook --locked --version 0.4.31 + shell: bash + + - name: Install mdbook-i18n-helpers + run: cargo install mdbook-i18n-helpers --locked --version 0.1.0 + shell: bash diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml new file mode 100644 index 000000000..3a67ac291 --- /dev/null +++ b/.github/workflows/mdbook.yml @@ -0,0 +1,72 @@ +# Sample workflow for building and deploying a mdBook site to GitHub Pages +# +# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html +# +name: Deploy mdBook site to Pages + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: pages + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + publish: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Rust cache + uses: ./.github/workflows/setup-rust-cache + + - name: Install mdbook + uses: ./.github/workflows/install-mdbook + + - name: Build in English + run: | + mdbook build -d book + + - name: Build all translations + run: | + for po_lang in $(cat ./LANGUAGES); do + echo "::group::Building $po_lang translation" + MDBOOK_BOOK__LANGUAGE=$po_lang \ + mdbook build -d book/$po_lang + echo "::endgroup::" + done + + # - name: Setup Pages + # uses: actions/configure-pages@v3 + + # - name: Upload artifact + # uses: actions/upload-pages-artifact@v1 + # with: + # path: ./book + + # - name: Deploy to GitHub Pages + # id: deployment + # uses: actions/deploy-pages@v2 + + - name: Rename book to public_html + run: mv book public_html + + - name: scp upload to production site + run: | + sshpass -p ${{ secrets.PROD_PASS }} scp -o 'StrictHostKeyChecking no' -r public_html/ ${{ secrets.PROD_USER }}@${{ secrets.PROD_IP }}:~/ diff --git a/.github/workflows/setup-rust-cache/action.yml b/.github/workflows/setup-rust-cache/action.yml new file mode 100644 index 000000000..f359ed35b --- /dev/null +++ b/.github/workflows/setup-rust-cache/action.yml @@ -0,0 +1,9 @@ +name: Setup Rust cache + +description: Configure the rust-cache workflow. + +runs: + using: composite + steps: + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 diff --git a/.gitignore b/.gitignore index 075f0f9a8..531af8d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ node_modules # Editors tmp files. *~ .idea/ - +.vscode diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d1e87fba0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +theme \ No newline at end of file diff --git a/LANGUAGES b/LANGUAGES new file mode 100644 index 000000000..6c4381495 --- /dev/null +++ b/LANGUAGES @@ -0,0 +1 @@ +es \ No newline at end of file diff --git a/README.md b/README.md index 464317064..54dd08dc9 100644 --- a/README.md +++ b/README.md @@ -10,29 +10,45 @@ We value and welcome all contributions! - Prioritize contributions that directly pertain to the book's content. - Even if an issue doesn't exist, feel free to create a PR for typos, errors, or content improvements and additions. -## Building the Book +### Setup -Before building or contributing to the book: +1. Rust related packages: + - Install toolchain providing `cargo` using [rustup](https://rustup.rs/). + - Install [mdBook](https://rust-lang.github.io/mdBook/guide/installation.html) and the translation extension: + ``` + cargo install mdbook --version 0.4.31 mdbook-i18n-helpers --version 0.1.0 + ``` +2. Host machine packages: + - Install [gettext](https://www.gnu.org/software/gettext/) for translations, usually available with regular package manager: + `sudo apt install gettext`. +3. Clone this repository. -- Ensure you have [mdBook] installed. While version 0.4.31 is recommended, newer versions should be compatible. +### Work locally (english, main language) -```bash -$ cargo install mdbook --version 0.4.31 -``` +All the Markdown files **MUST** be edited in english. To work locally in english: -Follow these steps to build and view the book: +- Start a local server with `mdbook serve` and visit [localhost:3000](http://localhost:3000) to view the book. + You can use the `--open` flag to open the browser automatically: `mdbook serve --open`. +- Make changes to the book and refresh the browser to see the changes. +- Open a PR with your changes. -1. Build the book: +### Work locally (translations) -```bash -$ mdbook build -``` +This book is targetting international audience, and aims at being gradually translated in several languages. +**All files in the `src` directory MUST be written in english**. This ensures that all the translation files can be +auto-generated and updated by translators. +To work with translations, those are the steps to update the translated content: -2. After building, the compiled content will be located in the **`book`** subdirectory. -3. To view the content in a browser: +- Run a local server for the language you want to edit: `./translations.sh es` for instance. If no language is provided, the script will only extract translations from english. +- Open the translation file you are interested in `po/es.po` for instance. You can also use editors like [poedit](https://poedit.net/) to help you on this task. +- When you are done, you should only have changes into the `po/xx.po` file. Commit them and open a PR. + The PR must stars with `i18n` to let the maintainers know that the PR is only changing translation. + The translation work is inspired from [Comprehensive Rust repository](https://github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md). -```bash -$ mdbook serve --open -``` +#### Initiate a new translation for your language -Tip: After making edits, simply refresh your browser to see the updates. +If you wish to initiate a new translation for your language without running a local server, consider the following tips: + +- Execute the command `./translations.sh new xx` (replace `xx` with your language code). This method can generate the `xx.po` file of your language for you. +- To update your `xx.po` file, execute the command `./translations.sh xx` (replace `xx` with your language code), as mentioned in the previous chapter. +- If the `xx.po` file already exists (which means you are not initiating a new translation), you should not run this command. diff --git a/book.toml b/book.toml index 605d230df..0424e8c29 100644 --- a/book.toml +++ b/book.toml @@ -1,4 +1,15 @@ [book] authors = ["Starknet Community with support from Starkware and the Starknet Foundation"] +language = "en" +multilingual = false src = "src" title = "The Starknet Book" + +[build] +extra-watch-dirs = ["po"] + +[preprocessor.gettext] +after = ["links"] + +[output.html] +git-repository-url = "https://github.com/starknet-edu/starknetbook" diff --git a/po/es.po b/po/es.po new file mode 100644 index 000000000..0bbdbd30e --- /dev/null +++ b/po/es.po @@ -0,0 +1,7730 @@ +msgid "" +msgstr "" +"Project-Id-Version: The Starknet Book\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2023-10-10 09:54-0300\n" +"Last-Translator: dami \n" +"Language-Team: Spanish \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4\n" + +#: src/SUMMARY.md:1 +msgid "The Starknet Book" +msgstr "El libro de Starknet" + +#: src/SUMMARY.md:4 +msgid "Introduction" +msgstr "Introducción" + +#: src/SUMMARY.md:8 +msgid "Getting Started" +msgstr "Primeros pasos" + +#: src/SUMMARY.md:10 +msgid "Tooling" +msgstr "Herramientas" + +#: src/SUMMARY.md:13 +msgid "Basic Installation" +msgstr "Instalación básica" + +#: src/SUMMARY.md:14 +msgid "Compile, Deploy, Interact" +msgstr "" + +#: src/SUMMARY.md:15 +msgid "Scarb: The Package Manager" +msgstr "" + +#: src/SUMMARY.md:16 +msgid "Starkli: A CLI interface 🚧" +msgstr "" + +#: src/SUMMARY.md:17 +msgid "Katana: A Local Node" +msgstr "" + +#: src/SUMMARY.md:18 +msgid "Starknet Devnet 🚧" +msgstr "" + +#: src/SUMMARY.md:19 +msgid "Starknet-js: Javascript SDK" +msgstr "" + +#: src/SUMMARY.md:20 +msgid "Starknet-React: React Integration" +msgstr "" + +#: src/SUMMARY.md:21 +msgid "Starknet-py: Python SDK 🚧" +msgstr "" + +#: src/SUMMARY.md:22 +msgid "Starknet-rs: Rust SDK 🚧" +msgstr "" + +#: src/SUMMARY.md:23 +msgid "Foundry Forge: Testing 🚧" +msgstr "" + +#: src/SUMMARY.md:24 +msgid "Foundry Cast: Interacting with Starknet 🚧" +msgstr "" + +#: src/SUMMARY.md:27 +msgid "Architecture" +msgstr "" + +#: src/SUMMARY.md:30 +msgid "Transactions" +msgstr "" + +#: src/SUMMARY.md:31 +msgid "Sequencers" +msgstr "" + +#: src/SUMMARY.md:32 +msgid "Provers 🚧" +msgstr "" + +#: src/SUMMARY.md:33 +msgid "Nodes 🚧" +msgstr "" + +#: src/SUMMARY.md:34 +msgid "Layer 3 and App Chains 🚧 " +msgstr "" + +#: src/SUMMARY.md:35 +msgid "Solidity Verifier 🚧" +msgstr "" + +#: src/SUMMARY.md:36 +msgid "Decentralization 🚧" +msgstr "" + +#: src/SUMMARY.md:38 +msgid "Account Abstraction" +msgstr "" + +#: src/SUMMARY.md:41 +msgid "Accounts" +msgstr "" + +#: src/SUMMARY.md:42 +msgid "Hello, Account! 🚧" +msgstr "" + +#: src/SUMMARY.md:43 +msgid "Standard AccounT 🚧" +msgstr "" + +#: src/SUMMARY.md:44 +msgid "Examples" +msgstr "" + +#: src/SUMMARY.md:45 +msgid "Multicaller 🚧" +msgstr "" + +#: src/SUMMARY.md:46 +msgid "Multisig 🚧" +msgstr "" + +#: src/SUMMARY.md:47 +msgid "Auto-Payments 🚧" +msgstr "" + +#: src/SUMMARY.md:48 +msgid "Alternative Signature Schemes 🚧" +msgstr "" + +#: src/SUMMARY.md:52 +msgid "STARKs 🚧" +msgstr "" + +#: src/SUMMARY.md:53 +msgid "Basics 🚧" +msgstr "" + +#: src/SUMMARY.md:54 +msgid "Math Primer 🚧" +msgstr "" + +#: src/SUMMARY.md:55 +msgid "Number Theory 🚧" +msgstr "" + +#: src/SUMMARY.md:56 +msgid "Geometry 🚧" +msgstr "" + +#: src/SUMMARY.md:57 +msgid "Cryptographic Primitives 🚧" +msgstr "" + +#: src/SUMMARY.md:58 +msgid "Arithimization 🚧" +msgstr "" + +#: src/SUMMARY.md:59 +msgid "Low Degree Testing 🚧" +msgstr "" + +#: src/SUMMARY.md:60 +msgid "FRI Protocol 🚧" +msgstr "" + +#: src/SUMMARY.md:61 +msgid "Efficient STARKs" +msgstr "" + +#: src/SUMMARY.md:62 +msgid "STARKs Protocol (Python) 🚧" +msgstr "" + +#: src/SUMMARY.md:63 src/SUMMARY.md:68 +msgid "Trace/Low Degree Extension 🚧" +msgstr "" + +#: src/SUMMARY.md:64 src/SUMMARY.md:69 +msgid "Constraints 🚧" +msgstr "" + +#: src/SUMMARY.md:65 src/SUMMARY.md:70 +msgid "FRI Commitments 🚧" +msgstr "" + +#: src/SUMMARY.md:66 src/SUMMARY.md:71 +msgid "Query Phase 🚧" +msgstr "" + +#: src/SUMMARY.md:67 +msgid "STARKs Protocol (Rust) 🚧" +msgstr "" + +#: src/title-page.md:1 +msgid "# The Starknet Book" +msgstr "" + +#: src/title-page.md:3 +msgid "" +"The Starknet Book is a work in progress, shaped by ongoing community\n" +"input. Some sections may be incomplete or still under review and are\n" +"marked under a 🚧 emoji. We welcome your suggestions, feedback, and\n" +"content contributions to make this book a reliable guide for everyone." +msgstr "" + +#: src/title-page.md:8 +msgid "" +"The Starknet Book is a step-by-step guide aimed at teaching you the\n" +"essentials of Starknet development. It’s a community effort, with each\n" +"chapter guiding you through the Starknet ecosystem." +msgstr "" + +#: src/title-page.md:12 +msgid "" +"Understanding Cairo, the key programming language for Starknet smart\n" +"contracts, is crucial. That’s why this book works hand-in-hand with the\n" +"Cairo Book, another community resource. You can access the Cairo Book\n" +"[**here**](https://book.cairo-lang.org/)." +msgstr "" + +#: src/title-page.md:17 +msgid "" +"In short, the Cairo Book helps you master Cairo, while The Starknet Book\n" +"focuses on Starknet’s specific features. For a well-rounded\n" +"understanding, we recommend exploring both. This book will introduce you\n" +"to tools, architecture, account setups, STARKs, and Starknet-specific\n" +"apps." +msgstr "" + +#: src/title-page.md:23 +msgid "## Table of Contents" +msgstr "" + +#: src/title-page.md:25 +msgid "**Chapter Titles**" +msgstr "" + +#: src/title-page.md:27 +msgid "" +"| Chapter | " +"Description " +"|\n" +"|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n" +"| 1: Starknet Introduction | Delve into the fundamental concepts of Starknet and acquaint yourself with the deployment of smart " +"contracts. |\n" +"| 2: Starknet Tooling | Familiarize yourself with vital tools, such as Protostar and Hardhat, and explore how languages like Javascript, Python, and " +"Rust can be leveraged for Starknet interactions. |\n" +"| 3: Starknet Architecture| Uncover Starknet’s core structure, gaining insights into the transaction lifecycle and the interplay between the Sequencer, " +"Prover, and Nodes. |\n" +"| 4: Account Abstraction | Delve deep into Starknet’s unique approach to user accounts, and master the art of crafting custom " +"accounts. |\n" +"| 5: STARKs | Dive into the intricacies of STARKs and their pivotal role in shaping Starknet’s " +"landscape. |" +msgstr "" + +#: src/title-page.md:36 +msgid "# Where to Start?" +msgstr "" + +#: src/title-page.md:38 +msgid "" +"Depending on your goals and interests, you can choose different paths\n" +"through the Starknet Book. Here are some recommendations based on\n" +"various objectives:" +msgstr "" + +#: src/title-page.md:42 +msgid "" +"- If you’re a **complete beginner** and want to start learning about\n" +" Cairo and Starknet from scratch, follow the book in its entirety,\n" +" starting with **Introduction to Starknet**.\n" +"\n" +"- If you’re an **experienced developer** looking to quickly dive into\n" +" writing scalable and decentralized smart contracts, focus on the\n" +" Cairo Book, particularly **chapter 12: Starknet Smart Contracts**\n" +" ([link](https://book.cairo-lang.org/ch99-00-starknet-smart-contracts.html)).\n" +"\n" +"- If you’re a **frontend developer** wanting to integrate Starknet\n" +" with a React frontend using Javascript, prioritize the\n" +" **starknet-js** and **starknet-react** subchapters in **Starknet\n" +" Tooling**\n" +"\n" +"- If you’re a **DevOps engineer** or **node operator** interested in\n" +" running a Starknet node and indexer, head straight to **Starknet\n" +" Architecture**.\n" +"\n" +"- If you’re a **security researcher** or **smart contract auditor**\n" +" wanting to learn about the Account Abstraction feature and its\n" +" implications, go for **Account Abstraction**.\n" +"\n" +"- If you’re a **blockchain enthusiast** curious about the underlying\n" +" architecture and mechanics of Starknet and Cairo, explore **Starknet\n" +" Architecture**.\n" +"\n" +"- If you’re a **cryptography expert** or **researcher** eager to\n" +" understand the fundamentals of STARKs and their connection to the\n" +" Starknet ecosystem, delve into **STARKs**." +msgstr "" + +#: src/title-page.md:72 +msgid "" +"Feel free to mix and match these paths based on your unique interests\n" +"and requirements." +msgstr "" + +#: src/title-page.md:75 +msgid "# Your Contributions Matter" +msgstr "" + +#: src/title-page.md:77 +msgid "" +"Welcome aboard! By contributing to the Starknet Book, you’re doing more\n" +"than sharing expertise—you’re shaping the future of decentralized tech.\n" +"Let’s build a guide that helps developers unlock Starknet’s potential." +msgstr "" + +#: src/title-page.md:81 +msgid "" +"For detailed contribution guidelines, visit the [Contributors\n" +"Guide](https://github.com/starknet-edu/starknetbook/blob/main/CONTRIBUTING.adoc).\n" +"Every contribution counts. Your skills and passion will help make this\n" +"book an invaluable tool." +msgstr "" + +#: src/title-page.md:86 +msgid "## How You Can Help" +msgstr "" + +#: src/title-page.md:88 +msgid "" +"- Found an empty section? Fill it in!\n" +"\n" +"- Think we need a new section? Suggest one.\n" +"\n" +"- See room for improvement? Go ahead and tweak it.\n" +"\n" +"- Want to add code in a new programming language? Go for it.\n" +"\n" +"- Found a bug? Fix it.\n" +"\n" +"- Exercises unclear? Add explanations.\n" +"\n" +"- Show off your favorite Cairo features through new exercises." +msgstr "" + +#: src/title-page.md:102 +msgid "# Additional Key Educational Resources" +msgstr "" + +#: src/title-page.md:104 +msgid "" +"We’ve compiled a list of valuable educational resources that will help\n" +"deepen your understanding and enhance your skills in coding with Cairo\n" +"and staying abreast with Starknet developments:" +msgstr "" + +#: src/title-page.md:108 +msgid "" +"1. **Cairo Book**: A comprehensive guide to Cairo, the programming\n" +" language for Starknet smart contracts. You can access it\n" +" [here](https://book.cairo-lang.org/).\n" +"\n" +"2. **Starklings**: A resource specifically designed to guide you\n" +" through learning Cairo programming, ensuring that you reach a\n" +" proficient level. You can access it\n" +" [here](https://github.com/shramee/starklings-cairo1).\n" +"\n" +"3. **Starknet Community Forum**: An online platform where you can\n" +" engage in discussions about the latest developments in Starknet.\n" +" Join the conversation [here](https://community.starknet.io/).\n" +"\n" +"4. **Starknet Documentation**: You can browse through the documentation\n" +" [here](https://docs.starknet.io/).\n" +"\n" +"5. **Cairo Documentation**: Explore it\n" +" [here](https://www.cairo-lang.org/docs).\n" +"\n" +"6. **Starknet Developer Telegram (English)**: A community for\n" +" English-speaking Starknet developers. This is a great platform for\n" +" networking, sharing ideas, and troubleshooting together. Join us on\n" +" Telegram [here](https://t.me/starknetna)." +msgstr "" + +#: src/ch00-00-introduction.md:1 +msgid "# The Starknet Network" +msgstr "" + +#: src/ch00-00-introduction.md:3 +msgid "## Preamble" +msgstr "" + +#: src/ch00-00-introduction.md:5 +msgid "" +"Historically, societal roles like currency, property rights, and social status titles have been governed by *protocols* and *registries*. Their value " +"stems from a widely accepted understanding of their integrity. These functions have predominantly been overseen by centralized entities prone to " +"challenges such as corruption, agency conflicts, and exclusion ([Eli Ben-Sasson, Bareli, Brandt, Volokh, 2023](https://hackmd.io/@Elibensasson/" +"ryMelVulp))." +msgstr "" + +#: src/ch00-00-introduction.md:7 +msgid "" +"Satoshi's creation, Bitcoin, introduced a novel approach for these functions, termed an *integrity web*. This is an infrastructure for societal roles " +"that:" +msgstr "" + +#: src/ch00-00-introduction.md:8 +msgid "" +"1. Is openly described by a public protocol.\n" +"2. Operates over a wide, inclusive, peer-to-peer network.\n" +"3. Distributes value fairly and extensively to maintain societal consensus on its integrity." +msgstr "" + +#: src/ch00-00-introduction.md:12 +msgid "" +"While Bitcoin addressed monetary functions, Ethereum expanded this to include any function that can be defined by computer programming. Both faced the " +"challenge of balancing scalability with decentralization. These integrity webs have often favored inclusivity over capacity, ensuring even those with " +"limited resources can authenticate the system's integrity. Yet, this means they struggle to meet global demand." +msgstr "" + +#: src/ch00-00-introduction.md:14 +msgid "## Defining \"Blockchain\"" +msgstr "" + +#: src/ch00-00-introduction.md:16 +msgid "" +"In the ever-evolving realm of technology, defining a term as multifaceted as \"Blockchain\" can be challenging. Based on current understandings and " +"applications, a Blockchain can be characterized by the following three properties ([Eli Ben-Sasson, 2023](https://twitter.com/EliBenSasson/" +"status/1709272086504485265)):" +msgstr "" + +#: src/ch00-00-introduction.md:18 +msgid "" +"1. **Public Protocol:** The foundation of a Blockchain rests upon a protocol that is openly available. This transparency ensures that any interested " +"party can understand its workings, fostering trust and enabling wider adoption.\n" +"2. **Open P2P Network:** Instead of relying on a centralized entity, a Blockchain operates over a peer-to-peer (P2P) network. This decentralized approach " +"ensures that operations are distributed across various participants or nodes, making the system more resilient to failures and censorship.\n" +"3. **Value Distribution:** Central to the Blockchain's operation is the way it rewards its operators. The system autonomously distributes value in a " +"manner that is wide-ranging and equitable. This incentivization not only motivates participants to maintain the system's integrity but also ensures a " +"broader societal consensus." +msgstr "" + +#: src/ch00-00-introduction.md:22 +msgid "" +"While these properties capture the essence of many Blockchains, the term's definition might need refinement as the technology matures and finds new " +"applications. Engaging in continuous dialogue and revisiting definitions will be crucial in this dynamic landscape." +msgstr "" + +#: src/ch00-00-introduction.md:24 +msgid "## Starknet Definition" +msgstr "" + +#: src/ch00-00-introduction.md:26 +msgid "" +"Starknet is a Layer-2 network that makes Ethereum transactions faster, cheaper, and more secure using zk-STARKs technology. Think of it as a boosted " +"layer on top of Ethereum, optimized for speed and cost." +msgstr "" + +#: src/ch00-00-introduction.md:28 +msgid "" +"Starknet bridges the gap between scalability and broad consensus. It integrates a mathematical framework to navigate the balance between capacity and " +"inclusivity. Its integrity hinges on the robustness of succinct, transparent proofs of computational integrity. This method lets powerful operators " +"enhance Starknet's capacity, ensuring everyone can authenticate Starknet's integrity using universally accessible tools ([Eli Ben-Sasson, Bareli, Brandt, " +"Volokh, 2023](https://hackmd.io/@Elibensasson/ryMelVulp))." +msgstr "" + +#: src/ch00-00-introduction.md:30 +msgid "## Starknet’s Mission" +msgstr "" + +#: src/ch00-00-introduction.md:32 +msgid "*Starknet’s mission is to allow individuals to freely implement and use any social function they desire.*" +msgstr "" + +#: src/ch00-00-introduction.md:34 +msgid "## Starknet’s Values" +msgstr "" + +#: src/ch00-00-introduction.md:36 +msgid "Starknet's ethos is anchored in core principles ([Eli Ben-Sasson, Bareli, Brandt, Volokh, 2023](https://hackmd.io/@Elibensasson/ryMelVulp)):" +msgstr "" + +#: src/ch00-00-introduction.md:38 +msgid "" +"- **Lasting Broadness.** Starknet continuously resists power consolidation. Key points include:\n" +" - Broad power distribution underpins Starknet's legitimacy and must persist across operations and decision-making. While centralized operation may be " +"necessary at times, it should be short-lived.\n" +" - Starknet's protocol and governance should always be open and transparent.\n" +" - Governance should bolster inclusivity, with a flexible structure that can evolve to ensure enduring inclusivity.\n" +"\n" +"- **Neutrality.** Starknet remains impartial to the societal functions it supports.\n" +" - The objectives and ethos of functions on Starknet lie with their creators.\n" +" - **Censorship resistance:** Starknet remains agnostic to the nature and meaning of user transactions.\n" +"\n" +"- **Individual Empowerment.** At its core, Starknet thrives on a well-informed and autonomous user base. This is achieved by fostering a culture rooted " +"in its core mission and values, with a strong emphasis on education." +msgstr "" + +#: src/ch00-00-introduction.md:49 +msgid "## Key Features" +msgstr "" + +#: src/ch00-00-introduction.md:51 +msgid "These are some key features of Starknet:" +msgstr "" + +#: src/ch00-00-introduction.md:53 +msgid "" +"- Low Costs: Transactions on Starknet cost less than on Ethereum.\n" +" Future updates like Volition and EIP 4844 will make it even cheaper.\n" +"\n" +"- Developer-Friendly: Starknet lets developers easily build\n" +" decentralized apps using its native language, Cairo.\n" +"\n" +"- Speed and Efficiency: Upcoming releases aim to make transactions\n" +" even faster and cheaper.\n" +"\n" +"- CVM: Thanks to Cairo, Starknet runs on it´s own VM, called Cairo VM\n" +" (CVM), that allow us to innovate beyond the Ethereum Virtual Machine\n" +" (EVM) and create a new paradigm for decentralized applications." +msgstr "" + +#: src/ch00-00-introduction.md:66 +msgid "Here some of them:" +msgstr "" + +#: src/ch00-00-introduction.md:68 +msgid "" +"- Account Abstraction: Implemented at the protocol level, this\n" +" facilitates diverse signing schemes while ensuring user security and\n" +" self-custody of assets.\n" +"\n" +"- Volition: Will be implemented on testnet during Q4 2023 will allow\n" +" developers to regulate data availability on Ethereum (L1) or on\n" +" Starknet (L2). Reducing L1 onchain data can radically reduce costs.\n" +"\n" +"- Paymaster: StarkNet will allow users to choose how to pay for\n" +" transaction fee, follows the guidelines laid out in EIP 4337 and\n" +" allows the transaction to specify a specific contract, a\n" +" **Paymaster**, to pay for their transaction. Supports gasless\n" +" transactions, enhancing user accessibility." +msgstr "" + +#: src/ch00-00-introduction.md:82 +msgid "## Cairo: The Language of Starknet" +msgstr "" + +#: src/ch00-00-introduction.md:84 +msgid "" +"Cairo is tailor-made for creating STARK-based smart contracts. As\n" +"Starknet’s native language, it’s central to building scalable and secure\n" +"decentralized apps. To start learning now, check out the [Cairo\n" +"Book](https://cairo-book.github.io/) and\n" +"[Starklings](https://github.com/shramee/starklings-cairo1)." +msgstr "" + +#: src/ch00-00-introduction.md:90 +msgid "" +"Inspired by Rust, Cairo lets you write contracts safely and\n" +"conveniently." +msgstr "" + +#: src/ch00-00-introduction.md:93 +msgid "### Why Choose Cairo?" +msgstr "" + +#: src/ch00-00-introduction.md:95 +msgid "" +"Cairo is designed for *Provable Computation,* a new paradigm that lets\n" +"programs prove their correctness without re-running them. Here’s why it\n" +"stands out:" +msgstr "" + +#: src/ch00-00-introduction.md:99 +msgid "" +"- Purpose-Built: Designed specifically for smart contracts.\n" +"\n" +"- No EVM Limits: Goes beyond what the Ethereum Virtual Machine can do.\n" +"\n" +"- Flexibility: Uses traits for more flexibility than inheritance." +msgstr "" + +#: src/ch00-00-introduction.md:105 +msgid "## Governance" +msgstr "" + +#: src/ch00-00-introduction.md:107 +msgid "" +"The Starknet Foundation oversees Starknet’s governance. Its duties\n" +"include:" +msgstr "" + +#: src/ch00-00-introduction.md:110 +msgid "" +"- Managing Starknet’s development and operations\n" +"\n" +"- Overseeing the Starknet DAO, which enables community involvement\n" +"\n" +"- Setting rules to maintain network integrity" +msgstr "" + +#: src/ch00-00-introduction.md:116 +msgid "" +"Our focus is on technical input and debate for improving the protocol.\n" +"While we value all perspectives, it’s often the technical insights that\n" +"steer us forward." +msgstr "" + +#: src/ch00-00-introduction.md:120 +msgid "" +"Members can influence Starknet by voting on changes. Here’s the process:\n" +"A new version is tested on the Goerli Testnet. Members then have six\n" +"days to review it. A Snapshot proposal is made, and the community votes.\n" +"A majority of *YES* votes means an upgrade to the Mainnet." +msgstr "" + +#: src/ch00-00-introduction.md:125 +msgid "In short, governance is key to Starknet’s evolution." +msgstr "" + +#: src/ch00-00-introduction.md:127 +msgid "To propose an improvement, create a SNIP." +msgstr "" + +#: src/ch00-00-introduction.md:130 +msgid "### SNIP: StarkNet Improvement Proposals" +msgstr "" + +#: src/ch00-00-introduction.md:132 +msgid "" +"SNIP is short for StarkNet Improvement Proposal. It’s essentially a\n" +"blueprint that details proposed enhancements or changes to the StarkNet\n" +"ecosystem. A well-crafted SNIP includes both the technical\n" +"specifications of the change and the reasons behind it. If you’re\n" +"proposing a SNIP, it’s your job to rally community support and document\n" +"any objections (more details\n" +"[here](https://community.starknet.io/t/draft-simp-1-simp-purpose-and-guidelines/1197#what-is-a-snip-2)).\n" +"Once a SNIP is approved, it becomes a part of the Starknet protocol. All\n" +"the SNIPs can be found in [this\n" +"repository](https://github.com/starknet-io/SNIPs)." +msgstr "" + +#: src/ch00-00-introduction.md:143 +msgid "SNIPs serve three crucial roles:" +msgstr "" + +#: src/ch00-00-introduction.md:145 +msgid "" +"1. They are the main avenue for proposing new features or changes.\n" +"\n" +"2. They act as a platform for technical discussions within the\n" +" community.\n" +"\n" +"3. They document the decision-making process, offering a historical\n" +" view of how StarkNet has evolved." +msgstr "" + +#: src/ch00-00-introduction.md:153 +msgid "" +"Because SNIPs are stored as text files in a [version-controlled\n" +"repository](https://github.com/starknet-io/SNIPs), you can easily track\n" +"changes and understand the history of proposals." +msgstr "" + +#: src/ch00-00-introduction.md:157 +msgid "" +"For those who are building on Starknet, SNIPs aren’t just\n" +"suggestions—they’re a roadmap. It’s beneficial for implementers to keep\n" +"a list of the SNIPs they’ve executed. This transparency helps users\n" +"gauge the state of a particular implementation or software library." +msgstr "" + +#: src/ch00-00-introduction.md:163 +msgid "## Learning Resources" +msgstr "" + +#: src/ch00-00-introduction.md:165 +msgid "For deeper insights into Starknet and Cairo:" +msgstr "" + +#: src/ch00-00-introduction.md:167 +msgid "" +"- [The Starknet Book](https://book.starknet.io): For mastering\n" +" Starknet\n" +"\n" +"- [The Cairo Book](https://cairo-book.github.io/): For mastering Cairo\n" +"\n" +"- [Starklings](https://github.com/shramee/starklings-cairo1):\n" +" Practical tutorials and examples" +msgstr "" + +#: src/ch00-00-introduction.md:175 src/ch02-08-starknet-react.md:361 src/ch03-00-architecture.md:251 src/ch03-02-sequencers.md:217 +#: src/ch03-03-provers.md:243 src/ch04-00-account-abstraction.md:242 +msgid "## Conclusion" +msgstr "" + +#: src/ch00-00-introduction.md:177 +msgid "" +"In decentralized technology, Starknet offers a solution to challenges that previous systems encountered. It's based on established *protocols* and " +"*registries*, following the initial concepts introduced by figures such as Satoshi. Through a specific mathematical method, Starknet seeks a balance " +"between scalability and consensus. As this technology progresses, Starknet adheres to principles of inclusivity, neutrality, and user empowerment. It's " +"poised for continuous adaptation and improvement in the field." +msgstr "" + +#: src/ch01-00-getting-started.md:1 +msgid "# Getting Started" +msgstr "" + +#: src/ch01-00-getting-started.md:3 +msgid "" +"Starknet is a scalable Layer-2 solution on Ethereum. This guide will walk you through the process of deploying and interacting with your first Starknet " +"smart contract using the Cairo programming language, a language tailored for creating validity proofs and that Starknet uses. For seasoned developers " +"looking to understand the core concepts and get hands-on experience, this guide offers step-by-step instructions and essential details." +msgstr "" + +#: src/ch01-00-getting-started.md:5 +msgid "" +"We will use the Starknet Remix Plugin to compile, deploy and interact with our smart contract. It is a great tool to get started with Starknet " +"development." +msgstr "" + +#: src/ch01-00-getting-started.md:7 +msgid "" +"1. Visit [The Remix Project](https://remix.ethereum.org/).\n" +"2. Navigate to the ‘Plugins’ section in the bottom left corner.\n" +"3. Enable the “Starknet” plugin." +msgstr "" + +#: src/ch01-00-getting-started.md:11 +msgid "\"Activate" +msgstr "" + +#: src/ch01-00-getting-started.md:13 +msgid "Activate the Starknet Plugin" +msgstr "" + +#: src/ch01-00-getting-started.md:15 +msgid "4. After enabling, the Starknet logo appears on the left sidebar. Click it to interact with opened Cairo files." +msgstr "" + +#: src/ch01-00-getting-started.md:18 +msgid "## Introduction to Starknet Smart Contracts" +msgstr "" + +#: src/ch01-00-getting-started.md:20 +msgid "The script below is a simple `Ownable` contract pattern written in Cairo for Starknet. It features:" +msgstr "" + +#: src/ch01-00-getting-started.md:22 +msgid "" +"- An ownership system.\n" +"- A method to transfer ownership.\n" +"- A method to check the current owner.\n" +"- An event notification for ownership changes.\n" +" " +msgstr "" + +#: src/ch01-00-getting-started.md:27 +msgid "" +"```rust\n" +"use starknet::ContractAddress;\n" +"\n" +"#[starknet::interface]\n" +"trait OwnableTrait {\n" +" fn transfer_ownership(ref self: T, new_owner: ContractAddress);\n" +" fn get_owner(self: @T) -> ContractAddress;\n" +"}\n" +"\n" +"#[starknet::contract]\n" +"mod Ownable {\n" +" use super::ContractAddress;\n" +" use starknet::get_caller_address;\n" +"\n" +" #[event]\n" +" #[derive(Drop, starknet::Event)]\n" +" enum Event {\n" +" OwnershipTransferred1: OwnershipTransferred1, \n" +" }\n" +"\n" +" #[derive(Drop, starknet::Event)]\n" +" struct OwnershipTransferred1 {\n" +" #[key]\n" +" prev_owner: ContractAddress,\n" +" #[key]\n" +" new_owner: ContractAddress,\n" +" }\n" +"\n" +" #[storage]\n" +" struct Storage {\n" +" owner: ContractAddress,\n" +" }\n" +"\n" +" #[constructor]\n" +" fn constructor(ref self: ContractState, init_owner: ContractAddress) {\n" +" self.owner.write(init_owner);\n" +" }\n" +"\n" +" #[external(v0)]\n" +" impl OwnableImpl of super::OwnableTrait {\n" +" fn transfer_ownership(ref self: ContractState, new_owner: ContractAddress) {\n" +" self.only_owner();\n" +" let prev_owner = self.owner.read();\n" +" self.owner.write(new_owner);\n" +" self.emit(Event::OwnershipTransferred1(OwnershipTransferred1 {\n" +" prev_owner: prev_owner,\n" +" new_owner: new_owner,\n" +" }));\n" +" }\n" +"\n" +" fn get_owner(self: @ContractState) -> ContractAddress {\n" +" self.owner.read()\n" +" }\n" +" }\n" +"\n" +" #[generate_trait]\n" +" impl PrivateMethods of PrivateMethodsTrait {\n" +" fn only_owner(self: @ContractState) {\n" +" let caller = get_caller_address();\n" +" assert(caller == self.owner.read(), 'Caller is not the owner');\n" +" }\n" +" }\n" +"}\n" +"```" +msgstr "" + +#: src/ch01-00-getting-started.md:92 +msgid "### Components Breakdown" +msgstr "" + +#: src/ch01-00-getting-started.md:94 +msgid "" +"The following is a brief description of the components in the contract. We will get into more details when we get deeper into Cairo so feel free to skip " +"this section for now if you are not familiar with smart contract development." +msgstr "" + +#: src/ch01-00-getting-started.md:96 +msgid "" +"1. **Dependencies and Interface**:\n" +" - **`starknet::ContractAddress`**: Represents a Starknet contract address.\n" +" - **`OwnableTrait`**: Specifies functions for transferring and getting ownership.\n" +"2. **Events**:\n" +" - **`OwnershipTransferred1`**: Indicates ownership change with previous and new owner details.\n" +"3. **Storage**:\n" +" - **`Storage`**: Holds the contract's state with the current owner's address.\n" +"4. **Constructor**:\n" +" - Initializes the contract with a starting owner.\n" +"5. **External Functions**:\n" +" - Functions for transferring ownership and retrieving the current owner's details.\n" +"6. **Private Methods**:\n" +" - **`only_owner`**: Validates if the caller is the current owner." +msgstr "" + +#: src/ch01-00-getting-started.md:110 +msgid "## Compilation Process" +msgstr "" + +#: src/ch01-00-getting-started.md:112 +msgid "To compile using Remix:" +msgstr "" + +#: src/ch01-00-getting-started.md:114 +msgid "" +"1. **File Creation**\n" +"\n" +" - Navigate to the \"File Explorer\" tab in Remix.\n" +" - Create a new file named `Ownable.cairo` and input the previous code.\n" +"\n" +"2. **Compilation**\n" +"\n" +" - Choose the `Ownable.cairo` file.\n" +" - In the \"Starknet\" tab, select \"Compile Ownable.cairo\".\n" +" - Post-compilation, an \"artifacts\" folder emerges containing the compiled contract in two distinct formats: Sierra (JSON file) and CASM. For " +"Starknet deployment, Remix will use the Sierra file. Do not worry about this process for now; we will cover it in detail in a later chapter. For now, " +"Remix will handle the compilation and deployment for us." +msgstr "" + +#: src/ch01-00-getting-started.md:125 +msgid "\"Artifacts" +msgstr "" + +#: src/ch01-00-getting-started.md:127 +msgid "Artifacts folder after compilation" +msgstr "" + +#: src/ch01-00-getting-started.md:129 +msgid "## Deployment on the Development Network" +msgstr "" + +#: src/ch01-00-getting-started.md:131 +msgid "To set your smart contract in motion, an initial owner must be defined. The Constructor function needs this information." +msgstr "" + +#: src/ch01-00-getting-started.md:133 +msgid "Here's a step-by-step guide to deploying your smart contract on the development network:" +msgstr "" + +#: src/ch01-00-getting-started.md:135 +msgid "" +"1. **Select the Appropriate Network**\n" +"\n" +" - Go to the Environment selection tab.\n" +" - Choose \"Remote Devnet\" for deploying your inaugural contract on a development network.\n" +"\n" +"2. **Choose a Devnet Account**\n" +"\n" +" - Under \"Devnet account selection\", a list of accounts specific to the chosen devnet is presented.\n" +" - Pick any account and copy its address.\n" +"\n" +"3. **Initiating Deployment**\n" +"\n" +" - Navigate to the \"Starknet\" tab.\n" +" - Input the copied address into the `init_owner` variable.\n" +" - Click on \"Deploy ownable.cairo\"." +msgstr "" + +#: src/ch01-00-getting-started.md:151 +msgid "Post-deployment, Remix's terminal will send various logs. These logs provide crucial details, including:" +msgstr "" + +#: src/ch01-00-getting-started.md:153 +msgid "" +" - `transaction_hash`: The unique hash of the transaction. This hash can be used to track the transaction's status.\n" +" - `contract_address`: The address of the deployed contract. Use this address to interact with your contract.\n" +" - `calldata`: Contains the `init_owner` address fed to the constructor." +msgstr "" + +#: src/ch01-00-getting-started.md:157 +msgid "" +"```bash\n" +"{\n" +" \"transaction_hash\": \"0x275e6d2caf9bc98b47ba09fa9034668c6697160a74de89c4655e2a70be84247\",\n" +" \"contract_address\": \"0x5eb239955ad4c4333b8ab83406a3cf5970554b60a0d8e78a531df18c59a0db9\",\n" +" ...\n" +" \"calldata\": [\n" +" \"0x4d9c8282b5633eeb1aab56393690d76f71e32f1b7be1bea03eb03e059245a28\"\n" +" ],\n" +" ...\n" +"}\n" +"```" +msgstr "" + +#: src/ch01-00-getting-started.md:169 +msgid "By following the above process, you successfully deploy your smart contract on the development network." +msgstr "" + +#: src/ch01-00-getting-started.md:172 +msgid "## Interaction with the Contract" +msgstr "" + +#: src/ch01-00-getting-started.md:174 +msgid "" +"With the contract now active on the development network, interaction becomes possible. Here's a guide to effectively interact with your contract on " +"Starknet:" +msgstr "" + +#: src/ch01-00-getting-started.md:176 +msgid "" +"1. **Initiating Interaction**\n" +"\n" +" - Navigate to the \"Starknet\" tab.\n" +" - Select the \"Interact\" option.\n" +" \n" +"2. **Calling the `get_owner` Function**\n" +"\n" +" - Choose the `get_owner` function. Since this function doesn't require arguments, the calldata field remains blank. (This is a read function, hence " +"calling it is termed as a \"call\".)\n" +" - Press the \"get_owner\" button. Your terminal will display the result, revealing the owner's address provided during the contract's deployment as " +"calldata for the constructor:" +msgstr "" + +#: src/ch01-00-getting-started.md:186 +msgid "" +"```bash\n" +"{\n" +" \"response\": {\n" +" \"result\": [\n" +" \"0x4d9c8282b5633eeb1aab56393690d76f71e32f1b7be1bea03eb03e059245a28\"\n" +" ]\n" +" },\n" +" \"contract\": \"ownable.cairo\",\n" +" \"function\": \"get_owner\"\n" +"}\n" +"```" +msgstr "" + +#: src/ch01-00-getting-started.md:198 +msgid "This call currently doesn't spend gas because the function does not change the state of the contract." +msgstr "" + +#: src/ch01-00-getting-started.md:200 +msgid "3. **Invoking the `transfer_ownership` Function**" +msgstr "" + +#: src/ch01-00-getting-started.md:202 +msgid "" +"- Now, for the **`transfer_ownership`** function, which requires the new owner's address as input.\n" +"- Enter this address into the calldata field. (For this, use any address from the \"Devnet account selection\" listed in the Environment tab.)\n" +"- Click the \"transfer_ownership\" button. The terminal then showcases the transaction hash indicating the contract's state alteration. Since we are " +"altering the contract's state this typo of interaction is called an \"invoke\" and needs to be signed by the account that is calling the function." +msgstr "" + +#: src/ch01-00-getting-started.md:206 +msgid "" +"For these transactions, the terminal logs will exhibit a \"status\" variable, indicating the transaction's fate. If the status reads \"ACCEPTED_ON_L2\", " +"the Sequencer has accepted the transaction, pending block inclusion. However, a \"REJECTED\" status signifies the Sequencer's disapproval, and the " +"transaction won't feature in the upcoming block. More often than not, this transaction gains acceptance, leading to a contract state modification. On " +"calling the **`get_owner`** function again we get this:" +msgstr "" + +#: src/ch01-00-getting-started.md:208 +msgid "" +"```bash\n" +"{\n" +" \"response\": {\n" +" \"result\": [\n" +" \"0x20884fd341e11a00b9d31600c332f126f5c3f9ffd2aa93cb43dee9f90176d4f\"\n" +" ]\n" +" },\n" +" \"contract\": \"ownable.cairo\",\n" +" \"function\": \"get_owner\"\n" +"}\n" +"```" +msgstr "" + +#: src/ch01-00-getting-started.md:220 +msgid "You've now adeptly compiled, deployed, and interacted with your inaugural Starknet smart contract. Well done!" +msgstr "" + +#: src/ch01-00-getting-started.md:223 +msgid "## Deploying on Starknet Testnet" +msgstr "" + +#: src/ch01-00-getting-started.md:225 +msgid "" +"After testing your smart contract on a development network, it's time to deploy it to the Starknet Testnet. Starknet Testnet is a public platform " +"available for everyone, ideal for testing smart contracts and collaborating with fellow developers." +msgstr "" + +#: src/ch01-00-getting-started.md:227 +msgid "First you need to create a Starknet account." +msgstr "" + +#: src/ch01-00-getting-started.md:229 +msgid "### Smart Wallet Setup" +msgstr "" + +#: src/ch01-00-getting-started.md:231 +msgid "" +"Before deploying your smart contract to Starknet, you must handle the transaction cost. While deploying to the Starknet Goerli Testnet is free, a smart " +"wallet account is essential. You can set up a smart wallet using either:" +msgstr "" + +#: src/ch01-00-getting-started.md:233 +msgid "" +"- [Braavos](https://braavos.app/)\n" +"- [Argent](https://www.argent.xyz/argent-x/)" +msgstr "" + +#: src/ch01-00-getting-started.md:236 +msgid "" +"Both are reliable Starknet wallets offering enhanced security and accessibility features thanks to the possibilities that the Cairo VM brings, such as " +"Account Abstraction (keep reading the Book for more on this)." +msgstr "" + +#: src/ch01-00-getting-started.md:238 +msgid "" +"1. Install the recommended chrome/brave extension for your chosen wallet.\n" +"2. Follow your wallet provider's instructions to deploy your account.\n" +" 1. Use the [Starknet Faucet](https://faucet.goerli.starknet.io/) to fund your account.\n" +"3. Deploy the account to the network. This usually takes around 10 seconds." +msgstr "" + +#: src/ch01-00-getting-started.md:243 +msgid "Once set up, you're ready to deploy your smart contracts to the Starknet Testnet." +msgstr "" + +#: src/ch01-00-getting-started.md:245 +msgid "### Deployment and Interaction" +msgstr "" + +#: src/ch01-00-getting-started.md:247 +msgid "" +"1. Follow the previous deployment steps.\n" +"2. In the 'Environment selection' tab, choose 'Wallet Selection'.\n" +"3. Select your Starknet account and continue with deploying and interacting with your contract." +msgstr "" + +#: src/ch01-00-getting-started.md:251 +msgid "You can monitor transaction hashes and addresses using any Starknet block explorers like:" +msgstr "" + +#: src/ch01-00-getting-started.md:253 +msgid "" +"- [Starkscan](https://testnet.starkscan.co/)\n" +"- [Voyager](https://goerli.voyager.online/)" +msgstr "" + +#: src/ch01-00-getting-started.md:256 +msgid "" +"These tools provide a visual representation of transactions and contract state alterations. Notably, when you alter the contract ownership using the " +"`transfer_ownership` function, the event emitted by the contract appears in the block explorer. It's an effective method to track contract events." +msgstr "" + +#: src/ch01-00-getting-started.md:259 +msgid "## Your Next Steps" +msgstr "" + +#: src/ch01-00-getting-started.md:261 +msgid "Decide your direction from the following choices:" +msgstr "" + +#: src/ch01-00-getting-started.md:263 +msgid "" +"1. **Deepen Your Starknet Knowledge**: For an extensive grasp of Starknet's inner workings and potential use cases, delve into Chapter 3 of the Starknet " +"Book. This chapter details Starknet’s architectural nuances. Then go ahead from there.\n" +"\n" +"2. **Dive into Cairo**: If you're more attuned to coding and wish to craft Starknet contracts, then Cairo is essential. It stands as Starknet's core " +"contract language. Begin with Chapters 1-6 of the [Cairo Book](https://book.cairo-lang.org/title-page.html), ranging from basics in *Getting Started* to " +"more advanced aspects such as *Enums and Pattern Matching*. Conclude by navigating to the [Starknet Smart Contracts chapter](https://book.cairo-lang.org/" +"ch99-00-starknet-smart-contracts.html), ensuring you have a well-rounded understanding." +msgstr "" + +#: src/ch02-00-starknet-tooling.md:1 +msgid "# Starknet Tooling" +msgstr "" + +#: src/ch02-00-starknet-tooling.md:3 src/ch02-03-scarb.md:3 +msgid "" +"To make the most of this chapter, a basic grasp of the Cairo programming\n" +"language is advised. We suggest reading chapters 1-6 of the [Cairo\n" +"Book](https://book.cairo-lang.org/title-page.html), covering topics from\n" +"*Getting Started* to *Enums and Pattern Matching.* Follow this by\n" +"studying the [Starknet Smart Contracts\n" +"chapter](https://book.cairo-lang.org/ch99-00-starknet-smart-contracts.html)\n" +"in the same book. With this background, you’ll be well-equipped to\n" +"understand the examples presented here." +msgstr "" + +#: src/ch02-00-starknet-tooling.md:12 +msgid "" +"Today, Starknet provides all essential tools for building decentralized\n" +"applications (dApps), compatible with multiple languages like\n" +"JavaScript, Rust, and Python. You can use the Starknet SDK for\n" +"development. Front-end developers can use Starknet.js with React, while\n" +"Rust and Python work well for back-end tasks." +msgstr "" + +#: src/ch02-00-starknet-tooling.md:18 +msgid "" +"We welcome contributors to enhance existing tools or develop new\n" +"solutions." +msgstr "" + +#: src/ch02-00-starknet-tooling.md:21 +msgid "In this chapter, you’ll explore:" +msgstr "" + +#: src/ch02-00-starknet-tooling.md:23 +msgid "" +"- Frameworks: Build using Protostar or Hardhat\n" +"\n" +"- SDKs: Discover multi-language support through Starknet.js,\n" +" Starknet-rs, Starknet\\_py, and Caigo\n" +"\n" +"- Front-end Development: Use Starknet.js and React\n" +"\n" +"- Testing: Understand testing methods with Protostar and the Devnet" +msgstr "" + +#: src/ch02-00-starknet-tooling.md:32 +msgid "" +"By chapter’s end, you’ll have a complete grasp of Starknet’s toolset,\n" +"enabling efficient dApp development." +msgstr "" + +#: src/ch02-00-starknet-tooling.md:35 +msgid "" +"Here’s a quick rundown of the tools that could be used for Starknet\n" +"development and that we’ll cover in this chapter:" +msgstr "" + +#: src/ch02-00-starknet-tooling.md:38 +msgid "" +"1. Scarb: A package manager that compiles your contracts.\n" +"\n" +"2. Starkli: A CLI tool for interacting with the Starknet network.\n" +"\n" +"3. Foundry: For contract testing.\n" +"\n" +"4. Katana: Creates a local test node.\n" +"\n" +"5. SDKs: starknet.js, Starknet.py, and starknet.rs interface with\n" +" Starknet using common programming languages.\n" +"\n" +"6. Starknet-react: Builds front-end apps using React." +msgstr "" + +#: src/ch02-01-basic-installation.md:1 src/ch02-03-scarb.md:34 src/ch02-07-starknet-js.md:13 +msgid "# Installation" +msgstr "" + +#: src/ch02-01-basic-installation.md:3 +msgid "" +"This chapter walks you through setting up your Starknet development\n" +"tools." +msgstr "" + +#: src/ch02-01-basic-installation.md:6 +msgid "Essential tools to install:" +msgstr "" + +#: src/ch02-01-basic-installation.md:8 +msgid "" +"1. [Starkli](https://github.com/xJonathanLEI/starkli) - A CLI tool for\n" +" interacting with Starknet. More tools are discussed in Chapter 2.\n" +"\n" +"2. [Scarb](https://github.com/software-mansion/scarb) - Cairo’s package\n" +" manager that compiles code to Sierra, a mid-level language between\n" +" Cairo and CASM." +msgstr "" + +#: src/ch02-01-basic-installation.md:15 +msgid "" +"For support or queries, visit our [GitHub\n" +"Issues](https://github.com/starknet-edu/starknetbook/issues) or contact\n" +"espejelomar on Telegram." +msgstr "" + +#: src/ch02-01-basic-installation.md:19 +msgid "## Starkli Installation" +msgstr "" + +#: src/ch02-01-basic-installation.md:21 +msgid "" +"Easily install Starkli using Starkliup, an installer invoked through the\n" +"command line." +msgstr "" + +#: src/ch02-01-basic-installation.md:24 +msgid "" +"```bash\n" +"curl https://get.starkli.sh | sh\n" +"starkliup\n" +"```" +msgstr "" + +#: src/ch02-01-basic-installation.md:29 +msgid "Restart your terminal and confirm installation:" +msgstr "" + +#: src/ch02-01-basic-installation.md:31 +msgid "" +"```bash\n" +"starkli --version\n" +"```" +msgstr "" + +#: src/ch02-01-basic-installation.md:35 +msgid "To upgrade Starkli, simply repeat the steps." +msgstr "" + +#: src/ch02-01-basic-installation.md:37 +msgid "## Scarb Package Manager Installation" +msgstr "" + +#: src/ch02-01-basic-installation.md:39 +msgid "We will get deeper into Scarb later in this chapter. For now, we will go over the installation process." +msgstr "" + +#: src/ch02-01-basic-installation.md:41 +msgid "For macOS and Linux:" +msgstr "" + +#: src/ch02-01-basic-installation.md:43 +msgid "" +"```bash\n" +" curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh\n" +"```" +msgstr "" + +#: src/ch02-01-basic-installation.md:47 +msgid "" +"For Windows, follow manual setup in the [Scarb\n" +"documentation](https://docs.swmansion.com/scarb/download.html#windows)." +msgstr "" + +#: src/ch02-01-basic-installation.md:50 +msgid "Restart the terminal and run:" +msgstr "" + +#: src/ch02-01-basic-installation.md:52 src/ch02-02-compile-deploy-interact.md:38 +msgid "" +"```bash\n" +" scarb --version\n" +"```" +msgstr "" + +#: src/ch02-01-basic-installation.md:56 +msgid "To upgrade Scarb, rerun the installation command." +msgstr "" + +#: src/ch02-01-basic-installation.md:58 +msgid "You are now set to code in Cairo and deploy to Starknet." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:1 +msgid "# Hello, World!" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:3 +msgid "" +"In this chapter, you’ll learn how to compile, deploy, and interact with\n" +"a Starknet smart contract written in Cairo." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:6 +msgid "" +"First, confirm that the following commands work on your system. If they\n" +"don’t, refer to Basic Installation in this chapter." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:9 +msgid "" +"```bash\n" +" scarb --version # For Cairo code compilation\n" +" starkli --version # To interact with Starknet\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:14 +msgid "## Find the compiler versions supported" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:16 +msgid "" +"We have to make sure that our Starkli compiler version match Scarb\n" +"compiler version" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:19 +msgid "To find the compiler versions supported by Starkli, execute:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:21 +msgid "" +"```bash\n" +" starkli declare --help\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:25 +msgid "" +"You’ll see a list of possible compiler versions under the\n" +"`--compiler-version` flag." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:28 +msgid "" +"```bash\n" +" ...\n" +" --compiler-version \n" +" Statically-linked Sierra compiler version [possible values: [COMPILER VERSIONS]]]\n" +" ...\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:35 +msgid "" +"Note that the Scarb compiler version might not align with Starkli’s\n" +"supported versions. To check Scarb’s version:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:42 +msgid "You’ll see a list that contains scarb, cairo and sierra version." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:44 +msgid "" +"```bash\n" +" scarb \n" +" cairo: \n" +" sierra: \n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:50 +msgid "" +"If there’s a mismatch, it is suggested that you install the version of\n" +"Scarb that uses the compiler version that Starkli supports. You can find\n" +"previous releases on\n" +"[Scarb](https://github.com/software-mansion/scarb/releases)'s GitHub\n" +"repo." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:56 +msgid "To install a specific version, such as `0.6.1`, run:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:58 +msgid "" +"```bash\n" +" curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 0.6.1\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:62 +msgid "## Smart Wallet Setup" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:64 +msgid "" +"A smart wallet comprises a Signer and an Account Descriptor. The Signer\n" +"is a smart contract with a private key for signing transactions, while\n" +"the Account Descriptor is a JSON file detailing the wallet’s address and\n" +"public key." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:69 +msgid "" +"1. Use Braavos or Argent X browser extensions to create your smart\n" +" wallet.\n" +"\n" +"2. Follow the provided instructions for your chosen wallet (Argent or\n" +" Braavos).\n" +"\n" +"3. Fund your wallet with ETH. Use [Starknet Goerli\n" +" Faucet](https://faucet.goerli.starknet.io/) as needed." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:78 +msgid "Now you’re ready to interact with Starknet smart contracts." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:80 +msgid "### Creating a Signer" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:82 +msgid "" +"The Signer is an essential smart contract capable of signing\n" +"transactions in Starknet. You’ll need the private key from your smart\n" +"wallet to create one, from which the public key can be derived." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:86 +msgid "" +"Starkli enables secure storage of your private key through a keystore\n" +"file. This encrypted file can be accessed using a password and is\n" +"generally stored in the default Starkli directory." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:90 +msgid "First, create the default directory:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:92 +msgid "" +"```bash\n" +" mkdir ~/.starkli-wallets/deployer -p\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:96 +msgid "" +"Then generate the keystore file. The signer command contains subcommands\n" +"for creating a keystore file from a private key or completely create a\n" +"new one. In this tutorial, we’ll use the private key option which is the\n" +"most common use case. You need to provide the path to the keystore file\n" +"you want to create. You can give any name to the keystore file, you will\n" +"likely have several wallets. In this tutorial, we will use the name\n" +"`my_keystore_ 1.json`." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:104 +msgid "" +"```bash\n" +" starkli signer keystore from-key ~/.starkli-wallets/deployer/my_keystore_1.json\n" +" Enter private key:\n" +" Enter password:\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:110 +msgid "" +"In the private key prompt, paste the private key of your smart wallet.\n" +"In the password prompt, enter a password of your choice. You will need\n" +"this password to sign transactions using Starkli." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:114 +msgid "" +"Export the private key from your Braavos or Argent wallet. For Argent X,\n" +"you can find it in the \"Settings\" section → Select your Account →\n" +"\"Export Private Key\". For Braavos, you can find it in the \"Settings\"\n" +"section → \"Privacy and Security\" → \"Export Private Key\"." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:119 +msgid "" +"While knowing the private key of a smart wallet is necessary to sign\n" +"transactions, it’s not sufficient. We also need to inform Starkli about\n" +"the signing mechanism employed by our smart wallet created by Braavos or\n" +"Argent X. Does it use an elliptic curve? If yes, which one? This is the\n" +"reason why we need an account descriptor file." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:125 +msgid "#### [OPTIONAL] The Architecture of the Starknet Signer" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:127 +msgid "" +"The Starknet Signer plays an instrumental role in securing your\n" +"transactions. Let’s demystify what goes on under the hood." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:130 +msgid "Key Components:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:132 +msgid "" +"1. **Private Key**: A 256-bit/32-byte/64-character (ignoring the *0x*\n" +" prefix) hexadecimal key that is the cornerstone of your wallet’s\n" +" security.\n" +"\n" +"2. **Public Key**: Derived from the private key, it’s also a\n" +" 256-bit/32-byte/64-character hexadecimal key.\n" +"\n" +"3. **Smart Wallet Address**: Unlike Ethereum, the address here is\n" +" influenced by the public key, class hash, and a salt. **[Learn more\n" +" in Starknet\n" +" Documentation](https://docs.starknet.io/documentation/architecture_and_concepts/Smart_Contracts/contract-address/)**." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:144 +msgid "To view the details of the previously created keystore file:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:146 +msgid "" +"```bash\n" +" cat ~/.starkli-wallets/deployer/my_keystore_1.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:150 +msgid "Anatomy of the `keystore.json` File:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:152 +msgid "" +"```json\n" +" {\n" +" \"crypto\": {\n" +" \"cipher\": \"aes-128-ctr\",\n" +" \"cipherparams\": {\n" +" \"iv\": \"dba5f9a67456b121f3f486aa18e24db7\"\n" +" },\n" +" \"ciphertext\": \"b3cda3df39563e3dd61064149d6ed8c9ab5f07fbcd6347625e081fb695ddf36c\",\n" +" \"kdf\": \"scrypt\",\n" +" \"kdfparams\": {\n" +" \"dklen\": 32,\n" +" \"n\": 8192,\n" +" \"p\": 1,\n" +" \"r\": 8,\n" +" \"salt\": \"6dd5b06b1077ba25a7bf511510ea0c608424c6657dd3ab51b93029244537dffb\"\n" +" },\n" +" \"mac\": \"55e1616d9ddd052864a1ae4207824baac58a6c88798bf28585167a5986585ce6\"\n" +" },\n" +" \"id\": \"afbb9007-8f61-4e62-bf14-e491c30fd09a\",\n" +" \"version\": 3\n" +" }\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:175 +msgid "" +"- **`version`**: The version of the smart wallet implementation.\n" +"\n" +"- **`id`**: A randomly generated identification string.\n" +"\n" +"- **`crypto`**: Houses all encryption details." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:181 +msgid "Inside **`crypto`**:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:183 +msgid "" +"- **`cipher`**: Specifies the encryption algorithm used, which in this\n" +" case is AES-128-CTR.\n" +"\n" +" - **AES (Advanced Encryption Standard)**: A globally accepted\n" +" encryption standard.\n" +"\n" +" - **128**: Refers to the key size in bits, making it a 128-bit\n" +" key.\n" +"\n" +" - **CTR (Counter Mode)**: A specific mode of operation for the AES\n" +" cipher.\n" +"\n" +"- **`cipherparams`**: Contains an Initialization Vector (IV), which\n" +" ensures that encrypting the same plaintext with the same key will\n" +" produce different ciphertexts.\n" +"\n" +" - **`iv` (Initialization Vector)**: A 16-byte hex string that\n" +" serves as a random and unique starting point for each encryption\n" +" operation.\n" +"\n" +"- **`ciphertext`**: This is the private key after encryption, securely\n" +" stored so that only the correct password can reveal it.\n" +"\n" +"- **`kdf` and `kdfparams`**: KDF stands for Key Derivation Function.\n" +" This adds a layer of security by requiring computational work,\n" +" making brute-force attacks harder.\n" +"\n" +" - **`dklen`**: The length (in bytes) of the derived key. Typically\n" +" 32 bytes.\n" +"\n" +" - **`n`**: A cost factor representing CPU/memory usage. A higher\n" +" value means more computational work is needed, thus increasing\n" +" security.\n" +"\n" +" - **`p`**: Parallelization factor, affecting the computational\n" +" complexity.\n" +"\n" +" - **`r`**: Block size for the hash function, again affecting\n" +" computational requirements.\n" +"\n" +" - **`salt`**: A random value that is combined with the password to\n" +" deter dictionary attacks.\n" +"\n" +"- **`mac` (Message Authentication Code)**: This is a cryptographic\n" +" code that ensures the integrity of the message (the encrypted\n" +" private key in this case). It is generated using a hash of both the\n" +" ciphertext and a portion of the derived key." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:231 +msgid "### Creating an Account Descriptor" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:233 +msgid "" +"An Account Descriptor informs Starkli about your smart wallet’s unique\n" +"features, such as its signing mechanism. You can generate this\n" +"descriptor using Starkli’s `fetch` subcommand under the `account`\n" +"command. The `fetch` subcommand takes your on-chain wallet address as\n" +"input and generates the account descriptor file. The account descriptor\n" +"file is a JSON file that contains the details of your smart wallet." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:240 +msgid "" +"```bash\n" +" starkli account fetch --output ~/.starkli-wallets/deployer/my_account_1.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:244 +msgid "" +"After running the command, you’ll see a message like the one below.\n" +"We’re using a Braavos wallet as an example, but the steps are the same\n" +"for an Argent wallet." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:248 +msgid "" +"```bash\n" +" Account contract type identified as: Braavos\n" +" Description: Braavos official proxy account\n" +" Downloaded new account config file: ~/.starkli-wallets/deployer/my_account_1.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:254 +msgid "To see the details of your Account Descriptor, run:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:256 +msgid "" +"```bash\n" +" cat ~/.starkli-wallets/deployer/my_account_1.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:260 +msgid "Here’s what a typical descriptor might look like:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:262 +msgid "" +"```json\n" +" {\n" +" \"version\": 1,\n" +" \"variant\": {\n" +" \"type\": \"braavos\",\n" +" \"version\": 1,\n" +" \"implementation\": \"0x5dec330eebf36c8672b60db4a718d44762d3ae6d1333e553197acb47ee5a062\",\n" +" \"multisig\": {\n" +" \"status\": \"off\"\n" +" },\n" +" \"signers\": [\n" +" {\n" +" \"type\": \"stark\",\n" +" \"public_key\": \"0x49759ed6197d0d385a96f9d8e7af350848b07777e901f5570b3dc2d9744a25e\"\n" +" }\n" +" ]\n" +" },\n" +" \"deployment\": {\n" +" \"status\": \"deployed\",\n" +" \"class_hash\": \"0x3131fa018d520a037686ce3efddeab8f28895662f019ca3ca18a626650f7d1e\",\n" +" \"address\": \"0x6dcb489c1a93069f469746ef35312d6a3b9e56ccad7f21f0b69eb799d6d2821\"\n" +" }\n" +" }\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:287 +msgid "Note: The structure will differ if you use an Argent wallet." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:289 +msgid "## Setting up Environment Variables" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:291 +msgid "" +"To simplify Starkli commands, you can set environment variables. Two key\n" +"variables are crucial: one for the Signer’s keystore file location and\n" +"another for the Account Descriptor file." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:295 +msgid "" +"```bash\n" +" export STARKNET_ACCOUNT=~/.starkli-wallets/deployer/my_account_1.json\n" +" export STARKNET_KEYSTORE=~/.starkli-wallets/deployer/my_keystore_1.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:300 +msgid "" +"Setting these variables makes running Starkli commands easier and more\n" +"efficient." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:303 +msgid "## Declaring Smart Contracts in Starknet" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:305 +msgid "Deploying a smart contract on Starknet involves two steps:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:307 +msgid "" +"- Declare your contract’s code.\n" +"\n" +"- Deploy an instance of the declared code." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:311 +msgid "" +"To get started, navigate to the `contracts/` directory in the [first\n" +"chapter](https://github.com/starknet-edu/starknetbook/tree/main/chapters/book/modules/chapter_1/pages/contracts)\n" +"of the Starknet Book repo. The `src/lib.cairo` file contains a basic\n" +"contract to practice with." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:316 +msgid "" +"First, compile the contract using the Scarb compiler. If you haven’t\n" +"installed Scarb, follow the installation guide in the [Setting up your\n" +"Environment](https://book.starknet.io/chapter_1/environment_setup.html)\n" +"section." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:321 +msgid "" +"```bash\n" +" scarb build\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:325 +msgid "" +"This creates a compiled contract in `target/dev/` as\n" +"\"contracts\\_Ownable.sierra.json\" (in Chapter 2 of the book we will learn\n" +"more details about Scarb)." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:329 +msgid "" +"With the smart contract compiled, we’re ready to declare it using\n" +"Starkli. Before declaring your contract, decide on an RPC provider." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:332 +msgid "### Choosing an RPC Provider" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:334 +msgid "There are three main options for RPC providers, sorted by ease of use:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:336 +msgid "" +"1. **Starknet Sequencer’s Gateway**: The quickest option and it’s the\n" +" default for Starkli for now. The sequencer gateway is deprecated and\n" +" will be disabled by StarkWare soon. You’re strongly recommended to\n" +" use a third-party JSON-RPC API provider like Infura, Alchemy, or\n" +" Chainstack.\n" +"\n" +"2. **Infura or Alchemy**: A step up in complexity. You’ll need to set\n" +" up an API key and choose an endpoint. For Infura, it would look like\n" +" `https://starknet-goerli.infura.io/v3/`. Learn more in the\n" +" [Infura\n" +" documentation](https://docs.infura.io/networks/starknet/how-to/choose-a-network).\n" +"\n" +"3. **Your Own Node**: For those who want full control. It’s the most\n" +" complex but offers the most freedom. Check out [Chapter 4 of the\n" +" Starknet Book](https://book.starknet.io/chapter_4/node.html) or\n" +" [Kasar](https://www.kasar.io/) for setup guides." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:353 +msgid "" +"In this tutorial, we will use Alchemy. We can set the STARKNET\\_RPC\n" +"environment variable to make command invocations easier:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:356 +msgid "" +"```bash\n" +" export STARKNET_RPC=\"https://starknet-goerli.g.alchemy.com/v2/\"\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:360 +msgid "### Declaring Your Contract" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:362 +msgid "" +"Run this command to declare your contract using the default Starknet\n" +"Sequencer’s Gateway:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:365 +msgid "" +"```bash\n" +" starkli declare target/dev/contracts_Ownable.sierra.json\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:369 +msgid "" +"According to the `STARKNET_RPC` url, starkli can recognize the target\n" +"blockchain network, in this case \"goerli\", so it is not necessary\n" +"explicitly specify it." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:373 +msgid "" +"Unless you’re working with custom networks where it’s infeasible for\n" +"Starkli to detect the right compiler version, you shouldn’t need to\n" +"manually choose a version with `--network` and `--compiler-version`." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:377 +msgid "" +"If you encounter an \"Error: Invalid contract class,\" it likely means\n" +"your Scarb’s compiler version is incompatible with Starkli. Follow the\n" +"steps above to align the versions. Starkli usually supports compiler\n" +"versions accepted by mainnet, even if Scarb’s latest version is not yet\n" +"compatible." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:383 +msgid "" +"After running the command, you’ll receive a contract class hash. This\n" +"unique hash serves as the identifier for your contract class within\n" +"Starknet. For example:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:387 +msgid "" +"```bash\n" +" Class hash declared: 0x04c70a75f0246e572aa2e1e1ec4fffbe95fa196c60db8d5677a5c3a3b5b6a1a8\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:391 +msgid "" +"You can think of this hash as the contract class’s *address.* Use a\n" +"block explorer like\n" +"[StarkScan](https://testnet.starkscan.co/class/0x04c70a75f0246e572aa2e1e1ec4fffbe95fa196c60db8d5677a5c3a3b5b6a1a8)\n" +"to verify this hash on the blockchain." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:396 +msgid "" +"If the contract class you’re attempting to declare already exists, it is\n" +"ok we can continue. You’ll receive a message like:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:399 +msgid "" +"```bash\n" +" Not declaring class as its already declared. Class hash:\n" +" 0x04c70a75f0246e572aa2e1e1ec4fffbe95fa196c60db8d5677a5c3a3b5b6a1a8\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:404 +msgid "## Deploying Smart Contracts on Starknet" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:406 +msgid "" +"To deploy a smart contract, you’ll need to instantiate it on Starknet’s\n" +"testnet. This process involves executing a command that requires two\n" +"main components:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:410 +msgid "" +"1. The class hash of your smart contract.\n" +"\n" +"2. Any constructor arguments that the contract expects." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:414 +msgid "" +"In our example, the constructor expects an *owner* address. You can\n" +"learn more about constructors in \\[Chapter 12 of The Cairo\n" +"Book\\]()." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:418 +msgid "The command would look like this:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:420 +msgid "" +"```bash\n" +" starkli deploy \\\n" +" \\\n" +" \n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:426 +msgid "" +"Here’s a specific example with an actual class hash and constructor\n" +"inputs (as the owner address use the address of your smart wallet so you\n" +"can invoke the transfer\\_ownership function later):" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:430 +msgid "" +"```bash\n" +" starkli deploy \\\n" +" 0x04c70a75f0246e572aa2e1e1ec4fffbe95fa196c60db8d5677a5c3a3b5b6a1a8 \\\n" +" 0x02cdAb749380950e7a7c0deFf5ea8eDD716fEb3a2952aDd4E5659655077B8510\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:436 +msgid "" +"After executing the command and entering your password, you should see\n" +"output like the following:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:439 +msgid "" +"```bash\n" +" Deploying class 0x04c70a75f0246e572aa2e1e1ec4fffbe95fa196c60db8d5677a5c3a3b5b6a1a8 with salt " +"0x065034b27a199cbb2a5b97b78a8a6a6c6edd027c7e398b18e5c0e5c0c65246b7...\n" +" The contract will be deployed at address 0x02a83c32d4b417d3c22f665acbc10e9a1062033b9ab5b2c3358952541bc6c012\n" +" Contract deployment transaction: 0x0743de1e233d38c4f3e9fb13f1794276f7d4bf44af9eac66e22944ad1fa85f14\n" +" Contract deployed:\n" +" 0x02a83c32d4b417d3c22f665acbc10e9a1062033b9ab5b2c3358952541bc6c012\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:447 +msgid "" +"The contract is now live on the Starknet testnet. You can verify its\n" +"status using a block explorer like\n" +"[StarkScan](https://testnet.starkscan.co/contract/0x02a83c32d4b417d3c22f665acbc10e9a1062033b9ab5b2c3358952541bc6c012).\n" +"On the \"Read/Write Contract\" tab, you’ll see the contract’s external\n" +"functions." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:453 +msgid "## Interacting with the Starknet Contract" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:455 +msgid "" +"Starkli enables interaction with smart contracts via two primary\n" +"methods: `call` for read-only functions and `invoke` for write functions\n" +"that modify the state." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:459 +msgid "### Calling a Read Function" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:461 +msgid "" +"The `call` command enables you to query a smart contract function\n" +"without sending a transaction. For instance, to find out who the current\n" +"owner of the contract is, you can use the `get_owner` function, which\n" +"requires no arguments." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:466 src/ch02-02-compile-deploy-interact.md:523 +msgid "" +"```bash\n" +" starkli call \\\n" +" \\\n" +" get_owner\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:472 +msgid "" +"Replace `` with the address of your contract. The\n" +"command will return the owner’s address, which was initially set during\n" +"the contract’s deployment:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:476 +msgid "" +"```bash\n" +" [\n" +" \"0x02cdab749380950e7a7c0deff5ea8edd716feb3a2952add4e5659655077b8510\"\n" +" ]\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:482 +msgid "## Invoking a Write Function" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:484 +msgid "" +"You can modify the contract’s state using the `invoke` command. For\n" +"example, let’s transfer the contract’s ownership with the\n" +"`transfer_ownership` function." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:488 +msgid "" +"```bash\n" +" starkli invoke \\\n" +" \\\n" +" transfer_ownership \\\n" +" \n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:495 +msgid "" +"Replace `` with the address of the contract and\n" +"`` with the address you want to transfer ownership\n" +"to. If the smart wallet you’re using isn’t the contract’s owner, an\n" +"error will appear. Note that the initial owner was set when deploying\n" +"the contract:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:501 +msgid "" +"```bash\n" +" Execution was reverted; failure reason: [0x43616c6c6572206973206e6f7420746865206f776e6572].\n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:505 +msgid "" +"The failure reason is encoded as a felt. o decode it, use the starkli’s\n" +"`parse-cairo-string` command." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:508 +msgid "" +"```bash\n" +" starkli parse-cairo-string \n" +"```" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:512 +msgid "" +"For example, if you see\n" +"`0x43616c6c6572206973206e6f7420746865206f776e6572`, decoding it will\n" +"yield \"Caller is not the owner.\"" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:516 +msgid "" +"After a successful transaction on L2, use a block explorer like\n" +"StarkScan or Voyager to confirm the transaction status using the hash\n" +"provided by the `invoke` command." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:520 +msgid "" +"To verify that the ownership has successfully transferred, you can call\n" +"the `get_owner` function again:" +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:529 +msgid "" +"If the function returns the new owner’s address, the transfer was\n" +"successful." +msgstr "" + +#: src/ch02-02-compile-deploy-interact.md:532 +msgid "" +"Congratulations! You’ve successfully deployed and interacted with a\n" +"Starknet contract." +msgstr "" + +#: src/ch02-03-scarb.md:1 +msgid "# Scarb: The Package Manager" +msgstr "" + +#: src/ch02-03-scarb.md:12 +msgid "" +"Scarb is Cairo’s package manager designed for both Cairo and Starknet\n" +"projects. It handles dependencies, compiles projects, and integrates\n" +"with tools like Foundry. It is built by the same team that created\n" +"Foundry for Starknet." +msgstr "" + +#: src/ch02-03-scarb.md:17 +msgid "# Scarb Workflow" +msgstr "" + +#: src/ch02-03-scarb.md:19 +msgid "Follow these steps to develop a Starknet contract using Scarb:" +msgstr "" + +#: src/ch02-03-scarb.md:21 +msgid "" +"1. **Initialize:** Use `scarb new` to set up a new project, generating\n" +" a `Scarb.toml` file and initial `src/lib.cairo`.\n" +"\n" +"2. **Code:** Add your Cairo code in the `src` directory.\n" +"\n" +"3. **Dependencies:** Add external libraries using `scarb add`.\n" +"\n" +"4. **Compile:** Execute `scarb build` to convert your contract into\n" +" Sierra code." +msgstr "" + +#: src/ch02-03-scarb.md:31 +msgid "" +"Scarb simplifies your development workflow, making it efficient and\n" +"streamlined." +msgstr "" + +#: src/ch02-03-scarb.md:36 +msgid "" +"Scarb is cross-platform, supporting macOS, Linux, and Windows. For\n" +"installation, refer to the [Chapter 1 setup\n" +"guide](https://book.starknet.io/chapter_1/environment_setup.html#the_scarb_package_manager_installation)." +msgstr "" + +#: src/ch02-03-scarb.md:40 +msgid "# Cairo Project Structure" +msgstr "" + +#: src/ch02-03-scarb.md:42 +msgid "Next, we’ll dive into the key components that make up a Cairo project." +msgstr "" + +#: src/ch02-03-scarb.md:44 +msgid "## Cairo Packages" +msgstr "" + +#: src/ch02-03-scarb.md:46 +msgid "" +"Cairo packages, also referred to as \"crates\" in some contexts, are the\n" +"building blocks of a Cairo project. Each package must follow several\n" +"rules:" +msgstr "" + +#: src/ch02-03-scarb.md:50 +msgid "" +"- A package must include a `Scarb.toml` file, which is Scarb’s\n" +" manifest file. It contains the dependencies for your package.\n" +"\n" +"- A package must include a `src/lib.cairo` file, which is the root of\n" +" the package tree. It allows you to define functions and declare used\n" +" modules." +msgstr "" + +#: src/ch02-03-scarb.md:57 +msgid "" +"Package structures might look like the following case where we have a\n" +"package named `my_package`, which includes a `src` directory with the\n" +"`lib.cairo` file inside, a `snips` directory which in itself a package\n" +"we can use, and a `Scarb.toml` file in the top-level directory." +msgstr "" + +#: src/ch02-03-scarb.md:62 +msgid "" +"my_package/\n" +" ├── src/\n" +" │ ├── module1.cairo\n" +" │ ├── module2.cairo\n" +" │ └── lib.cairo\n" +" ├── snips/\n" +" │ ├── src/\n" +" │ │ ├── lib.cairo\n" +" │ ├── Scarb.toml\n" +" └── Scarb.toml" +msgstr "" + +#: src/ch02-03-scarb.md:73 +msgid "Within the `Scarb.toml` file, you might have:" +msgstr "" + +#: src/ch02-03-scarb.md:75 +msgid "" +"[package]\n" +" name = \"my_package\"\n" +" version = \"0.1.0\"\n" +"\n" +" [dependencies]\n" +" starknet = \">=2.0.1\"\n" +" snips = { path = \"snips\" }" +msgstr "" + +#: src/ch02-03-scarb.md:83 +msgid "" +"Here starknet and snips are the dependencies of the package. The\n" +"`starknet` dependency is hosted on the Scarb registry (we do not need to\n" +"download it), while the `snips` dependency is located in the `snips`\n" +"directory." +msgstr "" + +#: src/ch02-03-scarb.md:88 +msgid "# Setting Up a Project with Scarb" +msgstr "" + +#: src/ch02-03-scarb.md:90 +msgid "" +"To create a new project using Scarb, navigate to your desired project\n" +"directory and execute the following command:" +msgstr "" + +#: src/ch02-03-scarb.md:93 +msgid "$ scarb new hello_scarb" +msgstr "" + +#: src/ch02-03-scarb.md:95 +msgid "" +"This command will create a new project directory named `hello_scarb`,\n" +"including a `Scarb.toml` file, a `src` directory with a `lib.cairo` file\n" +"inside, and initialize a new Git repository with a `.gitignore` file." +msgstr "" + +#: src/ch02-03-scarb.md:99 +msgid "" +"hello_scarb/\n" +" ├── src/\n" +" │ └── lib.cairo\n" +" └── Scarb.toml" +msgstr "" + +#: src/ch02-03-scarb.md:104 +msgid "" +"Upon opening `Scarb.toml` in a text editor, you should see something\n" +"similar to the code snippet below:" +msgstr "" + +#: src/ch02-03-scarb.md:107 +msgid "" +"[package]\n" +" name = \"hello_scarb\"\n" +" version = \"0.1.0\"\n" +"\n" +" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html\n" +" [dependencies]\n" +" # foo = { path = \"vendor/foo\" }" +msgstr "" + +#: src/ch02-03-scarb.md:115 +msgid "# Building a Scarb Project" +msgstr "" + +#: src/ch02-03-scarb.md:117 +msgid "Clear all content in `src/lib.cairo` and replace with the following:" +msgstr "" + +#: src/ch02-03-scarb.md:119 +msgid "" +"// src/lib.cairo\n" +" mod hello_scarb;" +msgstr "" + +#: src/ch02-03-scarb.md:122 +msgid "" +"Next, create a new file titled `src/hello_scarb.cairo` and add the\n" +"following:" +msgstr "" + +#: src/ch02-03-scarb.md:125 +msgid "" +"// src/hello_scarb.cairo\n" +" use debug::PrintTrait;\n" +" fn main() {\n" +" 'Hello, Scarb!'.print();\n" +" }" +msgstr "" + +#: src/ch02-03-scarb.md:131 +msgid "" +"In this instance, the `lib.cairo` file contains a module declaration\n" +"referencing *hello\\_scarb*, which includes the *hello\\_scarb.cairo*\n" +"file’s implementation. For more on modules, imports, and the `lib.cairo`\n" +"file, please refer to the subchapter on [imports in Chapter\n" +"2](https://book.starknet.io/chapter_2/imports.html)." +msgstr "" + +#: src/ch02-03-scarb.md:137 +msgid "" +"Scarb mandates that your source files be located within the `src`\n" +"directory." +msgstr "" + +#: src/ch02-03-scarb.md:140 +msgid "" +"To build (compile) your project from your `hello_scarb` directory, use\n" +"the following command:" +msgstr "" + +#: src/ch02-03-scarb.md:143 +msgid "scarb build" +msgstr "" + +#: src/ch02-03-scarb.md:145 +msgid "" +"This command compiles your project and produces the Sierra code in the\n" +"`target/dev/hello_scarb.sierra` file. Sierra serves as an intermediate\n" +"layer between high-level Cairo and compilation targets such as Cairo\n" +"Assembly (CASM). To understand more about Sierra, check out this\n" +"[article](https://medium.com/nethermind-eth/under-the-hood-of-cairo-1-0-exploring-sierra-7f32808421f5/)." +msgstr "" + +#: src/ch02-03-scarb.md:151 +msgid "" +"To remove the build artifacts and delete the target directory, use the\n" +"`scarb clean` command." +msgstr "" + +#: src/ch02-03-scarb.md:154 +msgid "## Adding Dependencies" +msgstr "" + +#: src/ch02-03-scarb.md:156 +msgid "" +"Scarb facilitates the seamless management of dependencies for your Cairo\n" +"packages. Here are two methods to add dependencies to your project:" +msgstr "" + +#: src/ch02-03-scarb.md:159 +msgid "- Edit Scarb.toml File" +msgstr "" + +#: src/ch02-03-scarb.md:161 +msgid "" +"Open the Scarb.toml file in your project directory and locate the\n" +"`[dependencies]` section. If it doesn’t exist, add it. To include a\n" +"dependency hosted on a Git repository, use the following format:" +msgstr "" + +#: src/ch02-03-scarb.md:165 +msgid "" +"[dependencies]\n" +" alexandria_math = { git = \"https://github.com/keep-starknet-strange/alexandria.git\" }" +msgstr "" + +#: src/ch02-03-scarb.md:168 +msgid "" +"For consistency, it’s recommended to pin Git dependencies to specific\n" +"commits. This can be done by adding the `rev` field with the commit\n" +"hash:" +msgstr "" + +#: src/ch02-03-scarb.md:172 +msgid "" +"[dependencies]\n" +" alexandria_math = { git = \"https://github.com/keep-starknet-strange/alexandria.git\", rev = \"81bb93c\" }" +msgstr "" + +#: src/ch02-03-scarb.md:175 +msgid "After adding the dependency, remember to save the file." +msgstr "" + +#: src/ch02-03-scarb.md:177 +msgid "- Use the scarb add Command" +msgstr "" + +#: src/ch02-03-scarb.md:179 +msgid "" +"Alternatively, you can use the `scarb add` command to add dependencies\n" +"to your project. Open your terminal and execute the following command:" +msgstr "" + +#: src/ch02-03-scarb.md:182 +msgid "$ scarb add alexandria_math --git https://github.com/keep-starknet-strange/alexandria.git" +msgstr "" + +#: src/ch02-03-scarb.md:184 +msgid "" +"This command will add the alexandria\\_math dependency from the specified\n" +"Git repository to your project." +msgstr "" + +#: src/ch02-03-scarb.md:187 +msgid "To remove a dependency, you can use the `scarb rm` command." +msgstr "" + +#: src/ch02-03-scarb.md:189 +msgid "" +"Once a dependency is added, the Scarb.toml file will be automatically\n" +"updated with the new dependency information." +msgstr "" + +#: src/ch02-03-scarb.md:192 +msgid "## Using Dependencies in Your Code" +msgstr "" + +#: src/ch02-03-scarb.md:194 +msgid "" +"After dependencies are added to your project, you can start utilizing\n" +"them in your Cairo code." +msgstr "" + +#: src/ch02-03-scarb.md:197 +msgid "" +"For example, let’s assume you have added the alexandria\\_math\n" +"dependency. Now, you can import and utilize functions from the\n" +"alexandria\\_math library in your `src/hello_scarb.cairo` file:" +msgstr "" + +#: src/ch02-03-scarb.md:201 +msgid "" +"// src/hello_scarb.cairo\n" +" use alexandria_math::fibonacci;\n" +"\n" +" fn main() -> felt252 {\n" +" fibonacci::fib(0, 1, 10)\n" +" }" +msgstr "" + +#: src/ch02-03-scarb.md:208 +msgid "" +"In the above example, we import the fibonacci function from the\n" +"alexandria\\_math library and utilize it in the main function." +msgstr "" + +#: src/ch02-03-scarb.md:211 +msgid "# Scarb Cheat Sheet" +msgstr "" + +#: src/ch02-03-scarb.md:213 +msgid "" +"Here’s a quick cheat sheet of some of the most commonly used Scarb\n" +"commands:" +msgstr "" + +#: src/ch02-03-scarb.md:216 +msgid "" +"- `scarb new `: Initialize a new project with the given\n" +" project name.\n" +"\n" +"- `scarb build`: Compile your Cairo code into Sierra code.\n" +"\n" +"- `scarb add --git `: Add a dependency to\n" +" your project from a specified Git repository.\n" +"\n" +"- `scarb rm `: Remove a dependency from your project.\n" +"\n" +"- `scarb run + {{/if}} + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ {{> header}} + + + + {{#if search_enabled}} + + {{/if}} + + + + +
+
+ {{{ content }}} +
+ + +
+
+ + + +
+ + {{#if live_reload_endpoint}} + + + {{/if}} + + {{#if google_analytics}} + + + {{/if}} + + {{#if playground_line_numbers}} + + {{/if}} + + {{#if playground_copyable}} + + {{/if}} + + {{#if playground_js}} + + + + + + {{/if}} + + {{#if search_js}} + + + + {{/if}} + + + + + + + {{#each additional_js}} + + {{/each}} + + {{#if is_print}} + {{#if mathjax_support}} + + {{else}} + + {{/if}} + {{/if}} + +
+ + diff --git a/translations.sh b/translations.sh new file mode 100755 index 000000000..bfdac3d4f --- /dev/null +++ b/translations.sh @@ -0,0 +1,67 @@ +PARAM1=$1 +PARAM2=$2 + +# Function section +function serve_book() { + LANG=$1 + + # Rebuild english version, updating the `messages.pot` file where all chunks of texts + # to be translated are extracted. + MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' \ + mdbook build -d po + + # Build available LANGUAGES. po file must exist for the languages listed + # in the LANGUAGE file. If it's not, you can add a language by running (xx replaced by the language code): + # msginit -i po/messages.pot -l xx -o po/xx.po + for po_lang in $(cat ./LANGUAGES) + do + echo merging and building "$po_lang" + msgmerge --update po/"$po_lang".po po/messages.pot + MDBOOK_BOOK__LANGUAGE="$po_lang" mdbook build -d book/"$po_lang" + done + + # Serving the language, if any. + if [ -z "$LANG" ] + then + echo "" + echo "No input language, stop after build." + exit 0 + fi + + # Serve the input language, if available. + MDBOOK_BOOK__LANGUAGE="$LANG" mdbook serve -d book/"$LANG" +} + +function build_new_language() { + LANG=$1 + FILE=po/"$LANG".po + + # Stop if no language paramter. + if [ -z "$LANG" ] + then + echo "" + echo "No input language, stop." + exit 0 + fi + + # Build a new LANGUAGE .po file if not exist . + if test -f "$FILE"; then + echo "" + echo "File $FILE already exists. Ensure you're initiating a new translation. Alternatively, use './transaction.sh $LANG' to serve an existing one." + else + msginit -i po/messages.pot -l "$LANG" -o po/"$LANG".po + fi +} + +# Main section +if [ "$PARAM1" == "new" ]; then + # The first parameter is 'new', PARAM2 is set to $LANG. + LANG=$PARAM2 + build_new_language "$LANG" + +else + # The first parameter is not 'new', PARAM1 is set to $LANG. + LANG=$PARAM1 + serve_book "$LANG" + +fi