Introduction
This is an attempt to make it easier to get started with Cosmos SDK. This CLI will -
- Create 3 EC2 instances that are validators that come to consensus and commit transactions.
- Allow you to deploy your cosmos sdk code easily.
- Allow you to submit transactions against a real life blockchain, in order to simulate a production environment.
- Gives you a clean testing environment against which to run your code.
Please note that this repo is WIP. Please file an issue if you come across an error.
Prerequisites
You will need the following tech to run this cli
- Terraform
- AWS CLI
- Docker.
- GoLang
- Starport
Make sure that you have Docker desktop running. Otherwise this will not work.
Using this CLI
- Clone this repo
- Run
go install github.com/prakashsanker/one-click-cosmos-testnet
- Scaffold a chain with starport
starport scaffold chain <chain-name>
- Run
starport chain serve
. Once you see that the chain is running, quit the process.
- Run
one-click-cosmos-testnet configure
and enter in your AWS details. To generate an access key and a secret key follow this documentation.
- Run
one-click-cosmos-testnet generate-test-infra
- Run
one-click-cosmos-testnet generate-test-net
You will see output like so
Node - 0
SSH into Node0 with this command ssh -i 'validator_key.pem' -o IdentitiesOnly=yes ec2-user@ec2-65-0-204-22.ap-south-1.compute.amazonaws.com
Submit transactions at ec2-65-0-204-22.ap-south-1.compute.amazonaws.com:1317
Node - 1
SSH into Node1 with this command ssh -i 'validator_key.pem' -o IdentitiesOnly=yes ec2-user@ec2-3-110-92-148.ap-south-1.compute.amazonaws.com
Submit transactions at ec2-3-110-92-148.ap-south-1.compute.amazonaws.com:1317
Node - 2
SSH into Node2 with this command ssh -i 'validator_key.pem' -o IdentitiesOnly=yes ec2-user@ec2-65-0-27-30.ap-south-1.compute.amazonaws.com
Submit transactions at ec2-65-0-27-30.ap-south-1.compute.amazonaws.com:1317
The url at port 1317
is where you can submit transactions.
Deploys
Right now, this is hacky, but works.
- Run
one-click-cosmos-testnet deploy
Rollbacks are not supported yet, but you can approximate by checking out (in git) and then running the deploy command.
Run one-click-cosmos-testnet get-validators
.
Diagnosing problems
You can ssh into the EC2 instance with the provided ssh command from get-validators
.
Once there, run docker container ls
and then docker exec -it <CONTAINER_ID> /bin/bash
to ssh into the docker container.