diff --git a/package-lock.json b/package-lock.json index 8cd9571b0..4c51dd125 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "devDependencies": { "all-contributors-cli": "^6.26.1", "husky": "^8.0.3", - "prettier": "^3.2.5" + "prettier": "^3.2.4" } }, "node_modules/@babel/runtime": { diff --git a/src/ch01-00-getting-started.md b/src/ch01-00-getting-started.md index 7530fc87a..16eabcb2b 100644 --- a/src/ch01-00-getting-started.md +++ b/src/ch01-00-getting-started.md @@ -1,49 +1,32 @@ # Getting Started -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 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. +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 general-purpose programming language for creating proofs of validity using Starknet. For experienced developers looking to understand the basics and gain hands-on experience, this guide provides step-by-step instructions and essential details. -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. +We will use the [Starknet Remix Plugin](https://github.com/NethermindEth/starknet-remix-plugin?tab=readme-ov-file) to compile, deploy, and interact with our smart contract. It's a great tool for getting started with Starknet development because you don't need to install anything on your computer. -1. Visit the [Remix IDE](https://remix.ethereum.org/) website. -2. Navigate to the `Plugin Manager` section in the bottom left corner. +1. Visit the [Remix IDE](https://remix.ethereum.org/#activate=Starknet&lang=en&optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.24+commit.e11b9ed9.js) website with the Starknet plugin enabled. -Plugin Manager +Start -3. Activate the `Starknet` plugin. +2. Then go to **settings** option and choose the Cairo version as shown in the image below. The latest version available in Remix is `v2.5.4`. -Activate the Starknet Plugin +Settings -4. Accept the permissions. Click "Remember my choice" to avoid this step in the future. +3. Now click on the `file explorer` tab to check the sample project details. On the `Scarb.toml` file you can find the version of this sample project. Since we want to use version 2.5.4 for this project, we have to verify that it matches in our `Scarb.toml`, otherwise modify to the correct version, `starknet = "2.5.4"`. -Accept Permissions - -5. After enabling, the Starknet logo appears on the left sidebar. - -Starknet Plugin - -6. Then go to **settings** option and choose the Cairo version as shown in the image below. The latest version available in Remix at the moment of this writing is `v2.5.4`. - -Starknet Plugin settings - -7. Now click on the `file explorer` tab to check the sample project details. On the `Scarb.toml` file you can find the version of this sample project. - -File explorer - -8. Since we want to use v2.5.4 for this project, we need to update our `Scarb.toml`: modify the highlighted line to the correct version, `starknet = "2.5.4"` for v2.5.4. - -Scarb file +File default ## Clean your sample project By default we got a sample project, however on this tutorial, we plan to show the `Ownable contract` example. To acomplish this we have to edit and delete some files and directories. 1. Rename the root directory to `ownable`. Go to your `Scarb.toml`, on [package] section, set `name` to `ownable`. -2. Delete `balance.cairo` and `forty_two.cairo` files. +2. Delete `balance.cairo` and `forty_two.cairo` files, if present. 3. Go to `lib.cairo` and remove all the content there. It should be empty. At the end, your new project should look something like this. -Scarb file +Scarb File ## Introduction to Starknet Smart Contracts @@ -152,10 +135,16 @@ To compile using Remix: - Navigate to the "Starknet" tab in Remix and click on `Home`. - In the `1 Compile` section choose `compile a single file`. + +Compilation simple + +- Accept the permissions. Click `Remember my choice` to avoid this step in the future. + +Permissions + - Click on `Compile lib.cairo`. -Compilation Process +Compilation simple - 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. diff --git a/src/img/ch01-compile-contract.png b/src/img/ch01-compile-contract.png deleted file mode 100644 index 289c03eb0..000000000 Binary files a/src/img/ch01-compile-contract.png and /dev/null differ diff --git a/src/img/ch01-remix-choose-devnet.png b/src/img/ch01-remix-choose-devnet.png deleted file mode 100644 index ec6239e49..000000000 Binary files a/src/img/ch01-remix-choose-devnet.png and /dev/null differ diff --git a/src/img/ch01-remix-compiletion.png b/src/img/ch01-remix-compiletion.png new file mode 100644 index 000000000..1bab51fcf Binary files /dev/null and b/src/img/ch01-remix-compiletion.png differ diff --git a/src/img/ch01-remix-file-default.png b/src/img/ch01-remix-file-default.png new file mode 100644 index 000000000..f963069f7 Binary files /dev/null and b/src/img/ch01-remix-file-default.png differ diff --git a/src/img/ch01-remix-file-scarb.png b/src/img/ch01-remix-file-scarb.png new file mode 100644 index 000000000..b8327a608 Binary files /dev/null and b/src/img/ch01-remix-file-scarb.png differ diff --git a/src/img/ch01-remix-file.png b/src/img/ch01-remix-file.png deleted file mode 100644 index 486636482..000000000 Binary files a/src/img/ch01-remix-file.png and /dev/null differ diff --git a/src/img/ch01-remix-permissions.png b/src/img/ch01-remix-permissions.png new file mode 100644 index 000000000..544272d2b Binary files /dev/null and b/src/img/ch01-remix-permissions.png differ diff --git a/src/img/ch01-remix-plugin-manager.png b/src/img/ch01-remix-plugin-manager.png deleted file mode 100644 index 811396d88..000000000 Binary files a/src/img/ch01-remix-plugin-manager.png and /dev/null differ diff --git a/src/img/ch01-remix-precompilation.png b/src/img/ch01-remix-precompilation.png new file mode 100644 index 000000000..6db9cfb15 Binary files /dev/null and b/src/img/ch01-remix-precompilation.png differ diff --git a/src/img/ch01-remix-settings.png b/src/img/ch01-remix-settings.png new file mode 100644 index 000000000..ca5336eb0 Binary files /dev/null and b/src/img/ch01-remix-settings.png differ diff --git a/src/img/ch01-remix-starknet-file-scarb.png b/src/img/ch01-remix-starknet-file-scarb.png deleted file mode 100644 index 9dba5be66..000000000 Binary files a/src/img/ch01-remix-starknet-file-scarb.png and /dev/null differ diff --git a/src/img/ch01-remix-starknet-plugin-icon.png b/src/img/ch01-remix-starknet-plugin-icon.png deleted file mode 100644 index 24474d27d..000000000 Binary files a/src/img/ch01-remix-starknet-plugin-icon.png and /dev/null differ diff --git a/src/img/ch01-remix-start.png b/src/img/ch01-remix-start.png new file mode 100644 index 000000000..11fbc70fb Binary files /dev/null and b/src/img/ch01-remix-start.png differ diff --git a/src/img/ch01-starknet-plugin.png b/src/img/ch01-starknet-plugin.png deleted file mode 100644 index 0d2060da1..000000000 Binary files a/src/img/ch01-starknet-plugin.png and /dev/null differ diff --git a/yarn.lock b/yarn.lock index 742b9653e..d9a976446 100644 --- a/yarn.lock +++ b/yarn.lock @@ -282,9 +282,9 @@ prettier@^2: integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== prettier@^3.2.4: - version "3.2.4" - resolved "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz" - integrity sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ== + version "3.2.5" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== regenerator-runtime@^0.14.0: version "0.14.1"