From f13992ad604cd5883ae1969b3bb9f8bda4cc370c Mon Sep 17 00:00:00 2001 From: Tim McMackin Date: Fri, 15 Mar 2024 09:17:13 -0400 Subject: [PATCH] Tutorial clarifications (#356) * Clarify what a wallet is and what tez is * SmartPy has only one syntax * Include "what is a smart contract" section in Archetype * Clarify parts of smart contract * Stress that you can't tamper with the contract * Clarify that LIGO is a high-level language * Add mention of permissions to next steps * There's no web app here --- docs/tutorials/smart-contract/archetype.md | 28 +++++++++++++++++----- docs/tutorials/smart-contract/cameligo.mdx | 25 ++++++++++++------- docs/tutorials/smart-contract/jsligo.mdx | 25 ++++++++++++------- docs/tutorials/smart-contract/smartpy.mdx | 25 ++++++++++--------- 4 files changed, 68 insertions(+), 35 deletions(-) diff --git a/docs/tutorials/smart-contract/archetype.md b/docs/tutorials/smart-contract/archetype.md index 3a8c42bc6..c25e0aa2e 100644 --- a/docs/tutorials/smart-contract/archetype.md +++ b/docs/tutorials/smart-contract/archetype.md @@ -2,7 +2,7 @@ title: Deploy a smart contract with Archetype authors: 'Tim McMackin' last_update: - date: 12 October 2023 + date: 15 March 2024 --- This tutorial covers writing a smart contract and deploying it to Tezos in the Archetype programming language. @@ -14,8 +14,8 @@ It uses the completium-cli command-line tool, which lets you work with Archetype In this tutorial, you will learn how to: -- Create a wallet -- Get tokens from a faucet +- Create a wallet to store cryptocurrency tokens +- Get free tez tokens (the native cryptocurrency token on Tezos) from a faucet - Code a contract in Archetype, including: - Defining the storage for the contract and its initial value - Defining entrypoints in the contract @@ -24,6 +24,18 @@ In this tutorial, you will learn how to: - Look up the current state of the contract - Call the contract from the command line +## What is a smart contract? + +A smart contract is a computer program that is stored on a blockchain and runs on a blockchain. +Because the blockchain is spread across many computer nodes, you don't have to think about where to host the program or worry whether a computer will run it or not. +Responsibility for running the contract is distributed across all of the nodes in the Tezos system, so when you deploy a smart contract, you can be confident that it will be available and unmodified when someone wants to run it. + +A smart contract has these parts: + +- Persistent storage, data that the contract can read and write +- One or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages +- A Tezos account that can store tokens (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) + ## The Archetype language Archetype is a high-level language designed specifically for writing Tezos smart contracts. @@ -48,7 +60,8 @@ It provides entrypoints that clients can call to change the value of that intege - The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage - The `reset` entrypoint takes no parameters and resets the value in storage to 0 -After you deploy the contract, you or any other user can call it through the command line or a distributed application (dApp). +After you deploy the contract, you or any other user can call it from various sources, including web applications, other contracts, and the Octez command-line client. +However, no one can prevent it from running or tamper with its code or its storage. ## Prerequisites @@ -319,5 +332,8 @@ Then, you can verify the updated storage on the block explorer or by running the Now the contract is running on the Tezos blockchain. You or any other user can call it from any source that can send transactions to Tezos, including command-line clients, dApps, and other contracts. -If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/). -You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed. +If you want to continue working with this contract, here are some ideas: + +- Change permissions for the contract so only your account can call its entrypoints +- Add your own entrypoints and originate a new contract; note that you cannot update the existing contract after it is deployed +- Create a dApp to call the contract from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/) diff --git a/docs/tutorials/smart-contract/cameligo.mdx b/docs/tutorials/smart-contract/cameligo.mdx index bb1145514..742e62e2d 100644 --- a/docs/tutorials/smart-contract/cameligo.mdx +++ b/docs/tutorials/smart-contract/cameligo.mdx @@ -2,7 +2,7 @@ title: Deploy a smart contract with CameLIGO authors: 'John Joubert, Sasha Aldrick, Claude Barde, Tim McMackin' last_update: - date: 3 January 2024 + date: 15 March 2024 --- This tutorial covers writing and deploying a simple smart contract with the LIGO programming language. @@ -12,10 +12,13 @@ Specifically, this tutorial uses the CameLIGO version of LIGO, which has syntax - If you are more familiar with Python, try [Deploy a smart contract with SmartPy](./smartpy). - To learn the Archetype language, try [Deploy a smart contract with Archetype](./archetype). +LIGO is a high-level programming language that you can use to write smart contracts for the Tezos blockchain. +It abstracts away the complexity of using Michelson (the smart contract language directly available on-chain) to make it easier to write smart contracts on Tezos. + In this tutorial, you will learn how to: -- Create a wallet -- Get tokens from a faucet +- Create a wallet to store cryptocurrency tokens +- Get free tez tokens (the native cryptocurrency token on Tezos) from a faucet - Code a contract in LIGO, including: - Defining the storage for the contract - Defining entrypoints in the contract @@ -32,9 +35,9 @@ Responsibility for running the contract is distributed across all of the nodes i A smart contract has these parts: -- It has persistent storage, data that the contract can read and write -- It has one or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages -- It has a Tezos account and can store tez (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) +- Persistent storage, data that the contract can read and write +- One or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages +- A Tezos account that can store tokens (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) ## Tutorial contract @@ -45,7 +48,8 @@ It provides entrypoints that clients can call to change the value of that intege - The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage - The `reset` entrypoint takes no parameters and resets the value in storage to 0 -After you deploy the contract, you or any other user can call it from a variety of Tezos clients and decentralized applications (dApps). +After you deploy the contract, you or any other user can call it from various sources, including web applications, other contracts, and the Octez command-line client. +However, no one can prevent it from running or tamper with its code or its storage. ## Creating and funding a wallet @@ -292,5 +296,8 @@ It also allows you to call the contract. Now the contract is running on the Tezos blockchain. You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts. -If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/). -You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed. +If you want to continue working with this contract, here are some ideas: + +- Change permissions for the contract so only your account can call its entrypoints +- Add your own entrypoints and originate a new contract; note that you cannot update the existing contract after it is deployed +- Create a dApp to call the contract from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/) diff --git a/docs/tutorials/smart-contract/jsligo.mdx b/docs/tutorials/smart-contract/jsligo.mdx index 573671143..a595b4d18 100644 --- a/docs/tutorials/smart-contract/jsligo.mdx +++ b/docs/tutorials/smart-contract/jsligo.mdx @@ -2,7 +2,7 @@ title: Deploy a smart contract with JsLIGO authors: 'John Joubert, Sasha Aldrick, Claude Barde, Tim McMackin' last_update: - date: 3 January 2024 + date: 15 March 2024 --- This tutorial covers writing and deploying a simple smart contract with the LIGO programming language. @@ -12,10 +12,13 @@ Specifically, this tutorial uses the JsLIGO version of LIGO, which has syntax si - If you are more familiar with OCaml, try [Deploy a smart contract with CameLIGO](./cameligo). - To learn the Archetype language, try [Deploy a smart contract with Archetype](./archetype). +LIGO is a high-level programming language that you can use to write smart contracts for the Tezos blockchain. +It abstracts away the complexity of using Michelson (the smart contract language directly available on-chain) to make it easier to write smart contracts on Tezos. + In this tutorial, you will learn how to: -- Create a wallet -- Get tokens from a faucet +- Create a wallet to store cryptocurrency tokens +- Get free tez tokens (the native cryptocurrency token on Tezos) from a faucet - Code a contract in LIGO, including: - Defining the storage for the contract - Defining entrypoints in the contract @@ -32,9 +35,9 @@ Responsibility for running the contract is distributed across all of the nodes i A smart contract has these parts: -- It has persistent storage, data that the contract can read and write -- It has one or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages -- It has a Tezos account and can store tez (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) +- Persistent storage, data that the contract can read and write +- One or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages +- A Tezos account that can store tokens (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) ## Tutorial contract @@ -45,7 +48,8 @@ It provides entrypoints that clients can call to change the value of that intege - The `decrement` entrypoint accepts an integer as a parameter and subtracts that integer from the value in storage - The `reset` entrypoint takes no parameters and resets the value in storage to 0 -After you deploy the contract, you or any other user can call it from a variety of Tezos clients and decentralized applications (dApps). +After you deploy the contract, you or any other user can call it from various sources, including web applications, other contracts, and the Octez command-line client. +However, no one can prevent it from running or tamper with its code or its storage. ## Creating and funding a wallet @@ -307,5 +311,8 @@ It also allows you to call the contract. Now the contract is running on the Tezos blockchain. You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts. -If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/). -You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed. +If you want to continue working with this contract, here are some ideas: + +- Change permissions for the contract so only your account can call its entrypoints +- Add your own entrypoints and originate a new contract; note that you cannot update the existing contract after it is deployed +- Create a dApp to call the contract from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/) diff --git a/docs/tutorials/smart-contract/smartpy.mdx b/docs/tutorials/smart-contract/smartpy.mdx index 1293f3c51..d9505ef97 100644 --- a/docs/tutorials/smart-contract/smartpy.mdx +++ b/docs/tutorials/smart-contract/smartpy.mdx @@ -2,7 +2,7 @@ title: Deploy a smart contract with SmartPy authors: 'John Joubert, Sasha Aldrick, Tim McMackin' last_update: - date: 20 February 2024 + date: 15 March 2024 --- This tutorial covers writing and deploying a simple smart contract with the SmartPy programming language. @@ -13,13 +13,12 @@ SmartPy has syntax similar to Python, but you don't need any experience with Pyt - To learn the Archetype language, try [Deploy a smart contract with Archetype](./archetype). SmartPy is a high-level programming language that you can use to write smart contracts for the Tezos blockchain. - -It abstracts away the complexity of using Michelson (the smart contract language directly available on-chain) and provides different syntaxes that make it easier to write smart contracts on Tezos. +It abstracts away the complexity of using Michelson (the smart contract language directly available on-chain) to make it easier to write smart contracts on Tezos. In this tutorial, you will learn how to: -- Create a wallet -- Get tokens from a faucet +- Create a wallet to store cryptocurrency tokens +- Get free tez tokens (the native cryptocurrency token on Tezos) from a faucet - Code a contract in SmartPy, including: - Creating a contract in the online IDE - Defining the storage for the contract @@ -37,9 +36,9 @@ Responsibility for running the contract is distributed across all of the nodes i A smart contract has these parts: -- It has persistent storage, data that the contract can read and write -- It has one or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages -- It has a Tezos account and can store tez (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) +- Persistent storage, data that the contract can read and write +- One or more entrypoints, which are a kind of function that clients can call, like endpoints in an API or functions or methods in many programming languages +- A Tezos account that can store tokens (technically, the contract is itself a type of Tezos account, but you can think of it as a program with a Tezos account) ## Tutorial contract @@ -50,6 +49,7 @@ It provides entrypoints that clients can call to change the value of that string - The `append` entrypoint accepts a new string as a parameter and appends it to the existing string. After you deploy the contract, you or any other user can call it from various sources, including web applications, other contracts, and the Octez command-line client. +However, no one can prevent it from running or tamper with its code or its storage. ## Creating and funding a wallet @@ -58,7 +58,7 @@ To deploy and work with the contract, you need a wallet and some tez tokens. 1. Install a Tezos-compatible wallet. Which wallet you install is up to you and whether you want to install a wallet on your computer, in a browser extension, or as a mobile app. - If you don't know which one to choose, try the [Temple](https://templewallet.com/) browser extension, because then you can use it in the same browser that you are using to view the web app. + If you don't know which one to choose, try the [Temple](https://templewallet.com/) browser extension. Desktop wallets for Tezos include the [Temple](https://templewallet.com/) browser extension, [Kukai](https://wallet.kukai.app/), and [Umami](https://umamiwallet.com/). @@ -313,5 +313,8 @@ Saving the contract address like this is important because the address is not sh Now the contract is running on the Tezos blockchain. You or any other user can call it from any source that can send transactions to Tezos, including Octez, dApps, and other contracts. -If you want to continue working with this contract, try creating a dApp to call it from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/). -You can also try adding your own entrypoints and originating a new contract, but you cannot update the existing contract after it is deployed. +If you want to continue working with this contract, here are some ideas: + +- Change permissions for the contract so only your account can call its entrypoints +- Add your own entrypoints and originate a new contract; note that you cannot update the existing contract after it is deployed +- Create a dApp to call the contract from a web application, similar to the dApp that you create in the tutorial [Build a simple web application](../build-your-first-app/) \ No newline at end of file