RPCiege: Setup
Tags: programming, rust, blockchain, web3
Published: 2023-06-27 19:28:39

> Earn digital collectible playing cards in [RPCiege](https://rpciege.com/), a smart contract coding game teaching the fundamentals of developing and deploying performant and secure blockchain applications though small, fun, code puzzles.

Before we begin the siege of the RPC we need to ensure our system is configured for building Soroban smart contracts. You have two clear options. The first is to use a virtual environment like [Gitpod](https://www.gitpod.io/) or [Codespaces](https://github.com/features/codespaces) which can have everything pre-installed and configured for you. In fact here's a good `hello-world` Gitpod VM we've built for you.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)][oigp]

The second option is to setup your own local machine to develop Rust Soroban smart contracts. Personally that's my recommendation as everything will be faster and cheaper but if you're just getting started and still evaluating your interest the Gitpod can be great way to get off the ground quickly and painlessly. Here's the instructions for how to do that.

> _<small>Instructions sniped from https://soroban.stellar.org/docs/getting-started/setup</small>_

Soroban contracts are small programs written in the [Rust] programming language.

To build and develop contracts you need only a couple prerequisites:

- A [Rust] toolchain
- An editor that supports Rust
- [Soroban CLI]

## Install Rust

If you use macOS, Linux, or another Unix-like OS, the simplest method to install
a Rust toolchain is to install `rustup`. Install `rustup` with the following
command.

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

If you use Windows, or need an alternative method of installing Rust, check out: https://www.rust-lang.org/tools/install

## Install the target

Install the `wasm32-unknown-unknown` target.

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

## Configure an Editor

Many editors have support for Rust. Visit the following link to find out how to
configure your editor:  
https://www.rust-lang.org/tools

A popular editor is Visual Studio Code:

- [Visual Studio Code] editor.
- [Rust Analyzer] for Rust language support.
- [CodeLLDB] for step-through-debugging.

[Visual Studio Code]: https://code.visualstudio.com
[Rust Analyzer]: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer
[CodeLLDB]: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb

## Install the Soroban CLI

The Soroban CLI can execute Soroban contracts in the same environment the
contract will execute on network, however in a local sandbox.

Install the Soroban CLI using `cargo install`.

```bash
# Note depending on when you read this
# 0.8.0 may not be the most recent version
cargo install --locked --version 0.8.0 soroban-cli
```

### Usage

Run the `soroban` command and you should see output like below.

```bash
% soroban
Build, deploy, & interact with contracts; set identities to sign with; configure networks; generate keys; and more.

Intro: https://soroban.stellar.org
CLI Reference: https://github.com/stellar/soroban-tools/tree/main/docs/soroban-cli-full-docs.md

Usage: soroban [OPTIONS] <COMMAND>

Commands:
  contract    Tools for smart contract developers
  config      Read and update config
  events      Watch the network for contract events
  lab         Experiment with early features and expert tools
  version     Print version information
  completion  Print shell completion code for the specified shell

Options:
      --global                     Use global config
  -f, --filter-logs <FILTER_LOGS>  Filter logs output. To turn on "soroban_cli::log::footprint=debug" or off "=off". Can also use env var `RUST_LOG`
  -q, --quiet                      Do not write logs to stderr including `INFO`
  -v, --verbose                    Log DEBUG events
      --very-verbose               Log DEBUG and TRACE events
      --list                       List installed plugins. E.g. `soroban-hello`
  -h, --help                       Print help (see more with '--help')
  -V, --version                    Print version

TESTING_OPTIONS:
      --config-dir <CONFIG_DIR>
```

Great! Now that you're hopefully all setup you're ready to begin skirmishing! Proceed to [The Booklet™](https://rpciege.com/booklet) and let the gaming begin!

[Rust]: https://www.rust-lang.org/
[Soroban CLI]: https://soroban.stellar.org/docs/reference/soroban-cli
[oigp]: https://gitpod.io/#https://github.com/stellar/soroban-examples