Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stellar-cli docs to support the latest protocol 22. #1055

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
46 changes: 8 additions & 38 deletions docs/build/smart-contracts/getting-started/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,48 +127,14 @@ Users of non-bash shells may need to adapt the above commands to suit their need

### Configuring the CLI for Testnet

Stellar has a test network called Testnet that you can use to deploy and test your smart contracts. It's a live network, but it's not the same as the Stellar public network. It's a separate network that is used for development and testing, so you can't use it for production apps. But it's a great place to test your contracts before you deploy them to the public network.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stellar cli has default networks, so this is no longer required.


To configure your CLI to interact with Testnet, run the following command:

<Tabs groupId="platform" defaultValue={getPlatform()}>

<TabItem value="unix" label="macOS/Linux">

```sh
stellar network add \
--global testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Network ; September 2015"
```

</TabItem>

<TabItem value="windows" label="Windows (PowerShell)">

```powershell
stellar network add `
--global testnet `
--rpc-url https://soroban-testnet.stellar.org:443 `
--network-passphrase "Test SDF Network ; September 2015"
```

</TabItem>

</Tabs>

Note the `--global` flag. This creates a file in your home folder's `~/.config/soroban/network/testnet.toml` with the settings you specified. This means that you can use the `--network testnet` flag in any Stellar CLI command to use this network from any directory or filepath on your system.

If you want project-specific network configurations, you can omit the `--global` flag, and the networks will be added to your working directory's `.soroban/network` folder instead.

### Configure an Identity

When you deploy a smart contract to a network, you need to specify an identity that will be used to sign the transactions.

Let's configure an identity called `alice`. You can use any name you want, but it might be nice to have some named identities that you can use for testing, such as [`alice`, `bob`, and `carol`](https://en.wikipedia.org/wiki/Alice_and_Bob).
Let's configure an identity called `alice`. You can use any name you want, but it might be nice to have some named identities that you can use for testing, such as [`alice`, `bob`, and `carol`](https://en.wikipedia.org/wiki/Alice_and_Bob). Notice that the account will be funded using [Friendbot](../../../learn/fundamentals/networks.mdx#friendbot).

```sh
stellar keys generate --global alice --network testnet
stellar keys generate --global alice --network testnet --fund
```

You can see the public key of `alice` with:
Expand All @@ -177,9 +143,13 @@ You can see the public key of `alice` with:
stellar keys address alice
```

Like the Network configs, the `--global` means that the identity gets stored in `~/.config/soroban/identity/alice.toml`. You can omit the `--global` flag to store the identity in your project's `.soroban/identity` folder instead.
Like the Network configs, the `--global` means that the identity gets stored in `~/.config/stellar/identity/alice.toml`. You can omit the `--global` flag to store the identity in your project's `.stellar/identity` folder instead.

By default, `stellar keys generate` will fund the account using [Friendbot](../../../learn/fundamentals/networks.mdx#friendbot). To disable this behavior, append `--no-fund` to the command when running it.
:::info

We previously used `~/.config/soroban` (global) and `.soroban` (local) as the configuration directories. These directories are still supported, but the preferred name is now `~/.config/stellar` and `.stellar` moving forward.

:::

[rust]: https://www.rust-lang.org/
[stellar cli]: #install-the-stellar-cli