🚀Building with Andromeda

Slide SDK Documentation: Installing and Configuring Andromeda

Prerequisites

  • Slide SDK and landslide-runner are already installed and set up.

  • You have obtained a Blockchain ID from the landslide-runner.

Installing and Configuring Andromeda

1. Deploy Andromeda to Local Network

First, we need to deploy Andromeda to your local Landslide network:

  1. Navigate to the landslide-runner directory (installed earlier):

    cd path/to/landslide-runner
  2. Run the following command to deploy Andromeda:

    ./andr.sh <blockchain-ID>

    Replace <blockchain-ID> with the actual Blockchain ID you received from the landslide-runner.

    For example:

    ./andr.sh M5Rj4ySM3g3ZREBJDJgaRCQxbqQutF1MXcHcniZEVZRKm9TPG
  3. Wait for the deployment process to complete. This may take a few minutes.

Understanding Your Andromeda Deployment

Let's break down what happened when you ran that ./andr.sh command.

What the Command Does

The ./andr.sh command sets up Andromeda on your local Landslide network. It deploys several smart contracts that make up the Andromeda system.

What Happened

The Good Stuff:

  • The script connected to your Landslide network successfully. Yay!

  • It deployed several important contracts:

    • Andromeda Kernel (the brain of the system)

    • VFS (Virtual File System, for managing data)

    • ADODB (Andromeda Digitial Object Database; another data management component)

    • CW20 (a token contract)

    • CW20 Exchange (for trading those tokens)

What This Means for You

  1. Your Andromeda system is mostly set up. 🎉

Next Steps

  1. Try using the Andromeda CLI to interact with your newly deployed contracts. This will help you confirm what's working.

  2. It might be helpful to check the current state of your network before running the deployment script. There could be existing contracts or transactions that are affecting the process.

  3. If you continue to encounter issues, it may be worth discussing with more experienced team members or consulting the Andromeda documentation for troubleshooting steps.

Pro Tip

As you work more with blockchain systems like Andromeda, you'll encounter various errors and edge cases. Each one is an opportunity to deepen your understanding of how these systems work under the hood.

2. Install Andromeda CLI

After deploying Andromeda to your local network, install the Andromeda CLI globally:

npm install -g @andromedaprotocol/cli

3. Configure Andromeda CLI

Now, configure the Andromeda CLI to connect to your local Landslide network:

  1. Create the configuration directory (if it doesn't exist):

    mkdir -p ~/.andr-cli
  2. Create and open the configuration file in a text editor:

    nano ~/.andr-cli/chainConfigs.json
  3. Copy and paste the following JSON content into the file:

    [
      {
        "chainName": "landslide",
        "chainId": "landslide-test",
        "chainUrl": "http://127.0.0.1:9754/ext/bc/<BLOCKCHAIN_ID>/rpc",
        "chainType": "testnet",
        "registryAddress": "",
        "addressPrefix": "wasm",
        "defaultFee": "0.5stake",
        "name": "landslide",
        "blockExplorerAddressPages": [],
        "blockExplorerTxPages": [],
        "kernelAddress": "wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d"
      }
    ]
  4. Replace <BLOCKCHAIN_ID> in the chainUrl field with your actual Landslide blockchain ID (the same one used in step 1).

  5. Save the file and exit the text editor (in nano, press Ctrl+X, then Y, then Enter).

4. Verify the Installation and Configuration

To verify that Andromeda is correctly installed and configured:

  1. Start the Andromeda CLI:

    andr
  2. In the CLI, switch to the Landslide network:

    chain use landslide
  3. If successful, you should now be connected to your local Landslide network.

Andromeda CLI Output Explanation

When you run the command chain use landslide-test in the Andromeda CLI, you should expect to see output similar to the following:

? test@landslide-test> chain use landslide-test
- Loading configs...
— Loading config...
Config loaded!
– Connecting client...Error: Query failed with (6): type: cosmwasm_std::addresses::Addr; key: [00, 10, 6B, 65, 72, 6E, 65, 6C, 5F, 61, 64, 64, 72, 65, 73, 73, 65, 73, 76, 66, 73] not found: query wasm contract failed: unknown request
[... stack trace ...]

Understanding the Output

  1. Successful Steps:

    • The CLI successfully loads the configurations.

    • It confirms that the config is loaded.

    • It attempts to connect to the client (your local Landslide network).

  2. Expected Error:

    • You will see an error message starting with "Error: Query failed with (6):..."

    • This error is expected and not a cause for concern at this stage of setup.

    • The error occurs because the CLI is trying to query certain contracts (like the kernel or VFS) that aren't fully set up yet on your local network.

  3. Prompt Change:

    • Despite the error, you should notice that your prompt changes to test@landslide-test>.

    • This indicates that you have successfully switched to the landslide-test network.

What This Means

  • The configuration for your landslide-test network is correct and recognized by the CLI.

  • The CLI can connect to your local Landslide network.

  • Some expected contracts or data aren't available yet, which is normal at this stage.

  • You can proceed with the next steps in setting up your Andromeda environment.

Next Steps

After seeing this output, you can continue with the next steps in the setup process, such as adding a wallet or deploying contracts. The error message does not prevent you from proceeding with these tasks.

If you encounter different errors or issues, please consult with your team lead or refer to the troubleshooting section of the Andromeda documentation.

Adding a Wallet to Andromeda CLI

After successfully connecting to the landslide-test network, the next step is to add a wallet. This wallet will be used for transactions and interactions with smart contracts on your local Landslide network.

Adding a Wallet Using Recovery

  1. In the Andromeda CLI, enter the following command:

    wallet add test --recover
  2. You will be prompted to enter a password. Choose a secure password and remember it, as you'll need it for future interactions with this wallet.

  3. After entering the password, you'll be asked to input a mnemonic phrase. For this setup, use *this specific private key*, as we loaded it with testnet tokens. Enter this mnemonic:

    tip yard art tape orchard universe angle flame wave gadget raven coyote crater ethics able evoke luxury predict leopard delay peanut embody blast soap
  4. Enter the mnemonic phrase exactly as shown above when prompted.

  5. You may see an error message after adding the wallet. This is expected and not a cause for concern.

Expected Output

After entering the mnemonic, you should see output similar to the following:

? Enter password for wallet test: ********
? Enter mnemonic: ****************************************************************************************
Error: Query failed with (6): type: cosmwasm_std::addresses::Addr; key: [00, 10, 6B, 65, 72, 6E, 65, 6C, 5F, 61, 64, 64, 72, 65, 73, 73, 65, 73, 76, 66, 73] not found: query wasm contract failed: unknown request
[... stack trace ...]

Understanding the Output

  • The error message is similar to what you saw when connecting to the network. This is normal at this stage of the setup.

  • Despite the error, the wallet should be successfully added to your Andromeda CLI configuration.

Verifying Wallet Addition

To confirm that the wallet was added successfully:

  1. Exit the Andromeda CLI:

    exit
  2. Restart the Andromeda CLI:

    andr
  3. Once back in the CLI, you should see a prompt indicating you're using the test wallet:

    ? test@<DISCONNECTED>>
  4. You can now switch to the landslide-test network again:

    chain use landslide-test

Next Steps

With your wallet set up, you're now ready to interact with your local Landslide network using the Andromeda CLI. The next steps typically involve deploying contracts or interacting with existing ones on your network.

Remember, the mnemonic phrase is crucial for accessing your wallet. In a real-world scenario, you should never share your mnemonic phrase. This test mnemonic is for local development purposes only.

If you encounter any issues during this process that differ from what's described here, please consult with your team lead or refer to the troubleshooting section of the Andromeda documentation.

Basic Andromeda CLI Operations

Now that you've set up Andromeda, here are some basic operations you can perform:

1. Check Balance

To check the balance of an address, follow these steps:

  1. In the Andromeda CLI, type the following command and hit Enter:

    Copybank balance
  2. You will be prompted to enter the denom (denomination) of the token. For our current setup, we are using "stake". So, type:

    Copystake

    and hit Enter.

  3. Next, you'll be prompted to enter the address. Use this address:

    Copywasm1kng6sqkm0mjuh09cwz6u86f75lmeflj9h0fqhr

    and hit Enter.

  4. The CLI will display the balance of the specified address in the "stake" denomination.

2. Transfer Funds

To transfer funds to another address:

transfer wasm1c4w4jxdkvj3ygdycdkjy98jve6w0d7257eqfx9 10stake

Set Keys in Kernel

You can set various keys in the kernel. Here are examples for economics, vfs, and adodb keys:

kernel set-key economics wasm1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqr5j2ht
kernel set-key vfs wasm17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsm0v070
kernel set-key adodb wasm1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrq8epk7w

Query Kernel

To query the kernel for set keys:

kernel query

Interacting with Smart Contracts

Get ADO Info

To get information about a deployed contract:

ado info wasm1eyfccmjm6732k7wp4p6gdjwhxjwsvje44j0hfx8nkgrm8fs7vqfsuw7sel

CW20 Token Operations

Mint Tokens

execute wasm1eyfccmjm6732k7wp4p6gdjwhxjwsvje44j0hfx8nkgrm8fs7vqfsuw7sel '{"mint":{"recipient":"wasm1c4w4jxdkvj3ygdycdkjy98jve6w0d7257eqfx9","amount":"1000"}}'

Transfer Tokens

execute wasm1eyfccmjm6732k7wp4p6gdjwhxjwsvje44j0hfx8nkgrm8fs7vqfsuw7sel '{"transfer":{"recipient":"wasm1kng6sqkm0mjuh09cwz6u86f75lmeflj9h0fqhr","amount":"500"}}'

Check Token Balance

query wasm1eyfccmjm6732k7wp4p6gdjwhxjwsvje44j0hfx8nkgrm8fs7vqfsuw7sel '{"balance":{"address":"wasm1c4w4jxdkvj3ygdycdkjy98jve6w0d7257eqfx9"}}'

VFS Operations

To interact with the VFS (Virtual File System):

execute wasm17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsm0v070 '{"get_possible_vfs_path":{"address":"wasm1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqr5j2ht"}}'

Economics Operations

To interact with the economics contract:

execute wasm1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqr5j2ht '{"get_funds":{}}'

CW20-Exchange Operations

To check current sales on the CW20-Exchange:

query wasm1pvrwmjuusn9wh34j7y520g8gumuy9xtl3gvprlljfdpwju3x7ucsfg5rpz '{"sale":{"asset":{"cw20":"wasm1eyfccmjm6732k7wp4p6gdjwhxjwsvje44j0hfx8nkgrm8fs7vqfsuw7sel"}}}'

Conclusion

This guide covers the basics of setting up and using the Slide SDK with Andromeda CLI. As you become more familiar with these operations, you'll be able to build more complex interactions and applications on the Landslide network.

Remember to always refer to the most up-to-date documentation and seek help from more experienced developers when dealing with advanced topics or issues.

Last updated

Logo

©2024 Gaia Labs LTD