From ded8ebb79880d92c44b0ef27164a2d3f9c616445 Mon Sep 17 00:00:00 2001 From: bengtlofgren Date: Tue, 10 Oct 2023 12:27:55 +0200 Subject: [PATCH 1/2] removed some first person --- packages/docs/pages/operators/ibc.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/docs/pages/operators/ibc.mdx b/packages/docs/pages/operators/ibc.mdx index 40981e77..a25433af 100644 --- a/packages/docs/pages/operators/ibc.mdx +++ b/packages/docs/pages/operators/ibc.mdx @@ -21,8 +21,8 @@ Below, we discuss first how to enable this connection between two pre-existing c ## Setup Hermes Hermes is an IBC relayer to relay IBC packets between chains (instances). -We have our [fork of Hermes supporting Namada instances](https://github.com/heliaxdev/hermes/tree/1.6.0-namada). -Before packet relay, we need the following steps to configure and start Hermes. +Namada uses a [fork of Hermes supporting Namada instances](https://github.com/heliaxdev/hermes/tree/1.6.0-namada). +Before packet relay, the user needs the following steps to configure and start Hermes. 1. Make Hermes config file 2. Create IBC client/connection/channel between instances @@ -113,7 +113,7 @@ These are the pieces of this puzzle you want to keep your 👀 on: Hermes CLI has commands to create them. Before the creation, a node of each instance should be running at the specified rpc addresses. If you don't have nodes, please set up nodes manually or through our [scripts](#set-up-local-namada-instances-using-the-hermes-script). ### Export environment variables -We will need to save certain environment variables. These are: +The relaying user will need to save certain environment variables. These are: ```bash copy export CHAIN_A_ID="" export CHAIN_B_ID="" @@ -183,7 +183,7 @@ cp $HOME/.local/share/namada/$CHAIN_A_ID/wallet.toml $HERMES/namada_wallet/$CHAI # Make sure this is done for both wallets on each chain! ``` -We are now ready to set up the client. +It is now possible to set up the client. ### Create IBC channel The "create channel" command (below) creates not only the IBC channel but also the necessary IBC client connection. @@ -269,7 +269,7 @@ hermes --config $HERMES_CONFIG start You can see more details of Hermes at [the official document](https://hermes.informal.systems/). -After the sync, you can create the channel and start Hermes as we explain [above](#create-ibc-channel). +After the sync, you can create the channel and start Hermes as explained [above](#create-ibc-channel). ```bash copy # create a channel hermes --config $HERMES_CONFIG \ @@ -293,7 +293,7 @@ cd hermes ./scripts/setup-namada $NAMADA_DIR $CHAIN_ID_A $CHAIN_ID_B ``` -In this case, we don't have to wait for sync. If the relayer account on each instance has enough balance, you can create a channel and start Hermes immediately as we explain [above](#create-ibc-channel). You find these chain IDs of the instances in the config file `config_for_namada.toml`. One can run `grep "id" ${HERMES_CONFIG}`. +In this case, the user doesn't have to wait for sync. If the relayer account on each instance has enough balance, the user can create a channel and start Hermes immediately as explained [above](#create-ibc-channel). The user finds these chain IDs of the instances in the config file `config_for_namada.toml`. One can run `grep "id" ${HERMES_CONFIG}`. ```bash copy # create a channel hermes --config $HERMES_CONFIG \ From 52fc600ffa69a9903b4194c88188187db4956e01 Mon Sep 17 00:00:00 2001 From: bengtlofgren Date: Tue, 10 Oct 2023 16:41:42 +0200 Subject: [PATCH 2/2] namadexer --- .../docs/pages/integrating-with-namada.mdx | 6 +- .../pages/integrating-with-namada/indexer.mdx | 103 ++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 packages/docs/pages/integrating-with-namada/indexer.mdx diff --git a/packages/docs/pages/integrating-with-namada.mdx b/packages/docs/pages/integrating-with-namada.mdx index 3c685c69..ec96ee92 100644 --- a/packages/docs/pages/integrating-with-namada.mdx +++ b/packages/docs/pages/integrating-with-namada.mdx @@ -3,4 +3,8 @@ This guide is for integrating with Namada. It is intended for developers who want to integrate with Namada in their own applications, and for engineers who want to extend Namada. ## License -Namada operates under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.html) and is free to use and modify. Please see the [LICENSE](https://github.com/anoma/namada/blob/main/LICENSE) for more information. \ No newline at end of file +Namada operates under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.html) and is free to use and modify. Please see the [LICENSE](https://github.com/anoma/namada/blob/main/LICENSE) for more information. + +## Table of Contents +- [SDK](./integrating-with-namada/sdk.mdx) +- [Indexer](./integrating-with-namada/indexer.mdx) \ No newline at end of file diff --git a/packages/docs/pages/integrating-with-namada/indexer.mdx b/packages/docs/pages/integrating-with-namada/indexer.mdx new file mode 100644 index 00000000..89184c41 --- /dev/null +++ b/packages/docs/pages/integrating-with-namada/indexer.mdx @@ -0,0 +1,103 @@ +import Expandable from '../../components/Expandable'; +import { Callout } from 'nextra-theme-docs' + +# Namada Indexer + +In collaboration with [Zondax](https://zondax.ch/), an indexer for the Namada blockchain has been born. + +The Namada indexer (a.k.a `namadexer`) constantly queries the Namada blockchain, and together with the [SDK](./sdk.mdx), is able to map blocks, transactions, along with other valuable information into a relational database (postgres). + +This is especially useful for performing analytics over the blockchain, including storing historical data in a way that could be easily queried. + +## Setting up + +The namada indexer's source code can be found [here](https://github.com/zondax/namadexer) and is simple to set up. + +The `namadexer` works best together with [Docker](https://www.docker.com/products/docker-desktop) + +```bash +git clone https://github.com/Zondax/namadexer.git +cd namadexer +make compose +``` + +## Running the server and db +Once the DockerFile has run, it is straightforward to both set up the postgres database as well as the server that will query the database. + +Make sure that `postgres` [is installed](https://www.postgresql.org/download/) on the local machine. + +**Run postgres in docker** +```bash +make postgres +# or run (and change arguments, e.g port): +# docker run --name postgres -e POSTGRES_PASSWORD=wow -e POSTGRES_DB=blockchain -p 5432:5432 -d postgres +``` +Once the postgres server is up and running, it is time to set up the server that will query the postgres db. + +Execute the following command in order to set up the server +``` +make run_server +``` + +If successful, the server should be running as a daemon on the localhost at port `30303`. + +## Run the indexer + +First, ensure that the `Settings.toml` within `config/Settings.toml` is configured correctly. + + +```toml +log_level = "info" +network = "public-testnet-14" + +[database] +host = "0.0.0.0:5435" +user = "postgres" +password = "wow" +dbname = "blockchain" +# Optional field to configure a timeout if database connection +# fails. +connection_timeout = 20 + + +[server] +serve_at = "0.0.0.0" +port = 30303 + +[indexer] +tendermint_addr = "0.0.0.0" +port = 26657 + +[jaeger] +enable = false +host = "localhost" +port = 6831 + +[prometheus] +host = "0.0.0.0" +port = 9000 +``` + + + + +**Interpreting the toml** + +It is important to change the following parameters: + +1. `indexer.tendermint_addr` - This should be the address and corresponding port of a synced Namada full node + +2. `database.host` - This should be the tcp address (with port) where the postgres database is running. + + +Once the setup is complete, it is possible to start the indexer + +```bash +make run_indexer +``` + +## Querying the database + +The pre-defined endpoints to query the database are described in the documentation [here](https://github.com/Zondax/namadexer/blob/main/docs/04-server.md). + +