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.
- Make sure you have
git
,make
, Go environment, andjq
installed on your machine.
-
Clone the Elys Repository
First, clone the Elys repository to your local machine:
git clone https://github.com/elys-network/elys.git
-
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. -
Download the Latest TestNet Snapshot
To get the latest TestNet snapshot available for the Elys network, use the following command to download the latest TestNet snapshot that uses the changes from the
main
branch:rm -rf ~/.elys && curl -o - -L https://snapshots.elys.network/elys-snapshot-main.tar.lz4 | lz4 -c -d - | tar -x -C ~/
-
Spin Up the Localnet
Use the command below to start the localnet:
elysd start
-
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
-
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.
After running deploy.sh
, set the provided environment variables:
export NODE=tcp://localhost:26657
export NAME=validator
export TS_CONTRACT_ADDRESS=<TS_CONTRACT_ADDRESS>
Replace <TS_CONTRACT_ADDRESS>
with the actual contract addresses provided by the deployment script.
- 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
andscripts/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
For questions or contributions, please open an issue or a pull request in the repository. Your feedback and contributions are welcome!