Quickstart Guide

This quickstart guide will walk you through the necessary steps to download, install & configure the SagaCLI, request your tokens and launch your chainlet.

IMPORTANT: Pegasus Incentivized Testnet is for testing purposes only. As such, this should be used for testing ONLY, not production deployments.

1. Download & Install SagaCLI

Download the SagaCLI or check if you're running the latest SagaCLI version.

Download link & latest version can be found here: https://docs.saga.xyz/getting-started/download-saga-cli

After you download the correct version for your OS, open up your command line terminal, CD to the directory where you downloaded it, then install it with the following command:

tar -xzf sagacli-operatingsystem.tar.gz -C /usr/local/bin/

Example: If you downloaded the MacOS version of the SagaCLI you would run the command:

tar -xzf sagacli-darwin-arm64.tar.gz -C /usr/local/bin/

Note: If you encounter an error and you're on MacOS or Linux, try using 'sudo' in the command and enter your computers password when prompted

sudo tar -xzf sagacli-darwin-arm64.tar.gz -C /usr/local/bin/

Then test that you can run the SagaCLI by typing sagacli at your command prompt. You should see the usage and available commands appear.

Note: If you encounter 'permission denied' when trying to run sagaclion MacOS or Linux, then issue the full command: sudo chmod +x /usr/local/bin/sagacli

Lastly, before you start to use sagacli, please ensure that you have installed the correct version. You may not be able to access all of the features in sagacli if you are using an incorrect version.

Note: Latest sagacli version is: 0.4.11

to check your version, run command: sagacli -v

2. Configure SagaCLI

Execute the following commands provided below to configure the sagacli to communicate with the Saga Platform Chain:

If you've used sagacli in the past on Cassiopeia, we recommend carefully verifying that all of the config parameters below are set correctly otherwise your CLI might fail.

sagacli config network-rpc https://spc.testnet-srv1.sagarpc.io
sagacli config controller https://controller.testnet-srv1.sagarpc.io
sagacli config platform-chain-id spc-testnet-1
sagacli config denom upsaga
sagacli config broadcast-mode sync
sagacli config faucet https://zgl952jrej.execute-api.us-east-1.amazonaws.com/Prod/fund

Once this is done, you can review your configuration by running

sagacli config
{
	"loglevel": "info",
	"controller": "https://controller.testnet-srv1.sagarpc.io",
	"output": "text",
	"keyring-backend": "os",
	"network-rpc": "https://spc.testnet-srv1.sagarpc.io",
	"from": "<your-local-key-name>",
	"platform-chain-id": "spc-testnet-1",
	"denom": "upsaga",
	"broadcast-mode": "sync",
	"ledger": "false",
	"faucet": "https://zgl952jrej.execute-api.us-east-1.amazonaws.com/Prod/fund",
	"base-gas-fee": ""
}

The "keyring-backend" in your config may show "os" or "file", this does NOT need to match with what's displayed above.

3. Verify SagaCLI

After completing Steps 1 & 2 run the following command to verify the sagacli is communicating with the Saga Platform Chain:

sagacli status

You should see the following output:

Saga Platform Chain     Controller
-------------------     ----------
Online                  Online                   

4. Generate Key/Address with SagaCLI

Next you'll setup your Key/Address. This is where you'll receive your upsaga tokens so you can launch your chainlet.

sagacli keys add <keyname>

Example: To generate a new key and call it mykey1 you would issue the command:

$ sagacli keys add mykey1

You'll then be prompted with:

$ Enter keyring passphrase:

The keyring passphrase can be anything you want but you'll you need to remember it as you'll need it to launch, manage and work with your chainlet.

Once completed, you should see this output. (The keyname will be different for your as well as the mnemoic phrase.)

$ sagacli keys add mykey1

- address: saga17tz488sq54l72mpt3ntl95gc50qtwta9l986u6
  name: mykey1
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AnxGYN/vnFJ0L6PXJr5aaUE+zGI+AKvNc7U+vPhu5joM"}'
  type: local


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

5. Faucet Airdrop Key

Your contact at Saga will send you a Faucet Airdrop Key which will auto-fund your wallet address. If you don't have your Faucet Airdrop Key, reach out to your contact at Saga.

After you have the passphrase from your Saga contact, tokens from the Saga Testnet Faucet can be requested into your Saga account using the Saga Web App or using the sagacli

Request tokens using Saga Web App

Saga Web App is now online at https://testnet-app.saga.xyz/

You will need a wallet, such as Keplr, that supports Cosmos SDK based blockchains If this is your first time using Keplr Wallet, follow this tutorial to install and start using it.

Click the Get Tokens! button towards the top right. This will open your Saga wallet.

Simply fill in the received passphrase and click on Request PSAGA Tokens

Your Keplr wallet may prompt you to approve this request. Simply click approve and your wallet will be funded with 350 PSAGA tokens.

Request tokens using sagacli

sagacli account get-tokens <faucet airdrop key>

Example: If you were provided with the Faucet Airdrop Key named "projectx-1" then issue this command and press enter:

$ sagacli account get-tokens projectx-1

Next, you'll be prompted to enter your keyring passphrase which is the same keyring passphrase you setup in Step#4.

After a few seconds, you will see a response similar to this:

$ Success! Faucet funded wallet saga1f7at0lnkd89t69eltkvcvuydq9enwsa942nqw6. Tx: A581EE27B208BFDC8F497A3416B942B8BB25BB7761BF13F4258E0C7A9F8D3D3D

6. Confirm Token Airdrop

Once you receive the "Success! Faucet funded wallet" message, the Token Airdrop is complete and you can verify using the sagacli by issuing the command:

sagacli account balance

You should see a minimum of 350,000,000 upsaga (350 PSAGA) in your account.

7. Launch Chainlet using SagaCLI

Ensure you have sufficient funds in the launcher's wallet. To launch a chainlet of type SagaOS, you need at least 310,000,000 upsaga (310 PSAGA). See the chainlet billing section for more details.

There are several different options for launching a Chainlet. Details can be found here.

sagacli chainlet launch SagaOS 0.5.2 <your project name> --genesis-account <Insert your Metamask address here>:<Tokens to be added to this account> --denom <your token denom> --fees 2500upsaga

Here's an example command that launches a chainlet called myprojectname:

sagacli chainlet launch SagaOS 0.5.2 myprojectname --genesis-account 0xFd54E1809f031727AD392445351ca2e02cA15c2A:100000000 --denom mpn --fees 2500upsaga

Now let's break down this command:

  • sagacli chainlet launch

    • The base command to launch chainlet

  • SagaOS

    • The chainlet type to launch. You can see the full list of chainlet types by running sagacli chainlet list-types

  • 0.5.2

    • The chainlet stack version to launch. Run the command: sagacli chainlet list-types and you'll see that 0.5.2 is the "Version"

  • myprojectname

    • The name of your project, ie. if your project name is "Cool Web3 Game" then name it coolweb3game

  • --genesis-account 0xFd54E1809f031727AD392445351ca2e02cA15c2A:100000000

    • The genesis-account flag is composed of your EVM address, along with the number of full tokens you want in your account, separated by a colon. The address can be copied directly from Metamask

  • --fees 2500upsaga

    • The fee to pay for this chainlet launch transaction

  • --denom mpn

    • The currency symbol you'll create. This should be between 2 and 6 characters. mpn is just used for this example.

Then press Enter and your Chainlet will launch.

Typically, a chainlet is launched within one minute of issuing a chainlet launch command as described above.

However, it can take longer, sometimes up to 2 to 3 minutes. So, if no data is returned by the commands in this section, please try again.

To obtain your URL's you'll first need your ChainID.

To get your ChainID, simply issue the command:

sagacli chainlet list

You will see similar output. You'll want to take note of your ChainID. In this example, my ChainID is coolapp_1682719845971475-1

$ sagacli chainlet list

ChainId                     Name     StackName     StackVersion     Status     EscrowBalance     
-------                     ----     ---------     ------------     ------     -------------     
coolapp_1682719845971475-1  coolapp  SagaOS        0.5.2            Online      230000000upsaga 

Next you'll run the following command. Make sure to replace <ChainID> with your actual ChainID

sagacli chainlet apis <ChainID>

It may take a few minutes for these endpoints to become available, and the Status will display as Unavailable until they do.

Example:

$ sagacli chainlet apis coolapp_1682719845971475-1

Name         Endpoint                                                      Status        
----         --------                                                      ------        
jsonrpc      coolapp-1682719845971475-1.jsonrpc.testnet-sp1.sagarpc.io     Available     
ws           coolapp-1682719845971475-1.ws.testnet-sp1.sagarpc.io          Available     
explorer     coolapp-1682719845971475-1.testnet-sp1.sagaexplorer.io        Available

9. Configuring Metamask Network:

Navigate to Metamask -> Settings -> Networks -> Add Network

The settings screen will look something like this:

From here, click on "Add a network manually" and type in the following settings in the required fields:

  • Network Name: This will be your Chainlet name (in this example I'm using "coolapp")

  • New RPC URL: This will be your chainlet's JSON-RPC endpoint from the sagacli chainlet apis command we executed in Step 8

    • https://coolapp-1682719845971475-1.jsonrpc.testnet-sp1.sagarpc.io
  • Chain ID: Here you need to input the middle numerical part of the ChainID. First, issue the command sagacli chainlet list

  • $ sagacli chainlet list                           
    ChainId                             Name             StackName     StackVersion     Status     EscrowBalance     
    -------                             ----             ---------     ------------     ------     -------------     
    coolapp_1682719845971475-1          coolapp          SagaOS        0.5.2            Online     230000000upsaga  
  • Second, use the middle numerical part of the ChainID (make sure to drop the '-1') Example below

  • 1682719845971475
  • Currency Symbol: This is your Chainlet currency symbol. You can get that by calling the sagacli chainlet get <ChainID>

  • $ sagacli chainlet get coolapp_1682719845971475-1
    ChainId                        Name        StackName     StackVersion     Launcher                                        Mantainers                                        CurrencySymbol     Status            
    -------                        ----        ---------     ------------     --------                                        ----------                                        --------------     ------            
    coolapp_1682719845971475-1     coolapp     SagaOS        0.5.2            saga1f7at0lnkd89t69eltkvcvuykq9enwsa942nqw6     [saga1f7at0lnkd89t69eltkvcvuykq9enwsa942nqw6]     coolcoin           STATUS_ONLINE     
    
  • Block Explorer URL

    • https://coolapp-1682719845971475-1.testnet-sp1.sagaexplorer.io

Taken together, the output will look similar with what you see in the following image below:

Once this final step is complete, you're ready to deploy any EVM-based smart contract. You can deploy with tools such as Remix, Truffle, even Thirdweb.

Last updated