feature(docker/neutrond): Setup a single node neutron testnet in docker (#131)
- Closes #112 Co-authored-by: Dave Kaj <davidkajpust@informal.systems> Co-authored-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
parent
63aa30db6b
commit
2ac5726463
12 changed files with 182 additions and 9 deletions
6
docker/README.md
Normal file
6
docker/README.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Docker Images
|
||||
|
||||
| Image | Description | Link |
|
||||
|-------|-------------|------|
|
||||
| Single node wasmd testnet | A single node network with a basic wasmd chain setup. Useful for basic, quick testing of your contracts. | [wasmd instructions](./wasmd/README.md) |
|
||||
| Single node neutron testnet | A single node neutron network. Useful for testing your contracts on a more advanced cosmwasm chain, with more up to date dependencies. | [neutron instructions](./neutrond/README.md) |
|
10
docker/neutrond/Makefile
Normal file
10
docker/neutrond/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Setup local accounts. This is only for local development and should not be used in production.
|
||||
import-local-accounts:
|
||||
neutrond keys add val1 --keyring-backend test > ./accounts/val1.txt 2>&1
|
||||
neutrond keys add val2 --keyring-backend test > ./accounts/val2.txt 2>&1
|
||||
neutrond keys add demowallet1 --keyring-backend test > ./accounts/demowallet1.txt 2>&1
|
||||
neutrond keys add demowallet2 --keyring-backend test > ./accounts/demowallet2.txt 2>&1
|
||||
neutrond keys add demowallet3 --keyring-backend test > ./accounts/demowallet3.txt 2>&1
|
||||
neutrond keys add rly1 --keyring-backend test > ./accounts/rly1.txt 2>&1
|
||||
neutrond keys add rly2 --keyring-backend test > ./accounts/rly2.txt 2>&1
|
||||
.PHONY: create-local-accounts
|
78
docker/neutrond/README.md
Normal file
78
docker/neutrond/README.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Setting up a Single Node Neutron Testnet
|
||||
|
||||
This guide provides instructions for setting up a single node Neutron testnet using Docker and local installation.
|
||||
|
||||
> Note - For more detailed instructions, refer to the [official Neutron documentation](https://docs.neutron.org/neutron/build-and-run/neutron-docker).
|
||||
|
||||
## Setup Steps
|
||||
|
||||
Clone the Neutron repository in your `$HOME` or your preferred repository:
|
||||
```
|
||||
git clone -b v4.0.1 https://github.com/neutron-org/neutron.git
|
||||
cd neutron
|
||||
```
|
||||
|
||||
Build the Docker image:
|
||||
```
|
||||
make build-docker-image
|
||||
```
|
||||
|
||||
Start the Docker container:
|
||||
```
|
||||
make start-docker-container
|
||||
```
|
||||
|
||||
Monitor the logs:
|
||||
```
|
||||
docker ps # Get the container ID
|
||||
docker logs -f <neutron-node-container-id>
|
||||
```
|
||||
|
||||
Verify the Docker keyring setup:
|
||||
```
|
||||
docker exec -it neutron neutrond query bank balances neutron1qnk2n4nlkpw9xfqntladh74w6ujtulwn6dwq8z --chain-id test-1
|
||||
```
|
||||
This should return:
|
||||
```
|
||||
balances:
|
||||
- amount: "100000000000000"
|
||||
denom: untrn
|
||||
pagination:
|
||||
total: "1"
|
||||
```
|
||||
|
||||
Install neutrond locally:
|
||||
```
|
||||
make install
|
||||
```
|
||||
|
||||
To setup the local keyring:
|
||||
```
|
||||
cd docker/neutrond
|
||||
make create-local-accounts
|
||||
```
|
||||
|
||||
Verify local keyring setup:
|
||||
```
|
||||
neutrond query bank balances neutron1qnk2n4nlkpw9xfqntladh74w6ujtulwn6dwq8z --chain-id test-1
|
||||
```
|
||||
|
||||
This should return:
|
||||
```
|
||||
balances:
|
||||
- amount: "100000000000000"
|
||||
denom: untrn
|
||||
pagination:
|
||||
total: "1"
|
||||
```
|
||||
|
||||
To stop and reset the chain, go back into the neutron source folder from github and run:
|
||||
```
|
||||
make stop-docker-container
|
||||
```
|
||||
|
||||
## How accounts are setup on neutron
|
||||
We use the standard 7 accounts that come from the neutron base docker setup. We have imported those to `docker/neutrond/accounts`. These accounts already exist in the container running the node, and we get them locally by running `make import-local-accounts`. We don't have functions to create or delete accounts, since we want to strictly follow their base docker setup, and thus keep the accounts the exact same. The 7 accounts are:
|
||||
- `demowallet1`, `demowallet2` and `demowallet3` - These are the accounts you should use for testing. They are seeded with the test token `untrn`, and 2 IBC tokens, `uibcatom` and `uibcusdc`.
|
||||
- `val1` and `val2` - accounts used to setup the validators for the test network. Seeded only with the test token `untrn`. Use if you need extra accounts beyond the demo wallets.
|
||||
- `rly1` and `rly2` - accounts used to setup IBC relayers for the test network. Only seeded with `untrn`. Use if you need extra accounts beyond the demo wallets.
|
11
docker/neutrond/accounts/demowallet1.txt
Normal file
11
docker/neutrond/accounts/demowallet1.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron1a57m0naqaf56hcvldfvagde7rajse68hnynpe4
|
||||
name: demowallet1
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A6iUKYrdZW53fFEXZpjfVqcaOcXOAucfHBhdzpx/u660"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
cave middle fade cube battle parrot live picture item before mention cheap veteran nose sting recipe talk vapor judge bracket flee flavor lazy blue
|
11
docker/neutrond/accounts/demowallet2.txt
Normal file
11
docker/neutrond/accounts/demowallet2.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron105slt5cpynvzv5cy6xadxl548em5wsjfh2shat
|
||||
name: demowallet2
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Akj8ZdWICka5rn2/M5csbMpt0tU0N9TMkC9981KqG3ks"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
thunder blanket sort image frequent village adult fish caution explain legend canyon canal property since razor whale zero idle parrot large tank such smart
|
11
docker/neutrond/accounts/demowallet3.txt
Normal file
11
docker/neutrond/accounts/demowallet3.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron1zf0a8ueetawfqwzzx5njmq88jpmqa827t5v38a
|
||||
name: demowallet3
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Av2LbNFHvcNR0D4BHk51lmiVvCRLOmoh4YMlJLnNbvg5"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
polar twice glass ostrich crush tank charge caution planet answer ripple culture staff relief have tragic occur helmet between slight proof direct output shoot
|
11
docker/neutrond/accounts/rly1.txt
Normal file
11
docker/neutrond/accounts/rly1.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron1zmr7dfc325907tvj8jl2p2p4cx84clk5aflstl
|
||||
name: rly1
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ak3alwik1L65ujlKbgQP//JL3LUlJmvA0zn8rt4eeoHG"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
garage advice weekend this dose mango sign horse tool torch mosquito repeat sentence valid scheme pull punch need prosper build actor say cancel allow
|
11
docker/neutrond/accounts/rly2.txt
Normal file
11
docker/neutrond/accounts/rly2.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron152zj7nyksf7dgrt4tpcf64t92k4ar9c2c97wxz
|
||||
name: rly2
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9jd2NZ40ZkD0TqBMmco6ejP1EzR1AnYIqSNm5m/Y997"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
run snack expand version flag foil used session name lift mouse repeat bunker pencil orchard lens kitchen prevent emerge alien outdoor else cat brass
|
11
docker/neutrond/accounts/val1.txt
Normal file
11
docker/neutrond/accounts/val1.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
override the existing name val1 [y/N]:
|
||||
- address: neutron1t4jlep6w6qxzwf58x49uya74x4tfjx4vd7v9a7
|
||||
name: val1
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Are6QBWqMGG3srEdzWj6ulFzX2J9mU5V5BUGDWpPZvzn"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
rare tobacco crisp auction shrug turkey transfer little giggle giraffe live stereo soft arctic raw page october river armor home champion check virus trap
|
11
docker/neutrond/accounts/val2.txt
Normal file
11
docker/neutrond/accounts/val2.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
- address: neutron1efkh8rpul8v6km98cuaejz0a5zczvvvz4ps82r
|
||||
name: val2
|
||||
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A0owhBMbRQ2jwJ7dKqwRA2fFyqSMpRmI2aefEdBIT/td"}'
|
||||
type: local
|
||||
|
||||
|
||||
**Important** write this mnemonic phrase in a safe place.
|
||||
It is the only way to recover your account if you ever forget your password.
|
||||
|
||||
photo mobile lady place outdoor camp fruit mouse spell feel service oval draw essay expect tuition fade drip riot manage aunt idle weather clap
|
|
@ -22,7 +22,7 @@ run: build
|
|||
# to refresh the accounts in ./accounts/
|
||||
#
|
||||
# Both targets require that the correct version of wasmd be installed locally.
|
||||
create-accounts:
|
||||
create-local-accounts:
|
||||
mkdir -p ./accounts
|
||||
wasmd keys add admin > ./accounts/admin.txt 2>&1
|
||||
wasmd keys add alice > ./accounts/alice.txt 2>&1
|
||||
|
@ -30,7 +30,7 @@ create-accounts:
|
|||
wasmd keys add charlie > ./accounts/charlie.txt 2>&1
|
||||
.PHONY: create-accounts
|
||||
|
||||
delete-accounts:
|
||||
delete-local-accounts:
|
||||
wasmd keys delete -y admin
|
||||
wasmd keys delete -y alice
|
||||
wasmd keys delete -y bob
|
||||
|
@ -40,7 +40,7 @@ delete-accounts:
|
|||
# Imports the accounts for admin, alice, bob and charlie from the text files in
|
||||
# the ./accounts/ folder. We assume that the mnemonic for each account is the
|
||||
# last line of each of the text files.
|
||||
import-accounts:
|
||||
import-local-accounts:
|
||||
tail -n 1 accounts/admin.txt | wasmd keys add admin --recover --keyring-backend=test
|
||||
tail -n 1 accounts/alice.txt | wasmd keys add alice --recover --keyring-backend=test
|
||||
tail -n 1 accounts/bob.txt | wasmd keys add bob --recover --keyring-backend=test
|
||||
|
|
|
@ -11,7 +11,7 @@ having a small amount of `ucosm` preloaded from genesis for experimentation.
|
|||
- `bob`
|
||||
- `charlie`
|
||||
|
||||
These accounts' details are stored in clear text in the [accounts](./accounts/)
|
||||
These accounts' details are stored in clear text in the [/accounts](./accounts/)
|
||||
folder.
|
||||
|
||||
**Note: this image is _not_ intended to be used in production.**
|
||||
|
@ -53,7 +53,7 @@ This will, by default, build a Docker image tagged `informaldev/wasmd:v0.44.0`.
|
|||
|
||||
## Transacting on behalf of the accounts
|
||||
|
||||
The accounts listed in the [`accounts`](./accounts/) folder are all already
|
||||
The accounts listed in the [`/accounts`](./accounts/) folder are all already
|
||||
imported into the `test` keyring within the Docker image. Once the container is
|
||||
running, you can run the following to list them:
|
||||
|
||||
|
@ -65,10 +65,10 @@ docker exec -it wasmd \
|
|||
|
||||
## Importing the account keys
|
||||
|
||||
As previously mentioned, the [`accounts`](./accounts/) folder contains all of
|
||||
As previously mentioned, the [`/accounts`](./accounts/) folder contains all of
|
||||
the necessary material to construct the public/private keypairs of the accounts.
|
||||
|
||||
A convenient helper target is provided in [`Makefile`](./Makefile) to facilitate
|
||||
A convenient helper target is provided in [`/wasmd/Makefile`](./wasmd/Makefile) to facilitate
|
||||
importing of these accounts into a local `wasmd` configuration (i.e. on your
|
||||
host machine, outside of the Docker container). This will allow you to transact
|
||||
on behalf of any of those accounts from outside of the Docker container.
|
||||
|
@ -77,7 +77,7 @@ on behalf of any of those accounts from outside of the Docker container.
|
|||
your local machine as what is built into the `wasmd` Docker image.
|
||||
|
||||
```bash
|
||||
make import-accounts
|
||||
make import-local-accounts
|
||||
```
|
||||
|
||||
To check that the accounts have been imported correctly, on your host machine
|
||||
|
@ -88,7 +88,9 @@ run:
|
|||
wasmd keys list --keyring-backend=test
|
||||
```
|
||||
|
||||
## Querying accounts in the container
|
||||
> Note - You don't need to run `make create-local-accounts` because that was already done, hence why the text files (i.e. `alice.txt`) are included on git. However, they won't be in your local keyring until you run `make import-local-accounts`. If we ever have to reset the accounts, you'd run `make delete-local-accounts` followed by `make create-local-accounts` and push the updated accounts to github.
|
||||
|
||||
## Querying accounts in the wasmd container
|
||||
|
||||
To query, for example, the `admin` account's balance, where the `admin`
|
||||
account's address is `wasm1mkrm9m8g0dzv5z73xg8yzlj6srqc72qru5xfv3`, once the
|
||||
|
|
Loading…
Reference in a new issue