Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 35 additions & 28 deletions gravity-dex.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gravity DEX

## Table Of Contents
## Table of Contents

* [Basic Node Operation](Basic-Node-Operation)
* [Resources](#Resources)
Expand Down Expand Up @@ -60,39 +60,40 @@
- [Discord channel](https://discord.gg/vcExX9T)
- [Peers and seed nodes](https://hackmd.io/@KFEZk8oMTz6vBlwADz0M4A/BkKEUOsZu#)
- [Performance Testing for Liquidity module(Gravity DEX)](https://github.com/tendermint/liquidity/blob/develop/doc/Performance%20Testing%20for%20Liquidity%20Module.pdf)

### Hardware Requirements

Minimum requirements

- 2 Core CPU
- 8GB RAM
- 8 GB RAM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know we need space between the number and gigabytes. Is this conventional?

- SSD
- ex) AWS m5.Large
- Example: AWS m5.Large

Recommended spec

- 4 Core CPU
- 16GB RAM
- 16 GB RAM
- Provisioned IOPS SSD

### Install Go

Minimum requirements

- 2 Core CPU
- 8GB RAM
- 8 GB RAM
- SSD
- ex) AWS m5.Large
- Example: AWS m5.Large

Recommended spec

- 4 Core CPU
- 16GB RAM
- 16 GB RAM
- Provisioned IOPS SSD

Go 1.16+ or later is required for the Cosmos SDK.
Go 1.16+ or higher is required for the Cosmos SDK.

In this example, we will be installing Go on Ubuntu 18.04.2 LTS:
For example, to install Go on Ubuntu 18.04.2 LTS:

```bash
# First remove any existing old Go installation
Expand Down Expand Up @@ -128,7 +129,7 @@ gaiad version
-> v5.0.5
```

### Setup
### Set Up the Chain

1. Initialize the chain with the config files.

Expand All @@ -155,7 +156,7 @@ gaiad version

### Basic Configuration Setup

1. Manually add the below peers list in your `$HOME/.gaia/config/config.toml` file. Since IBC and swap state transactions are very large, it is suggested to increase the timeout for a transaction to be committed and maximum size of request body and header. Without configuring those values, you may experience the node to stop from time to time when your node receives too many requests.
1. Manually add the following peers list in your `$HOME/.gaia/config/config.toml` file.

```bash
# Comma separated list of seed nodes to connect to
Expand All @@ -173,17 +174,21 @@ gaiad version
# global HTTP write timeout, which applies to all connections and endpoints.
# See https://github.com/tendermint/tendermint/issues/3435
timeout_broadcast_tx_commit = "600s"
```

2. Another change to make in the `$HOME/.gaia/config/config.toml` file is to increase the timeout for a transaction to be committed and maximum size of request body and header. Since IBC and swap state transactions are very large, your node might stop from time to time when your node receives too many requests. Configure these values to increase the timeout:
Copy link
Contributor

@jaybxyz jaybxyz Aug 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to locate the field down to part 2 since part 1 only deals with setting up the peers list.

# The ibc and swap state are very large, causing the node itself 
# to stop on excessive queries. Therefore, we customize the rpc configuration 
# as above.

# How long to wait for a tx to be committed during /broadcast_tx_commit.
# WARNING: Using a value larger than 10s will result in increasing the
# global HTTP write timeout, which applies to all connections and endpoints.
# See https://github.com/tendermint/tendermint/issues/3435
timeout_broadcast_tx_commit = "600s"


```bash
# Maximum size of request body, in bytes
max_body_bytes = 10000000

# Maximum size of request header, in bytes
max_header_bytes = 10485760
```

Note: If your node is unable to connect to any of the seeds listed here, you can find seeds and peers in [this document](https://hackmd.io/@KFEZk8oMTz6vBlwADz0M4A/BkKEUOsZu#) maintained by community members, and at [Atlas](https://atlas.cosmos.network/nodes), which is automatically generated by crawling the network. You can also join [Discord channel](https://discord.gg/vcExX9T) to reach out to any Cosmos community members to get help on this.
Note: If your node is unable to connect to any of the seeds listed here, you can find seeds and peers in the [stargate peers and seed nodes](https://hackmd.io/@KFEZk8oMTz6vBlwADz0M4A/BkKEUOsZu#) document that is maintained by community members and in the [Atlas node explorer](https://atlas.cosmos.network/nodes), a list that is automatically generated by crawling the network. You can also join the [Discord channel](https://discord.gg/vcExX9T) to reach out to Cosmos community members to get help.

2. Replace necessary configuration
3. Run these commands to configure the seed nodes:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of "Replace necessary configuration" I think we're saying to run these commands?

Copy link
Contributor

@jaybxyz jaybxyz Aug 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think it is better.


```bash
sed -i '' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' $HOME/.gaia/config/config.toml
Expand All @@ -193,12 +198,12 @@ gaiad version

### State sync

State sync allows a new node to join a network by fetching a snapshot of the application state at a recent height instead of fetching and replaying all historical blocks. This can reduce the time needed to sync with the network from days to minutes. Reference [this article](https://blog.cosmos.network/cosmos-sdk-state-sync-guide-99e4cf43be2f) to know more about Cosmos SDK state sync.
State sync allows a new node to join a network by fetching a snapshot of the application state at a recent height instead of fetching and replaying all historical blocks. This state sync can reduce the time needed to sync with the network from days to minutes. See the [Cosmos SDK State Sync Guide](https://blog.cosmos.network/cosmos-sdk-state-sync-guide-99e4cf43be2f) to know more about Cosmos SDK state sync.

**Option 1. Setup using state synced data dump**
**Option 1. Set up using state synced data dump**

- The data that is state sync based on A height is about 1 gigabyte, so it can be set lighter and faster, but there is no index for past blocks.
- Download one of the download links below.
- Download from one of these download links:
- [cosmoshub-4_state_synced_7271293.tar](https://ipfs.io/ipfs/QmZqGwAQh9QHurbg3YvJJSkQd7T6tg35cFVD1FRF4bAm8J?filename=cosmoshub-4_state_synced_7271293.tar) (IPFS)
- [cosmoshub-4_state_synced_7271293.tar](https://drive.google.com/file/d/1ku0HZ8xXrG4UDPe0ywdG4NQHve1iZ4tP/view?usp=sharing) [](https://ipfs.io/ipfs/QmZqGwAQh9QHurbg3YvJJSkQd7T6tg35cFVD1FRF4bAm8J?filename=cosmoshub-4_state_synced_7271293.tar)(Google Drive)
- Unzip
Expand All @@ -213,11 +218,11 @@ State sync allows a new node to join a network by fetching a snapshot of the app

`gaiad start`

**Option 2. State sync via snapshot supply nodes**
**Option 2. State sync by using snapshot supply nodes**

1. snapshot supply nodes (2 node setting- Block must be at the latest height)
1. Snapshot supply nodes (2 node setting, Block must be at the latest height)

Manually add the below setting in `$HOME/.gaiad/config/app.toml` file.
Manually add the following setting in the `$HOME/.gaiad/config/app.toml` file.

```bash
[state-sync]
Expand All @@ -232,9 +237,9 @@ State sync allows a new node to join a network by fetching a snapshot of the app

2. Node to receive snapshot (1 node that needs to sync)

Manually add the below setting in `$HOME/.gaiad/config/config.toml` file.
Manually add the following setting in the `$HOME/.gaiad/config/config.toml` file.

(Set the peers list as well.)
Be sure to set the peers list as well.

`#"snapshot-interval = 100, snapshot-keep-recent = 2" → lastblock - 100 = trust_height`

Expand Down Expand Up @@ -272,7 +277,7 @@ State sync allows a new node to join a network by fetching a snapshot of the app

- `gaiad start`

If you see log like this, it's going well.
If your log looks like this, it's going well.

```bash
7:11PM INF Fetching snapshot chunk chunk=7 format=1 height=7271000 module=statesync total=33
Expand Down Expand Up @@ -305,7 +310,8 @@ State sync allows a new node to join a network by fetching a snapshot of the app

Query, tx are available when synchronization is up to the latest height.

Details are available [here](https://hub.cosmos.network/main/gaia-tutorials/join-mainnet.html).
Details are available in the [Join the Cosmos Hub Mainnet](https://hub.cosmos.network/main/gaia-tutorials/join-mainnet.html) blog post.

## Query Information

### Pool
Expand Down Expand Up @@ -370,7 +376,7 @@ pool:

```

Query reserve coins of the pool:
> Query reserve coins of the pool:

```bash
gaiad query bank balances cosmos1jmhkafh94jpgakr735r70t32sxq9wzkayzs9we
Expand All @@ -389,7 +395,7 @@ pagination:
total: "0"
```

Query total supply of the pool coin
> Query total supply of the pool coin:

```bash
gaiad query bank total --denom=pool96EF6EA6E5AC828ED87E8D07E7AE2A8180570ADD212117B2DA6F0B75D17A6295
Expand All @@ -401,6 +407,7 @@ Result:
amount: "1000000"
denom: pool96EF6EA6E5AC828ED87E8D07E7AE2A8180570ADD212117B2DA6F0B75D17A6295
```

### Pools

> Query for all liquidity pools
Expand Down Expand Up @@ -553,7 +560,7 @@ withdraws:

> Query for all withdraw messages on the batch of the liquidity pool

Example `withdraws` query command
Example `withdraws` query command:

```bash
gaiad query liquidity withdraws 1
Expand Down Expand Up @@ -747,7 +754,7 @@ JSON Structure:

```

Result
Result:

```json
{
Expand Down Expand Up @@ -1001,7 +1008,7 @@ Example `withdraw` tx command:
gaiad tx liquidity withdraw 1 10000pool96EF6EA6E5AC828ED87E8D07E7AE2A8180570ADD212117B2DA6F0B75D17A6295 --from validator --chain-id testing --keyring-backend test -y
```

JSON Structure
JSON Structure:

```json
{
Expand Down