Skip to content

Commit

Permalink
Updates to the my first dapp guide (#430)
Browse files Browse the repository at this point in the history
* Updates to the installation dependencies

* Update to the archwayd link

* Updates to setting up a basic Archway project

* Expand on how to create a new project
  • Loading branch information
emperorjm authored Jan 4, 2024
1 parent 09007a4 commit 7bb7766
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 54 deletions.
56 changes: 18 additions & 38 deletions content/2.developers/1.getting-started/1.install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ To get started developing on the Archway Network, you will need to have the the
- [Rustc](#rustc 'Install Rust')
- [Cargo](#cargo 'Install Cargo')
- [Cargo Generate](#cargo-generate 'Install Cargo Generate')
- [wasm32](#wasm32 'Install wasm32')
- [Node.js](#nodejs-and-npm 'Install Node.js and NPM')
- [Node.js and NPM](#nodejs-and-npm 'Install Node.js and NPM')
- [Archway Developer CLI](#archway-developer-cli 'Install develolper CLI')
- <a href="https://docs.docker.com/get-docker" target="_blank" >Docker</a>

### Optional
- [Archwayd](#archwayd 'Install Archway Daemon')
- [Archwayd](#archwayd-optional 'Install Archway Daemon')

## Rustc

Expand All @@ -31,17 +30,17 @@ To install Rust, follow the instructions for your operating system <a href="http

## Cargo

Cargo is the Rust package manager, like **go get** for Golang or **npm** is for JavaScript. Cargo comes with Rust if you installed **rustc** using **rustup**.
Cargo is the Rust package manager, like **go get** is for Golang or **npm** is for JavaScript. Cargo comes with Rust if you installed **rustc** using **rustup**.

If you did not already install **rustc** with **rustup**, or don't have **cargo** in your command line path, see the instructions for installing Cargo <a href="https://doc.rust-lang.org/cargo/getting-started/installation.html" target="_blank" title="Install Rust">here</a>.

## Cargo Generate

The **cargo-generate** tool creates a new Rust project quickly by leveraging a pre-existing code base.

Archway uses **cargo-generate** and **cargo-run-script** to provide and manage project templates for dapp development.
Archway Developer CLI uses **cargo-generate** and **cargo-run-script** to provide and manage project templates for dapp development.

To install **cargo-generate** with **vendored-openssl**, and the **cargo-run-script** module, run the commands:
To install <a href="https://cargo-generate.github.io/cargo-generate/installation.html#using-cargo-generate-with-vendored-openssl" target="_blank">cargo-generate</a> with **vendored-openssl**, and the **cargo-run-script** module, run the commands:
::highlight-card

```bash
Expand All @@ -51,36 +50,23 @@ cargo install cargo-run-script

::

## wasm32
## Node.js and npm

The **wasm32** <a href="https://rustup.rs/" target="_blank" >rustup</a> target is a 32-bit "bare wasm" module for producing <a href="https://webassembly.org/" target="_blank" >WebAssembly</a> output that makes zero assumptions about your host machine and environment (hence the `-unknown-unkown` suffix). It's required by the <a href="https://www.npmjs.com/package/@archwayhq/cli" target="_blank" >Developer CLI</a>, as of version <a href="https://www.npmjs.com/package/@archwayhq/cli/v/1.2.1" target="_blank" >`1.2.1`</a>, for optimizing **wasm** output for on-chain storage of binaries.
**npm** is a package manager for JavaScript and Node.js. It's required for installing and updating the Archway Developer CLI.

Install **wasm32** using the following command:
::highlight-card

```bash
rustup target add wasm32-unknown-unknown
```

::

## Node.js and Npm
For installing **Node.js** and **npm**, see instructions for your operating system <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank">here</a>.

**npm** is a package manager for JavaScript and Node.js. Archway uses **npm** for installing and updating the developer CLI.

For installing **node.js** and **npm**, see instructions for your operating system <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank">here</a>.

::alert{variant="info"}
<!--::alert{variant="info"}
**@archwayhq/cli** requires Node.js version 14 or higher, but some older versions in the `beta` release track required Node.js version 17. You can check which version you have installed using the command **archway --version**.
<a href="https://www.npmjs.com/package/@archwayhq/cli?activeTab=versions" target="_blank" >See all availble versions of @archwayhq/cli</a>
#title
Info
::
::-->

## Docker

<a href="https://docs.docker.com/" target="_blank" title="Install Docker">Docker</a> is needed for the Developer CLI to use the <a href="https://github.com/CosmWasm/rust-optimizer" target="_blank" >rust optimizer</a>. Make sure to follow all the steps with **root** access to prevent conflicts and confusions on the deployment process which requires root permission. You can use <a href="https://docs.docker.com/get-docker/" target="_blank" title="Install Docker">Docker Desktop</a> or <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" title="Install Docker">Docker Engine</a>.
<a href="https://docs.docker.com/" target="_blank" title="Install Docker">Docker</a> is required for the Archway Developer CLI to use the <a href="https://github.com/CosmWasm/rust-optimizer" target="_blank" >rust optimizer</a>. You can use <a href="https://docs.docker.com/get-docker/" target="_blank" title="Install Docker">Docker Desktop</a> or <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" title="Install Docker">Docker Engine</a>.

::alert{variant="warning"}
For Linux users, it's recommended to run the Docker daemon in <a href="https://docs.docker.com/engine/security/rootless/" target="_blank"> **Rootless Mode**</a>
Expand All @@ -90,7 +76,7 @@ Warning

## Archway Developer CLI

You can install the [Archway CLI](/developers/developer-tools/developer-cli) by using <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank" >npm</a>
You can install the [Archway CLI](/developers/developer-tools/developer-cli) by using <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank" >npm</a>:

::highlight-card

Expand All @@ -108,12 +94,9 @@ Info

## Archwayd (optional)

**archwayd** is an implementation of a Cosmos zone with **wasm** smart contracts enabled, and which adds new modules for developer rewards and for executing **wasm**.
All the actions executable through **Archway Developer CLI** can also be performed via **archwayd**, but it requires significantly more knowledge to achieve the same results.

To build **archwayd**, you can download the <a href="https://github.com/archway-network/archway/releases" target="_blank" >latest release</a>, as building **archwayd** from source is not recommended.


You can download the latest release of the pre-built binary from the <a href='https://github.com/archway-network/archway/releases' target='_blank'>releases page</a>.
To install **archwayd**, you can either download the [latest release](https://github.com/archway-network/archway/releases) of the pre-built binary or build **archwayd** from [source](https://github.com/archway-network/archway#build-from-source). Ensure that you use the release corresponding to the version of **archwayd** being used on the chain where you will be deploying your contracts.

For Linux, and depending on your architecture:

Expand Down Expand Up @@ -147,7 +130,7 @@ wget https://github.com/archway-network/archway/releases/download/$$archwayVersi

### Verify the integrity of the binary

You can now verify the download by generating the sha256 hash for the downloaded file:
You can verify the binary by generating the sha256 hash of the downloaded file:

::tab-card{noOfTabs=2}
#title0
Expand Down Expand Up @@ -177,10 +160,7 @@ sha256sum archwayd_linux_arm64

::

Using the _sha256sum_ should give you a string (i.e.
_4dd95ee0729b6593c9c390bde6e0c7bf3af0957d7f323e216b76ddb663fa7bc7_).

You can then download the sha256 checksum file relative to the release file:
Using the sha256sum command should generate a string (e.g., 4dd95ee0729b6593c9c390bde6e0c7bf3af0957d7f323e216b76ddb663fa7bc7). Next, you can download the sha256 checksum file corresponding to the release file using the command:

::highlight-card

Expand All @@ -191,11 +171,11 @@ wget archwaysha256.txt https://github.com/archway-network/archway/releases/downl

::

and you can compare that the sha256 hash strings match, By doing so, you are ensuring that the downloaded file matches the actual release file.
Then you can compare the two sha256 hash strings to ensure they match. By doing so, you confirm that the downloaded file matches the official release file.

### Add executable permissions

After downloading the file, you can add executable permissions to it using the chmod command:
After downloading the file, you can add executable permissions to it using the **chmod** command:

::highlight-card

Expand Down
34 changes: 28 additions & 6 deletions content/2.developers/1.getting-started/3.setup.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
---
objectID: developers_getting-started_setup
title: Setup
description: How to set up your Archway Network environment for development purposes
description: How to set up a basic Archway smart contract project
parentSection: Developers
parentSectionPath: /developers
---

# Project Setup

A new Archway project involves creating a Rust-based application that compiles to WebAssembly (wasm), a binary instruction format optimized for efficient execution. Setting up a new Archway project is most straightforward when using the [Archway Developer CLI](/developers/developer-tools/developer-cli). Let's begin the process of creating a new project with the help of this Developer CLI.
A new Archway project involves creating a Rust-based application that compiles to WebAssembly (wasm), a binary instruction format optimized for efficient execution on chain. Setting up a new Archway project is most straightforward when using the [Archway Developer CLI](/developers/developer-tools/developer-cli). Let's begin the process of creating a new project with the help of this Developer CLI.

## Creating an account

Use the command **archway accounts list** to view wallets in your key ring, or create a new wallet using:
Use the command **archway accounts list** to view accounts in your environment's keyring, or create a new account using **archway accounts new**.

**Usage:**

::highlight-card

```bash
$ archway accounts new [ACCOUNT-NAME] [STDININPUT] [--json] [--log-level debug|error|info|warn] [--ledger | --recover] [--hd-path <value>] [--keyring-backend file|os|test] [--keyring-path <value>]
```
::

**Example:**

::highlight-card
```bash
Expand Down Expand Up @@ -48,6 +59,17 @@ Checking for updates...
The **archway new** command starts a new project.
**Usage:**
::highlight-card
```bash
$ archway new [PROJECT-NAME] [--json] [--log-level debug|error|info|warn] [--chain <value>] [--contract] [--contract-name <value>] [--template <value>]
```
::
**Example**:
::highlight-card
```bash
Expand Down Expand Up @@ -125,13 +147,13 @@ VALUE (required) The config value
```
::

In **Chain ID** specifies the chain the project is currently configured to interact with. You can use the following command to easily switch to a different chain:
The **Chain ID** specifies the chain the project is currently configured to interact with. You can use the following command to easily switch to the Archway testnet (**constantine-3**):

::highlight-card

```bash
$ config chains use <chain-id>
$ archway config set chain-id constantine-3
```
::

You will need to enter the Chain ID that you will want to switch to. Currently "**constantine-3**" for Testnet and "**archway-1**" for Mainnet.
You can find the list of public Archway networks [here](/resources/networks).
35 changes: 25 additions & 10 deletions content/2.developers/3.guides/3.my-first-dapp/1.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@ parentSectionPath: /developers

# Project Setup

This guide outlines the following workflow:
In the [Getting Started Setup](/developers/getting-started/setup) section, you learned how to create and configure a new project using the Archway Developer CLI. Projects initiated with **archway new** can utilize our predefined templates as starting points. For this guide, we will create a project using the [**Increment**](https://github.com/archway-network/archway-templates/tree/main/increment) contract template.

Ensure that you have [Archway Developer CLI](/developers/developer-tools/developer-cli) installed. If you haven't yet created an account within the Archway Developer CLI, you can do so now by following these [steps](/developers/getting-started/setup#creating-an-account).

1. [Create a new project](#creating-a-project)
2. [Request testnet Tokens](../2.faucet.md)
3. [Produce _default_ and _CosmWasm_ **wasm** binaries](./3.wasm.md)
4. [Deploy to a testnet](./4.deploy.md)
5. [Create transactions and query data from a deployed contract](./5.interact.md)
6. [Build a dapp frontend](./6.dapp.md)

## Creating a project

In the [Setup](../../1.getting-started/2.setup.md) section we learned how to create and configure a new Archway project.
Execute the following command to create a new project:

::highlight-card

```bash
archway new
```
::


You will be asked for the following information:

1. **Enter the name of the new project**: Type in a name for your project.
2. **Select a chain to use**: Use your keyboard's up and down arrow keys to select one of the available chains for the project. You should see an option for **Archway Testnet**, which is the stable testnet recommended for dapp development, and **Archway**, the production network. For this example, select **Archway Testnet**.
3. **Choose a name for your contract**: Each project can have one or more contracts, and this name will be given to the first contract created within the project. Name this contract **increment**.
4. **Choose a starter template**: This is the template your first contract will be built from. Since we are creating a contract based on the [**Increment**](https://github.com/archway-network/archway-templates/tree/main/increment) template, select **Increment** from the list.
5. **Which version do you want to generate?**: This particular template has two variants: **full**, which provides the full feature set of the template, and **minimal**, a more barebones version. For this example, let's go with **full**.


Archway Developer CLI should then go through the process of downloading and compiling what is needed to get your project set up and ready for you to deply and interact on chain.

Projects created with **archway new** can use our predefined templates or are start from a blank canvas. For this guide we will be using the Increment template.
## Request testnet Tokens

If you haven't created a project or selected the '**Increment**' starter template, please return to the [Setup](../../1.getting-started/2.setup.md) section to finish this step. Make sure you have the [Archway Developer CLI](/developers/developer-tools/developer-cli) installed.
To execute transactions on any of the available Archway networks, you will need tokens. Different networks require different types of tokens, depending on whether you are working on a **testnet** or **mainnet**. For testnet purposes, 'testnet tokens' are typically used, which can be acquired without real-world cost via a faucet. The [guide on accessing testnet tokens](/developers/guides/faucet) gives a walkthrough of how to obtain these tokens.

0 comments on commit 7bb7766

Please sign in to comment.