# Installing required tools

The first thing you need to do before you can deploy your first smart contract on the Phron Testnet is to prepare your computer for development in Rust and ink!.

## Rust <a href="#rust" id="rust"></a>

This guide uses [https://rustup.rs](https://rustup.rs/) installer and the `rustup` tool to manage the Rust toolchain. It's the default way of installing Rust and we highly recommend doing it that way. However, if you prefer a different method, please check the "Other installation methods" section on the official [Rust website](https://www.rust-lang.org/tools/install).

To install and configure `rustup` enter the following commands in your shell:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
```

Now you have the latest stable version of Rust installed on your computer. For the development of smart contracts you will need a slightly more recent `nightly` version, together with some additional components:

```bash
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
```

Rust comes with its native package manager `cargo` which is also used for compiling Rust code. Make sure `cargo` is installed correctly and visible in your shell environment:

```bash
cargo --help
```

## ink! <a href="#ink" id="ink"></a>

ink! is an [Embedded Domain Specific Language](https://wiki.haskell.org/Embedded_domain_specific_language) (EDSL) that can be used to write WASM smart contracts in Rust. In other words, ink! is a collection of "add-ons" on top of Rust that modify the behavior of the language to produce, instead of regular binary code that can be executed by your computer, special WASM code compatible with Substrate-based smart contracts execution environment. Ultimately, every ink! smart contract is just a normal Rust program with a tiny bit of additional ink!-specific headers called "macros".

To start using ink! you first need to install the `binaryen` package, which is used to optimize the WebAssembly bytecode of the contract. Most likely `binaryen` is available from your default package manager:

```sh
# For Ubuntu or Debian users:
sudo apt install binaryen
# For MacOS users:
brew install binaryen
# For Arch or Manjaro users:
pacman -S binaryen
```

You can also directly download a [binary release](https://github.com/WebAssembly/binaryen/releases).

With `binaryen` present you can install `cargo contract`:

```bash
cargo install --force --locked cargo-contract
```

`cargo contract` is an add-on to `cargo` that extends it with commands helpful in the development of smart contracts. You can check what can be done with it by invoking `cargo contract --help`. We will very soon use it to create our very first ink! smart contract.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.phron.ai/developers/build-with-phronai/smart-contracts-development/rust-contracts/phron-smart-contracts-basics/installing-required-tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
