🚀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:
Navigate to the landslide-runner directory (installed earlier):
Run the following command to deploy Andromeda:
Replace
<blockchain-ID>
with the actual Blockchain ID you received from the landslide-runner.For example:
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
Your Andromeda system is mostly set up. 🎉
Next Steps
Try using the Andromeda CLI to interact with your newly deployed contracts. This will help you confirm what's working.
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.
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:
3. Configure Andromeda CLI
Now, configure the Andromeda CLI to connect to your local Landslide network:
Create the configuration directory (if it doesn't exist):
Create and open the configuration file in a text editor:
Copy and paste the following JSON content into the file:
Replace
<BLOCKCHAIN_ID>
in thechainUrl
field with your actual Landslide blockchain ID (the same one used in step 1).Save the file and exit the text editor (in nano, press
Ctrl+X
, thenY
, thenEnter
).
4. Verify the Installation and Configuration
To verify that Andromeda is correctly installed and configured:
Start the Andromeda CLI:
In the CLI, switch to the Landslide network:
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:
Understanding the Output
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).
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.
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
In the Andromeda CLI, enter the following command:
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.
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:
Enter the mnemonic phrase exactly as shown above when prompted.
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:
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:
Exit the Andromeda CLI:
Restart the Andromeda CLI:
Once back in the CLI, you should see a prompt indicating you're using the test wallet:
You can now switch to the landslide-test network again:
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:
In the Andromeda CLI, type the following command and hit Enter:
You will be prompted to enter the denom (denomination) of the token. For our current setup, we are using "stake". So, type:
and hit Enter.
Next, you'll be prompted to enter the address. Use this address:
and hit Enter.
The CLI will display the balance of the specified address in the "stake" denomination.
2. Transfer Funds
To transfer funds to another address:
Set Keys in Kernel
You can set various keys in the kernel. Here are examples for economics, vfs, and adodb keys:
Query Kernel
To query the kernel for set keys:
Interacting with Smart Contracts
Get ADO Info
To get information about a deployed contract:
CW20 Token Operations
Mint Tokens
Transfer Tokens
Check Token Balance
VFS Operations
To interact with the VFS (Virtual File System):
Economics Operations
To interact with the economics contract:
CW20-Exchange Operations
To check current sales on the CW20-Exchange:
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