elys-network / bindings

Custom CosmWasm bindings for the Elys chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elys Localnet Setup Guide

This guide provides instructions on how to spin up a new localnet using the Elys network for development purposes. Follow these steps to set up your environment, build contracts, and deploy them to your localnet.

Prerequisites

  • Make sure you have git, make, Go environment, and jq installed on your machine.

Getting Started

  1. Clone the Elys Repository

    First, clone the Elys repository to your local machine:

    git clone https://github.com/elys-network/elys.git
  2. Build the Binary

    Navigate into the cloned repository and build the binary using:

    git tag -f v999.999.999 && make install

    This command will install the elysd daemon.

  3. Download the Latest Snapshot

    Get the latest snapshot available for the Elys network by using the following command:

    rm -rf ~/.elys && curl -o - -L https://snapshots.elys.network/elys-snapshot-main.tar.lz4 | lz4 -c -d - | tar -x -C ~/
  4. Spin Up the Localnet

    Use the command below to start the localnet:

    elysd start

Deploying Contracts

  1. Build Contracts

    From the bindings repository, build all three contracts binaries:

    ./scripts/build.sh

    Note: For Dev and testing purpose you can use a fast build script which creates unoptimized but fast build of contract in terms of time.

    ./scripts/fast_build.sh
  2. Deploy Contracts

    Deploy the contracts to your localnet:

    ./scripts/deploy.sh

    This script deploys the contracts and provides you with environment variables to set for future interactions.

Setting Environment Variables

After running deploy.sh, set the provided environment variables:

export NODE=tcp://localhost:26657
export NAME=validator
export FS_CONTRACT_ADDRESS=<FS_CONTRACT_ADDRESS>
export TS_CONTRACT_ADDRESS=<TS_CONTRACT_ADDRESS>
export AH_CONTRACT_ADDRESS=<AH_CONTRACT_ADDRESS>

Replace <FS_CONTRACT_ADDRESS>, <TS_CONTRACT_ADDRESS>, and <AH_CONTRACT_ADDRESS> with the actual contract addresses provided by the deployment script.

Additional Configuration

  • When deploying contracts subsequently, running ./scripts/deploy.sh will migrate instead of initializing the contracts.
  • Add any new queries and messages introduced to scripts/queries.sh and scripts/messages.sh to document their specifications and test them. These scripts use the environment variables set earlier to determine the network and contract addresses. If the variables are not set, it defaults to TestNet and its contract addresses.

Example query command:

$ ./scripts/queries.sh elys1u8c28343vvhwgwhf29w6hlcz73hvq7lwxmrl46 liquid_assets

Questions & Contributions

For questions or contributions, please open an issue or a pull request in the repository. Your feedback and contributions are welcome!

About

Custom CosmWasm bindings for the Elys chain

License:Apache License 2.0


Languages

Language:Rust 93.3%Language:Shell 5.7%Language:JavaScript 1.0%