Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions source/mainnet/downloads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,6 @@ cargo-concordium

For information about installing ``cargo-concordium``, see :ref:`Install tools for development <build-contract>`.

.. Note::

From version 2.8.0 the distribution for ``cargo-concordium`` has been simplified. Now, once you have installed rustup, you can quickly and easily install ``cargo-concordium`` without downloading a separate package or going through many steps. If you already have ``cargo-concordium`` installed, you may need to remove the existing ``cargo-concordium`` from your PATH to be able to update versions in the future.

VSCode extension
----------------

You can `install the VSCode extension <https://marketplace.visualstudio.com/items?itemName=Concordium.concordium-smart-contracts>`__ for smart contract development from the VSCode marketplace.

For information about using the VSCode extension, `watch the video <https://www.youtube.com/watch?v=9qjcsGDeveg>`_.

Smart contract deploy and initialize tool
=========================================

Expand Down
14 changes: 7 additions & 7 deletions source/mainnet/how-to/governance/install-ledger-app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ You need to install a custom certificate to ensure that the LEDGER device trusts
.. code-block:: console
:substitutions:

$cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|
$ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|

.. For now, setting up custom CAs on Nano S+ does not make any difference, as sideloading signed apps is not working.
..
Expand All @@ -290,14 +290,14 @@ You need to install a custom certificate to ensure that the LEDGER device trusts
.. .. code-block:: console
.. :substitutions:
..
.. $cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|
.. $ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|
..
.. .. group-tab:: Nano S+
..
.. .. code-block:: console
.. :substitutions:
..
.. $cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus
.. $ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus

#. Load the certificate onto the LEDGER device by running the following script from the extracted folder:

Expand Down Expand Up @@ -375,14 +375,14 @@ After installing the certificate, you can proceed to install the Concordium LEDG
.. code-block:: console
:substitutions:

$cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|
$ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|

.. group-tab:: Nano S+

.. code-block:: console
:substitutions:

$cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus
$ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus

#. Install the Concordium application on the LEDGER device by running the following script from the folder you extracted the files to:

Expand Down Expand Up @@ -458,14 +458,14 @@ For the app to work properly with the current version of the Desktop Wallet, mak
.. code-block:: console
:substitutions:

$cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|
$ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanos-|nano-s-firmware|

.. group-tab:: Nano S+

.. code-block:: console
:substitutions:

$cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus
$ cd ~/Downloads/concordium-governance-ledger-app-|ccd-governance-version|-nanosplus

#. Install the Concordium application on the LEDGER device by running the following script from the folder you extracted the files to:

Expand Down
2 changes: 1 addition & 1 deletion source/mainnet/how-to/governance/voting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ These wallets do not have the capability to connect to dApps. But you do have an

.. code-block:: console

$concordium-client --secure --grpc-ip grpc.mainnet.concordium.software transaction send --amount AMOUNT --receiver A --sender B --memo delegatevote
$ concordium-client --secure --grpc-ip grpc.mainnet.concordium.software transaction send --amount AMOUNT --receiver A --sender B --memo delegatevote

#. Enter the command above in the Concordium Client, where AMOUNT is the number of CCD to be sent (1 micro-CCD is enough), A is the name/address of the account to which the vote is delegated, and B is the sender name/address. Note the memo ``delegatevote`` for the delegation to be valid. Furthermore, there is no service license agreement for the grpc endpoint.

Expand Down
8 changes: 1 addition & 7 deletions source/mainnet/how-to/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ Step-by-step guides for completing specific tasks on Concordium. Browse all guid
- :doc:`Build a contract schema <smart-contracts/build-schema>`
- :doc:`Use custom errors <smart-contracts/custom-errors>`
- :doc:`Pass JSON parameters <smart-contracts/json-params>`
- :doc:`Use no_std <smart-contracts/no-std>`
- :doc:`Use fallback entrypoints <smart-contracts/fallback-entrypoints>`
- :doc:`Write an upgradeable contract <smart-contracts/upgradeable-contract>`
- :doc:`Implement the factory pattern <smart-contracts/factory-pattern>`
- :doc:`Unit test a contract <smart-contracts/unit-test-contract>`
- :doc:`Integration test a contract <smart-contracts/integration-test-contract>`
- :doc:`Deploy a smart contract module <smart-contracts/deploy-module>`

Expand All @@ -103,7 +101,6 @@ Step-by-step guides for completing specific tasks on Concordium. Browse all guid
- :doc:`Inspect <smart-contracts/inspect-instance>`
- :doc:`Invoke <smart-contracts/invoke-instance>`

- :doc:`Migrate contracts <smart-contracts/migrate-contracts>`
- :doc:`Best practices <smart-contracts/best-practices/index>`

- :doc:`Development <smart-contracts/best-practices/development>`
Expand Down Expand Up @@ -169,14 +166,11 @@ Step-by-step guides for completing specific tasks on Concordium. Browse all guid
Build a contract schema <smart-contracts/build-schema>
Use custom errors <smart-contracts/custom-errors>
Pass JSON parameters <smart-contracts/json-params>
Use no_std <smart-contracts/no-std>
Use fallback entrypoints <smart-contracts/fallback-entrypoints>
Use fallback entrypoints <smart-contracts/fallback-entrypoints>
Write an upgradeable contract <smart-contracts/upgradeable-contract>
Implement the factory pattern <smart-contracts/factory-pattern>
Unit test a contract <smart-contracts/unit-test-contract>
Integration test a contract <smart-contracts/integration-test-contract>
Deploy a smart contract module <smart-contracts/deploy-module>
Migrate contracts <smart-contracts/migrate-contracts>
Best practices <smart-contracts/best-practices/index>

.. toctree::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Select your platform below to configure your node with validator keys.

.. code-block:: console

$concordium-client validator add <keys-file>.json --sender validatorAccount --stake <amount-to-stake> --validator-credentials-out <concordium-data-dir>/validator-credentials.json
$ concordium-client validator add <keys-file>.json --sender validatorAccount --stake <amount-to-stake> --validator-credentials-out <concordium-data-dir>/validator-credentials.json

where you replace

Expand Down Expand Up @@ -311,7 +311,7 @@ You can use ``concordium-client`` to see the status of the node. For more inform

.. code-block:: console

$concordium-client raw GetNodeInfo
$ concordium-client raw GetNodeInfo

...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ Consider the following map for storing all user bids in an auction contract:

.. code-block:: rust

pub struct State<S = StateApi> {
bids: StateMap<Address, Amount, S>
pub struct State {
bids: StateMap<Address, Amount>
}

Computing the maximum for each new bid requires iterating over the map.
Expand Down Expand Up @@ -316,11 +316,16 @@ Code documentation
Automated testing
-----------------

The Concordium standard library `concordium-std`_ offers several possibilities for testing the smart contract code.
Integration tests of smart contracts can be implemented as described on :ref:`Integration testing <integration-test-contract>`.
Integration tests allows you to test the contract in an environment where:

- The smart contract runs in the real Wasm interpreter
- The smart contract interacts with the real host functions and real chain integration
- Only the chain itself is stubbed, as the only component that is not "real"

- Use :ref:`Integration testing <integration-test-contract>` to test particular cases where you define what is the valid output.
- (**Deprecated**) Use :ref:`Unit testing <unit-test-contract>` to test particular cases where you define what is the valid output.
- (**Deprecated**) :ref:`Property-based testing <writing_property_based_tests>` is a variant of randomized testing that repeatedly checks a *property* with randomly generated input.
Besides from integration tests, you can also implement plain Rust unit tests for functions that does not interact with the host.
A third, and more advanced, possibility is using the `concordium_test macro <https://docs.rs/concordium-std/latest/concordium_std/attr.concordium_test.html>`_.
Examples of this may be found in `concordium-std tests <https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/concordium-std/src/impls.rs>`_.

Use the :ref:`smart contract specification <best-practices-specification>` guidelines from this document to come up with cases and properties to test.

Expand Down
54 changes: 7 additions & 47 deletions source/mainnet/how-to/smart-contracts/build-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,21 @@ Set up smart contract development tools
This guide covers how to install the tools needed to develop, build, and deploy
smart contracts on Concordium.

.. Note::

You can also watch a video about installing the smart contract tools.

.. raw:: html

<iframe src="https://www.youtube.com/embed/0UIyAlZjvLg?si=D0lguDkUjiHCKLcu" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Once you are familiar with smart contracts, it is a good idea to read the :ref:`Smart contracts best practices<sc-development-best-practices>`.

.. Note::

To request CCDs for testing, use the buttons in the Concordium Wallets when running Testnet.

Rust and Cargo
==============

First, `install rustup`_, which installs both Rust_ and Cargo_ on your
machine.

.. Note::

Currently, Rust toolchain versions up to ``1.81`` are and newer are not supported by older ``cargo-concordium`` versions ( <= ``4.0.0``). Update ``cargo-concordium`` if you see the error ``Unexpected byte 0x80. Expected 0x00`` as follows:

.. code-block:: console

$ cargo install cargo-concordium
$ cargo concordium --version
$ cargo-concordium 4.1.1

The minimum supported rust version is currently version ``1.73``

Then use ``rustup`` to install the Wasm target, which is used for compilation:

.. code-block:: console

$rustup target add wasm32-unknown-unknown
$ rustup target add wasm32v1-none

``cargo-concordium``
cargo-concordium
====================

``cargo-concordium`` is the tool for developing smart contracts for the Concordium
Expand All @@ -63,46 +39,30 @@ To install ``cargo-concordium`` run:

.. code-block:: console

$cargo install --locked cargo-concordium
$ cargo install --locked cargo-concordium

For a description of how to use the ``cargo-concordium`` run:

.. code-block:: console

$cargo concordium --help
$ cargo concordium --help

To use verifiable builds with cargo-concordium a container runtime such as `Docker <https://www.docker.com/>`_ is required.

VSCode extension
----------------

The `VSCode extension <https://marketplace.visualstudio.com/items?itemName=Concordium.concordium-smart-contracts>`__ can help you develop Concordium smart contracts. The extension sets up the editor for development, installs the ``cargo-concordium`` smart contract development tool for all supported platforms, and provides commands in the editor for the essential workflows, such as building and testing smart contracts.

You can watch a video about how to use the VSCode extension.

.. raw:: html

<iframe src="https://www.youtube.com/embed/9qjcsGDeveg?si=zGDkjMAdP5JjRMd8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Typescript smart contract client generator
------------------------------------------
==========================================

The `Typescript smart contract client generator <https://www.npmjs.com/package/@concordium/ccd-js-gen>`_ helps you generate JavaScript/TypeScript clients for smart contracts on the Concordium blockchain, providing a lower development time and better type-safety.

Concordium software
===================
Concordium client
=================

The tool to deploy and interact with smart contracts is
:ref:`concordium-client<concordium-client>`. It is distributed as part of the
:ref:`Concordium software<downloads>` package.

To ease deployment and initialization, you can use the `Smart contract deploy and initialize tool <https://sctools.mainnet.concordium.software/>`__. It works with the |bw| to deploy and initialize smart contracts to Mainnet and Testnet.

.. note::

To deploy smart contract modules and interact with the chain, make sure
that you are :ref:`running a node<run-a-node>`.

.. _Rust: https://www.rust-lang.org/
.. _Cargo: https://doc.rust-lang.org/cargo/
.. _install rustup: https://rustup.rs/
Expand Down
Loading
Loading