Skip to content

Commit 918303f

Browse files
Merge branch 'main' into bw-142-release
2 parents bcec1df + 4c2335a commit 918303f

File tree

2 files changed

+35
-90
lines changed

2 files changed

+35
-90
lines changed

source/mainnet/smart-contracts/tutorials/counter/counter-contract.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Once you have set up the tools needed you are ready to create your smart contrac
2323

2424
.. code-block:: console
2525
26-
cargo concordium init
26+
$cargo concordium init
2727
28-
Select the ``Default`` option from the menu.
28+
Select the ``default`` option from the menu.
2929

3030
.. image:: images/select-default.png
3131
:width: 100%
@@ -165,7 +165,7 @@ Create a ``dist`` folder to keep the schema output file and Wasm compiled contra
165165

166166
.. code-block:: console
167167
168-
cargo concordium build --out dist/module.wasm.v1 --schema-out dist/schema.bin
168+
$cargo concordium build --out dist/module.wasm.v1 --schema-out dist/schema.bin
169169
170170
.. image:: images/build.png
171171
:width: 100%
@@ -174,7 +174,7 @@ Deploy it with the command below.
174174

175175
.. code-block:: console
176176
177-
concordium-client module deploy dist/module.wasm.v1 --sender <YOUR-ACCOUNT> --name counter --grpc-port 20001
177+
$concordium-client module deploy dist/module.wasm.v1 --sender <YOUR-ACCOUNT> --name counter --grpc-port 20001
178178
179179
.. image:: images/deploy.png
180180
:width: 100%
@@ -183,7 +183,7 @@ Initialize it to create your contract instance, so you are ready to invoke the f
183183

184184
.. code-block:: console
185185
186-
concordium-client contract init <YOUR-MODULE-HASH> --sender <YOUR-ADDRESS> --energy 30000 --contract counter --grpc-port 20001
186+
$concordium-client contract init <YOUR-MODULE-HASH> --sender <YOUR-ADDRESS> --energy 30000 --contract counter --grpc-port 20001
187187
188188
.. image:: images/initialize.png
189189
:width: 100%
@@ -198,7 +198,7 @@ First, check the initial state of the contract.
198198

199199
.. code-block:: console
200200
201-
concordium-client contract invoke <YOUR-CONTRACT-INSTANCE> --entrypoint view --schema dist/schema.bin --grpc-port 20001
201+
$concordium-client contract invoke <YOUR-CONTRACT-INSTANCE> --entrypoint view --schema dist/schema.bin --grpc-port 20001
202202
203203
Since you just initialized the contract it is 0.
204204

@@ -212,7 +212,7 @@ Create a JSON file that holds your operator that will be given as input to the f
212212

213213
.. code-block:: console
214214
215-
concordium-client contract update <YOUR-CONTRACT-INSTANCE> --entrypoint increment --parameter-json <PATH-TO-JSON> --schema dist/smart-contract-multi/schema.bin --sender <YOUR-ADDRESS> --energy 6000 --grpc-port 20001
215+
$concordium-client contract update <YOUR-CONTRACT-INSTANCE> --entrypoint increment --parameter-json <PATH-TO-JSON> --schema dist/smart-contract-multi/schema.bin --sender <YOUR-ADDRESS> --energy 6000 --grpc-port 20001
216216
217217
Start by testing with your conditions. First, try another account other than the owner of the contract since you want that only the owner can call this function.
218218

source/shared/setup-env.rst

+28-83
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Setup the development environment
55
=================================
66

7-
Before starting the smart contract tutorials, you must prepare your development environment by installing a number of tools.
7+
Before starting the smart contract tutorials, you must prepare your development environment by installing a number of tools. This topic covers the setup required for the tutorials.
88

99
.. Note::
1010

@@ -16,7 +16,7 @@ Before starting the smart contract tutorials, you must prepare your development
1616

1717
First, you need to install ``rustup`` which installs Rust and Cargo to your computer. Go to `Rustup <https://rustup.rs/>`_ to install ``rustup`` for your platform.
1818

19-
Select **1** to continue the installation.
19+
Type **1** to continue the installation.
2020

2121
.. image:: images/mint-install-rustup.png
2222
:width: 100%
@@ -37,19 +37,26 @@ During Wasm installation in your system you should see something similar to belo
3737
.. image:: images/mint-wasm-install.png
3838
:width: 100%
3939

40-
Now you need to install the Concordium software package. :ref:`Click here<cargo-concordium-testnet>` and download the version 2.2.0 or greater of ``cargo-concordium`` for your operating system. The tool is the same for both testnet and mainnet.
40+
Now you need to install the Concordium software package. ``cargo-concordium`` is the tool for developing smart contracts for the Concordium blockchain. It can be used for :ref:`compiling<compile-module>` and :ref:`testing<integration-test-contract>` smart contracts, and enables features such as :ref:`building contract schemas<build-schema>`.:ref:`Click here<cargo-concordium-testnet>` and download the version 2.2.0 or greater of ``cargo-concordium`` for your operating system. The tool is the same for both testnet and mainnet.
4141

42-
First, rename the ``cargo-congordium-v.x.x`` file to ``cargo-concordium``. Then go to the directory where the file is downloaded and run this command to make it executable. You also need to move the ``cargo-concordium`` executable to the cargo folder. :ref:`Follow the information here<setup-tools>` to ensure that your cargo-concordium is configured correctly. The commands below are specifically for MacOS. Remember to adjust the commands based on your operating system.
42+
.. note::
43+
44+
If you are not using Ubuntu/Linux as your operating system, the following screenshots and commands will be different.
45+
Remember to adjust the following commands based on your operating system.
46+
47+
To install ``cargo-concordium`` run:
4348

4449
.. code-block:: console
4550
46-
sudo chmod +x cargo-concordium
51+
$cargo install --locked cargo-concordium
52+
53+
For a description of how to use the ``cargo-concordium`` run:
4754

4855
.. code-block:: console
4956
50-
mv cargo-concordium ~/.cargo/bin
57+
$cargo concordium --help
5158
52-
If everything is correct, when you enter the command ``cargo concordium --help`` it shows something similar to the below.
59+
To use verifiable builds with cargo-concordium a container runtime such as `Docker <https://www.docker.com/>`_ is required.
5360

5461
.. image:: images/cargo-help.png
5562
:width: 100%
@@ -63,17 +70,12 @@ If everything is correct, when you enter the command ``cargo concordium --help``
6370

6471
.. _interact-with-your-contract:
6572

66-
Install Concordium Client
67-
=========================
73+
Download and run Concordium Client
74+
==================================
6875

69-
The tutorials use ``concordium-client`` as a command line tool to deploy, mint, and transfer. :ref:`Download it here<concordium-node-and-client-download-testnet>`. Rename the package to ``concordium-client`` in case it has some version annotation.
76+
The ``concordium-client`` tool allows you to interact with a Concordium node. The tutorials use ``concordium-client`` as a command line tool to deploy, mint, and transfer. The tools is available for Windows, Mac, and Linux. :ref:`Download it for your operating system here<concordium-node-and-client-download-testnet>`. You find documentation of important commands that the ``concordium-client`` tool provides :ref:`here<concordium-client>`.
7077

71-
.. note::
72-
73-
If you are not using Ubuntu/Linux as your operating system, the following screenshots will look different.
74-
Remember to adjust the following commands based on your operating system.
75-
76-
Go to the folder where you downloaded the ``concordium-client``. You can check if you are in the correct folder when you see the output ``concordium-client`` from the command:
78+
Rename the package to ``concordium-client`` in case it has some version annotation. Go to the folder where you downloaded the ``concordium-client``. You can check if you are in the correct folder when you see the output ``concordium-client`` from the command:
7779

7880
.. code-block:: console
7981
@@ -90,8 +92,11 @@ Go to the folder where you downloaded the ``concordium-client``. You can check i
9092
without prepending them with ``./``. Effectively, prepending with ``./``
9193
searches for the executable package in the current directory while
9294
omitting ``./`` searches for the executable package in the PATH variable.
95+
The macOS distribution is an installer that places an alias to the binary into the folder ``/usr/local/bin``. So after installing, you should have ``concordium-client`` on your path.
9396

94-
The package is not yet executable. You change this with the command:
97+
On MacOS or Linux, access the command line with the Terminal application. On Windows, use the Power Shell or Command Prompt application. If you run it outside of the command line (e.g., by double clicking in Windows Explorer), then the Concordium Client will exit immediately without doing anything useful.
98+
99+
Before you can use the downloaded Concordium Client on Linux you have to make the downloaded file executable. Run the following command to make the file you download executable:
95100

96101
.. code-block:: console
97102
@@ -111,9 +116,7 @@ You should see some output that will help you in getting familiar with the ``con
111116
.. image:: images/pb_tutorial_9.png
112117
:width: 100 %
113118

114-
The ``concordium-client`` tool allows you to interact with your testnet node. You find important commands that the ``concordium-client`` tool provides :ref:`here<concordium-client>`.
115-
116-
Your next task enables the ``concordium-client`` tool to talk to your testnet node. There are two options to achieve this:
119+
Your next task enables the ``concordium-client`` tool to talk to a testnet node. There are two options to achieve this:
117120

118121
.. dropdown:: **Option 1 (beginners)**
119122

@@ -178,70 +181,12 @@ Your next task enables the ``concordium-client`` tool to talk to your testnet no
178181
.. image:: images/pb_tutorial_17.png
179182
:width: 100 %
180183

181-
Run a node
182-
==========
183-
184-
.. note::
185-
186-
It is technically fine to run your testnet node locally on your machine instead of on a server in the cloud. Since blockchain nodes have to run 24/7 to be up-to-date with the blockchain, you have to run your local machine 24/7. Alternatively, if you don't want to run your local machine 24/7, you can let your node catch up whenever you start your machine. Because this takes some time, the tutorials recommend a cloud provider setup for convenience. You can also use the Concordium hosted testnet node ``grpc.testnet.concordium.com`` on port 20000 (gRPCv2 and gRPC-web). You can use this node for API calls of *chain methods only*.
187-
188-
You will need to run a node. You can run any node platform you wish. You can create an account on your favorite cloud provider to set up your instance unless you intend to run a testnet node locally on your machine. The following are the requirements to run a simple testnet node. See the :ref:`requirements <system-requirements-node-mainnet>` for mainnet nodes.
189-
190-
.. list-table::
191-
:widths: 25 25
192-
:header-rows: 1
193-
194-
* - Hardware (Testnet node)
195-
- Recommended
196-
* - CPU (Core)
197-
- 2
198-
* - RAM (Memory)
199-
- 8 GB
200-
* - Storage
201-
- 25 GB
202-
* - Operating system
203-
- Ubuntu 20.04 or 22.04
204-
205-
You can also run a Docker image of a node that can be :ref:`found here<run-a-node>`. Docker file configurations can be found in the ``docker-compose.yml`` file as described :ref:`here<run-a-node>`. Don't forget the set a name for your node with the parameter ``CONCORDIUM_COLLECTOR_NODE_NAME``.
206-
207-
Sync your node
208-
--------------
209-
210-
Start the syncing process of the testnet node by following the guide for your platform :ref:`Ubuntu<ubuntu-node>`, :ref:`Docker<docker-node>`, :ref:`Windows<windows-node>`, or :ref:`MacOS<macos-node>`. This step currently takes some time, potentially hours based on your device configuration, because your node is freshly started and needs to recover all the previous blocks.
184+
Concordium node on Testnet
185+
==========================
211186

212-
You should find your node name on the `Concordium testnet dashboard <https://dashboard.testnet.concordium.com/>`_. It will take less than a day until your testnet node is fully synced. You can observe the syncing process by watching the finalization length of your node. Wait until the ``Fin Length`` (finalization length) of your node is the same as the highest value used by the majority of nodes. Once the height value is the same as the height in `CCDScan <https://testnet.ccdscan.io/blocks>`__, then you can continue with the development.
213-
214-
.. note::
215-
216-
To allow the network dashboard to display nodes in the network and their current status, a node must run a collector. The collector is enabled by the default start-up script but can be disabled.
217-
218-
.. image:: ./images/pb_tutorial_13.png
219-
:width: 100 %
220-
221-
Alternatively, you can query the syncing state of your node with ``concordium-client``. Wait until the ``last finalized block height`` of your node is the same as the highest value used by the majority of nodes.
222-
223-
.. code-block:: console
224-
225-
./concordium-client consensus status --grpc-port 20001
226-
227-
.. image:: ./images/pb_tutorial_19.png
228-
:width: 100 %
229-
230-
.. note::
231-
232-
It is a good practice to enable inbound connections on port 8889 (testnet) in your instance. You can allow inbound connections from any IPv4 and IPv6 address, by selecting ``0.0.0.0/0`` and ``::/0`` on the port 8889. This is not mandatory for the node to sync but it will make your node a good network participant. Feel free to skip this step if you are not feeling confident editing the inbound connection rules of your instance.
233-
234-
.. image:: ./images/pb_tutorial_12.png
235-
:width: 100 %
236-
237-
Remember you are working on the testnet. Check if your node collector is up and running in CCDScan. Look for the name of your node in the network section of the dashboard.
238-
239-
.. image:: images/node-collector.png
240-
:width: 100%
241-
242-
.. Note::
187+
For the purposes of these tutorials and for testing, a node is available on testnet to use when testing smart contracts and dApps so you do not need to run your own node. You can use this node for API calls of chain methods only with gRPC v2 and gRPC web. The address is ``grpc.testnet.concordium.com`` on port 20000 (gRPCv2 and gRPC-web). You can use this node for API calls of *chain methods only*. This node is maintained by Concordium, but Concordium does not guarantee availability. The status of this node is available on the `Testnet status page <https://status.testnet.concordium.software>`__.
243188

244-
For testing purposes, a node is available on testnet to use when testing smart contracts and dApps. You can use this node for API calls of chain methods only with gRPC v2 and gRPC web. The address is node.testnet.concordium.com on port 20000 (gRPCv2 and gRPC-web). You can use this node for API calls of *chain methods only*. This node is maintained by Concordium, but Concordium does not guarantee availability. The status of this node is available on the `Testnet status page <https://status.testnet.concordium.software>`__.
189+
If you wish to run your own node, see :ref:`Run a node on Concordium<node-requirements>`.
245190

246191
.. _setup-wallet:
247192

@@ -262,7 +207,7 @@ Use the Testnet faucet in your account to claim 2000 CCDs for testing purposes.
262207
.. image:: images/testnet-faucet-bw.png
263208
:width: 50%
264209

265-
One thing to note is that if you click |send|, you enter transaction window. This allows you to transfer CCDs. You can type the amount of CCD and the recipient’s address in this section. As you can see just below those textboxes, there is a value highlighting the “Estimated transaction fee” in CCD terms. This allows you to estimate the costs beforehand and it allows helps you to calculate your business expenses in the future.
210+
One thing to note is that if you click |send|, you enter a transaction window. This allows you to transfer CCDs. You can type the amount of CCD and the recipient’s address in this section. As you can see just below those textboxes, there is a value highlighting the “Estimated transaction fee” in CCD terms. This allows you to estimate the costs beforehand and it allows helps you to calculate your business expenses in the future.
266211

267212
.. image:: images/tx-fee-in-bw.png
268213
:width: 100%

0 commit comments

Comments
 (0)